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

trying to make this code work for zelda..

trying to make this code work for zelda..
by on (#54284)
alright maybe i'm being dumb... but i can't seem to get this code working :? other then if i change the value in the rom file.. or use the cheat tool in fce.. what it should do is give you 255 ruby's from picking up just 1
any help would be good here what i got


game writes ruby's to ram address $066D

-----debug info------(search for writing to $066D)

:6CD8:99 57 06 STA $0657,Y @ $067E = #$00
:6CDB:A5 15 LDA $0015 = #$DA
:6CDD:4A LSR
:6CDE:B0 B6 BCS $6C96
:6CE0:AD 7D 06 LDA $067D = #$00
:6CE3:F0 0B BEQ $6CF0
:6CE5:CE 7D 06 DEC $067D = #$00 <<<(search string/my code)
:6CE8:EE 6D 06 INC $066D = #$00 <<<(writes)
:6CEB:A9 10 LDA #$10
:6CED:8D 04 06 STA $0604 = #$00
:6CF0:AD 7E 06 LDA $067E = #$00
:6CF3:F0 0B BEQ $6D00
:6CF5:CE 7E 06 DEC $067E = #$00
:6CF8:CE 6D 06 DEC $066D = #$00
:6CFB:A9 10 LDA #$10
:6CFD:8D 04 06 STA $0604 = #$00
:6D00:A0 28 LDY #$28
:6D02:B9 97 6C LDA $6C97,Y @ $6CBE = #$24
:6D05:99 02 03 STA $0302,Y @ $0329 = #$24
:6D08:88 DEY

6CE5=EE >>> 255 ruby's from 1 (works in cheat search tool)

VVVTSKVK - 6CE5?CE:EE (this doesn't work)

------ rom search ------
looking for (CE 7D 06)

0000: >INES header<
6560: AD 7D 06 F0 0B >>> CE 7D 06 <<< EE 6D 06 A9 10 8D 04 06
6570: AD 7E 06 F0 0B CE 7E 06 CE 6D 06 A9 10 8D 04 06

VTSTISVK - 6555?CE:EE (doesn't work)

but if i change 6565:EE in the rom file it works
what am i doing wrong? anyone have some good pointers? :)

by on (#54286)
If you are using real hardware, the Game Genie codes only work on $8000-FFFF. You cannot make a code for the $6xxx range.

by on (#54290)
thanks for replying :)
i know about the address range
in the rom file if i change $6565 it works fine

this is from the rom
0000: >INES header<
6560: AD 7D 06 F0 0B >>> CE 7D 06 <<< EE 6D 06 A9 10 8D 04 06
6570: AD 7E 06 F0 0B CE 7E 06 CE 6D 06 A9 10 8D 04 06

i want the CE to be EE

by on (#54292)
You can't use ROM offsets for Game Genie codes. You have to find out where this code is mapped in the addressing space of the NES (probably somewhere between $8000 and $FFFF).

Since you have a search string, you can open the game in FCEUXD, open its Hex Editor (under the "Tools" menu) and search for the string there. Once you find the string you can see where the byte you want to change is.

by on (#54293)
Game Genie codes have nothing to do with the Rom File address, and all to do with the address of the bank within the NES's memory.

For instance, Zelda uses 16K bankswitching, with the last bank as the fixed bank. Any bank besides the last one would be mapped in at 8000. So something at 0x6565 in the file would be located at 0xA555 in memory.

by on (#54295)
Dwedit wrote:
Game Genie codes have nothing to do with the Rom File address, and all to do with the address of the bank within the NES's memory.

For instance, Zelda uses 16K bankswitching, with the last bank as the fixed bank. Any bank besides the last one would be mapped in at 8000. So something at 0x6565 in the file would be located at 0xA555 in memory.


it works! :)
one ruby is now worth 255 - VTSZISVK

how did you get A555 form 6565?
i know you take 0x10 away for the header so then you have 6555
thought it might have something todo with the mapper.. :oops:
i mean is their an easy way just knowing the number of banks?
how did you get A from 6 tho? thanks everyone for the help!

by on (#54296)
ROM C000-FFFF is fixed to the last PRG bank. (last 16k)
ROM 8000-BFFF is the switchable bank.

You know the game is MMC1, using 16K bankswitching. (some MMC1 games use 32k bankswitching)
Since the byte you're interested in is not in the fixed bank, it must be in the switchable bank.

You take the file address, subtract 0x10 for the iNES header. Then you only use the low 14 bits, so 0x6555 becomes 0x2555 (Address = address AND 0x3FFF or Address MOD 0x4000). Finally, add 0x8000 because it's in the switchable bank. There's your address within the NES memory.

by on (#54297)
jims cool wrote:
i know you take ten away for the header so then you have 6555

Don't call "$10" "ten", it's confusing. It's sixteen when converted to decimal. It's a good idea to use "$" or "0x" when talking about hexadecimal numbers.

Quote:
it might have something todo with the mapper

I has to do with where the CPU sees the contents of the ROM file. The NES reserves the range $8000-$FFFF of the memory it sees for ROMs (it's also possible to place ROM at $6000, but few games do it). The mapper used by Zelda divides this range in two: $8000-$BFFF and $C000-$FFFF, and it places the last bank of of the ROM file at the second slot ($C000-$FFFF).

Since the byte you wanted to change is close to the beginning of the ROM file, it can't be in the last bank, so whatever bank it is it's definitely going to be seen at $8000-$BFFF. So all you have to do is ignore any banks that come before the one of your interest. Each bank is 16384 bytes long, in hex this is $4000. Subtract $4000 from $6555 and you get $2555, and since this value is < $4000 (if it wasn't you should have kept subtracting $4000 until it was) this the offset of the byte within the bank. Since this bank is going to be placed at $8000, add $8000 to $2555 and you get $A555.

EDIT: Beaten! =)

by on (#54299)
i remember seeing this someplace in a text file.. couldn't find it
thanks tokumaru! couldn't of asked for a better explanation :D

by on (#54303)
Dwedit wrote:
ROM C000-FFFF is fixed to the last PRG bank. (last 16k)
ROM 8000-BFFF is the switchable bank.

That's true of games that use SNROM as if it were UNROM, like Zelda. But other games might use it like BNROM (swap 32 KiB at a time) or more rarely like Crazy Climber ($8000 fixed to first 16 KiB bank, $C000 switchable). I seem to remember a Zelda-based pirate multi using 32 KiB bank mode for the NROM games it contained.