MasterGear Documentation

# MasterGear
version 2.0

### by Marat Fayzullin

# Contents

- Disclaimers
- New in This Version
- History
- Introduction
- MG Ports
- Registered Users
- What is Included
- What is not Included
- Keyboard Assignments
- Command Line Options
- Frequently Asked Questions
- Thanks

# Disclaimers

- Mark3, MasterSystem, GameGear, SG1000, SC3000, and SF7000 are all registered trademarks of SEGA.
- GameGenie is a registered trademark of Galoob.
- The author is in no way affiliated with SEGA.
- The author is in no way affiliated with any pirate group out there.
- The author cannot and will not provide you with any MasterSystem, GameGear, or other games.
- The author cannot be held responsible for anything this program will do to your computer, brains, free time, housemates, pets, or family members.

# New in This Version

- When you buy MG-Windows, you now also get MG-MSDOS.
- Added DirectDraw-based full screen mode to MG-Windows. Press [ALT]+[ENTER] to switch in and out of the full screen mode. Use it with caution, as DirectDraw is notoriously unstable.
- Switched to the latest version of the OpenWatcom C/C++ compiler.
- The infamous Windows problem with spaces in directory names seems to be fixed by using a newer compiler.
- Joystick problems in MG-Windows are fixed.
- Added joystick configuration to MG-Windows setup panel.
- Fixed a Unix sound driver problem with non-atomic write, thanks to Colin Howell.
- Added quick state loading ([F6]) and moved state saving to another key ([F7]).
- Added fast-forwarding option ([F9] or [PAGEUP]).
- Added TV raster emulation to MG-Windows.
- Fixed several bugs in the MIDI logging code and the Windows MIDI sound driver.
- MG-MSDOS now uses 44.1kHz wave-synthetic sound by default.
- Window size and position are now saved on exit in MG-Windows.

# History

## New in MG 1.5

- Added initial support for SF7000 disk-based home computer (-sf7000).
- Added support for the CodeMasters ROM mapper (-cdms/-nocdms).
- Added separate and correct emulation for i8255 PPIs.
- Increased default VPeriod to 65100 (Back To The Future 3 works now).
- Small fix to DI instruction.
- Correct emulation of IFF1/IFF2 latches (thanks, Zoop!).
- Multiple timing fixes in the Z80 core (thanks, Zoop!).
- Fixed Z80 interrupt handling after EI (thanks, Maarten!).
- Fixed SMS and GG palettes to range from black to true white.
- MG-Windows now runs in 16BPP HiColor mode.
- Added debugger to MG-MSDOS and MG-Windows (F1).

## New in MG 1.4

- Added many new command line options: -sg1000, -fm/-nofm, -drums/-nodrums, -eeprom/-sram, -static/-nostatic.
- Added YM2413 (OPLL) FM chip emulation (-fm/-nofm). It works best with MG-Windows midiOut sound drivers or MIDI soundtrack logging.
- Added option to simulate SN76489 (PSG) noise channel with MIDI drums (-drums/-nodrums).
- Added 93C46 serial EEPROM chip emulation (-eeprom/-sram). World Series Baseball and Majors Pro Baseball can save and load data now.
- Added special SG1000 mode (-sg1000).
- Added ability to load 8kB cartridges.
- Added static color allocation option (-static/-nostatic).
- Added separate handling for line and VBlank interrupts.
- Changed the way interrupt enabling flags work.
- Changed interrupt and display enabling flags in VDP.
- Saved state (.STA) file format has changed.
- Fixed mapper problem affecting state saving.
- Sound API has been rewritten to accommodate MIDI instruments, dynamic instrument changes, drums, etc.
- New sound and MIDI logging APIs have been integrated.
- Added F6 to save emulation state in MG-Unix.
- Changed Setup Panel GUI in MG-Windows.
- Fixed window resizing when changing model in MG-Windows.
- Fixed several problems with MG-Windows waveOut sound drivers.

## New in MG 1.3

- Documentation converted to HTML.
- Added game state saving/loading.
- Fixed a bug in the Z80 BIT opcode, thanks to Zoop.
- Multiple fixes to the VDP emulation.
- Complete TMS9918 emulation (SG1000/SC3000).
- Added separate SC3000 emulation option.
- Added SC3000 keyboard emulation.
- Sound in MG-Unix fixed to work on some buggy OSS versions.
- Added speed control to MG-Unix.
- MG-Unix runs in a resizable window now.
- Fixed IPC key allocation bug in MG-Unix.
- MG-Windows uses multimedia timer to sync screen refresh.
- Added size/position snapshotting to MG-Windows.
- Added keyboard bindings to MG-Windows.

## New in MG 1.2

- Documentation expanded.
- Added emulation for Japanese SG1000/SC3000 systems which were predecessors to the MasterSystem.
- Fixed Japanese/English switch.
- Even more accurate VRAM read/write emulation (multiple minor glitches fixed).
- Fixed VBlank control bits in VDP.
- VBlank interrupts are persistent now (Samurai Spirits and Robocop 3).
- Added multi-phase VBlank processing (Smash TV, Spiderman).
- Memory is initialized to 00h not FFh now (done by bootup ROM?) (Shanghai 2).
- Windows version has got a "Sync to Timer" option to control emulation speed.

## New in MG 1.1

- Windows version is now ready and available for sale. You can register it online with a credit card.
- VPeriod/HPeriod are counted in the CPU cycles instead of CPU opcodes.
- Fixed bug preventing Rainbow Islands from running.
- Fixed bug which caused trash to appear on display in Galaxy Force.
- Changed VRAM read/write code which fixed glitches in Surfing Ninjas and many other games using inappropriate VRAM access modes.
- Changed -delay option so that Astro Warrior, Mah Jong, and several other games run without glitches.
- Changed sound chip base frequency to make it sound correctly.
- Changed keyboard assignments (see documentation).
- Unix version runs in 8bpp, 16bpp, 32bpp, and 24bpp X11 modes (24bpp not on all servers though).
- Music is saved in the MIDI format. No conversion needed.

# 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:

- Hardware
  - CPU (Z80)
  - MasterSystem video processor
  - GameGear video processor
  - SG1000/SC3000 video processor (TMS9918)
  - Programmable sound generator (SN76489)
  - Mark3 FM sound generator (YM2413 aka OPLL)
  - 32kB internal RAM in SC3000
  - 8kB internal RAM in MasterSystem and GameGear
  - 16kB internal VRAM
  - SC3000 keyboard
  - SF7000 floppy disk drive
- Cartridges
  - Standard bank switching
  - CodeMasters bank switching
  - Cartridge RAM
  - Battery backed SRAM
  - Serial EEPROM (93C46) used in some GameGear ROMs
  - Localization switch between English/Japanese modes
  - Automatic localization for GameGear ROMs
- Other
  - Emulation state saving and loading
  - Automatic handling of GZIPped ROMs
  - Soundtrack logging into MIDI files
  - Built-in debugger (Unix port only)
  - Resizable window (Windows and Unix ports)
  - Full-screen mode (Windows and MSDOS ports)
  - Loadable background pictures (MSDOS port only)
  - Screen snapshots (MSDOS port only)

# 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:
    - Check your ROM image size: it must be a multiple of 8192. If it is 512 bytes longer, then you may have a 512-byte copier header attached to it. In this case, remove first 512 bytes of the file. Unix users can do it in a following way:

          dd if=<input-file> of=<output-file> skip=1 bs=512

    - If a game refuses to work, try increasing `-vperiod` value, or moving the "VBlank Period" knob in the MG-Windows Setup Panel.

    - Try to fiddle with `-hperiod` value, or the "HBlank Period" knob in the MG-Windows Setup Panel and see if it helps.

    - If you see corrupted spots at the MG screen, or a game behaves strangely, try `-delay/-nodelay` options, or check/clear the "Delay VRAM reads by one" checkbox in the MG-Windows Setup Panel.

    - If some sprites blink or do not appear at all, try changing `-uperiod` value (1 will give you the best picture, but the slowest emulation), or moving the "Update Period" knob in the MG-Windows Setup Panel.

    - MG may not currently run this game. Few games are supported at this moment. Don't expect 100% compatibility with real hardware.

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:

    - Increase screen update period. The picture will get more jerky, but emulation becomes faster.

    - On Unix, always use MIT Shared Memory Extension for X (MITSHM). This, of course, means that you have to run MG locally.

    - On Unix, run X in 8bpp or 16bpp mode.

    - On Windows and Unix, use 1:1 window to achieve the highest speed.

    - On Windows, use MIDI sound, as wave synthesis takes quite a lot of CPU time.

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

    - Decrease screen update period to 2 or even to 1. The emulation will become much slower, but smoother.

    - On Unix, use `-sync` option to tie screen updates to the certain frequency (usually, 60Hz divided by the screen update period).

    - On Windows, use "Sync To..." option in the Setup Panel to tie screen updates to a certain frequency (usually, 60Hz divided by the screen update period).

    - On Windows and Unix, double or triple the window size.

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:

    - Use MIDI sound instead. MIDI has both advantages and disadvantages, but it generally sounds better than wave synthesis.

    - Make MG window smaller to decrease the load on the CPU. 1:1 is the optimal size.

    - Decrease the sampling frequency (in the Setup Panel). The sound may become tinkier, but less distorted.

    - Increase the number of wave buffers (in the Setup Panel). This may cause sound to fall a second or two behind the screen action, but the sound quality will become better.

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):

- Gershon Elber, author of GIFLib.
- Marcel de Kogel, who helped me with the MSDOS port.
- Alex Krasivsky, the initial author of Adlib sound driver on which MG-MSDOS sound is based.
- Juan Luis Lario for the pictures of GameGear.
- James McKay, author of the Massage emulator.
- Authors of ZLib and Markus Oberhumer, who told me about ZLib.
- Charles Scheffold and other authors of PMODE/W.
- Ian Spielman, who wrote the enchanced Unix/X drivers for MG.
- John Stiles, author of the MG port to Macintosh.
- Unknown guy from .BR who showed me how to handle PC joystick.
- Many other people who helped with information, bug reports, and cartridge images for testing.

© Copyright by Marat Fayzullin (fms [AT] cs [DOT] umd [DOT] edu)