6800 Indexed Jump

Thread Starter

bighand

Joined Apr 2, 2009
18
I'm having a bit of a brainfart while trying to trace through some old 6800 code.

ldx $9ffe
jsr $00,x

Does this jump to 9FFE or does it read two bytes from 9FFE and then use that as the jump address?

I'm confused because the two bytes at 9FFE-9FFF are the last two bytes of a ROM, and the bytes are not a jump/branch/return instruction so execution would continue at A000 which is not a valid address. But if the two bytes (94 10) are an address then 9410 is in the middle of an unrelated routine and it doesn't seem right to jump there.
 

MrChips

Joined Oct 2, 2009
34,629
LDX $7ffe

does not load $7FFE into X.

It loads the two bytes at $7FFE-7FFF into X.

Then JSR 0,X jumps to the new address contained in X.
 

Thread Starter

bighand

Joined Apr 2, 2009
18
Thanks. I guess I need to brush up on the addressing modes.

It looks like I was getting LDX $nnnn mixed up with LDX #$nnnn.
 
Top