This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

Hacking text beeps

Hacking text beeps
by on (#239402)
So I've never really done any sound hacking on the NES before and there's a text adventure game I want to increase the text speed (I know how to do that already) and reduce the amount of beeps per letter. Any help to get me pointed in the right direction would be appreciated. I've been looking at the wiki for technical info, but it's like stumbling in the dark for me.
Re: Hacking text beeps
by on (#239403)
If the game has a NSF with sound effects, you can find the init function for sound effects, and breakpoint on that for when the game tries to play a sound effect. You could make it play every other time, or every 4th time, etc...
Re: Hacking text beeps
by on (#239408)
Quote:
there's a text adventure game
[on the NES]

There is?

Princess Tomato in the Salad Kingdom?
Re: Hacking text beeps
by on (#239413)
The Kemco games (Shadowgate, Uninvited, Deja Vu, etc...) might also qualify.
Re: Hacking text beeps
by on (#239439)
When you say the init function, are you talking about the APU register $4015?
Re: Hacking text beeps
by on (#239443)
Let me guess, is it... SOS on the Titanic? But with less beeps per letter... you would end up with IMI or ETE on the Titanic.
Re: Hacking text beeps
by on (#239451)
I mean that a game will usually do something like this...

lda #effect_number
jsr init_routine

Not a hardware register write, this is all software stuff. If you have a NSF for the game, then someone has already taken the time to isolate the music engine.
Re: Hacking text beeps
by on (#239466)
The game is Metal Slader Glory for those that are curious. I'm working on an update to my translation for it.

Each character has their own unique text beeps for the most part and their own text speeds. All this is stored with the speaker name. Clearly I can see there is some correlation between the speed of text printing and the speed of text beeps, but I've yet to actually find it in the code.

I remember now. A while back someone made some repo's of the translation from all new materials, but there were no text beeps. I believe this is due to the game using the MMC5's square sound waves.

So, I was able to find the data/music for the beeps by virtue of writes to $5006, which if I'm interpreting it right is the timer. $5004 gets set to $30. I guess all I need to figure out now is how the text speed influences that data.
Re: Hacking text beeps
by on (#239532)
Calling it a text adventure, although it also has graphics, is what made the confusion. Especially as it has been a lot of talk about making an engine for text-only adventure games on the forums recently.
Krzysiobal made an MMC5 clone repro. But it looks like he didn't clone the audio chip which is a big point in this game according to Mr Yoshimiru.


That "timer" is for controlling the frequency of the sound channel. It is not the duration of the sound. It used to be called "period" in the wiki but it seems to have been changed to "timer". Probably technically correct but confusing. The length counter is what controls the duration of the sound.
MMC5 pulse channels are pretty much the same as the APU's pulse channels, except they have no sweep hardware. BTW a sweep is changing frequency over time and an envelope is changing volume over time.

APU pulse 1
$4000 envelope/volume and duty cycle
$4001 sweep
$4002 frequency low
$4003 length and frequency high

APU pulse 2
$4004 envelope/volume and duty cycle
$4005 sweep
$4006 frequency low
$4007 length and frequency high

MMC5 pulse 1
$5000 envelope/volume and duty cycle
$5001 (unused)
$5002 frequency low
$5003 length and frequency high

MMC5 pulse 2
$5004 envelope/volume and duty cycle
$5005 (unused)
$5006 frequency low
$5007 length and frequency high


Keep in mind that, like Dwedit said, sound engines often don't use the hardware length counter, envelope or sweep (they often disable them). Instead they do these things manually in software. Duration is done by unmuting and muting the channel with the desired timing, envelope is done by manipulating volume every frame as desired and sweeping is the same but by manipulating frequency instead.

For that reason, looking for writes to the sound registers might not do you any good. You need to figure out what byte or bytes are controlling the duration of the sound effect in the sound effect data that is loaded.

Edit: If $5004 gets set to $30, the hardware envelope and length counters are both disabled. So the game do indeed use software envelope and duration.
Re: Hacking text beeps
by on (#239538)
how about just skip where-ever the "lda #sound id jsr initsound" thing is at for the text drawing...and make it skip over "space" so it doesnt play the sound during blank spaces between words

thats what i do for megaman odyssey at least, it's not really much, but it does help a little bit so the sound doesnt always play nonstop constantly.