News:

11 March 2016 - Forum Rules

Main Menu

SNES ASM direct page addressing

Started by Mikey88, February 08, 2015, 04:26:57 PM

Previous topic - Next topic

Mikey88

While tracing in Geiger's Debugger I ran into this.

$00/841A DD FF FF    CMP $FFFF,x[$00:01FE]   A:83F6 X:01FF Y:0000 P:eNvmxdIzC
$00/841D F0 6C       BEQ $6C    [$848B]      A:83F6 X:01FF Y:0000 P:envmxdIzC


I understand (or thought i understood) CMP $FFFF,x is comparing the value at address $00:01FE. Then if equal, branch. What i am having trouble with is, if it says BEQ $6C and the DP is #$00 I thought the effective address would be $006C, but the debugger says $848B. I am not quite sure how it is getting this address. Any help would me much appreciated.[/code]

mziab

It's not direct page addressing. Branch instructions use Program Counter relative addressing. The operand is actually a signed number relative to the next opcode.

Mikey88

Great! Thank you! I did not know branching used a different addressing mode. I see now it is the program counter #$841F + #$6C = #$848B. Thanks again!