Re: [stella] FE bank switching again

Subject: Re: [stella] FE bank switching again
From: Adam Wozniak <adam@xxxxxxxxxxxxxxxx>
Date: Wed, 22 Jan 2003 21:16:16 -0800 (PST)
On Wed, 22 Jan 2003, Adam Wozniak wrote:
> I just can't make it do it reliably.  I believe my understanding of
> the state machine inside the cart is not complete.

Ok, I can switch reliably now.  What a pain in the a**.

Here are some hints, for anyone who comes behind me and finds this as
frustrating as I did...

Make sure to poke $1FF and $1FE.  Other low addresses ($0FF and $0FE, for
example) won't do it.

An RTS instruction causes the CPU to read $1FE BEFORE $1FF.  If the cart
sees them in the wrong order it may or may not switch banks.

I could never figure out how the cart is actually triggered to bank switch
during a JSR.  I suspect it is the order of the stack write (a JSR writes
$1FF BEFORE $1FE (I think)) combined with the previous reads from the cart.
But like I said, I never got it figured out.

Here's what I wound up with...

To switch to $DXXX:
   peek ($1000);        // an arbitrary cart address
   poke ($01FE, $D0);   // simulate CPU read during RTS
   poke ($01FF, $D0);

To switch to $FXXX:
   peek ($1000);        // an arbitrary cart address
   poke ($01FE, $F0);   // simulate CPU read during RTS
   poke ($01FF, $F0);

Enjoy.

-- 
Will code for food.       http://cuddlepuddle.org/~adam/resume.html

adam@xxxxxxxxxxxxxxxx        http://cuddlepuddle.org/~adam/pgp.html

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


Current Thread