Other than I/O ports for PPU, vectors, service routines, and program code, should there be any specific values saved in memory? Looking at the iNES rom for Super Mario Brothers, there are the following instructions after the header:
I initialize all values of memory to 0x00 before I load in the ROM and setup interrupt vectors and handlers.
Is the rom expecting values at address $2020 and $07DC? Is it supposed to send PC below the starting point of the ROM because the BPL is checking the flag after a DEX which is still positive?
Or should one of the previous branches be taken?
Code:
...
LDA $2020 ; contents of A now 0x00
BPL FB ; branch is not taken
LDA $2020 ; contents of A still 0x00
BPL FB ; branch is not taken (A is not negative)
LDY #FE
LDX #05
LDA ($07D7, X) ; contents of A still 0x00
CMP #0A ; 0x00 - 0x0A
BCS 0C ; branch is not taken (carry not set)
DEX
BPL F6 ; Branch is taken, but the offset is a large negative which throws PC below the beginning of ROM
...
LDA $2020 ; contents of A now 0x00
BPL FB ; branch is not taken
LDA $2020 ; contents of A still 0x00
BPL FB ; branch is not taken (A is not negative)
LDY #FE
LDX #05
LDA ($07D7, X) ; contents of A still 0x00
CMP #0A ; 0x00 - 0x0A
BCS 0C ; branch is not taken (carry not set)
DEX
BPL F6 ; Branch is taken, but the offset is a large negative which throws PC below the beginning of ROM
...
I initialize all values of memory to 0x00 before I load in the ROM and setup interrupt vectors and handlers.
Is the rom expecting values at address $2020 and $07DC? Is it supposed to send PC below the starting point of the ROM because the BPL is checking the flag after a DEX which is still positive?
Or should one of the previous branches be taken?