This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Converting RAM Modifications to ROM

Converting RAM Modifications to ROM
by on (#232324)
G'day everyone

So I have been mucking about with a Homebrew game called 田雞 (Frog) and I tried making the protagonist start the game with 5 lives rather than 3. I could do this by freezing a RAM Value and restarting FCEUX. I wanted to make this change apart of the ROM and I have spent hours trying to figure out the solution. Here are the steps that I have been taking:

1 Get RAM Address 0x0507 (Frog's starting amount of lives, I have checked this value) and
make a write breakpont using FCEUX Debugger

2 Run the debugger and reset the game, getting seemingly random values such as "CE 07 05" as seen in the image above

Have I made a mistake trying to locate these values? Do they direct me to the specific byte (02)? I would appreciate if somebody could lend a hand.

Re: Converting RAM Modifications to ROM
by on (#232325)
That is not random at all. that is code to decrement the life counter. DEC ( DECrement by 1 ) 07 05 6502 stores address LO HI so that is $0507 which is the address you found. That is the code that "takes a life away" you are looking for something like a9 03 8d 07 05
Re: Converting RAM Modifications to ROM
by on (#232327)
Thanks a tonne, I figured from what you said about DECrement that the debugger was triggered as I killed myself. In response, I left the debugger running as I restarted the game and it triggered with the STA Instruction, which I figured is Storage/Accumulation Data. Thanks again for the help, but how did you predict "A9 03 8D 07 05" (03 was actually 02, because 00 counts as 1) so accurately?
Re: Converting RAM Modifications to ROM
by on (#232331)
there are only so many ways to init a memory location in 6502
LDA #2
STA $0507
would be the number 1 way
having an array of numbers that it loads in with something like
ldx #7
lda XXXX,x
sta $0500,x
bpl $XX
would be the 2nd

LDX #2
STX $0507 and
LDY #2
STY $0507
possible but very rare chance.