News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Snes debugging question  (Read 2752 times)

Sledge

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
Snes debugging question
« on: August 18, 2011, 04:06:04 pm »
So let's say I'm debugging a SNES game with SNES9x and I come up with the following intruction:

LDA $00AF

So it means that BYTE at adress 00AF will be stored in A.
Before I can step into the next intruction, I'd like to know whats the byte value at 00AF, where can i see that?

Gil Galad

  • Full Member
  • ***
  • Posts: 186
    • View Profile
    • Homepage of Gil Galad
Re: Snes debugging question
« Reply #1 on: August 18, 2011, 04:26:57 pm »
You can step the debugger of course. And trace the code to see what writes to that address directly. Also,  a memory viewer would help if it has one.
Homepage of Gil Galad || New Forum

“I don’t know half of you half as well as I should like; and I like less than half of you half as well as you deserve. ”

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7067
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Snes debugging question
« Reply #2 on: August 19, 2011, 09:58:37 pm »
Either one byte, or the 2-byte value at $AF and $B0, depending on whether the Accumulator is set to 8- or 16-bit mode.

Also, if the instruction is actually LDA $AF, it will actually be CPU address ($AF + register D ) in bank DB.
(I think so, only zero-page instructions use D?)
"My watch says 30 chickens" Google, 2018

MathOnNapkins

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 638
  • Who ya gonna call
    • View Profile
    • Arc-Nova - Rohmackin' and Chiptunin'
Re: Snes debugging question
« Reply #3 on: August 20, 2011, 03:27:22 am »
Geiger's has a memory viewer. I haven't used it in a while but it should be listed as a button like "hex editor", or "ram viewer" or something like that. Switch to WRAM. Assumedly, $00AF corresponds to a RAM location, though not necessarily. That would depend upon the value of the data bank register. The debugger should be able to tell you this before you step over the instruction. The line might look something like:

Code: [Select]
lda $00af [$7e0000]
or

Code: [Select]
lda $00af [$000000]
There's a possibility that it could be from rom, but I doubt it. That would only likely occur if the bank were in the ranges 0x40 to 0x7D or 0xC0 to 0xFF.