All Registers Aren't Created Equal?

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
xamboni
Posts: 38
Joined: Sat Apr 27, 2019 11:56 am

All Registers Aren't Created Equal?

Post by xamboni »

I have recently been taking apart the Taito audio engine in an attempt to write some new music on it. So far I have identified the music table, channel inits, and note locations. I wrote a script to hollow these areas out and insert new values for a basic song.

However while running some tests I noticed my pulse channels cannot go as low as expected. If I write a value greater than 0x3 for the top three bits in the timer register my square wave channel outputs something like a high hat or noise channel hit. I feel like this must be operator error as games such as Castlevania III use notes this low quite often. I modified nosefart to dump the values being written to the registers and I can clearly see the same numbers being put in there.

Nosefart output:
Taito (This outputs a small noise sound)
PC: 0x8119. Storing 0xf2 into Y 0x4002.
PC: 0x812b. Storing 0xd into Y 0x4003. // This has bit 3 set in the store value for the note duration. Essentially this is 0x5 for the top three bits.
// f = 1789773 ÷ (16× (0x5f2))

Konami (This correctly plays a low d)
PC: 0x820b. Storing 0xd into X offset 0x4003.
PC: 0x8221. Storing 0xf2 into X offset 0x4002.

Do I need to dive into the audio engine again and see if anything is being disabled or hamstrung? Is there a setting that prevents the pulse from going too low?
User avatar
rainwarrior
Posts: 8732
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: All Registers Aren't Created Equal?

Post by rainwarrior »

Yes, the sweep units will silence low pitches unless they are disabled.

I would recommend that you write $08 to $4001 and $4005 at startup to initialize the sweep units in a disabled state.
xamboni
Posts: 38
Joined: Sat Apr 27, 2019 11:56 am

Re: All Registers Aren't Created Equal?

Post by xamboni »

Well after reading the sweep unit page it is unfortunate I missed that in my research. I went up and down the pulse page mainly around the frequency equation. I am not sure this problem comes up too often but a note or link to the muting section may be something to add there.

Thanks for the quick answer. Luckily the taito engine has the option of initializing the sweep register before each note. After changing my script the notes coming out are correct. Thank you!
Post Reply