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

Author Topic: Zelda 1: Have Title Screen Music Play In File Menu???  (Read 2312 times)

The3Dude

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Zelda 1: Have Title Screen Music Play In File Menu???
« on: June 01, 2020, 02:18:36 pm »
Could it be possible to allow the title theme music to play even in the file select menu? I really want to do this with the song that is currently for the title screen.

Any help would be greatly appreciated! :D
~The3Dude~

Cyneprepou4uk

  • Sr. Member
  • ****
  • Posts: 455
  • I am the baldest romhacker
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #1 on: June 01, 2020, 02:50:55 pm »
You mean like it should continue playing without interruption when going into menu, or changing menu music to title music, or what?
iromhacker.ru - NES ROM hacking tutorials for beginners. Please use Google Translate browser extension

The3Dude

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #2 on: June 01, 2020, 02:57:10 pm »
You mean like it should continue playing without interruption when going into menu, or changing menu music to title music, or what?

I want to accomplish this,"It should continue playing without interruption when going into menu", or just have the title screen music be the music for the file select menu. As long as I hear title music in the file menu, I am okay with it lol.
~The3Dude~

Cyneprepou4uk

  • Sr. Member
  • ****
  • Posts: 455
  • I am the baldest romhacker
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #3 on: June 01, 2020, 03:09:10 pm »
Never played zelda, so it's all a common practice.

Game has a ram address with music id, probably it is the same address as sound id, which will make it easier to find by performing some ingame actions with different sounds.

To shut down music game writes 00 to sound address, and a bit later writes music id byte to play another one. Usually something like this
LDA #ID
STA $sound
JSR PlaySound

So either prevent it from writting 00, and also from writting menu sound id, or change menu id to title id.
iromhacker.ru - NES ROM hacking tutorials for beginners. Please use Google Translate browser extension

The3Dude

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #4 on: June 01, 2020, 04:03:33 pm »
Never played zelda, so it's all a common practice.

Game has a ram address with music id, probably it is the same address as sound id, which will make it easier to find by performing some ingame actions with different sounds.

To shut down music game writes 00 to sound address, and a bit later writes music id byte to play another one. Usually something like this
LDA #ID
STA $sound
JSR PlaySound

So either prevent it from writting 00, and also from writting menu sound id, or change menu id to title id.

I found it, thank you so much! :D
~The3Dude~

ActionGamer

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #5 on: June 01, 2020, 05:03:23 pm »
Hey the3dude you mind teaching me how to do that?
« Last Edit: June 01, 2020, 05:12:28 pm by ActionGamer »

The3Dude

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #6 on: June 01, 2020, 05:52:10 pm »
Hey the3dude you mind teaching me how to do that?

Go to 1D56 change A9 to C0
and go to 1D57 change 00 to 19.
~The3Dude~

ActionGamer

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #7 on: June 01, 2020, 06:18:30 pm »
Oki how do I change it to the game over theme?

June 01, 2020, 06:22:10 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Um dude it doesn't just play over the menu screen, it plays over everything

The3Dude

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #8 on: June 01, 2020, 06:33:33 pm »
Oki how do I change it to the game over theme?

June 01, 2020, 06:22:10 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Um dude it doesn't just play over the menu screen, it plays over everything

It does???? Crap. Lemme see something.
~The3Dude~

bogaabogaa

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #9 on: June 02, 2020, 01:48:42 am »
You probably did overwrite a section of code that is used to mute music. The code to control that is also very simple. Type the music ID into RAM at $600 and it will play the music. $600 - $608 are used for different music Control tasks. Just find some code that only goes off when the menu is active and write.

lda #$MUSIC ID
sta $600

there might not be space in the code so you need to hijack with a JMP or JSR to some free space.

Could be a good first task to write some code somewhere. When you have found an hijacked you might get other ideas what else you could let run for the title screen.


Here I made a example. I also added a IPS. But here you can see how to use a ASM patcher (Xkas Plus https://github.com/devinacker/xkas-plus ). Check out what the make.bat file does in a text editor. Then check the code in the asm file.
https://www.dropbox.com/s/thrdc1bfc5fmo5m/ZeldaExample.zip?dl=0


For the game over it is the same trick. If you plan to add some music to different rooms you might consider to write some nicer code. For example hijack before it mutes and do some checks for the rooms/screens you like to have different music. For that example you would need to learn branches what is a other good beginner task to get into coding.

If you have questions about how the ROM is mapped to the CPU bus and where to find info on how to program for the 6502 feel free to ask.
« Last Edit: June 02, 2020, 03:37:38 am by bogaabogaa »
CV ROM DiscordServer
https://discord.gg/PvFgxRg

The3Dude

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #10 on: June 03, 2020, 04:27:14 pm »
You probably did overwrite a section of code that is used to mute music. The code to control that is also very simple. Type the music ID into RAM at $600 and it will play the music. $600 - $608 are used for different music Control tasks. Just find some code that only goes off when the menu is active and write.

lda #$MUSIC ID
sta $600

there might not be space in the code so you need to hijack with a JMP or JSR to some free space.

Could be a good first task to write some code somewhere. When you have found an hijacked you might get other ideas what else you could let run for the title screen.


Here I made a example. I also added a IPS. But here you can see how to use a ASM patcher (Xkas Plus https://github.com/devinacker/xkas-plus ). Check out what the make.bat file does in a text editor. Then check the code in the asm file.
https://www.dropbox.com/s/thrdc1bfc5fmo5m/ZeldaExample.zip?dl=0


For the game over it is the same trick. If you plan to add some music to different rooms you might consider to write some nicer code. For example hijack before it mutes and do some checks for the rooms/screens you like to have different music. For that example you would need to learn branches what is a other good beginner task to get into coding.

If you have questions about how the ROM is mapped to the CPU bus and where to find info on how to program for the 6502 feel free to ask.

Thank you so much! All I did was edit your ASM to have the music ID be "DC" Now it has the title screen music!
~The3Dude~

bogaabogaa

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #11 on: June 04, 2020, 08:25:38 pm »
Nice to hear that it is working for you.

Just a reminder. I did randomly pick a section of code that is running on that screen so it might be possible that this will lead to a bug.
A good thing could be hijack the section of code where it does mute the screen. You did find that one and it might be a much better place to hijack.

Would you like your heart counter to be in that format too? Back then I did not know how to use Xkas for the Nes. Also do you feel like it helps to understand how to code things for a nes game a bit better? Or do you feel like it makes it all more complicated?

The files might act as a templet for other things you like to do. If you are confused on how to read the offsets. Here a quick overview how the Nes does map the ROM to the bus.

Example Mapping MMC1 UNROM:
---------------------------------------------------------
CPU Bus                                    PRG ROM
---------------------------------------------------------
$0000-$0800        2KB internal RAM
$0800-$1fff        Mirrors of RAM
$2000-$2007        Mirrors PPU Register
$     -$3fff        Repeat every 8 bytes   
$4000-$4017        NES APU Register and Controller ($4016-$4017)
$4018-$401F        APU Function (disabled)
$     -$5fff        deverse PRG RAM/ROM MapperRegister
$6000-$7fff        SRAM
$8000-$bfff        Most mappers start there PRG banks here.
                Only one Bank at a Time!
   ||||||||
   |00---------------------------------- $0000
   |||||||
   |01---------------------------------- $4000
   ||||||
   |02---------------------------------- $8000   
   |||||
   |03---------------------------------- $c000
   ||||
   |04--------------------------------- $10000
   |||
   |05--------------------------------- $14000
   ||
   |06--------------------------------- $18000
   |
$c000-ffff                               $1c000 (Always at the end of the CPU bus!)
   |
   |The CPU expects interrupt vectors in a fixed place at the end of the cartridge space.
   |
   |$FFFA-$FFFB = NMI vector
   |$FFFC-$FFFD = Reset vector
   |$FFFE-$FFFF = IRQ/BRK vector
   |
   |----------------------------------- $1ffff
CV ROM DiscordServer
https://discord.gg/PvFgxRg

The3Dude

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #12 on: June 04, 2020, 08:30:11 pm »
Nice to hear that it is working for you.

Just a reminder. I did randomly pick a section of code that is running on that screen so it might be possible that this will lead to a bug.
A good thing could be hijack the section of code where it does mute the screen. You did find that one and it might be a much better place to hijack.

Would you like your heart counter to be in that format too? Back then I did not know how to use Xkas for the Nes. Also do you feel like it helps to understand how to code things for a nes game a bit better? Or do you feel like it makes it all more complicated?

The files might act as a templet for other things you like to do. If you are confused on how to read the offsets. Here a quick overview how the Nes does map the ROM to the bus.

Example Mapping MMC1 UNROM:
---------------------------------------------------------
CPU Bus                                    PRG ROM
---------------------------------------------------------
$0000-$0800        2KB internal RAM
$0800-$1fff        Mirrors of RAM
$2000-$2007        Mirrors PPU Register
$     -$3fff        Repeat every 8 bytes   
$4000-$4017        NES APU Register and Controller ($4016-$4017)
$4018-$401F        APU Function (disabled)
$     -$5fff        deverse PRG RAM/ROM MapperRegister
$6000-$7fff        SRAM
$8000-$bfff        Most mappers start there PRG banks here.
                Only one Bank at a Time!
   ||||||||
   |00---------------------------------- $0000
   |||||||
   |01---------------------------------- $4000
   ||||||
   |02---------------------------------- $8000   
   |||||
   |03---------------------------------- $c000
   ||||
   |04--------------------------------- $10000
   |||
   |05--------------------------------- $14000
   ||
   |06--------------------------------- $18000
   |
$c000-ffff                               $1c000 (Always at the end of the CPU bus!)
   |
   |The CPU expects interrupt vectors in a fixed place at the end of the cartridge space.
   |
   |$FFFA-$FFFB = NMI vector
   |$FFFC-$FFFD = Reset vector
   |$FFFE-$FFFF = IRQ/BRK vector
   |
   |----------------------------------- $1ffff

Actually I appreciate your effort in explanations. It does make things easier, and for anyone else who reads this post in the future and needs detailed info... You have done great on that! :thumbsup: . I haven't found any bugs yet. But I have fiddled to the extreme with the sound effects and music, even adding new PCM sounds to replace the old ones. I've added the ReDead Shriek into Zelda 1, and it actually sounds good. Haha. :laugh:
~The3Dude~

ActionGamer

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #13 on: June 12, 2020, 02:57:17 pm »
You probably did overwrite a section of code that is used to mute music. The code to control that is also very simple. Type the music ID into RAM at $600 and it will play the music. $600 - $608 are used for different music Control tasks. Just find some code that only goes off when the menu is active and write.

lda #$MUSIC ID
sta $600

there might not be space in the code so you need to hijack with a JMP or JSR to some free space.

Could be a good first task to write some code somewhere. When you have found an hijacked you might get other ideas what else you could let run for the title screen.


Here I made a example. I also added a IPS. But here you can see how to use a ASM patcher (Xkas Plus https://github.com/devinacker/xkas-plus ). Check out what the make.bat file does in a text editor. Then check the code in the asm file.
https://www.dropbox.com/s/thrdc1bfc5fmo5m/ZeldaExample.zip?dl=0


For the game over it is the same trick. If you plan to add some music to different rooms you might consider to write some nicer code. For example hijack before it mutes and do some checks for the rooms/screens you like to have different music. For that example you would need to learn branches what is a other good beginner task to get into coding.

If you have questions about how the ROM is mapped to the CPU bus and where to find info on how to program for the 6502 feel free to ask.

Thank you so much, I used the code too. If you don't mind that.

bogaabogaa

  • Full Member
  • ***
  • Posts: 150
    • View Profile
Re: Zelda 1: Have Title Screen Music Play In File Menu???
« Reply #14 on: June 13, 2020, 01:33:43 am »
Feel free to use that crappy piece. Would be cool to hijack the code where The3Dude did find the mute music code. This could then be used to write costume routines to rooms without music. Make a routine that checks in what room you are and branch if you have some idea what to do with it.
CV ROM DiscordServer
https://discord.gg/PvFgxRg