[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why is this code exiting to the basic prompt?



I've started tracing ballblazer to see why it isn't starting properly.

The observed behavior is that it displays the crack screen and waits
for a key.  Once a key is pressed, the machine jumps right back to the
basic prompt.  (?!!?)

Looking at the disassembled source, I'm even more confused.

7fd: jmp 2466
2466: 6da0.719f > 400 (each byte is xor'd with BB -- this is obviously
the crack screen)
248B: wait for keypress, clear strobe, jmp 2400
2400:  copy 6000.6eff > 6d00 using ZP registers 0-4
[
	m0 = 6d00
	for (m1 = a800; m1 > 5f00; m1 -= 100, m2 -= 100)
		for(y=0; y < 256; y++) mem[(m1)+y] = mem[(m0)+y]
]
2423: copy 2000.23ff > 400
2440: Fill a29d.be9e with 0's  (self-modifying!)
2454: Soft reset (3f2) = 400,  JMP 400
400: Stack Ptr = FF, X=A=0
406: Fill 0.ff with 0's, Fill 200.2ff with 0's
40e: Activate Language Card Ram write
FFFC = 400, 20 = 20, 21 = 1, 22 = 40
42a: Turn on hires fullscreen mode

Now, since I'm not seeing a hires screen, I know that the jmp to 400
never happens.  At least not to the code I saw in the debugger anyway.
If I press ctrl+reset and then 2400g then I see the game appear and all
is happy.

So I can infer only a few things, some of which shouldn't be possible:
1) the jmp 2400 never happens and goes to the wrong place for some
reason (basic, warm-reset, or who knows where?)
2) It does NOT get as far as 2423 -- if I type "2423g" I see the game
appear but it crashes
3) So logically, 1 must be true.  So that means something is odd about
the following:

248B: LDA $c010 ;clear strobe
248E: LDA $c000 ;get key
2491: BPL $248E ;wait for keypress
2493: LDA $c010 ;clear strobe
2496: JMP $2400 ;start game

This doesn't make ANY sense.  But it's logically the only place where
this COULD go wrong!

-B