Any updates you say? Indeed - I say!
Since I had done a pretty good mapping of the music-data I knew for sure there was data not used in the actual game.
For instance a piece that only played a scale, up and down some notes.
Since the original played the title-song on the game-over screen, that got me thinking:
Why not insert the game-over theme from Zelda to play instead. That proved to be extremely easy,
just insert the music-data and find the particular pointer and change it to play the new song.
So there you go - my hack now have more unique melodies than the original port.
But wait...since that went so easy, why not step it up a bit:
The original NES game played a different theme when entering any of the temples.
This was apparently planned, but then scrapped in the port - for whatever reason.
I claim it was planned, since the routine for changing music is obviously called,
when entering a temple. You can hear this, because whatever tune that was playing,
starts over from the very beginning - when ENTERING any temple.
So I thought - why not ASM hack the full feature into the port!!
It took me a day or two - before I figured the whole thing out,
but here is how you do it:
The routine for changing the music is located at ROM Offset 12A5.
It starts off by reading the RAM address C1B0,
which holds the pointer ordinal to the song to play.
FA 0B C1 ld a,C1B0
06 00 ld b,00
4F ld c,a
CB 21 sla c
21 C5 3F ld hl,3FC5
09 add hl,bc
2A ldi a,hl
66 ld h,hl
6F ld l,a
CD DB 22 call 22DB
So, when you have pasted the music data for your new temple-music (preferably by overwriting some unused data),
there are 4 simple steps left:
1. Add an additional pointer to the collection of music pointers. The temple-music pointer is number 12.
ROM 3FE9: FF FF -> 30 75
2. Hijack the writing of the flag that is set everytime you enter or are restored inside a temple.
Since we need to store the song to play somewhere in RAM - why not borrow the flag used to denote
that you are currently on board the boat. It's not like it is used inside temples anyway.
ROM 07D0: EA OC C1 -> CALL BELOW CODE
EA OC C1 ld C10C,a - Write a into RAM C10C (Current save-point)
3E 12 ld a,12
EA D0 C0 ld C0D0,a - Write a into RAM C0D0 (Boating flag)
3. Hijack the reading of the flag of which song to play. If the boating-flag is set to the temple-song,
use that instead of whatever is written to the regular flag.
ROM 12A5: FA 0B C1 -> CALL BELOW CODE
FA 0B C1 ld a,C10B - Read RAM C10B into a (The song to play)
4F ld c,a - Set c to a
FA D0 C0 ld a,C0D0 - Read RAM C0D0 into a (Boating flag)
FE 12 cp a,12
28 01 jr z,1 - Jump if a = 12
79 ld a,c - Set a to c
4. Hijack a call that is made after entering/exiting any door, this has to happen BEFORE the song-flag is read.
The reason for that is that we are only concerned with RESTORING the regular music BACK,
when we are EXITING - if the temple-song is currently playing.
ROM 06C8: CD D0 06 -> CALL BELOW CODE
FA D0 C0 ld a,C0D0 - Read RAM C0D0 into a
FE 12 cp a,12
20 06 jr nz,06 - Jump over music change if a != 12
FA 0B C1 ld a,C10B - Read RAM C10B into a
CD A8 12 call 12A8
3E 00 ld a,00
EA D0 C0 ld C0D0,a - Write a into RAM C0D0
CD D0 06 call 06D0
I have stuffed all my Hijack ASM at the very beginning of the ROM. I don't know how actual hardware handles that,
but this has been tested in both Bgb and Visualboy.
So there you go - a missing feature from the original has been HACKED into the port.
Now, when you ENTER a temple or restore a game by PASSWORD, in Zelda: Missing Link,
- the music will change into the Song of Healing, from Majoras Mask.