Re: [stella] FE Bankswitching

Subject: Re: [stella] FE Bankswitching
From: Adam Wozniak <adam@xxxxxxxxxxxxxxxx>
Date: Sun, 2 Mar 2003 16:13:14 -0800 (PST)
On Sat, 1 Mar 2003, Eckhard Stolberg wrote:

> > Wait for two consecutive accesses to the stack ($0100-$01FF).
> > 
> > IF the first access was at an EVEN address (A0 == 0) then use D5 of the
> > second access.
> > 
> > IF the first acces was at an ODD address (A0 == 1) then use D5 of the
> > access AFTER the second access (i.e. the THIRD access).
> Are you sure that the part with the even address is really nessessary?
> According to this desription of the JSR and RTS command:
>      JSR
>         #  address R/W description
>        --- ------- --- -------------------------------------------------
>         1    PC     R  fetch opcode, increment PC
>         2    PC     R  fetch low address byte, increment PC
>         3  $0100,S  R  internal operation (predecrement S?)
>         4  $0100,S  W  push PCH on stack, decrement S
>         5  $0100,S  W  push PCL on stack, decrement S
>         6    PC     R  copy low address byte to PCL, fetch high address
>                        byte to PCH
>      RTS
>         #  address R/W description
>        --- ------- --- -----------------------------------------------
>         1    PC     R  fetch opcode, increment PC
>         2    PC     R  read next instruction byte (and throw it away)
>         3  $0100,S  R  increment S
>         4  $0100,S  R  pull PCL from stack, increment S
>         5  $0100,S  R  pull PCH from stack
>         6    PC     R  increment PC
> a JSR would do three accessess to the stack with only two
> different addresses (cycle 3 and 4 have the same address),
> while a RTS does three accesses with three different addresses.
> If the JSR/RTS would always be executed over the top of the
> stack memory, the first access to the stack would always be
> an odd address. For JSR it would be $01FF, and for RTS it
> would be $01FD. The high byte of the destination address
> would be read in the cycle after the second access to the
> stack in both cases.
> Have you ever tried your FE bankswitching hardware with
> only the part for the odd address? If that wouldn't
> work, it would mean that this description of the internal
> behaviour of JSR/RTS is wrong. That might confirm the
> description that Kroko posted.

This works to switch to bank $D000:
peek ($1000);
poke ($01FE, $D0);
poke ($01FF, $D0);

This does not work:
peek ($1000);
poke ($01FF, $D0);
poke ($01FE, $D0);

Also note that for the JSR, a cart can NOT detect "two consecutive accesses
to the same address" (it has no clock line!), so from the cart's point of
view those "three accesses (two same address, one differnt)" look like two

Will code for food.


Archives (includes files) at
Unsub & more at

Current Thread