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.

The problem

You want to rip that music. But it is impossible, due to the nature of the game, to stop SFX playing. You don't know how to hack games - you read the guides here and here and they are too hard for you - and you can't get someone who can to do it for you,

The solution - a hack

Here you go:

ROM[0066] = FB, 18, FE

Too technical? Here's a simple guide...

  1. Find the "meka.pat" file in Meka's folder
  2. Open it in a text editor (for example, Notepad)
  3. Look for two lines that resemble the above hack
  4. Remove the ";" character from the start of those two lines
  5. Save the file

That's enabled the hack. Now to test if it works.

  1. Re-open Meka and load your game
  2. Wait for some music to play
  3. Press the Pause button (usually mapped to Space on your keyboard)

The game should freeze, but the music should keep playing.

It is important not to save your game when it's in this frozen state. If you do, it's hard to get it out again. So be careful and always save your game before you press Pause.

When you finish, go back to the meka.pat file and re-add those semicolons. This will disable the hack and allow you to pause your games as normal.

Possible problems

Nothing happens when I press Pause

Check you removed the right semicolons. Check you saved the meka.pat file. Note that this only works for Master System games (and the few MS mode GG games), that is games with extension .sms. It doesn't work with GG games.

The music stops when I press Pause

If this happens, sorry, the hack doesn't work. It works with almost all games, just not the one you chose.

The game requires me to use the pause button sometimes

Then you have to remove the hack (re-add the semicolons and save), reload Meka, play to the bit where you want to log some music, save, quit Meka, put it back (remove the semicolon and save), load Meka, load the game. Hopefully that makes sense.

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.

Almost all games use the Vertical Blanking Interrupt (VBlank) for timing, with the VBlank code doing everything that has to happen every frame (updating the screen, updating the sound, reading the controller inputs) and some code elsewhere running the game engine (which might end up taking more than one frame to do everything). If we can kill off the game engine then nothing can happen to trigger any sound effects or stop the music.

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 0x0066 using the meka.pat entry described above.

Things to note:

  1. 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.
  2. I do need to ei though, because it is quite common for a game to di in the VBlank handler but ei out of it.
  3. At three bytes, this code should (in theory) almost never overwrite anything important that's placed immediately after the original pause handler (unless the game uses a jr or rst to redirect to the pause handler, or just has a retn).
  4. 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.

Return to top