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

Poll

What should the new name for the "Spell" spell be?

Reveal
5 (21.7%)
Unveil
4 (17.4%)
Enigma
9 (39.1%)
Expose
5 (21.7%)

Total Members Voted: 23

Author Topic: Zelda II Redux  (Read 157118 times)

Trax

  • Hero Member
  • *****
  • Posts: 524
    • View Profile
    • Trax ROM Hacking
Re: Zelda II Redux
« Reply #260 on: October 25, 2018, 01:35:31 am »
Yes, one CHR bank per frame, actually. The code adjusts the speed of frames using RAM $12, which is a permanent ascending counter.

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1259
    • View Profile
Re: Zelda II Redux
« Reply #261 on: October 25, 2018, 01:38:17 pm »
Yes, one CHR bank per frame, actually. The code adjusts the speed of frames using RAM $12, which is a permanent ascending counter.
So the code uses RAM address or value $12?
Also, you mentioned something about expanded banks from 14 (original) to 16.
Does Shadow of Night use the original 14 CHR banks or is it expanded to 16?
And if it's the former, does it use each CHR bank for the animation, or only two (being the 14th the one for the animation)?

njosro

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Zelda II Redux
« Reply #262 on: October 25, 2018, 05:54:29 pm »
way to go, trax!  :thumbsup: I always wondered how it was done.

ShadowOne, my interpretation is that Shadow of Night expands it to 16 CHR banks, because if it's 1 bank per frame, and Shadow of Night has 4 animation frames if I remember correctly, that's 4 extra banks.

Trax

  • Hero Member
  • *****
  • Posts: 524
    • View Profile
    • Trax ROM Hacking
Re: Zelda II Redux
« Reply #263 on: October 27, 2018, 12:15:18 pm »
That's how it's done. It's not elegant, but it works. The original CHR bank is 8, part 1000-1FFF. This bank contains the first frame. Bank D already exists, but is empty. In the hack, it contains a copy of bank 8, with the tiles to animate changed, for second frames. Banks E and F are added through expansion, and are also copies of bank 8, with third and fourth frames changed.

azul120

  • Jr. Member
  • **
  • Posts: 15
    • View Profile
Re: Zelda II Redux
« Reply #264 on: October 29, 2018, 02:05:02 am »
Interesting stuff here.

Can't help but wonder what could be done with a mapper conversion. First things first of course.

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1259
    • View Profile
Re: Zelda II Redux
« Reply #265 on: October 29, 2018, 12:01:04 pm »
That's how it's done. It's not elegant, but it works. The original CHR bank is 8, part 1000-1FFF. This bank contains the first frame. Bank D already exists, but is empty. In the hack, it contains a copy of bank 8, with the tiles to animate changed, for second frames. Banks E and F are added through expansion, and are also copies of bank 8, with third and fourth frames changed.
Interesting.
Is there a way to make the expansion to 16 CHR banks? (Is it the MMC1 to MMC3 hack or is it something to do with the free space available near the end of the ROM?)
Afaik, for Zelda 2 Redux I might only require 3 frames of animation to make it work and behave as it does on Link no Bouken (Japanese release), I don't know if having the 4 frames could make things easier/harder, but that'll come in due time.
What address in Shadow of Night does the code for this animation start at to take a peek at it?

Shade Aurion

  • Submission Reviewer
  • Sr. Member
  • *****
  • Posts: 257
  • Shadow Keeper
    • View Profile
    • DudeGoBack
Re: Zelda II Redux
« Reply #266 on: October 29, 2018, 02:54:42 pm »
So.. I know that the animated tiles are all thats left and all, but looking over the differences betweend the fds version and the nes version ( https://tcrf.net/Zelda_II:_The_Adventure_of_Link/Regional_Differences ) a few other things might be easy additions and cool:
- reverting the River Devil
- reverting the church
-reverting King's Tomb (although maybe removing the enemies and keeping the woman and have her drop some lore. This would be a good place to add in a prince sprite full of remorse if you were ever going to)
- reverting kasuto's secret building
- maybe revert one of the river guards to give more variety?

I dunno, just some ideas. I'm super excited either way to replay Zelda 2 eitherway ^_^

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1259
    • View Profile
Re: Zelda II Redux
« Reply #267 on: October 29, 2018, 04:35:28 pm »
So.. I know that the animated tiles are all thats left and all, but looking over the differences betweend the fds version and the nes version ( https://tcrf.net/Zelda_II:_The_Adventure_of_Link/Regional_Differences ) a few other things might be easy additions and cool:
- reverting the River Devil
- reverting the church
-reverting King's Tomb (although maybe removing the enemies and keeping the woman and have her drop some lore. This would be a good place to add in a prince sprite full of remorse if you were ever going to)
- reverting kasuto's secret building
- maybe revert one of the river guards to give more variety?

I dunno, just some ideas. I'm super excited either way to replay Zelda 2 eitherway ^_^
I did take all these Regional differences into consideration for Redux.
Most of them though, feel like really minor changes and/or look better to me in the NES version.
For example, the Kasuto building does look better to me compared to the full green bricks, same for the guards (you change one, most likely all the others will change too). The Church new cross does look way better in the NES version for sure, FDS one looks too simple.

The only ones I did consider seriously are the River Devil, the spawn sprites and the King's Tomb area.
The River Devil I am looking for official artwork to see which one of the two sprites between versions is the closest to the original artwork. The Spawn sprites I might add some color to the NES ones (like making the Bot spawn sprite blue and the monster one perhaps brown or some red/orange color).
The Tomb's area I am really not sure what I will do for it. I do like the original FDS setting, but if I restore that one I would have to get rid of the enemies and put back the NPC there instead. I'll see what happens once the water animation is done.

Trax

  • Hero Member
  • *****
  • Posts: 524
    • View Profile
    • Trax ROM Hacking
Re: Zelda II Redux
« Reply #268 on: October 29, 2018, 11:42:39 pm »
Going from MMC1 to MMC3 is not a piece of cake. It involves a different way of loading graphics. You can probably use the same CHR swap as the original, i.e. swap 0x2000 bytes at PPU 0x0000 or 0x1000 in one shot. But the advantage of MMC3 is that you can individually swap smaller chunks of the PPU at any given time. I think the smallest is 0x400 bytes, which is a quarter of 0x0000 or 0x01000, or 64 tiles. That would make tile animation a lot easier and less "hacky".

As far as I know, MMC1 allows a maximum of 16 banks, so the expansion of banks is possible with MMC1. Just change the ROM's header, and then make sure the correct banks are swapped as needed. As for Zelda II specifically, you have to take bank 7 and move it to 15. I think the rest can be left where it is.

In Shadow of Night, the code for the Overworld bank swapping is at 0x2A40.

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1259
    • View Profile
Re: Zelda II Redux
« Reply #269 on: October 30, 2018, 04:55:18 pm »
Going from MMC1 to MMC3 is not a piece of cake. It involves a different way of loading graphics. You can probably use the same CHR swap as the original, i.e. swap 0x2000 bytes at PPU 0x0000 or 0x1000 in one shot. But the advantage of MMC3 is that you can individually swap smaller chunks of the PPU at any given time. I think the smallest is 0x400 bytes, which is a quarter of 0x0000 or 0x01000, or 64 tiles. That would make tile animation a lot easier and less "hacky".

As far as I know, MMC1 allows a maximum of 16 banks, so the expansion of banks is possible with MMC1. Just change the ROM's header, and then make sure the correct banks are swapped as needed. As for Zelda II specifically, you have to take bank 7 and move it to 15. I think the rest can be left where it is.

In Shadow of Night, the code for the Overworld bank swapping is at 0x2A40.
Okay, so I will stick to MMC1 (CHR) to avoid any unwanted trouble with graphics.
Now unto more detailed questions:
  • I started reading a little bit about the NES header, seeing as to how you suggested to change the header to make the game grab 16 CHR banks, and bumped into this:
    http://www.neshq.com/hardgen/nes_header.txt

    Now my question is, and correct me if I'm wrong, but I'm seeing that the Zelda 2 ROM has hex values [08 10 12] starting at 0x000004. Do I still need to make a change here? According to this, the $08 at 0x04 is the PRG byte, unless I got it wrong and that is the CHR bank byte, is this the one required to be changed to $10 instead of $08?


  • At 0x2A40 I get the exact same assembly code as in vanilla Zelda 2, seems like the changes start at 0x2A50 instead for me (don't know if this is correct).
    I got something like this (code started at 0x2A50):
Code: [Select]
A5 12      LDA $12
29 30      AND #$30
4A         LSR A
4A         LSR A
4A         LSR A
4A         LSR A
A8         TAY
B9 70 AA   LDA $AA70,Y
8D 00 A0   STA $A000
B9 80 AA   LDA $AA80,Y
8D 00 A0   STA $A000
B9 90 AA   LDA $AA90,Y
8D 00 A0   STA $A000
B9 A0 AA   LDA $AAA0,Y
8D 00 A0   STA $A000
B9 B0 AA   LDA $AAB0,Y
8D 00 A0   STA $A000

And then, from 0x2A80 up to 0x2AB4 I am getting something that looks like a table of sorts:
Code: [Select]
10 10 10 10
08 01 00 01
04 00 01 01
02 01 01 01
01 01 01 01

I'm still unsure what the table does, wanted to make sure first that I'm on the right track.

Trax

  • Hero Member
  • *****
  • Posts: 524
    • View Profile
    • Trax ROM Hacking
Re: Zelda II Redux
« Reply #270 on: October 30, 2018, 05:54:41 pm »
The original game has values 08 0E, which translates to 8 PRG banks and 14 CHR banks. Your header already has 16 CHR banks (10 in hex), so you don't have to do anything.

As for the code, I always express my pointers as real addresses, not file addresses, so you have to add 0x10 to compensate for the file header. The code you pasted here is correct. And yes, the table is related, and should be kept that way. The values are a little weird, but basically, it will load a different bank every 0x10 frames, in that order: 08, 0D, 0E, 0F. For speed, it's 16 / 60 = 0.27 seconds per frame, so about 4 frames per second. If you want to have a different animation speed, you need to modify the code slightly.

Shadic

  • Jr. Member
  • **
  • Posts: 38
    • View Profile
Re: Zelda II Redux
« Reply #271 on: October 30, 2018, 09:11:33 pm »
Will this modify the bank loading for every graphic in the game, then?

If so, that would allow for all sorts of BG animation. Obviously you wouldn't want to go overkill on it, but it can be done tastefully - grass to softly blow in the wind, water to actually ripple, etc. I've seen it before in SMB hacks.

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1259
    • View Profile
Re: Zelda II Redux
« Reply #272 on: October 31, 2018, 01:11:32 pm »
The original game has values 08 0E, which translates to 8 PRG banks and 14 CHR banks. Your header already has 16 CHR banks (10 in hex), so you don't have to do anything.

As for the code, I always express my pointers as real addresses, not file addresses, so you have to add 0x10 to compensate for the file header. The code you pasted here is correct. And yes, the table is related, and should be kept that way. The values are a little weird, but basically, it will load a different bank every 0x10 frames, in that order: 08, 0D, 0E, 0F. For speed, it's 16 / 60 = 0.27 seconds per frame, so about 4 frames per second. If you want to have a different animation speed, you need to modify the code slightly.
I started copying the banks and all.
I copied range/bank 0x030010 up to 0x03200F (using YY-CHR) three times starting at offset 0x03A010 and ending at 0x04000F.
I modified the tile related to the water (which is $6E) in each new frame/bank, and I also added some extra/dummy tiles as visual reference to know if the bank switching is working through FCEUX's PPU Viewer.

Then, went ahead and introduced the code from Shadow of Night found at 0x2A50 into Zelda 2.
However, the banks aren't switching yet, I am getting the same static bank/frame as in original Zelda 2.
Am I still missing something else?

Will this modify the bank loading for every graphic in the game, then?

If so, that would allow for all sorts of BG animation. Obviously you wouldn't want to go overkill on it, but it can be done tastefully - grass to softly blow in the wind, water to actually ripple, etc. I've seen it before in SMB hacks.
It's possible without a doubt.
Shadow of Night doesn't only make this bank switching thing to just animate the water, it also does this for animations related to other overworld tiles, like the town tile which has a little smoke animation, and also for grass movement and another one which seems similar to the water tile but I haven't seen in the overworld yet, so yeah it should be possible to add animation to the whole overworld once this is working.
« Last Edit: October 31, 2018, 01:28:27 pm by ShadowOne333 »

Trax

  • Hero Member
  • *****
  • Posts: 524
    • View Profile
    • Trax ROM Hacking
Re: Zelda II Redux
« Reply #273 on: November 01, 2018, 02:30:16 am »
It's because the new code is never executed. It doesn't simply execute after the preceding code, which is unrelated. You have to hook it up somewhere in the original code. Shadow of Night does it exactly at $1C182, which is straight into the NMI routine. It replaces the operation to increase $12 (permanent timer that is increased by 1 every frame), replaces it with a JSR (Jump to SubRoutine) that points to another routine stored in the VERY limited unused space of Bank 7 (which is a shame, because expanding in Bank 7 is quite important if you want to create new code), at $1FF4C. This routine reads like this:

Code: [Select]
1FF4C: AD 6807 LDA $0768
1FF4F: D0 03 BNE $1FF54
1FF51: 20 40AA JSR $AA40
1FF54: E6 12 INC $12
1FF56: 60 RTS

It reads $0768 (I don't even know exactly what this variable does), if it's 0, executes the code at $AA40 (translates to 2A40 in Bank 0, the code that does the actual bank switching), then increases $12 as usual and returns. Whew. Don't you think ASM is funny?

So, copy the code at $1FF4C like above (it's supposed to replace a bunch of FF values), and then replace the operation at $1C182 [EE 12 00] with [20 4C FF]. You should be good to go.

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1259
    • View Profile
Re: Zelda II Redux
« Reply #274 on: November 01, 2018, 11:50:52 am »
Thanks, Trax!
That did the trick :D
I managed to get overworld animation working!

I also went a little bit overboard with it already hahah
Just take a look:



I already animated the grass, River Devil and the water :)
I am thinking if I should animate the towns too, to something similar to Shadow of Night, I will see.
Any suggestions about the sand?
Should I animate that too? Or leave it as it is?

----------------------------------------------------------------------------------------------------------

Edit:
Oops, I just noticed a side effect by watching the GIF, take a look at the lower-left corner.
Turns out the tile used for the water is also the same one used for the rock-like terrain near the labyrinth at the Great Palace.

No biggie though, what I can do is make use of one of the empty tiles in that bank, and simply make it repeat the same tile in each frame of animation, all I need to do is just find where in the ROM is the routine that tells the game what tile to load for that particular terrain, and change it from $6E to whatever I choose it to be.
I already went ahead and added the tile to the corresponding banks, that tile should be $8E, so I just need to find where in the ROM is that routine to change the tile loading from $6E to $8E.
« Last Edit: November 01, 2018, 01:11:35 pm by ShadowOne333 »

darthvaderx

  • Full Member
  • ***
  • Posts: 158
    • View Profile
Re: Zelda II Redux
« Reply #275 on: November 01, 2018, 01:08:14 pm »

Oops, I just noticed a side effect by watching the GIF, take a look at the lower-left corner.
Turns out the tile used for the water is also the same one used for the rock-like terrain near the labyrinth at the Great Palace.
 

No no no. This is not a side effect but a lava river and it's also animated in the FDS version as seen in this video (start from 1:28:58):

https://www.youtube.com/watch?v=m-DVpDh_tko

Other areas also contain this lava effect so I suggest you use the video to identify them, okay?

(See the video at 1:48:02 for example.)
« Last Edit: November 01, 2018, 01:19:29 pm by darthvaderx »

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1259
    • View Profile
Re: Zelda II Redux
« Reply #276 on: November 01, 2018, 01:15:37 pm »
No no no. This is not a side effect but a lava river and it's also animated in the FDS version as seen in this video (start from 1:28:58):

https://www.youtube.com/watch?v=m-DVpDh_tko

Other areas also contain this lava effect so I suggest you use the video to identify them, okay?

Oh you're right.
I thought that was a path of some sort, not actual "lava". :P
Thanks for pointing it out!

As far as I can tell, only the water and the lava-like thing are animated on the Overworld for the Japanese release.
If someone finds something else that's animated in the overworld and I haven't noticed yet, please let me know!

Shadic

  • Jr. Member
  • **
  • Posts: 38
    • View Profile
Re: Zelda II Redux
« Reply #277 on: November 01, 2018, 04:55:29 pm »
This looks great! Good job.

ShadowOne333

  • Hero Member
  • *****
  • Posts: 1259
    • View Profile
Re: Zelda II Redux
« Reply #278 on: November 01, 2018, 05:35:17 pm »
Mmmmm weird.
I seem to have a complete mess of files in my PC.

I cannot seem to find the latest version of Zelda 2 Redux I posted which has the Loto reference restored.
Anyone here has it? Could you share it please?
I have a lot of IPS and I am not sure which one is the correct one anymore lol
And the one I linked seems to not have the Dragon Quest reference neither. :/

njosro

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: Zelda II Redux
« Reply #279 on: November 01, 2018, 06:44:38 pm »
ShadowOne, Is this the one you're talking about?

Quote
Here's the updated IPS with the now restored Dragon Quest/Loto reference thanks to njosro!
https://www.dropbox.com/s/9nvida92kyh5svj/Zelda2Redux.ips?dl=0

As always, let me know if you guys find anything out of place or something :P

If it's not the patch you're looking for, you can send me the current patch you've got and I'll put in the Loto dialog starter for you.