jsMSX

The first MSX Emulator 100% written in Javascript

Currently at version 0.9.2

About | Introduction | Download | To Do | Acknowledgements | Disclaimer | Requirements | The Online Emulator | ChangeLog

jsMSX is a MSX emulator 100% written in Javascript. Yes, you read it: Javascript!

It emulates the underlying Z80 CPU, TMS9918 Video Display Processor (VDP), PPI, RAM slots and Megaram. In its present form, it should be able to run any program or game developed for MSX 1.0.

Since Javascript currently is mostly an interpreted language in web browsers, it is at least an order of magnitude slower than other languages such as C and Java. Therefore, jsMSX requires a very fast computer to emulate MSX at the normal 50-60 interrupts per second inside a web browser, and it faces many performance challenges. They present an interesting testbed for pushing the current Javascript webbrowser implementations to their limits and for comparing their relative speed.

The initial motivation was to find some interesting project to develop while exploring the possibilities of the [canvas] tag and Javascript language in the most recent web browsers (like Firefox 2+) which implement an accelerated mechanism for displaying graphics. jsMSX can also be used to tightly integrate existing MSX programs in web page logic.

Current web browsers like Firefox 1.5, Opera 9.0, Safari and IE 6.0 with Google's Canvas Plug-in should be able to run jsMSX too from version 0.9.2 onwards, albeit a bit slower because they do not implement the accelerated access to the canvas element.

Download

You can download the Javascript source code of jsMSX in the project page.

Or you can directly list the jsMSX SVN repository files.

To Do:

Lots of work to optimize the performance and add MSX 2.0, 2.0+ and TurboR features are still necessary. Version 1.0 will release an optimized javascript engine for MSX 1.0. Version 2.0, 3.0 and 4.0 will be compatible with MSX 2.0, 2.0+ and TurboR respectively. An uncompress javascript function able to read zip and lhz file streams is also necessary to load compressed rom files. If you think you'd like to participate, are just curious or want to say hello, please have a look at the project.

Acknowledgments:

The ancestry of this project can be traced from Davidson&Pollard's Z80 class of the Java Spectrum Emulator, which was used in Murilo Queiroz's Java Phoenix Emulator (first Java Arcade emulator), which was used in Arnon Cardoso's Java MSX Emulator (first Java MSX emulator), from which portions of the initial javascript code was derived after reading this thread: http://www.msx.org/forumtopic4176.html. Thank you all for your past efforts!

Requirements:

jsMSX requires a web browser that is able to execute Javascript 1.3 and that implements the tag [canvas], for instance Firefox 1.5 or 2.0+, Opera 9.0, Safari and IE 6.0 with Google's Canvas Plug-in.

If the methods getImageData() and putImageData() are available, for instance in Firefox 2.0, it is possible to use a mechanism for displaying graphics faster. Therefore, currently FF 2.0 is the recommended platform to run jsMSX on.

For now, I have tested jsMSX only on FF 1.5 and FF 2.0. The core jsMSX files should work on any browser with the tag [canvas]. If you know of any other web browsers in which jsMSX works, please drop a line to the project forum.

Disclaimer:

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. The full license is available at http://www.gnu.org/licenses/gpl.html This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

jsMSX Copyright (c) 2006 Marcus Granado [mrc.gran(@)gmail.com]

The Online Emulator:

You can find an online demonstration of the jsMSX emulator here.

ChangeLog:

[20060824] jsMSX 0.9.1 - First public version released.
-Emulates MSX 1.0 Z80,VDP and PPI

[20060902] jsMSX 0.9.2
- new fallback gfx support for web browsers implementing only unaccelerated 
[canvas] tag (i.e. without get/putImageData() gfx acceleration methods), 
such as Firefox 1.5, Opera 9.0, IE 6.0 and Safari. jsMSX will now run on 
them, albeit slower. 
- optimization of Z80 code with 2x improvement in performance (many 
function calls replaced for direct assignment). 


TODO until jsMSX 1.0: 
-optimize javascript code, specially Z80 emulation and (V)RAM access.

[?] jsMSX 1.0 - MSX 1.0 optimized emulation

[?] jsMSX 2.0 - MSX 2.0 emulation

[?] jsMSX 3.0 - MSX 2.0+ emulation

[?] jsMSX 4.0 - MSX TurboR emulation