MasterGear
version 2.0

by Marat Fayzullin

Contents


Disclaimers


New in This Version


History

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


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://www.komkon.org/fms/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:


MG Ports

Because of its portability, MG can be compiled on a wide variety of platforms: Unix, MacOS, Windows, PocketPC, MSDOS, AmigaOS, etc. Following are the major MG ports available at the moment:

Unix

MG-Unix is available freely in binary form for various flavors of Unix from the MG distribution site. I am always trying to compile it on as many different Unices as I have handy at the moment.

MacOS

The Macintosh version of MG is being developed by John Stiles. It is available from him as a shareware and can be found at the MG distribution site.

Windows

The Windows version of MG is available from me, Marat Fayzullin, for $35US. This fee ensures that you will get you the latest full version of MG-Windows with free updates via email as long as MG-Windows is being updated. For more information about it, take a look at

http://www.komkon.org/fms/MG/MGWindows.html

If you do want to see Windows version being developed, please, register it by one of the following methods:

ORDER BY MAIL
Send $35US in cash, money order, or a US bank check to:
     Marat Fayzullin
     3030 Southview Road
     Ellicott City, MD 21042
     USA
Don't forget to include your email address and mention that you want MG-Windows, as I'm selling several other products as well. The software will be emailed to you as soon as I receive the money.

ORDER BY PHONE
Call one of the following numbers in US:
     1-800-242-4775 (extension 15673)
     1-713-524-6394 (extension 15673)
and refer to product #15673 (MG-Windows). This service is provided by DigiBuy. You can pay them with a credit card. Don't forget to give them your email address. The software will be emailed to you as soon as I receive the notification from DigiBuy.

ORDER ON THE WEB
Tell your WWW browser to go to

http://www.digibuy.com/cgi-bin/order.html?296825+92971104569

and use the online form to register MG-Windows. You can pay with a credit card. They take MasterCard, Visa, Amex, or Discover. The software will be emailed to you as soon as I receive the notification from DigiBuy.

MSDOS

The MSDOS version of MG is included with the Windows version. By buying the MG-Windows you effectively buy the MG-MSDOS as well. MG-MSDOS is compiled with OpenWatcom C/C++ and runs in full screen mode under the DOS4GW 32bit DOS extender. It supports analogue joysticks, screen snapshots, and includes a debugger.

PocketPC

The PocketPC version of MG has long been developed by Aaron Oneal. Recently, Aaron moved to other projects and passed the maintenance duties to me, Marat Fayzullin. You can get the PocketPC versions of MG and my other emulators from

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

Linux

Currently, MG-Linux (ELF, GLIBC, X11) is compiled from the same source as all other Unix versions. You can get it for free from the MG distribution site. Please, do not ask me for an SVGALib version though: I do not consider SVGALib a viable standard and will not develop for it.

Registered Users

If you registered MG-Windows, please do not give your copy to anybody. And I do mean anybody. There was a couple of cases when registered users gave MG away to their friends, relatives, or just "KeWl" characters on the Net, and then I found it pirated, put onto WWW pages, and even posted to USENET newsgroups. If I find your personalized copy of MG being spread around, your registration gets automatically cancelled which means no support and no more updates.

I understand that the previous paragraph may sound threating to some people, but this kind of piracy really hurts my profits and feelings. I've put a lot of effort into MG, and can only continue working on it if people do not try to cheat on me.

It may also be a good idea to buy a real cartridge for each cartridge image you use with the emulator. SEGA software is copyrighted, but as long as you own the real cartridge, you are protected by the law allowing customers to backup bought software.


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.
  [SPACE]    - FIRE-A button (also: [LALT],A,S,D,F,G,H,J,K,L)
  [LCONTROL] - FIRE-B button (also: Z,X,C,V,B,N,M)
  [ENTER]    - START button (only in GameGear mode)
  [TAB]      - RESET button (only in MasterSystem mode)
  [BACKSPC]  - PAUSE button (only in MasterSystem mode)
  [ESC]      - Quit emulation (also: [F12])
  [F11]      - Reset hardware
  [F2]       - Turn soundtrack log on/off
  [F3]       - Toggle FIRE-A autofire on/off
  [F4]       - Toggle FIRE-B autofire on/off
  [F6]       - Load emulation state (*.STA)
  [F7]       - Save emulation state (*.STA)
  [F9]       - Fast-forward emulation (also: [PGUP])

  [SHIFT] and [CAPSLOCK] switch between MasterSystem joypads

  When compiled with #define SOUND:
  [1]-[3]    - Toggle PSG melodic channels on/off
  [4]        - Toggle PSG noise channel on/off
  [5]        - Toggle FM melodic channels on/off
  [6]        - Toggle FM drums on/off
  [0]        - Toggle all sound on/off
  [-]        - Decrease sound volume
  [+]        - Increase sound volume

  When compiled with #define DEBUG:
  [F1]       - Go into built-in debugger

  When compiled with #define MSDOS:
  [F8]       - Toggle joysticks 1/2 on/off
  [F10]      - Make a screen snapshot (SNAPxxxx.GIF)

Command Line Options

These options only work in MG-Unix and other MG ports with the command line interface. MG-Windows takes no command line options, just a file name.
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]
  -uperiod <period>   - Number of VBlanks per screen update [3]
  -help               - Print this help page
  -sg1000/-sc3000/    - Run as SG1000/SC3000/SF7000/SMS/GG [-sms]
  -sf7000/-sms/-gg      (overrides .SG/.SC/.SF/.SMS/.GG file extensions)
  -engl/-jap          - Run in English/Japanese mode [-engl]
                        (overrides country code in GG carts)
  -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]

  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 SOUND:
  -sound [<quality>]  - Sound emulation quality [44100]
                        0 - Off                1 - Adlib (MSDOS)
                        Values >8191 are treated as wave synthesis
                        frequencies.
  -nosound            - Same as '-sound 0'

  When compiled with #define UNIX:
  -shm/-noshm         - Use MIT SHM extensions for X [-shm]
  -saver/-nosaver     - Save CPU when inactive [-saver]
  -sync <frequency>   - Sync screen updates to <frequency> [0]
  -nosync             - Same as '-sync 0'
  -static/-nostatic   - Use static color allocation [-nostatic]
  -scale <factor>     - Scale window by <factor> [1]

  When compiled with #define MSDOS:
  -back <filename>    - Use <filename> as background picture [MG.GIF]
  -vsync/-novsync     - Sync screen updates [-novsync]
  -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 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. Why is MG so slow on my machine?
    Because your machine is too slow to run MG. My experience shows that you need at least a Pentium/90 machine with fast video to run MG at a reasonable speed. Following are the ways to speeds thing up:

  12. MG is too fast on my machine! How do I slow it down?
    Frankly, when I started writing MG, I never expected that it will be too fast on any machine :). But times change...

  13. What is that EMUTools package and where do I get it?
    EMUTools is a set of utilities which may be useful for both emulator authors and users. They allow to list and verify different ROM images, convert music files, disassemble and compare ROMs. EMUTools can be obtained from MG WWW site.

  14. 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.

  15. 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.info-zip.org/pub/infozip/zlib/

  16. I entered registration code into MG-Macintosh and now it says I pirated it!
    MG-Macintosh will lock up if you try to "register" it without paying for registration and using the correct registration code. It will then refuse to work on your computer. If you think that you have been mistreated for a simple typing error, contact John Stiles for help.

  17. 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 2the 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.

  18. 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.

  19. 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.

  20. 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.

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

  22. Does MG-Windows support joystick? My joystick doesn't work!
    MG-Windows supports joystick. If your joystick does not work, go into Windows Control Panel to see if it is configured and calibrated properly. Also, some new joysticks working in esoteric standards (like GRiP) are known to have problems.

  23. MG-Windows starts, but then quits immediately!
    Check the pathname to wherever your MG is located. It should not contain spaces. For example, "C:\Program Files\MG" is a bad place for MG, while "C:\MG" will work. This bug is caused by an old version of C compiler I am using. I hope to get rid of it when I switch to a new compiler.

  24. Colors are all screwed up in MG-Windows!
    When running Windows in 256-color mode, it will try to approximate colors to existing ones, but it won't always get an exact match. I'm working on fixing this. For now, switch Windows into 16bit or better graphics to get perfect colors.

  25. Black window in MG-Windows!
    If you are running Windows in 256-color mode, then this is most likely the cause of a problem. Try switching Windows into 16bit or better screen mode.

  26. Command line options don't work in MG-Windows!
    They shouldn't. MG-Windows supports no command will only accept the ROM file name at the command line, but no options. All configuration is done via Setup Panel and MG.INI file.

  27. Volume control works strangely in MG-Windows!
    It is a result of the volume control being shared between MG and other Windows applications. You can usually restore normal volume by leaving MG window and then activating it again.

  28. Will MG-Windows work on Windows 3.xx?
    It may, but I can't guarantee it. MG-Windows has never been tested on Windows 3.xx. Maybe it is time to upgrade.

  29. I'm a registered MG-Windows user and some games no longer run!
    It is quite possible that your MG.INI file no longer works with the new version of MG. It is my suggestion to delete MG.INI every time you get a new version of MG. You can still use some ASCII editor (Notepad or DOS Editor) to migrate some of your old settings into new MG.INI.

  30. 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].

  31. 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.

  32. How do I save and load the machine state during the game?
    The machine state can be saved by pressing [F6] button. 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. State saving is not perfect yet, so for some games the state may not be correctly saved.

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 (fms [AT] cs [DOT] umd [DOT] edu)