Re: [stella] FE Bankswitching

Subject: Re: [stella] FE Bankswitching
From: "Eckhard Stolberg" <Eckhard_Stolberg@xxxxxx>
Date: Sun, 15 Dec 2002 20:02:54 +0100
So I don't know if it's really safe to assume JSR/RTS automatically implies
bankswitching. (I suppose we could put a moritorium on these kind of uses.
That RAM routine could include a NOP before the RTS and we just wouldn't use
JSR/RTS to waste cycles (But do any games already use this?) but it'd have
to be pretty prominently mentioned somewhere (FAQ?) so someone who starts
programming 2 or 5 years from now doesn't go and do this...)

OK, I guess I need to clarify my last statement a bit.

Games that use FE bankswitching have one 4K bank compiled for
$F000 and one 4K bank compiled for $D000. If you are in the $F000
bank and wanted to switch into the $D000 bank, you could do a
"JSR $D123". You would then execute some code at $D123. If you
wanted to switch back to the $F000 bank, you could use a "JSR $F456",
or you could use a "RTS", since the return address on the stack
would point into the $F000 bank.

Two accesses on the stack in a row usually are generated either
by a JSR command or by a RTS command. The only other ways to
generate two consecutive accesses to the stack area is with a
BRK command or a RTI command (which can be avoided easily in
VCS programming), or by running code in the stack area, which
I don't think any VCS game has ever done.

So if you wanted to construct a device to run FE bankswitched
games on a real VCS (which is what I think the original poster
wants to do), you could savely asume that any occurance of a
JSR command or a RTS command in a FE ROM image is meant to
trigger the bankswitching logic. And since the FE bankswitched
games (like most other VCS games) don't use BRK commands or
RTI commands, you can also assume that the occurance of two
consecutive accesses to the stack area stemm from a JSR command
or from a RTS command.

Ciao, Eckhard Stolberg

Archives (includes files) at
Unsub & more at

Current Thread