BlastEm
Contents
BlastEm is an accurate emulator for the Sega Mega Drive, with early [[Master System]] support. It is currently the emulator of choice for Genesis VGM logging.
The most recent nightly build should be used for logging. At the time of this writing, that's nightly 6f58af5bd6fa, released on April 8. You should not need to relog any rips created with nightlies after this version, unless a significant change has been made to the music emulation.
The default Model settings of BlastEm are acceptable, and shouldn't need changing except in rare, special circumstances. (These include playback for music known to be prepared in the PAL/Europe framerate (50fps), and tracks affected by the Model 1 slowdown bug (the preferred model to use instead is not known yet.) However, you may find it useful to configure other options in default.cfg, such as the save paths. Some information to that effect is included in the .cfg file.
BlastEm's hotkeys are listed at the beginning of default.cfg. To begin or stop a VGM log (with default/initial key settings), press m. To take a screenshot, press p.
Command Line Usage
Accurate as of 0.6.3-pre-48f718126099 (options may change in later builds):
blastem [OPTIONS] ROMFILE [WIDTH] [HEIGHT]
Options:
-h Print this help text
-r (J|U|E) Force region to Japan, US or Europe respectively
-m MACHINE Force emulated machine type to MACHINE. Valid values are:
sms - Sega Master System/Mark III
gen - Sega Genesis/Megadrive
jag - Atari Jaguar
-f Toggles fullscreen mode
-g Disable OpenGL rendering
-s FILE Load a GST format savestate from FILE
-o FILE Load FILE as a lock-on cartridge
-d Enter debugger on startup
-n Disable Z80
-v Display version number and exit
-l Log 68K code addresses (useful for assemblers)
-y Log individual YM-2612 channels to WAVE files
-e FILE Write hardware event log to FILE
Making Paths for Your VGMs and Screenshots
Before recording, you will probably want to change the following path settings in default.cfg:
initial_path $HOME screenshot_path $HOME vgm_path $HOME
These paths use the special variable $HOME, which places your screenshots and VGMs in your User folder. This is probably not what you want.
BlastEm allows for some fairly complex custom folder structures, but you probably want something basic and easy to start. I'll show you how my paths are set up.
To store things in BlastEm's folder, change $HOME to $EXEDIR. I've made this change to all three lines above in my default.cfg. The problem is, you'll quickly end up with a mess with no further changes. We also need these two settings:
screenshot_template $ROMNAME/%Y%m%d_%H%M%S.png vgm_template $ROMNAME/%Y%m%d_%H%M%S.vgm
These lines work off screenshot_path and vgm_path above. They've been modified from what you'll see in default.cfg. With $ROMNAME in place like so, BlastEm will put each screenshot and VGM into a subfolder matching the loaded ROM's name.
You can also control where saved games and states go:
save_path ./$ROMNAME
., in this context, should mean the same as $EXEDIR. Just to be sure, though, it's better to prefer $EXEDIR.
Feel free to experiment with these settings and learn if you're of a mind. But if you just want quick and dirty workable settings, this should suit you, I hope.
Using the Debugger [work in-progress]
Recent nightlies have streamlined debugger usage. As an example, to print the value inside a register, you do this:
print/x [$ff05ec ].b
/x makes the printed output come in (lowercase) hex; it's a format code. [brackets] are required to access memory. (The space is currently needed due to a parser bug.) .b indicates the address is byte-length.
set [$FFF009 ].b 130
Odd-numbered 68k memory addresses can't be accessed as Wwords. If you don't know what that means, it means you have to specify the length as a byte, as shown above.
To set a value using a hex number, you need to prefix that number with "0x":
set [$FFF009 ].b 0xE1 z80 set [$1B88 ] 0x81
Use ? or help in the debugger for a list of commands.
You can hit return/enter without typing any commands to reuse the last command you entered. For fun, use
frames 60 and hit return a bunch of times before focus returns to the debugger.
For those coming from the Sound_Hacking/Sega_Consoles page
For triggers that say maincpu, use set in 68k mode. (This is the default mode when you open the debugger, so you don't need to do anything to use it unless you went to z80 mode.)
For genesis_snd_z80, use set in z80 mode. You can do so by using the z80 command as shown above, or use it to enter Z80 mode and use set directly. Note that many SMPS games use the trigger address 1c09.
Using Game Genie codes with BlastEm (for now)
Although BlastEm currently lacks Game Genie support, the utility Game Genie Guy can apply codes for you (and unlike other more dated utilities, it does work). For some games, you must include the "Master Code(s)" to override the checksum, or combine GGG with the UCon utility to correct the checksum when you patch (the GGG readme explains how). If GGG doesn't work for your code, try reading the Troubleshooting section of its readme. (Big thanks to Elfor from the BlastEm Discord for this tip.)
Before you file a bug report concerning a specific game...
It's possible an apparent bug may occur on real Genesis/SCD hardware (which makes the bug "correct behavior"); also, a difference from another emulator could be due to that emulator being inaccurate, not BlastEm. Because of these possibilities, it's most helpful to confirm that the game's bug/inaccuracy does not occur on real hardware, and record proof as such, before bringing a report if you can.