Re: [stella] programming teaser

Subject: Re: [stella] programming teaser
From: "Andrew Davie" <atari2600@xxxxxxxxxxxxx>
Date: Fri, 20 May 2005 07:53:51 -0400
The whole point being that in a kernel you don't necessarily need to compare 
a counter value, nor branch when it reaches the final value.  In notBD, 
there are n rows, each done by identical code in consecutive banks.  By 
switching banks, the code keeps running, but the last bank has a "rts" just 
after the switch.  It's an interesting technique, used in notBD's new kernal 
(worked on by Thomas and I) -- and without which, the kernel probably 
wouldn't be possible.

In answer to Dennis, this particular code runs in BOTH RAM and ROM.  It's a 
bit weird, but the code is defined in ROM, and you (can) call the ROM 
routine still.  But it is also copied to multiple RAM banks, and the first 
bankswitch will switch to the code running in RAM (because, in the 
bankswitch scheme I am using, there is only one switchable bank -- in an 
address area shared by both the ROM-switchable and RAM-switchable banks).

Another way to achieve the same effect as the rather unique 'tricky' 
subroutine would be with self-modifying code, but it costs cycles.  The 
above technique is totally cycle-free in terms of detecting and forcing the 
end of a loop.  You do, of course, need the right memory architecture to 
achieve this :)

Cheers
A


----- Original Message ----- 
From: "Thomas Jentzsch" <tjentzsch@xxxxxx>
To: <stella@xxxxxxxxxxxxxxxxxx>
Sent: Friday, May 20, 2005 9:07 PM
Subject: Re: [stella] programming teaser


Fred wrote:
> Maybe your bankswitching instruction swaps the code out after x=8 and 
> finds
> an RTS where the ldy #21 was?

Bingo!

BTW: THAT one was solely Andrew's idea! ;-)

Have fun!
Thomas
_______________________________________________________
Thomas Jentzsch | *** Every bit is sacred ! ***
tjentzsch at web dot de |



______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193

Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://stella.biglist.com


Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://stella.biglist.com

Current Thread