A first public release of fMSX [Unix/X version] – the portable
MSX emulator is available at
http://www.cs.umd.edu/users/fms/MSX/
It will soon appear at ftp.funet.fi in /pub/msx directory
as well.
I’m looking for people who will port fMSX on other platforms.
******* fMSX *******
The Portable MSX Emulator
version 0.2 Unix/X
by Marat Fayzullin
email: f…@wam.umd.edu
IRC: RST38h
WWW: http://www.cs.umd.edu/users/fms/
* INTRODUCTION *
This package includes C sources for portable MSX emulator,
X-Windows screen, sprite and keyboard drivers and a makefile
allowing to compile fMSX under Unix/X. fMSX has been tested
on following Unix systems:
FreeBSD Linux SunOS Solaris OSF/1
It was also succesfully run on Amiga and IBM PC [under MeSsyDOS],
although no decent drivers exist for these systems yet. If you
would like to write these drivers, *please*, contact me by email
or some other means. Feel free to look at existing drivers in
X11.c as well as at other code. More explanations follow.
You will need MSX.ROM file containing MSX BIOS and BASIC
code in order to run fMSX. Following games were successfully
run on fMSX:
Pacman Goonies CosmoExplorer
Rally-X Antarctic Adventure Raid On Bungeling Bay
Hype Comic Bakery Road Fighter
SnakeIt Sky Jaguar HAL Professional Golf
LodeRunner Super Cobra
Following games didn’t work:
King’s Valley Paskha Hyper Rally Zanac
Ye Ar Kungfu Othello Konami Tennis Athletic Land
Ye Ar Kungfu 2 Payload Knightmare Volguard
Konami Tennis Aroid Magic Wizard Riseout
Thinking Rabbit
I hope to fix the next version so that 90% games will work.
* HISTORY *
fMSX is an emulator of an old Z80-based family of home computers
known as MSX. MSX computers 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, Chilie] countries as well as in Europe [Holland, France]
and Soviet Union, but they are virtually unknown in USA. Although MSX
standard quietly died to year 1988, world got to see MSX2, MSX2+ and
TurboR extensions of it.
In spite of its sad history, MSX was a very nice computer,
especially useful in educational purposes which i clearly indicated
by example of Soviet Union. Russian ministry of education bought
hundreds of MSXes [and later MSX2s] grouped into "computerized
classroom systems" of 10-16 machines interconnected by a simple
network. Entire generation of programmers has grown up using these
computers.
Hardware-wise, MSX represents a hybride of a Nintendo Entertainment
System and a generic CP/M-80 machine. Its heart is Z80 CPU working
at 3.75MHz in the base model [frequency was rised up to 28Mhz in
TurboR]. The video subsystem is built around TI9918 or TI9928 VDP
chip also used in Texas Instruments’ own TI-99/4 computers. In the
later MSX models this chip was upgraded to V9938 [MSX2] and V9948
[MSX2+]. The latest version is V9958. The audio system is handled
by AY-8913 chip, same as one used in Sinclair ZX Spectrum audio.
AY-8913 provides 3 channels of synthetized sound, noise generation
and two general purpose parallel IO ports which are used for
joysticks and some other things in MSX design. Due to this hardware
structure, MSX machines were perfectly suitable for games and there
is a lot of good games either written or ported to them. You can find
more information about MSX and remaining MSX fans at
http://www.cs.umd.edu/users/fms/MSX/
* COMPILATION TIPS *
The fMSX is written in fairly portable C code and may therefore
be with any decent ANSI C compiler [Borland compilers choke, though:
the code is too complicated for them]. Standard CC or GCC should
do the job under Unix [although beware of GCC code generation bugs].
If you are working under MeSsyDOS or [God prohibits] Windows, use
WATCOM C which is known to compile fMSX right. On Amiga, use SAS/C.
If your compiler does choke up trying to compile Z80.c, try putting
#define LAME
into beginning of MSX.h file. This should simplify the code but it
will also make emulation slower. Also, don’t try to optimize code
generated from Z80.c file: most compilers will run out of memory
doing this, the resulting code is just to complex to optimize.
If you are using an Intel-based computer or any other machine
which has least-significant-byte-first data layout [for example,
DEC Alpha], insert
#define LSB_FIRST
into beginning of MSX.h file. fMSX will not work otherwise.
If you put
#define DEBUG
into beginning of MSX.h, the emulator will print debugging
information about Z80 registers after executing each command.
You can turn debugging on and off by setting Trace variable
to 1 and 0 accordingly.
When you port fMSX to a new machine, you have to write a set
of drivers for keyboard, sprites, and each screen mode you want
to emulate [usually SCREENs 0 - 2]. fMSX comes with a set of drivers
for X-Windows system. The code for these drivers is in X11.c. The
screen drivers use simple XSIZE*YSIZE array of bytes to generate
image, so in most cases you will only need to adjust these drivers
to your own needs. Note that the X11 drivers use so-called MIT
Shared Memory Extension for fast transfers from buffer to a window.
If you do not have MIT SHM extension in your system,remove
#define MITSHM
from MSX.h file. You can also turn MITSHM off [for example, if
you use remote X terminal] by setting UseSHM variable to 0 before
starting the emulation.
* CODE STRUCTURE *
Several other variables control the behaviour of fMSX. All
of them should be set before starting the emulation in order to
take effect:
Verbose = 0..4
Defines amount of debugging information printed by emulator.
Default value is 1.
IPeriod = 5000..50000
Defines how many Z80 commands should be execute between two
interrupts. Normal interrupt rate is 60Hz for NTSC systems or
50Hz for PAL systems. Default value of IPeriod is 10000.
UseSHM = 0/1
Use MIT SHM extension in X11 screen drivers. Default value
is 1. #define MITSHM should be present in order to use this
option.
Trace = 0/1
Print debugging information about Z80 state. Default value
is 1. #define DEBUG should be present in order to use this
option. Tracing can be turned on and off during execution
[for example, in keyboard driver].
Printer = "printer.out"
Name of file to output data sent to MSX printer. Default value
of this variable is NULL which causes fMSX to "print" to stdout.
CartA = "cartridge.file"
Name of a .ROM file to load into Slot 1. Default value is
"CARTA.ROM". This variable is ignored if no file exists.
CartB = "cartridge.file"
Name of a .ROM file to load into Slot 2. Default value is
"CARTB.ROM". This variable is ignored if no file exists.
In order to run the emulation:
1. Set all necessary variables.
2. Initialize screen and keyboard drivers [in the case
of X11 drivers, it is done by calling InitX() implemented
in X11.c and returning 1 on success or 0 otherwise]
3. Call StartMSX()
4. Shut down screen and keyboard [in X11 case, by calling
TrashX()].
5. Exit the program.
Take a look at fMSX.c to see an example of a sequence
explained above.