Google

fMSX
version 2.2

by Marat Fayzullin

Contents


New in This Version

As I now have four (!) different emulators to maintain in addition to my academic studies, I expect you, people, to look for bugs and fix them if possible. Please, submit your fixes and bug reports!

  • Interrupt system rewritten.
  • Mapper management rewritten.
  • Keyboard assignments changed again. Check the documentation!
  • Made a new MSDOS port of fMSX (still in development).
  • Integrated modular AY8910 emulation.
  • Integrated modular SCC emulation.
  • Integrated SndUnix/SndWin/SndMSDOS sound drivers.
  • Sound track is now logged to MIDI files.
  • Added a table of I/O handler functions to Z80 core for easy expansion.
  • Added ability to load flat (no mapper) 64kB ROMs.
  • Added automatic MegaROM mapper guessing (-rom 6).
  • Added standard PAL/NTSC timings.
  • Added V9958 version flag in MSX2+ mode (VDP S1).
  • Added correct emulation of HR/VR flags (VDP S2).
  • Fixed border color in SCREEN8 (VDP R7).
  • Fixed blinking frequency in TEXT80 (VDP R13).
  • Added ADJUST register emulation (VDP R18).
  • Added V9938 character scrolling to SCREEN0 and TEXT80 (VDP R23).
  • Added scrolling to SCREEN1, SCREEN2, and SCREEN3 (VDP R23).
  • Fixed scrolling bug in SCREEN6 and SCREEN7 (VDP R23).
  • Made left/right borders 9/7 pixels in SCREEN0 and TEXT80.
  • Added -home option to tell fMSX where to find system ROMs.
  • Added -auto option for auto fire on pressing SPACE.
  • Fixed information printed on -help.
  • Fixed crash in fMSX-Windows when switching from 8kB to 16kB MegaROMs.
  • Fixed trash in MSX2 logo in fMSX-Windows that appeared after reset.
  • Better resizing in fMSX-Windows Setup panel.

History

New in fMSX 2.1

  • New fMSX-Windows available. Buy it now !
  • Rewritten V9938 graphical operations support.
  • Rewritten initialization sequence.
  • Improved real-time clock emulation.
  • Fixed a problem with color sprites (Zanac-Ex, Aleste).
  • Fixed problems with memory allocation.
  • Fixed mouse offset in fMSX-Unix/X.
  • Extended documentation, added more questions to FAQ.
  • Reduced window size in Unix/X to speed up updates.
  • fMSX-Unix now supports 16bpp and 32bpp Xservers for sure.
  • Added speed throttling to fMSX-Unix (see -sync).
  • fMSX-Unix runs in a resizable window now.
  • Fixed IPC key allocation bug in fMSX-Unix.
  • Many small fixes to the code.

    New in fMSX 2.0b

    • Major code rewrite!
    • Line-by-line screen updates implemented
    • Standard modular Z80 emulation
    • Support for 16bit and 32bit X11 screens (possibly 24bit)
    • Support for KANJI.ROM
    • Mouse support
    • Joystick support
    • Multiple bug fixes
    • Multiple new bugs (look for them!)

    New in fMSX 1.5

    • More stable split screen (Zanac-Ex no longer blinks)
    • RAM mapper fixed again (Designer+ works now)
    • V9938 SRCH command fixed
    • MSXDOS2.ROM support
    • PAINTER.ROM support
    • FMPAC.ROM support
    • .PSG file format is updated
    • Serial port support is not yet implemented

    Introduction

    fMSX is a portable emulator of MSX home computers written in C. You can always get the latest fMSX source code and support files from

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

    MSX is an old Z80-based family of home computers which appeared in 1982 as an attempt to establish a single standard in home computing similar to VHS in video. They were popular in Asian (Korea, Japan) and South American (Brazil, Chile) countries as well as in Europe (Netherlands, France, Spain) and former Soviet Union, but they are virtually unknown in USA. Although MSX standard quietly died to year 1988, the world got to see MSX2, MSX2+, and TurboR extensions of the standard.

    The MSX standard has been designed by a Japanese company called ASCII in cooperation with Microsoft, which provided a firmware version of its BASIC for the machine. There is a widespread rumor that "MSX" stands for "MicroSoft eXtended". MSX machines were produced by such giants as Sony, Yamaha, Panasonic, Toshiba, Daewoo, and Philips. The only MSX model ever sold in USA appears to be an early SpectraVideo machine.

    In spite of its sad history, MSX is a very nice computer, especially good for education, which is clearly indicated by an example of the Soviet Union. Russian Ministry of Education bought hundreds of MSXes (and later MSX2s) grouped into "computerized classroom systems" of 10-16 machines connected with a simple network. Entire generation of programmers has grown up using these computers.

    Hardware-wise, MSX represents a hybride of a videogame console and a generic CP/M-80 machine. Its heart is a Z80 CPU working at 3.58MHz in the base model. The clock frequency has been doubled in the TurboR. The video subsystem is built around a TI9918 or TI9928 VDP chip also used in Texas Instruments' TI-99/4 computers, ColecoVision, and Coleco Adam. In the late MSX models, this chip has been upgraded to V9938 (MSX2) and then to V9958 (MSX2+ and TurboR). The latest version of it is V9990. The audio system is handled by AY-3-8910 chip by General Instruments, same as the one used in Sinclair ZX Spectrum 128 audio. AY-3-8910 provides 3 channels of melodic sound, noise generation, volume envelopes, and two general purpose parallel IO ports which are used for joysticks and some other things in the MSX design. Due to their hardware architecture, MSX machines were perfectly suitable for games and there is a lot of good games either written or ported to them.


    fMSX Ports

    There are versions of fMSX for Amiga, Macintosh, IBM PC (both MSDOS and Windows), and other systems. Following people have been maintaining ports of fMSX to these systems:
    Amiga:      Hans Guijt
    Windows:    Marat Fayzullin
                Tekuro Tokuyama
    Macintosh:  John Stiles
                Paul Chapman
    PC9801:     Murakami Reki
    MSDOS:      Marcel de Kogel
    
    If you would like to port fMSX to another system or make changes to the fMSX's code, please, contact me by email or some other means. Note that fMSX source code is freely distributable but it is not in public domain. You cannot use it for commercial purposes unless you contact me to arrange the conditions of such usage and get my permission. Feel free to look at existing drivers as well as at other code.

    Registered Users

    If you registered fMSX-Windows, please do not give your copy to anybody. And I do mean anybody. There was a couple of cases when registered users gave my programs away to their friends, relatives, or just "KeWl" guys on the Net, and then I found programs pirated, put onto WWW pages, and even posted to USENET newsgroups. If I find your personalized copy of fMSX 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 fMSX, and can only continue working on it if people do not try to cheat on me.


    What is Included

    Source Code Distribution

    This distribution includes complete portable C sources for fMSX and screen/keyboard drivers for Unix/X. fMSX-Unix has been tested on many different Unix flavors. The included sources should be sufficient to port fMSX to any sufficiently advanced system, while Unix/X drivers can be used as an example for the system-dependent part of the port.

    Windows Distribution

    This is a port of fMSX to the Microsoft's Windows operating system. The uncrippled Windows version of fMSX is available from me, Marat Fayzullin, for $35US. This fee ensures that you get the latest full version of fMSX-Windows with no limitations. You will also get free updates via email as long as fMSX-Windows is being updated. For more information about it, take a look at

    http://www.komkon.org/fms/fMSX/fMSXWindows.html

    fMSX-Windows is a 32bit application which runs under Windows 95/98/NT Windows NT. It is compiled with Borland C++ Builder and does not need WinG, DirectX, or any other "API" from Microsoft screwing your system. Video card accelerating BitBlt() and StretchBlt() GDI calls and a fast computer are strongly recommended though.

    There is also another Windows port of fMSX available from Teturo Tokuyama. It is free but not up-to-date and lacks many features.

    If you want me to continue developing fMSX and would like to receive the full version of fMSX-Windows, please, register it by one of the following methods:

    ORDER ON THE WEB
    Tell your WWW browser to go to

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

    and use the online form to register fMSX-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.

    ORDER BY PHONE
    Call one of the following numbers in US:
         1-800-242-4775 (extension 15247)
         1-713-524-6394 (extension 15247)
    
    and refer to product #15247 (fMSX-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 BY MAIL
    Send $35US in cash, money order, or a US bank check to:
         Marat Fayzullin
         6304 Hampton Place
         Elkridge, MD 21075
         USA
    
    Don't forget to include your email address and mention that you want fMSX-Windows, as I'm selling several other products as well. The software will be emailed to you as soon as I receive the money.

    Buttons

    Unix version:
      [LALT]          - Joystick A button
      [LCONTROL]      - Joystick B button
      [RSHIFT]        - CAPS LOCK
      [RCONTROL]      - COUNTRY
      [RALT]          - GRAPH
      [F6]            - HOME/CLS
      [F7]            - DELETE
      [F8]            - INSERT
      [F9]            - SELECT
      [F10]           - STOP/BREAK
      [CONTROL]+[F6]  - Turn spacebar autofire on/off
      [CONTROL]+[F7]  - Change disk in drive A:
      [CONTROL]+[F8]  - Change disk in drive B:
      [CONTROL]+[F9]  - Turn fixed font on/off
      [CONTROL]+[F10] - Turn soundtrack logging on/off
      [F11]           - Go into the built-in debugger (with #define DEBUG)
      [F12]           - Quit emulation
    
    Windows version:
      [Insert]       - INSERT
      [Delete]       - DELETE
      [Home]         - HOME/CLS
      [End]          - SELECT
      [PageUp]       - STOP/BREAK
      [PageDown]     - COUNTRY
      [CapsLock]     - CAPS LOCK
      [Alt]          - GRAPH
      [F6]           - Change cartridge in slot A
      [F7]           - Change disk in drive A:
      [F8]           - Change disk in drive B:
      [F9]           - Invoke Setup panel
      [F10]          - Invoke Windows menu
      [F11]          - Reset emulation
      [F12]          - Quit emulation
    

    Command Line Options

    Usage: fmsx [-option1 [-option2...]] [filename1] [filename2]
    
      [filename1] = name of file to load as cartridge A
    
      [filename2] = name of file to load as cartridge B
    
      [-option] =
      -verbose <level>    - Select debugging messages [1]
                            0 - Silent       1 - Startup messages
                            2 - V9938 ops    4 - Disk/Tape
                            8 - Memory      16 - Illegal Z80 ops 
      -hperiod <period>   - Number of CPU cycles per HBlank [228]
      -vperiod <period>   - Number of CPU cycles per VBlank [59736]
      -uperiod <period>   - Number of VBlanks per screen update [2]
      -pal/-ntsc          - Set PAL/NTSC HBlank/VBlank periods [NTSC]
      -help               - Print this help page
      -home <dirname>     - Set directory with system ROM files [off]
      -printer <filename> - Redirect printer output to file [stdout]
      -serial <filename>  - Redirect serial I/O to a file [stdin/stdout]
      -diska <filename>   - Set disk image used for drive A: [DRIVEA.DSK]
                            (multiple -diska options accepted)
      -diskb <filename>   - Set disk image used for drive B: [DRIVEB.DSK]
                            (multiple -diskb options accepted)
      -tape <filename>    - Set tape image file [off]
      -font <filename>    - Set fixed font for text modes [DEFAULT.FNT]
      -logsnd <filename>  - Write soundtrack to a file [LOG.MID]
      -auto/-noauto             - Use/Don't use autofire on SPACE [off]
      -ram <pages>        - Number of 16kB RAM pages [4/8/8]
      -vram <pages>       - Number of 16kB VRAM pages [2/8/8]
      -rom <type>         - Select MegaROM mapper types [0,0]
                            (two -rom options accepted)
                            0 - Konami 8kB    1 - MSXDOS2 16kB
                            2 - Konami5 8kB   3 - Konami4 8kB
                            4 - ASCII 8kB     5 - ASCII 16kB
                            >5 - try guessing mapper type
      -msx1/-msx2/-msx2+  - Select MSX model [-msx2]
      -joy <type>         - Select joystick types [0,0]
                            (two -joy options accepted)
                            0 - No joystick
                            1 - Normal joystick
                            2 - Mouse in joystick mode
                            3 - Mouse in real mode
    
      With #define DEBUG:
      -trap <address>     - Trap execution when PC reaches address [FFFFh]
                            (when keyword 'now' is used in place of the
                            <address>, execution will trap immediately)
    
      With #define SOUND:
      -sound/-nosound     - Play/don't play sound [-sound]
    
      With #define MITSHM:
      -shm/-noshm         - Use/don't use MIT SHM extensions for X [-shm]
    
      With #define UNIX:
      -saver/-nosaver     - Save/don't save CPU when inactive [-saver]
      -sync <freq>        - Frequency to sync screen updates to [no sync]
      -nosync             - Same as '-sync 0'
      -scale <factor>     - Scale window by <factor> [1]
    
      With #define MSDOS:
      -vsync/-novsync     - Sync/Don't sync screen updates [-novsync]
      -240/-200           - Use/Don't use non-standard 256x240 mode [-200]
      -static/-nostatic   - Use/Don't use static color allocation [-nostatic]
    

    Frequently Asked Questions

    1. Where do I get MSX software?
      Go to http://www.komkon.org/fms/MSX/ and follow links from there.

    2. What do I do with .BAS,.GMB,.CRC,.LDR files?
      These are BASIC programs. You run them from MSX BASIC with

      RUN "filename"

    3. What do I do with .BIN,.OBJ,.GM files?
      These are binary files with programs, also known as BLOADable files. You can run them from MSX BASIC with

      BLOAD "filename",R

    4. What do I do with .COM files?
      These are MSXDOS command files. You can run them from MSXDOS by typing their names sans ".COM" extension.

    5. What are the .ROM files?
      These are binary images of cartridge ROMs that can be loaded into fMSX. There are "small" cartridge ROMs of 8kB, 16kB, or 32kB, and the MegaROMs, which can be 128kB, 256kB and even 512kB. MegaROMs require a special MegaROM mapper feature of fMSX that can be adjusted with -rom options.

    6. What are the .ROM files included with fMSX?
      Following .ROM files may not be normal cartridges, but they are used by fMSX:
      MSX.ROM      - Standard MSX BIOS and BASIC code
      MSX2.ROM     - MSX2 BIOS and BASIC code
      MSX2EXT.ROM  - MSX2 ExtROM containing system extensions
      MSX2P.ROM    - MSX2+ BIOS and BASIC code
      MSX2PEXT.ROM - MSX2+ ExtROM containing system extensions
      DISK.ROM     - MSX DiskROM containing BDOS and Disk BASIC (optional)
      RS232.ROM    - RS232 BIOS and BASIC extensions (optional)
      FMPAC.ROM    - FM-PAC BIOS and BASIC extensions (optional)
      MSXDOS2.ROM  - MSXDOS2 system core (optional)
      PAINTER.ROM  - Yamaha Painter, graphical editor found in Russian MSX
                     machines from Yamaha (optional)
      KANJI.ROM    - ROM with Kanji character images (optional)
      CMOS.ROM     - Non-volatile memory used in MSX2 and MSX2+. This file gets 
                     rewritten on exit if non-volatile memory was changed.
      

    7. How do I use disks with fMSX?
      fMSX includes disk support starting with version 0.9. If you have an earlier version, you cannot use disks. The following instructions assume that you have a version supporting disks.

      First, make sure that the DISK.ROM file containing MSX DiskROM is in the current directory. Then, use an MSDOS program called DCOPY.EXE to create disk images of your MSX disks:

      DCOPY <drive>: <filename>.DSK

      These images are just raw files with all disk blocks written in a sequence. They can also be created on a Unix machine with

      cp /dev/rfd0 <filename>.DSK

      or a similar command. If you have a 1.44MB HD floppy formatted on MSX for 720kB, don't forget to stick a piece of tape on the HD/DD indicator hole.

      After you have created disk image files, run fMSX in the following way:

      fmsx -diska <filename1>.DSK -diskb <filename2>.DSK

      where two image filenames will become your drives A: and B:. You can also have default disks called DRIVEA.DSK and DRIVEB.DSK and located in the current directory.

    8. Is there an easier way to work with disk images?
      In fact, there is. Look at two programs that come with fMSX, called wrdsk and rddsk. The wrdsk program allows you to create a disk image and add files to it:

      wrdsk <filename>.DSK <file> <file> ...

      The rddsk program will read files from a given disk image:

      rddsk <filename>.DSK [-d <dir>] [<file> <file> ...]

    9. Why is the emulator so slow on my PC?
      Because your PC is too slow to run the emulator. The faster your machine is, the faster it will run. On slow machines, you can try speeding things up by increasing -uperiod value to 3..6. This value controls how frequently fMSX updates the display.

    10. Emulator is too fast on my PC!
      When fMSX was created, I didn't expect that computers would become too fast for it :). Nevertheless, if fMSX-Unix is too fast on your computer, you can synchronize it to any given frequency using -sync option. You would usually want to do -sync 25 -uperiod 2 which means "perform every second screen update and synchronize updates to 25Hz".

    11. I can't get some BASIC programs to work with the emulator.
      Many MSX programs have BASIC loaders written for machines not quite compatible with each other. Other loaders expect the machine to have only one floppy disk drive and use the memory dedicated to the second drive. To make such programs work, perform two "magic passes" on fMSX before running a loader:
      • When booting MSX, press [CTRL]+[DEL] keys to switch off the second disk drive.
      • Before running a program, type POKE &hFFFF,&hAA to set MSX memory manager into the mode expected by most loaders.

    12. I can't get some ROM images to work with the emulator.
      Try increasing -vperiod value. If the ROM image is bigger than 32kB, try using -rom <N> parameter with different <N>s (see fmsx -help for a complete list). If you still can't get ROM image to work, send it to me for analysis.

    13. Is it legal to spread cartridge ROMs?
      NO. Nobody seems to care though, mainly because there is no profit to be made from MSX software any longer. Nevertheless, be aware of the fact that by using commercial software you haven't bought you are commencing an act of piracy.

    14. When compiling fMSX-Unix, I get "undefined name" errors.
      This means that your linker cannot find the libraries necessary for the emulator (namely, libX11.a and libXext.a) or some additional libraries (like libsocket.a and libnsl.a) are required. Find these libraries in your system and modify the Makefile so that the final invocation of the C compiler has -L<path_to_libs> options. If you have no libXext.a library, try #undefining MITSHM option.

    15. When starting fMSX-Unix, I get X_ShmAttach error.
      You are probably trying to run the emulator on a remote Xterminal while it attempts to use shared memory for interfacing with X. Use -noshm option to disable the usage of shared memory.

    16. The emulation starts under Unix, but then I get X_PutImage error.
      Unix/X version of fMSX can currently be compiled for 8bit, 16bit, or 32bit Xterminals. Neither 1bit nor 4bit Xterminals will work with the drivers included into official fMSX distribution. Arnold Metselaar developed the drivers supporting any Xterminal. These drivers are available at

      http://www.math.utwente.nl/~metselaa/msx/X-drivers.html

    17. I start the fMSX-Unix, but the window stays black.
      Some other X11 application took over all available colors so that fMSX emulation could not allocate any for itself. Check if you run XV, Netscape, or something similar and quit these applications.

    18. I get distorted colors in fMSX-Windows.
      You are probably running Windows in an 8bit mode. In this mode, only 256 colors are accessible, and some of them are taken by other programs. Therefore, the system is trying to pick the closest possible colors, which do not always look right. Switch Windows into 16bit or 24bit modes for the right colors.

    Thanks to...

    Hans Guijt [.NL]
    Working on Amiga port, Hans has done a very good job in getting fMSX run fast on an Amiga. He rewrote the CPU emulation and the screen drivers in assembler, optimized the VDP emulation, wrote sound drivers, and added many more things making fMSX-Amiga the best, if not the fastest MSX emulator for this platform. Thanks, Hans (and yes, I do remember those .ROM files too ;)).

    Igor Sharfmesser [.KZ] and Alex Krasivsky [.RU]
    Igor and Alex have brought to life fMSX-MSDOS. The first version, including screen and keyboard drivers, was done by Igor. AdLib sound was added by Alex.

    Teturo Tokuyama [.JP]
    Teturo has done an excellent port of fMSX to Windows. As much as I hate Windows, I must admit that Teturo's fMSX-Win32 rules. Period.

    Murakami Reki [.JP]
    Murakami has written PC9801 port of fMSX. He is the guy whom you have to thank for the disk support in fMSX. If not for him, I would have never started implementing it :).

    Marcel de Kogel [.NL]
    Marcel wrote an excellent port of fMSX to MSDOS. His MSDOS version of fMSX was actually the first one that supported all fMSX features correctly. Marcel also provided invaluable help debugging and improving fMSX and other emulators.

    Ville Hallik [.EE]
    AY8910 and SCC chips emulation, written by Ville for Linux/FreeBSD /dev/dsp device, and SunOS /dev/audio, was the best fMSX sound emulation I have seen at the time. And, yes, it lets you play MSX games with sound on a Unix system! =:)

    John Stiles [.US]
    John took over the development of the Macintosh version of fMSX and managed to speed up the common part of display drivers used in the Unix/X, MSDOS, Windows, and Macintosh versions.

    Paul Chapman [.CA]
    Paul Chapman is the original author of fMSX-Macintosh. Although his port had bugs, it looked great and ran faster than the original MSX computer on an average PPC-based Macintosh of that time. As Paul was not able to continue developing fMSX-Macintosh, the development has been taken over by John Stiles.

    Arnold Metselaar [.NL]
    If you happen to have a non-standard X11 display, get Arnold's X11 drivers fixed to work for any screen depth.

    Guenter Woigk [.DE]
    Found a bug with offsets in Z80 commands using IX/IY registers.

    Martial Benoit [.FR]
    Explained how VDP deals with sprites and sent me copies of V9938 and WD2793 databooks (WOW! Thanks, Martial :)).

    Alex Wulms [.NL]
    Sent me a copy of WD1793 databook.

    Maarten Huurne [.NL]
    Has done some extensive bug-hunting on the Solid Snake cartridge ;).

    ...and to all of .NL/.CL/.SU people who helped me with advices, information, and encouragment.

    ENJOY THE EMULATOR AND LET US KEEP MSX ALIVE :)

    © Copyright by Marat Fayzullin (fms@cs.umd.edu)