Hacking text beeps

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
Pennywise
Posts: 62
Joined: Tue Jul 14, 2009 11:04 am

Hacking text beeps

Post by Pennywise » Tue May 28, 2019 6:46 pm

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.

User avatar
Dwedit
Posts: 4236
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Hacking text beeps

Post by Dwedit » Tue May 28, 2019 7:55 pm

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...
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

User avatar
dougeff
Posts: 2617
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: Hacking text beeps

Post by dougeff » Wed May 29, 2019 5:42 am

there's a text adventure game
[on the NES]

There is?

Princess Tomato in the Salad Kingdom?
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
Dwedit
Posts: 4236
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Hacking text beeps

Post by Dwedit » Wed May 29, 2019 6:32 am

The Kemco games (Shadowgate, Uninvited, Deja Vu, etc...) might also qualify.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

Pennywise
Posts: 62
Joined: Tue Jul 14, 2009 11:04 am

Re: Hacking text beeps

Post by Pennywise » Thu May 30, 2019 4:30 am

When you say the init function, are you talking about the APU register $4015?

nocash
Posts: 1092
Joined: Fri Feb 24, 2012 12:09 pm
Contact:

Re: Hacking text beeps

Post by nocash » Thu May 30, 2019 7:59 am

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.

User avatar
Dwedit
Posts: 4236
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Re: Hacking text beeps

Post by Dwedit » Thu May 30, 2019 10:21 am

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.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

Pennywise
Posts: 62
Joined: Tue Jul 14, 2009 11:04 am

Re: Hacking text beeps

Post by Pennywise » Thu May 30, 2019 7:38 pm

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.

Pokun
Posts: 1274
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Hacking text beeps

Post by Pokun » Sat Jun 01, 2019 8:39 am

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.

kuja killer
Posts: 87
Joined: Mon May 25, 2009 2:20 pm

Re: Hacking text beeps

Post by kuja killer » Sat Jun 01, 2019 5:02 pm

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.

Post Reply