Need help tracking down the hex addresses of CV1 music!

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
spookgoblin
Posts: 25
Joined: Thu Jul 20, 2017 9:01 am

Need help tracking down the hex addresses of CV1 music!

Post by spookgoblin »

Hey all,

I'm looking to modify the music in the intro sequence of Castlevania 1.
I've looked through Sliver X's documents but am having trouble finding the song data--more specifically, I'm having trouble finding the first note of that (or any) song. Does anyone have any ideas for how to track it down?

Many thanks!
Bavi_H
Posts: 193
Joined: Sun Mar 03, 2013 1:52 am
Location: Texas, USA
Contact:

Re: Need help tracking down the hex addresses of CV1 music!

Post by Bavi_H »

The end of the Castlevania Music Format document lists offsets in the .NES file for the pointer locations of each track's channels. The next-to-last section in the document ("Calculating") briefly explains how to convert the pointer format to an offset into the .NES file.

Example: The document says the pointer for Track 1, channel Square 1 is at offset 825. Here's how to get to the first data byte for this channel.
  1. Use a hex editor to open the .NES file. (In FCEUX, you can go to the Debug menu and choose Hex Editor, then in the Hex Editor window, go to the View menu and choose ROM File.)
  2. Go to offset 825. (In the FCEUX Hex Editor window, go to the File menu, choose Goto Address and enter 825.)
  3. Make a note of the byte at that offset and the byte after it: 809B
  4. Use the conversion procedure in the document:
    1. Swap the bytes: 9B80
    2. Subtract hex 8000: 1B80
    3. Add hex 10: 1B90
  5. Go to offset 1B90. This is the first data byte for this channel -- D6 -- which the document explains is a tempo command.
spookgoblin
Posts: 25
Joined: Thu Jul 20, 2017 9:01 am

Re: Need help tracking down the hex addresses of CV1 music!

Post by spookgoblin »

Ahh thank you!
The way you explained it seemed to click a lot better :)

I've got some tinkering to do!
spookgoblin
Posts: 25
Joined: Thu Jul 20, 2017 9:01 am

Re: Need help tracking down the hex addresses of CV1 music!

Post by spookgoblin »

Yay! I've successfully changed the music! :)
My future wife will be so ecstatic to hear a spooky wedding march in place of the intro jingle!


Now...
Does anyone know where the attribute table is for CV1? That's my last big hurdle.
I've tried using the debugger to help me find it based on writes to certain PPU RAM addresses but I'm not really sure what I'm doing. I know I'm looking for LDA with reference to certain hex addresses, but I don't know if I'm doing it right -_-

At the very least, I know that the PPU addresses that are responsible are:
$23C1
$23C9
$23D9

Anyone willing to help guide me to the right ROM addresses?
Thanks!
Post Reply