It is a common problem when ripping VGMs from a game to find that you are unable to rip them without sound effects (SFX) playing. This page describes a general-purpose hack which will allow most Master System games’ music to be ripped without SFX playing.
What the hell is that? Don’t worry, I have all the steps described below...
Step 1: find the checksum
Open Meka’s folder. It should look a bit like the one to the right only with more cool stuff in it. (I’ve even assumed you have Windows set to hide file extensions, possibly the most lame option possible.) You need to open the meka.nam file in a text editor. What’s one of those? Notepad. Here’s the easy way:
- Double-click on the “meka.txt” file (it might just say “meka” and have a little notepad icon next to it like in the picture).
- Notepad should open up with Meka’s documentation in it. You should read it, you know, it’s interesting. But not now.
- Drag and drop the meka.nam file onto Notepad.
Now you have the meka.nam file open, you need to find the game you’re ripping music from. Try pressing F3 to bring up the Find dialogue.
At the start of the line is a 16-letter code - a checksum - which identifies the game in Meka. You need to select and then copy this to the clipboard (Ctrl+C).
If you find your game has more than one entry, you might have to try all of them in turn until they work. For now, grab the first one.
Step 2 - add it to meka.pat
Now you need to open meka.pat in the text editor. (You can open it in the existing window, we don’t need it any more so long as you already copied the checksum.) Then go down to the bottom and add this:
except instead of “checksum” you have to paste the checksum of the game. I suggest you also add a comment to remind you what game it was - you can add a comment by starting the line with a semicolon “;” and then you can write anything you like after it.
Now save the file by choosing Save from the File menu. An important step, it must be said, and easy to mess up because Notepad (in Windows 98) doesn’t save when you press Ctrl+S.
Step 3: play the game
Now open the game in Meka and quickly start a new game and wait until the music’s playing. Once it’s going, press Pause (mapped to the Space Bar by default). If all goes according to plan, two things should happen:
- The game will freeze
- The music won’t
If the music stops, sorry, this hack didn’t work. Delete it from meka.pat and go about your business. If it doesn’t... hooray! Here’s the procedure:
- Play through the game to just before the music you want is about to play
- Save your game (press F5)
- Start VGM logging
- Make the music start
- Press Pause as soon as possible, before any SFX play
- Log the music (plenty of it) and then stop logging
- Load the game (F7) and play on
The save/load is because this hack permanently freezes the game. Whatever you do, don’t save a frozen game!
Finally, delete the section from meka.pat when you’ve finished because you don’t want the Pause button to freeze the game when you’re playing it normally.
Appendix 1: possible problems
1. Nothing happens when I press Pause
Check you got the checksum right. Check you saved the meka.pat file. If the game has more than one entry, try other checksums. Note that this only works for Master System games (and the few MS mode GG games), that is games with extension .sms. It might work with SG-1000 and SC-3000 games, I’m not sure. It definitely doesn’t work with GG games.
2. The music stops when I press Pause
You obviously weren’t listening. I said already that if this happens, sorry, the hack doesn’t work. It works with almost all games, just not the one you chose.
3. The game requires me to use the pause button sometimes
Then you have to remove the hack (to temporarily remove it, put a semicolon at
the start of the
ROM=fb,18,fe line and save), play to the bit where
you save in the instructions above, save, quit Meka, put it back (remove the
semicolon and save), load Meka, load the game. Hopefully that makes sense.
Appendix 2: how it works
All SMS games have to have a pause button handler at offset 0x0066 in the file - when Pause is pressed, execution goes there, and the game has no choice in the matter (it can’t turn it off). So I know that this is somewhere I can put code and it will always run when Pause is pressed.
Virtually every game relies on the Vertical Blanking Interrupt (VBlank) for timing and as a result is very likely to use it for timing updates to the sound output. Therefore, so long as VBlank interrupts are enabled, the sound will still update whenever there is a VBlank, even if the rest of the code doesn’t run.
(Actually, I don’t know why games do this. The sound code doesn’t need to go in the VBlank, unless the framerate is so bad it destroys the music otherwise, so it could equally well be in the out-of-VBlank main loop. It’s probably there because there will be several busy-loops for various game elements.)
So, if I put some code at offset 0x0066 that turns on VBlank interrupts and then hangs the game, it’ll (hopefully) give me constantly updating sound (music) without any SFX being triggered (hung gameplay). Here’s some code to do that:
Loop: jr Loop
When converted to machine code, that’s:
fb ; ei 18 fe ; jr -2
So, we can write
fb 18 fe at offset $66 using the meka.pat entry
Things to note:
- I don’t write to the VDP registers to enable VBlank interrupts and turn off line interrupts. I could, but generally games don’t change those flags in the VBlank loop and they’ll be set up properly when Pause is pressed.
- I do need to
eithough, because it is quite common for a game to
diin the VBlank handler but
eiout of it.
- At three bytes, this code should (in theory) almost never overwrite anything important that’s placed immediately after the original pause handler. The smallest thing that could be there logically is a
jp addr, which is three bytes. It could possibly be a
jr offset, which is two, or just a
rst $xxwhich is one, but these seem very unlikely to me.
- This is just a general-purpose hack and is no substitute for a proper game hack to grab music tracks based on their internal track number. It is, however, still useful for freezing the game, for example to stop title screen timeouts or in-game timers.