WaitJoystick()exit when window closed.
Currently, MG is able to run about 98% of SMS/GG/SF7000/SC3000/SG1000 carts and disk images that I have. With the help from friends I hope to make it as close to original machines as possible and emulate some exotic peripherals such as light gun, sports pad, and GameGenie. At this moment, MG supports following features:
MasterGear is a very portable application and has been compiled for a wide variety of platforms: Unix, Linux, Windows, Android, MacOS, PocketPC, Symbian, MSDOS, and so on. The complete up-to-date list of MaterGear ports is available at the MaterGear distribution site. Following are the major ports:
The Android version of MasterGear is available from Google Play:
Once you download a copy, you should be able to use it on as many Android devices as you own, as long as they are all linked to the same Google Play account. Make sure to enable automatic updates, as MG-Android updates often. The Android version comes with many additional features, such as Cheatopedia with cheat codes for many popular games, State Exchange letting MasterGear users exchange saved games, the Box Art Downloader, improved Network Play functionality, and more.
The MG-Windows is now free for everyone to use and share. It can be downloaded from the MasterGear homepage:
For more information, take a look at my other products for Windows:
As I have made MG-Windows free, it is no longer being sold via eSellerate. Existing users should go to the above site and download a fresh copy. If you wish to support my work on MG-Windows and other emulators, please consider buying MG-Android.
MG-Unix and MG-Linux are available freely in binary form from the MasterGear homepage:
I am always trying to compile it on as many different Unix and Linux flavors as I have handy at the moment.
The MG-Maemo works on Nokia devices running Maemo or Meego OS. It is specifically optimized for Maemo platform and available for free from respective package repositories and MasterGear homepage. As both Maemo and Meego platforms are dead, I am no longer developing for them though.
I am no longer developing and supporting MG-MSDOS, as the MSDOS platform is completely dead nowadays. Older MG-MSDOS versions were sold as part of the MG-Windows package (now free), compiled with OpenWatcom C++, and used DOS4GW 32bit DOS extender and VESA screen drivers.
The MG-Symbian port worked on phones running the 3rd Edition of the Nokia S60 software. It is no longer being developed and supported, as Symbian and all its development tools are dead. You can still access some of my Symbian products at this address though:
The PocketPC version of MasterGear has long been developed by Aaron Oneal. As PocketPC is long dead though, MG-PocketPC is dead as well. You can still get older PocketPC versions of MasterGear and my other emulators from
mg - MG executable file (Unix, mg -help for options) mg.exe - MG executable file (Windows) mg-dos.exe - MG executable file (MSDOS, mg-dos -help for options) MG.html - This documentation
Absolutely no ROM images of SEGA games are included. These games are still copyrighted by the companies who produced them and therefore I cannot distribute any of them. I'm also unable to tell you where to find these games, so do not email me asking for it. You will have to look for games on your own.
When using SC3000 keyboard, press
[CONTROL]+[KEY] to access
a special function of the
[KEY], if it also performs a
[ALT] - Hold to switch to the second controller [SPACE] - FIRE-A button (also: [SHIFT],A,S,D,F,G,H,J,K,L,Q,E,T,U,O) [CONTROL] - FIRE-B button (also: Z,X,C,V,B,N,M,W,R,Y,I,P) [ENTER] - START button (only in GameGear mode) [TAB] - PAUSE button (only in MasterSystem mode) [ESC] - Quit emulation (also: [F12]) [PGUP] - Fast-forward emulation (also: [F9]) [F2] - Turn soundtrack log on/off [F3] - Toggle FIRE-A autofire on/off [F4] - Toggle FIRE-B autofire on/off [F5] - Invoke configuration menu [F6] - Load emulation state (*.STA) [F7] - Save emulation state (*.STA) [F8] - Replay recorded gameplay [F9] - Fast-forward emulation (also: [PGUP]) [F11] - Reset hardware [F12] - Quit emulation (also: [ESC]) [ALT]+[PGUP] - Increase audio volume [ALT]+[PGDOWN] - Decrease audio volume When compiled with #define DEBUG: [F1] - Go into built-in debugger When compiled with #define MSDOS: [F10] - Make a screen snapshot (SNAPxxxx.GIF) When compiled with #define WINDOWS: [ALT]+[ENTER] - Switch between full scren and window modes
These options only work in MG-Unix and other MG ports with the command line interface.
Usage: mg [-option1 [-option2...]] [filename] [filename] = Name of the file to load as a cartridge [CART.ROM] [-option] = -verbose <level> - Select debugging messages  0 - Silent 1 - Startup messages 2 - Illegal accesses 4 - Illegal Z80 ops 8 - Bank switching 16 - Sound 32 - VDP registers 64 - VRAM accesses 128 - Disk accesses -hperiod <period> - Number of CPU cycles per HBlank  -vperiod <period> - Number of CPU cycles per VBlank  -skip <percent> - Percentage of frames to skip  -help - Print this help page -sf7000/-sms/-sms2/ - Run as SG1000/SC3000/SF7000/SMS/SMS2/GG [auto] -gg/-sg1000/-sc3000 (overrides .SG/.SC/.SF/.SMS/.GG file extensions) -engl/-jap - Run in English/Japanese mode [auto] (overrides country code in GG cartridges) -autoa/-noautoa - Autofire for button A [-noautoa] -autob/-noautob - Autofire for button B [-noautob] -delay/-nodelay - Delay VRAM reads [-nodelay] -eeprom/-sram - Emulate 93C46 EEPROM or normal SRAM [-sram] -fm/-nofm - Emulate YM2413 FM sound chip [-fm] -cdms/-nocdms - Emulate CodeMasters ROM mapper [-nocdms] -drums/-nodrums - Use MIDI drums for PSG noise [-nodrums] -logsnd <filename> - Write soundtrack to a MIDI file [LOG.MID] -printer <filename> - Redirect printer output to file [stdout] -sync <frequency> - Sync screen updates to <frequency>  -nosync - Do not sync screen updates -tv/-lcd/-raster - Simulate TV scanlines or LCD raster [off] -soft/-eagle - Scale display with 2xSaI or EAGLE [off] -epx/-scale2x - Scale display with EPX or Scale2X [off] -cmy/-rgb - Simulate CMY/RGB pixel raster [off] -mono/-sepia - Simulate monochrome or sepia CRT [off] -green/-amber - Simulate green or amber CRT [off] -sound [<quality>] - Sound emulation quality  -nosound - Same as '-sound 0' When compiled with #define DEBUG: -trap <address> - Trap execution when PC reaches address [FFFFh] When a keyword 'now' is used in place of the <address>, execution will trap immediately. When compiled with #define UNIX: -shm/-noshm - Use MIT SHM extensions for X [-shm] -saver/-nosaver - Save CPU when inactive [-saver] -scale <factor> - Scale window by <factor>  When compiled with #define MSDOS: -back <filename> - Use <filename> as background picture [MG.GIF] -vsync - Sync screen updates [-vsync] -static/-nostatic - Use static color allocation [-nostatic]
I do not know. I can't give you any due to both legal and moral reasons. Please, do not mail me asking for games. I will delete your mail right away, and you won't get an answer.
You can use a special device called cartridge copier. Pascal Felber has made such a copier. Its schematics and software are available at
You can also buy this copier from Pascal, either in parts or as a pre-built kit.
Over years, SEGA has produced several different 8bit videogame consoles. They all had similar hardware built around a generic Z80 CPU, TMS9918 video chip, and SN76489 sound chip.
The oldest members of the family, SG1000, SC3000, and SF7000, had an original TMS9918 VDP and apparently weren't sold in US and most of the Europe. SG1000 was a "proper" gaming console, while SC3000 was a home computer with a keyboard and BASIC in ROM. SF7000 added a floppy disk drive to the SC3000.
The MasterSystem, widely sold in the US, has an additional extended screen mode not available in the standard TMS9918 VDP. Most MasterSystem games rely on this screen mode. The compatibility with TMS9918 screen modes has been retained though, so MasterSystem can play SG1000/SC3000 games.
The GameGear only has the MasterSystem native screen mode truncated to fit smaller screen, but not TMS9918 screen modes. It also has an extended color palette of 2x16-out-of-512 colors, as compared to MasterSystem's 2x16-out-of-64 colors.
Japanese and some European versions of MasterSystem, such as Mark3, have a sound chip made by Yamaha (YM2413, aka OPLL). The chip provides either nine channels of FM sound, or six FM channels and five drums.
SEGA machines have no BIOS ROM as in MSX or ColecoVision. Instead, they have a small bootup ROM which initializes the hardware and then switches itself off, passing control of the hardware to the cartridge.
To force MG into emulating desired system, use
-sms/-gg/-sc3000/-sg1000/-sf7000 options or select system
type in the MG-Windows Setup Panel. If you use .SMS, .GG, .SG, .SC, and
.SF file name extensions to distinguish between MasterSystem, GameGear,
SG1000, SC3000, and SF7000 ROMs or disk images, MG will check these
extensions and switch into an appropriate mode.
In the MasterSystem mode, MG defaults to the US/Europe localization
-engl). In the GameGear mode, MG checks the country code. If
the cartridge is either for Japan or US/Europe only, the localization
switch is forced into an appropriate state. It may be overridden by giving
a localization option (
Japanese versions of MasterSystem, such as Mark3, contain a YM2413 FM
synthesizer chip from Yamaha. To make MG emulate this chip, use the
-fm option or select "Emulate FM sound chip" in the
MG-Windows Setup Panel. Some games will not use FM chip unless you switch
to Japanese localization (
To fully appreciate FM chip emulation, you should use MG-Windows with MIDI sound, as YM2413 heavily relies on MIDI instruments and drums. Soundtrack log file (that is MIDI) is also going to show YM2413 music in all its glory.
Some GameGear games, namely World Series Baseball and Majors Pro Baseball,
do not have usual battery-backed memory on cartridge. Instead, they use
a little chip known as 93C46. This chip contains 128 bytes of non-volatile
memory that stays intact even without battery support. It is frequently
used in TVs, VCRs, etc. to retain the device state (the last channel you
watched and such). Since version 1.4, MG will fully emulate 93C46 chip if
you use the
-eeprom option or select the "Emulate serial
EEPROM" checkbox in the MG-Windows Setup Panel.
I am trying to compile Unix binaries for as many flavors of Unix as possible, but as I do not have access to many machines, do not expect immediate support for every Unix flavor out there. Don't mail me asking for the source either: MG source code is no longer publicly distrbutable, as much as I regret to say this :(.
This is explained in the beginning of this document.
This may happen when you are trying to run a MasterSystem or SG1000 game
in the GameGear mode or vice versa. By default, MG will try to recognize
game type by
.SMS/.GG/.SG/.SC/.SF extensions. If your files
have different extensions, you can use
-sms/-gg/-sg1000/-sc3000/-sf7000 options in MG-Unix or select
an appropriate hardware model in the Setup Panel of MG-Windows.
There may be several reasons why a game has problems running on MG or does not run at all:
dd if=<input-file> of=<output-file> skip=1 bs=512
-skipvalue, or the "Draw XX% Frames" menu itmes in MG-Windows and see if it helps.
-delay/-nodelayoptions, or check/clear the "Delay VRAM reads" menu item in MG-Windows.
If your copy of MG has been compiled with
#define ZLIB, it
will recognize and automatically unpack GZIPped files. MG-Windows and most
versions of MG-Unix are compiled with this option. To find out whether
your MG-Unix supports this feature, run it with the
option and see if it says anything about GZIP support.
Some MG-Unix binaries are compiled with
#define ZLIB option
to make them automatically recognize and unpack GZIPped files. This option
requires ZLib library which can be obtained from
This may happen if the versions of your shared libraries are older than the ones for which MG has been compiled. A decent way to deal with this is to upgrade your Unix. A quick and dirty way is to make a symbolic link from the existing library to a name required by MG.
You are probably trying to run MG-Unix on a remote Xterminal while it
attempts to use shared memory for interfacing with X. Use
-noshm option to tell it not to use shared memory.
MG-Unix version currently needs 8bpp, 16bpp, or 32bpp X. Neither 1bpp nor 4bpp Xterminals will work. 24bpp Xterminals may work, but don't count on it.
Some other X application took over all available colors so that the emulation could not allocate any for itself. Check if you run XV, Netscape, or something similar.
The wave synthesized sound in MG-Windows may become distorted on slow or highly loaded machines (no graphics acceleration, for example). There are several ways you can improve sound:
In SC3000 mode, MG will emulate SC3000 keyboard and also provide 32kB of
RAM. This allows to run BASIC Level 3, Music Editor, and other SC3000
programs. Following are non-obvious keyboard equivalents for SC3000 keys:
Take notice that all special MG functions accessed with the keys used
by SC3000 keyboard (such as
) are still
accessible if you press these keys with
To use an SF7000 disk image, you will first need to have an 8kB
SF7000.ROM file with the SF7000 BIOS in the current
directory. As long as you have this file, simply supply the file name
of a disk image (with
.SF extension) in the command line
or select it from an Open dialog in MG-Windows. MG will load the disk
image and try to boot from it.
The machine state can be saved by pressing
[F7] button and
[F6]. The resulting data file will have the same
name as your cartridge file, but its extension is going to be .STA. This
state file will be loaded automatically next time you start MG. The same
state file is not guaranteed to work for versions of MG running on different
"-Wall"and fixed warnings.
-sms2command line option.
-4x3command line option to MG-Unix.
-rastercommand line options.
-ambercommand line options.
-nolcdcommand line options.
-cmycommand line options.
-eaglecommand line options.
-nolcdcommand line options.
-zoom/-nozoomcommand line options with
-soft/-nosoftand made softening, scanline simulation, and synchronization options work on all relevant platforms (Unix, Maemo, MSDOS).
[F8]toggle scanline simulation, while
-novsyncoption from MG-MSDOS, as
-nosyncdoes the same thing.
#ifdef SOUNDfinally retired from the code. The sound code is always compiled in anyway.
-zoom/-nozoomoption to MG-MSDOS that will zoom SMS/GG display to fill the whole screen, using image softening algorithm.
-sync/-nosyncoption to MG-MSDOS to sync screen updates to the timer (use
-tvoptions used, otherwise it runs in 320x200x15bpp screen mode.
-printercommand line option.