{"id":871,"date":"2011-06-09T19:36:01","date_gmt":"2011-06-09T19:36:01","guid":{"rendered":"http:\/\/www.linkovitch.me.uk\/blog\/?p=871"},"modified":"2014-10-20T13:04:03","modified_gmt":"2014-10-20T13:04:03","slug":"timings","status":"publish","type":"post","link":"https:\/\/www.linkovitch.me.uk\/blog\/2011\/06\/timings\/","title":{"rendered":"Timings"},"content":{"rendered":"<p>I am working away on something I have always wanted to write, a tracker mod player.\u00c2\u00a0 Many years ago I mentioned to Tyr that I wanted to write one that resided entirely within the DSP of the Jaguar, and this is my current plan.\u00c2\u00a0 Of course rather than try and learn both the RISC CPU and how to write a tracker player I have decided to prototype the design on the 68K.\u00c2\u00a0 This should be challenging enough, however I am very pleased with my initial progress, which I have left to fester for a while due to frustrations and having other things I need to do.<\/p>\n<p>The main issue seems to be that I simply cannot squeeze sufficient time out of the 68K, which is crazy given it&#8217;s faster than the one in an Atari ST, and there are rather quick players on the ST.\u00c2\u00a0 I for some reason have been struggling to push more than one channel past 8kHz which is pretty naff (although I am most chuffed in the general code, just it needs more work and optimisation)<\/p>\n<p>This evening I decided to try out one of my ideas, I pondered that perhaps by ignoring the object processor if it had perhaps gone into a sulk mode and decided that if it wasn&#8217;t to be played with it would steal some of the bus bandwidth and sulk.\u00c2\u00a0 So I gave it something to do.. no difference.. bollocks&#8230;<\/p>\n<p>I decided to try some other things before I reach &#8220;stop coding o&#8217;clock&#8221; (if I code past that time, I simply will not sleep! \ud83d\ude42 ).\u00c2\u00a0 So I decided to look at how much time my code was taking on the CPU, as well as see if I could fire the interupt faster than I presently was doing.\u00c2\u00a0 To achieve this I removed my playback routines from the interupt handler and simply replaced them with 2 instructions.\u00c2\u00a0 One to change the background colour blue at the start and one to change it black at the end, with nothing between them.\u00c2\u00a0 This produced some nice small blue lines on the screen, perfect, I can now SEE how long it takes the CPU to perform these 2 simple tasks (long than I thought too!).<\/p>\n<p>For my next trick I re-introduced my playback code, but crippled it to simply just the portion of the routine which checks for new samples to play, and re-ran it.\u00c2\u00a0 There was now a LOT of blue on the screen! although the amount of code was quite small. hmmm clearly the code is less than optimal time wise, naturally as I am coding a prototype I have not been as stringent as I would for a final.<\/p>\n<p>My thoughts at this stage are that I am asking the 68K to access main RAM too much, as it has no instruction cache of it&#8217;s own, its instructions, and most of the data have to be dragged from main RAM, in the case of 32bit data that alone will require 2 fetches.\u00c2\u00a0 To test the effects of reads on main RAM I removed my playback routine from the interupt handler again and replaced it with 10 nop instructions.\u00c2\u00a0 Running the test again, I get slightly longer line than with nothing between the colour changes..\u00c2\u00a0 OK, I added ten 16 bit memory reads instead of the NOPS, the amount of blue increased GREATLY, it is hard to tell but instead of being only about 6cm of blue it now seems to wrap across whole scanlines!\u00c2\u00a0 Changing this to ten 16 bit moves from one internal data register to another reduces the line back down to a much nicer 8cm sized line&#8230;<\/p>\n<p>So.. it looks like I am going to have to figure a way of doing this without the simplicity and comfort main RAM was giving me.\u00c2\u00a0 Good job I do this for the fun of the challenge really \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am working away on something I have always wanted to write, a tracker mod player.\u00c2\u00a0 Many years ago I mentioned to Tyr that I wanted to write one that resided entirely within the DSP of the Jaguar, and this is my current plan.\u00c2\u00a0 Of course rather than try and learn both the RISC CPU &hellip; <a href=\"https:\/\/www.linkovitch.me.uk\/blog\/2011\/06\/timings\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Timings<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,3,22],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linkovitch.me.uk\/blog\/wp-json\/wp\/v2\/posts\/871"}],"collection":[{"href":"https:\/\/www.linkovitch.me.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linkovitch.me.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linkovitch.me.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linkovitch.me.uk\/blog\/wp-json\/wp\/v2\/comments?post=871"}],"version-history":[{"count":2,"href":"https:\/\/www.linkovitch.me.uk\/blog\/wp-json\/wp\/v2\/posts\/871\/revisions"}],"predecessor-version":[{"id":1559,"href":"https:\/\/www.linkovitch.me.uk\/blog\/wp-json\/wp\/v2\/posts\/871\/revisions\/1559"}],"wp:attachment":[{"href":"https:\/\/www.linkovitch.me.uk\/blog\/wp-json\/wp\/v2\/media?parent=871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linkovitch.me.uk\/blog\/wp-json\/wp\/v2\/categories?post=871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linkovitch.me.uk\/blog\/wp-json\/wp\/v2\/tags?post=871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}