Re: [stella] Star Fire: 1 step forward 2 steps back :-)

On Sun, 1 Dec 2002, Manuel Polik wrote:
>
> Well, that explains the problem, but what would be a
> proper solution?
Hi Manuel,
Ok, I found your source from earlier this week (star6.s). I think I
understand now. You want to start in Bank 1 and that's where your start
code is. If the hardware starts in Bank 0, you want to immediately
switch to Bank 1 and execute the start code.
If these are the only times you actually read from the hot addresses and
the RESET and SWI vectors, you can try the code below.
ORG $1FF9 ; Bank 0
SwitchToBank1: ; this is never actually read...the switch happens
BRK ; first and the data is read from bank 1
ORG $2FFC
ResetVector ; this could probably be Start, but it's best to
.word SwitchToBank1 ; force the hardware into Bank 1 in the proper way.
SoftwareInterrupt ; jumps to start code
.word Start
ORG $1FF8 ; Bank 1
; (sorry...I don't know how the DASM banking works)
SwitchToBank0: ; this is never actually read...the switch happens
BRK ; first and the data is read from bank 0
InitHardware: ; this is the hot address to switch to Bank 1
BRK ; jumps to the SWI vector at $fffe:ffff
ORG $1FFC
ResetVector ; this could probably jump directly to Start, but
.word InitHardware ; it's best to force the hardware into Bank 1
SoftwareInterrupt ; jumps to the start code.
.word Start ; it messes up the stack, etc...but who cares?
I know I've reused labels and addresses. You shouldn't!
I just don't know how DASM banking works (yet) and I'm too lazy to
go dig through the archives now. ;)
It's a little convoluted, but it makes nice use of the BRK instruction and
it saves a few bytes of ROM.
-Chris
----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/