MasterGear
version 4.9

by Marat Fayzullin

Contents

Disclaimers

New in This Version

Introduction

MasterGear (MG) is an emulator of several 8bit videogame consoles produced by SEGA: Mark3, MasterSystem, handheld GameGear, and their predecessors SG1000, SC3000, and SF7000. MG runs most games written for these consoles on a personal computer. As MG is written in a portable C programming language, it runs on many different platforms, such as desktops, palmtops, cell phones, set-top boxes, newer videogame consoles, DVD players, and even digital cameras. You can always get the latest MG binaries and support files from

http://fms.komkon.org/MG/

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 Ports

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:

MG-Android

The Android version of MasterGear is available from Google Play:

https://play.google.com/store/apps/details?id=com.fms.ng

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.

MG-Windows

The MG-Windows is now free for everyone to use and share. It can be downloaded from the MasterGear homepage:

http://fms.komkon.org/MG/

For more information, take a look at my other products for Windows:

http://fms.komkon.org/EmuWindows/

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

MG-Unix and MG-Linux are available freely in binary form from the MasterGear homepage:

http://fms.komkon.org/MG/

I am always trying to compile it on as many different Unix and Linux flavors as I have handy at the moment.

MG-Maemo and MG-Meego

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.

MG-MSDOS

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.

MG-Symbian

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:

http://fms.komkon.org/EmuSymbian/

MG-PocketPC

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

http://fms.komkon.org/MorphGear/

What is Included

Following files are included into the distribution:
  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

What is not Included

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.

Keyboard Assignments

When using SC3000 keyboard, press [CONTROL]+[KEY] to access a special function of the [KEY], if it also performs a keyboard function.

  [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

Command Line Options

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 [5]
                          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 [215]
  -vperiod <period>   - Number of CPU cycles per VBlank [65000]
  -skip <percent>     - Percentage of frames to skip [25]
  -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> [60]
  -nosync             - Do not sync screen updates
  -tv/-lcd/-raster    - Simulate TV scanlines or LCD raster [off]
  -linear             - Scale display with linear interpolation [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]
  -4x3                - Force 4:3 television screen ratio [off]
  -fps                - Show framerate counter [off]
  -sound [<quality>]  - Sound emulation quality [22050]
  -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> [2]

  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]

Frequently Asked Questions

  1. I WANNA PLAY GAMES!!!! WHERE DO I GET GAMES???????

    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.

  2. How do I copy games from cartridges to a computer?

    You can use a special device called cartridge copier. Pascal Felber has made such a copier. Its schematics and software are available at

    http://lsewww.epfl.ch/~felber/IO-56/

    You can also buy this copier from Pascal, either in parts or as a pre-built kit.

  3. What are MasterSystem and GameGear? How their hardware works?

    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.

  4. How system selection and localization work?

    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 (-engl/-jap).

  5. FM sound does not work for me!

    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 (-jap option).

    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.

  6. What is serial EEPROM chip and how do I use it?

    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.

  7. There is no version of MG for my Unix!

    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 :(.

  8. Where do I get MG for Windows and MSDOS?

    This is explained in the beginning of this document.

  9. Game comes up with wrong colors and trash on the screen.

    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.

  10. My favorite game doesn't work on MG. What do I do?

    There may be several reasons why a game has problems running on MG or does not run at all:

  11. Do I need to unpack GZIPped ROM images to run them on MG?

    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 -help option and see if it says anything about GZIP support.

  12. When starting MG-Unix, ld says that libz library isn't found.

    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

    http://www.zlib.net/

  13. When starting MG-Unix, ld says that some library isn't found.

    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.

  14. When starting MG-Unix, I get X_ShmAttach error.

    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.

  15. When starting MG-Unix, I get X_PutImage error.

    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.

  16. When starting MG-Unix, the window stays black.

    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.

  17. The sound is distorted in the MG-Windows. How do I fix it?

    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:

  18. How do I use SC3000 keyboard?

    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:

    SC3000       MasterGear
    -------------------------
    [SHIFT]      [SHIFT]
    [CONTROL]    [CONTROL]
    [ALT]        [ALT]
    [FUNCTION]   [TAB]
    [GRAPHLOCK]  [CAPSLOCK]
    [DEL/INS]    [BS]
    [CLS/HOME]   [HOME]
    [YEN]        [`]
    [PI]         [END]
    [^]          [=]
    [@]          [\]
    [:]          [']
    
    Take notice that all special MG functions accessed with the keys used by SC3000 keyboard (such as [0]..[6]) are still accessible if you press these keys with [CONTROL].

  19. How do I use SF7000 disk images?

    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.

  20. How do I save and load the machine state during the game?

    The machine state can be saved by pressing [F7] button and loaded using [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 hardware.

History

New in MG 4.8

New in MG 4.7

New in MG 4.6

New in MG 4.5

New in MG 4.4

New in MG 4.3

New in MG 4.2

New in MG 4.1

New in MG 4.0

New in MG 3.7

New in MG 3.6

New in MG 3.5

New in MG 3.4

New in MG 3.3

New in MG 2.6

New in MG 2.5

New in MG 2.4

New in MG 2.3

New in MG 2.2

New in MG 2.1

New in MG 2.0

New in MG 1.5

New in MG 1.4

New in MG 1.3

New in MG 1.2

New in MG 1.1

Thanks

I would like to thank Richard Aplin, Chris Shay, and Neil Harding, who helped with invaluable technical information about MasterSystem and GameGear. Thanks also go to (alphabetically):
© Copyright by Marat Fayzullin (marat [AT] komkon [DOT] org)