6800 Indexed Jump

Discussion in 'Embedded Systems and Microcontrollers' started by bighand, Sep 22, 2014.

  1. bighand

    Thread Starter Member

    Apr 2, 2009
    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.
  2. MrChips


    Oct 2, 2009
    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.
  3. bighand

    Thread Starter Member

    Apr 2, 2009
    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.