News: 11 March 2016 - Forum Rules

Author Topic: SNES ASM direct page addressing  (Read 2272 times)

Mikey88

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
SNES ASM direct page addressing
« on: February 08, 2015, 04:26:57 pm »
While tracing in Geiger's Debugger I ran into this.

Code: [Select]
$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]
« Last Edit: February 08, 2015, 04:51:55 pm by Mikey88 »

mziab

  • Sr. Member
  • ****
  • Posts: 330
    • View Profile
    • mteam
Re: SNES ASM direct page addressing
« Reply #1 on: February 08, 2015, 04:43:22 pm »
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

  • Jr. Member
  • **
  • Posts: 10
    • View Profile
Re: SNES ASM direct page addressing
« Reply #2 on: February 08, 2015, 05:27:15 pm »
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!