Re: [stella] programming teaser --> bankswitching

Subject: Re: [stella] programming teaser --> bankswitching
From: "Andrew Davie" <atari2600@xxxxxxxxxxxxx>
Date: Fri, 20 May 2005 18:02:43 -0400
> What bankswitching scheme are you using?  I ask because I'm not aware of 
> any
> that allow multiple banks of RAM except for E7 or Starpath, and the Kroko
> cart doesn't support these.

The bankswitch mode is 'Tigervision 3E'.  It is 3F with RAM support added. 
The specs are up to 480K of ROM (to maintain CC2 compatibility this is 
reduced from a potential 512K) and up to 32K of RAM (though in theory this 
could be 256K it is limited to 32K to maintain KK compatibility).  Various 
ROM sizes are supported, as the fixed bank is always the last 2K of the ROM.
Write to 3F, it switches in a 1K ROM bank.  Write to 3E, it switches in a 1K 
RAM bank into the *same* address space. The reason for this is that 2K of 
address space is required for the RAM -- the highest bit is used by the 
hardware to detect a read or write access.  There is a 2K fixed ROM bank. 
It is a very tricky mode to use, as accessing the switchable RAM from the 
switchable ROM is somewhat complex, as one can imagine!  It also adds some 
programming limitations related to the use of the address space to trigger 
reads or writes to the switched RAM;  in particular, no indexed writes may 
cross page boundaries, and one must remember to add 1K to the address of 
data to which you are writing (for the read/write bit).  Despite these 
oddities, I am *very* comfortable with using it -- it allows some very 
interesting code to be developed.  Just ask Thomas :)
This bankswitch mode *is* supported by both KK and CC2.  It was designed by 
Armin (KK maker) and myself specifically to take advantage of some spare 
space on KK hardware, but more specifically to allow games like BoulderDash 
to be written. There are some things one might change for a *perfect* 
bankswitch mode, but this is what was possible using the available 
chip-space, and I think the notBoulderDash demo pretty much shows what can 
be done using it. 
Armin has also designed a stand-alone cartridge layout for this mode.

----- Original Message ----- 
From: "Fred Quimby" <c9r@xxxxxxxxxxx>
To: <stella@xxxxxxxxxxxxxxxxxx>
Sent: Saturday, May 21, 2005 7:45 AM
Subject: Re: [stella] programming teaser

> What bankswitching scheme are you using?  I ask because I'm not aware of 
> any
> that allow multiple banks of RAM except for E7 or Starpath, and the Kroko
> cart doesn't support these.
>>The whole point being that in a kernel you don't necessarily need to
>>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" 
>>after the switch.  It's an interesting technique, used in notBD's new
>>(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 
>>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 
>>end of a loop.  You do, of course, need the right memory architecture to
>>achieve this :)
>>----- 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?
>>BTW: THAT one was solely Andrew's idea! ;-)
>>Have fun!
>>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:
>>Archives (includes files) at
>>Unsub & more at
>>Archives (includes files) at
>>Unsub & more at
> Archives (includes files) at
> Unsub & more at

Archives (includes files) at
Unsub & more at

Current Thread