nesdev.com
http://forums.nesdev.com/

Please help with Zelda 1 & 2 ROM hacking
http://forums.nesdev.com/viewtopic.php?f=10&t=19000
Page 2 of 4

Author:  Mattiac [ Sun Jun 30, 2019 5:28 am ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

It sounds like a possible solution. Thank you, Xamboni-san!

xamboni wrote:
Quote:
Oh, thank you! It sounds like progress. I do want a fifth row
after 0-9 and that's where I wish to put the Swedish
characters.


Right I get you on that I will give it another go. Worst case though we change the box to be wider left and right by one column. Then we can move the A letter left and shift the rest of the letters back one space like a snake. You would then have 5 extra spaces for new letters to be used.

I plan on finding the vertical wrap though so probably a moot point. I should probably test the horizontal addition and see if it correctly takes what is in the new row and puts it in for the name.

Author:  xamboni [ Tue Jul 09, 2019 10:18 pm ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

Ok I found the extra row test so I think the Zelda 1 problem is under control now. In the European version of the game the vertical cursor test is done at location 0x9e13. Note this is a static address rather than runtime memory.

The game will do a memory compare on the cursor's RAM location against this address. On each cursor move 0x10 is added to the RAM address holding the cursors location. This result after the add is compared to the contents of 0x9813. If you add 0x10 to 0x9813 you will see the cursor move down another row before it resets to the beginning.

My modified binary now has the byte sequence 0x23 0x30 0x10 0xd7 0x87 0xf0 0x77 0xb7 around the important locations. Let me know if you have any questions or if I made any mistakes. There are a ton of changes in my modified binary so I might have things a bit backwards here. Next time I sit down I'll work with a clean binary to test the changes.

edit: I should have mentioned the important byte in the above sequence is 0xd7. The original game vertical max is 0xc7.

Author:  Mattiac [ Wed Jul 10, 2019 1:08 pm ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

Thank you so very much, Xamboni-san! ^_^

I feel a bit stupid because I'm not sure I understand, but should
I go to 0x9e13 and enter the byte sequence there? Will that add
the Swedish characters as well or do I have to add them to a
table somewhere else?

xamboni wrote:
Ok I found the extra row test so I think the Zelda 1 problem is under control now. In the European version of the game the vertical cursor test is done at location 0x9e13. Note this is a static address rather than runtime memory.

The game will do a memory compare on the cursor's RAM location against this address. On each cursor move 0x10 is added to the RAM address holding the cursors location. This result after the add is compared to the contents of 0x9813. If you add 0x10 to 0x9813 you will see the cursor move down another row before it resets to the beginning.

My modified binary now has the byte sequence 0x23 0x30 0x10 0xd7 0x87 0xf0 0x77 0xb7 around the important locations. Let me know if you have any questions or if I made any mistakes. There are a ton of changes in my modified binary so I might have things a bit backwards here. Next time I sit down I'll work with a clean binary to test the changes.

edit: I should have mentioned the important byte in the above sequence is 0xd7. The original game vertical max is 0xc7.

Author:  xamboni [ Wed Jul 10, 2019 5:37 pm ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

Quote:
I feel a bit stupid because I'm not sure I understand, but should
I go to 0x9e13 and enter the byte sequence there? Will that add
the Swedish characters as well or do I have to add them to a
table somewhere else?


No reason to feel stupid my man. I am sure I skipped a ton of steps in my explanation and as always I am still learning too.

Adding in the Swedish characters is probably the easier part of this so I didn't address it too much yet. In an earlier post I believe there was a picture showing the additional letters you want are doable so we can go over that later. First lets confirm the cursor now behaves the way you want.

You will need a hex editor in order to review the bytes I posted earlier. I pulled up a page on wikipedia which shows a few options for you. BeyondCompare is available on multiple platforms and requires a license but you can use their trial period for a bit. HxD (Windows) and Bless (Linux) are two others that I can say will get the job done.

    1. Make a copy of your European ROM.
    2. Open up the copy inside of your hex editor of choice.
    3. Confirm you are looking at a ton of game data and code (Hex bytes). The first 3 bytes are 0x4e 0x45 0x53 which spells NES in ascii characters.
    4. Either search for the byte pattern I listed (233010c787f0) or navigate to address 0x9e13. If your hex editor shows addresses in decimal rather than hexadecimal then it is 40467.
    5. Change the byte c7 to d7, save the file change, and load the game in an emulator. In BeyondCompare if you load the original game in the left pane and the copy in the right when doing a hex comparison (File->NewSession->HexCompare) then your change will be obvious.
    6. See if the menu is behaving the way you want.

Sorry for the typo in my last post. 0x9813 should be 0x9e13.

Author:  Mattiac [ Fri Jul 12, 2019 7:08 am ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

Wow, it's really cool that a tiny change like that can
cause a big difference. Now it's like I wished for.

The cursor didn't move to the bottom when I moved
it to the top character and pressed up, but I guess
you will figure that out as well.

Thank you a lot, Xamboni-san!

Have a nice day!

xamboni wrote:
Quote:
I feel a bit stupid because I'm not sure I understand, but should
I go to 0x9e13 and enter the byte sequence there? Will that add
the Swedish characters as well or do I have to add them to a
table somewhere else?


No reason to feel stupid my man. I am sure I skipped a ton of steps in my explanation and as always I am still learning too.

Adding in the Swedish characters is probably the easier part of this so I didn't address it too much yet. In an earlier post I believe there was a picture showing the additional letters you want are doable so we can go over that later. First lets confirm the cursor now behaves the way you want.

You will need a hex editor in order to review the bytes I posted earlier. I pulled up a page on wikipedia which shows a few options for you. BeyondCompare is available on multiple platforms and requires a license but you can use their trial period for a bit. HxD (Windows) and Bless (Linux) are two others that I can say will get the job done.

    1. Make a copy of your European ROM.
    2. Open up the copy inside of your hex editor of choice.
    3. Confirm you are looking at a ton of game data and code (Hex bytes). The first 3 bytes are 0x4e 0x45 0x53 which spells NES in ascii characters.
    4. Either search for the byte pattern I listed (233010c787f0) or navigate to address 0x9e13. If your hex editor shows addresses in decimal rather than hexadecimal then it is 40467.
    5. Change the byte c7 to d7, save the file change, and load the game in an emulator. In BeyondCompare if you load the original game in the left pane and the copy in the right when doing a hex comparison (File->NewSession->HexCompare) then your change will be obvious.
    6. See if the menu is behaving the way you want.

Sorry for the typo in my last post. 0x9813 should be 0x9e13.

Author:  xamboni [ Fri Jul 12, 2019 3:27 pm ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

Quote:
The cursor didn't move to the bottom when I moved
it to the top character and pressed up, but I guess
you will figure that out as well.


Hmmmmm mine was working both ways as intended. Maybe I made two changes that fixed both ways and didnt realize it from my notes. I'll boot it up soon-ish and see what is going on.

Author:  xamboni [ Fri Jul 12, 2019 9:50 pm ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

Well when you are right you are right. The second change must have slipped my mind. I made two changes to account for going up as well.

0x9e13: 0xc7 -> 0xd7
0x9e17: 0xb7 -> 0xc7

Author:  xamboni [ Fri Jul 12, 2019 11:29 pm ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

I looked into the other parts of the equation here and it seems we might be looking at a bit more difficulty. I added a new row of letters into the games background code locations. Unfortunately this throws off some pointers for the initial Zelda splash screen so we will have to fix that math. Also when the cursor selects a location it does not use what is there per se. We will have to identify that dereference and fix it up. As a first test I moved the cursor to the new row and instead of the zero I put there it loaded an 'x' into my name.

If you would like to play around with the backgrounds on the enter name menu look at address 0x1a1fe. You will see a clear pattern of number bytes (0x0#) and black bytes (0x24) alternating. For example that particular row begins with the numbers 0-9. In hex we see 0x00 0x24 0x01 0x24 0x02 0x24...

You can add another row by adding the bytes 0x23 0x26 0x13 0x00 0x24 0x01... at location 0x1a211. This breaks the game due to relative offsets found throughout the code. As an easy way of fixing this I removed bytes starting at 0x1ad80. Those bytes are filler 0xff's so they are probably not used for anything. If you add in the byte pattern I listed about (0x23 0x26... ) you need to remove the exact same amount of 0xff's from the padding section.

Let me know if you have any questions. As long as you keep the byte count the same you can modify things as much as you want to get it cosmetically looking like swedish letters in the final row.

Author:  Mattiac [ Sun Jul 14, 2019 7:08 am ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

There are two offsets where one can change to replace ! with Å for example. I know where, but I have my notes at home and I will return tomorrow. Unless I borrow my friends computer here.

xamboni wrote:
I looked into the other parts of the equation here and it seems we might be looking at a bit more difficulty. I added a new row of letters into the games background code locations. Unfortunately this throws off some pointers for the initial Zelda splash screen so we will have to fix that math. Also when the cursor selects a location it does not use what is there per se. We will have to identify that dereference and fix it up. As a first test I moved the cursor to the new row and instead of the zero I put there it loaded an 'x' into my name.

If you would like to play around with the backgrounds on the enter name menu look at address 0x1a1fe. You will see a clear pattern of number bytes (0x0#) and black bytes (0x24) alternating. For example that particular row begins with the numbers 0-9. In hex we see 0x00 0x24 0x01 0x24 0x02 0x24...

You can add another row by adding the bytes 0x23 0x26 0x13 0x00 0x24 0x01... at location 0x1a211. This breaks the game due to relative offsets found throughout the code. As an easy way of fixing this I removed bytes starting at 0x1ad80. Those bytes are filler 0xff's so they are probably not used for anything. If you add in the byte pattern I listed about (0x23 0x26... ) you need to remove the exact same amount of 0xff's from the padding section.

Let me know if you have any questions. As long as you keep the byte count the same you can modify things as much as you want to get it cosmetically looking like swedish letters in the final row.

Author:  xamboni [ Sun Jul 14, 2019 10:09 am ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

Quote:
There are two offsets where one can change to replace ! with Å for example. I know where, but I have my notes at home and I will return tomorrow. Unless I borrow my friends computer here.


Not quite sure what you mean but if you get something working let me know what changes you made and I will test them out.

Author:  Mattiac [ Tue Jul 16, 2019 9:08 am ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

I had to change at offset 1A1B0-1A210
and offset 09DC0-09DE0 in order to
replace ! with an Å for example.
Only the graphics would change if
I only changed at one offset, so
I had to change at both places
because it would otherwise look
like Å on the screen but it would
print ! if I typed it on the name
registration screen. I used HxD.
I just don't know how to add more
characters in the mix...

Have a great day, Xamboni-san!

xamboni wrote:
Quote:
There are two offsets where one can change to replace ! with Å for example. I know where, but I have my notes at home and I will return tomorrow. Unless I borrow my friends computer here.


Not quite sure what you mean but if you get something working let me know what changes you made and I will test them out.

Author:  xamboni [ Tue Jul 16, 2019 2:12 pm ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

Quote:
I just don't know how to add more
characters in the mix...


You can add more characters into the mix by using the image editor program "yychr". I believe I got the tool from smwcentral.net but I am sure it hosted elsewhere also. Once you have that program throw the game into a debugger. For this I used fceux in Windows. In Linux fceux does not have many debugging features.

Once in the debugger go to the name registration screen and hit "pause|break" on your keyboard. This should halt the game. From there bring up the PPU memory viewer. I think this is something like Tools->HexViewer->PpuMemory. In that window's file menu there is an option to "Dump PPU Memory" which creates a binary file containing the tiles loaded into the PPU at that moment. This binary file can be fed directly into yychr which displays the tile set and allows you to make changes. In yychr do File->LoadFile->Select your binary dump file. If the graphics look messed up there is a drop down box in the lower left which scrolls through the different gaming systems. There is probably an entry named NES 4-bit or something. Once you are looking at the actual letters click around to change them how you would like. You can see several spaces after the standard letters where adding your new letters can happen.

I typed this from memory so some of it might be a little inaccurate. Let me know if you have any questions.

Author:  tepples [ Tue Jul 16, 2019 5:08 pm ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

xamboni wrote:
Once you have that program throw the game into a debugger. For this I used fceux in Windows. In Linux fceux does not have many debugging features.

However, if your Linux box uses an x86 or x86-64 processor, you can use FCEUX for Windows in Wine with no problem.

xamboni wrote:
Once in the debugger go to the name registration screen and hit "pause|break" on your keyboard.

Or if your laptop's keyboard lacks a Pause button, you can click "Step" in the debugging window, or press \ (backslash) for frame advance with the game window focused.

Author:  Mattiac [ Thu Jul 18, 2019 5:08 am ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

Thank you, Xamboni-san, but I meant that I already
know how to easily add Swedish characters to the
tileset, but I don't know how I can add them in the
right places in the ROM that has some kind of list
and table over the characters in the registration
screen.

xamboni wrote:
Quote:
I just don't know how to add more
characters in the mix...


You can add more characters into the mix by using the image editor program "yychr". I believe I got the tool from smwcentral.net but I am sure it hosted elsewhere also. Once you have that program throw the game into a debugger. For this I used fceux in Windows. In Linux fceux does not have many debugging features.

Once in the debugger go to the name registration screen and hit "pause|break" on your keyboard. This should halt the game. From there bring up the PPU memory viewer. I think this is something like Tools->HexViewer->PpuMemory. In that window's file menu there is an option to "Dump PPU Memory" which creates a binary file containing the tiles loaded into the PPU at that moment. This binary file can be fed directly into yychr which displays the tile set and allows you to make changes. In yychr do File->LoadFile->Select your binary dump file. If the graphics look messed up there is a drop down box in the lower left which scrolls through the different gaming systems. There is probably an entry named NES 4-bit or something. Once you are looking at the actual letters click around to change them how you would like. You can see several spaces after the standard letters where adding your new letters can happen.

I typed this from memory so some of it might be a little inaccurate. Let me know if you have any questions.

Author:  xamboni [ Fri Jul 19, 2019 11:13 pm ]
Post subject:  Re: Please help with Zelda 1 & 2 ROM hacking

Quote:
Thank you, Xamboni-san, but I meant that I already
know how to easily add Swedish characters to the
tileset, but I don't know how I can add them in the
right places in the ROM that has some kind of list
and table over the characters in the registration
screen.


Sorry for misunderstanding. I worked a bit more on the background layout. I can now add another row and fix the borders around it cosmetically. I will work on the mysterious dereference that drives what character is chosen.

Page 2 of 4 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/