MSX emulator and Z80 IDE
An MSX1 in your browser — TMS9918A video (every mode, sprites, fifth-sprite and collision flags), AY-3-8910 sound, slots, mapper cartridges with Konami SCC, and .CAS tapes — booting the open-source C-BIOS (or your own MSX BIOS for BASIC), with a Z80 assembler, MSX examples and a debugger with breakpoints beside the code, VDP, PSG and slot views.
Added
How to use it
Press Power on, or just Assemble & run in the Code & debug tab — the MSX starts by itself. It boots C-BIOS, an open-source MSX BIOS, which starts cartridges: with nothing in the slot it shows its banner and "No cartridge found". Click the screen to give it the keyboard.
Running software
Drop a file on the screen, or use Open file…:
-
.ROM / .MX1 / .MX2 — a cartridge goes into slot 1 and the MSX restarts. The mapper (plain, ASCII 8 KB, ASCII 16 KB, Konami, Konami SCC) is detected from the bank-switch writes in the code; the menu beside the cartridge name overrides it.
-
.CAS — a tape. With your own MSX BIOS the page types
BLOAD"CAS:",R,CLOADorRUN"CAS:"for the first file, and the tape loads instantly through the BIOS tape routines. C-BIOS has no BASIC, so there a binary file is put in RAM and called directly. -
.BIN in BLOAD format (
FE, start, end, run address) — copied into RAM and called.
The Software tab opens a URL or an archive.org item. Eject empties the slot.
Writing Z80 code
The examples are MSX programs: hello world with CHPUT (&H00A2), SCREEN 2 filled by writing
to the VDP’s ports, a 16 × 16 sprite on the cursor keys, the fifth-sprite and collision flags,
a tune on the PSG, a Konami SCC arpeggio, colour bands in the border timed against the frame
interrupt, the keyboard matrix through SNSMAT, and a program in RAM.
A program that starts with a cartridge header at ORG $4000 (DB "AB", DW start) runs as a
cartridge: Assemble & run (Ctrl/⌘+Enter) puts it in slot 1, restarts the MSX and the BIOS
calls it. Anything else (at ORG $C000, say) is copied into RAM once the BIOS is idle and
called, as BLOAD ,R would; RET returns. A first line ; mapper: konamiscc (or ascii8,
ascii16, konami) picks the cartridge mapper. Build .ROM saves the cartridge for other
emulators or a flash cartridge; Build .CAS makes a tape of a RAM program.
The BIOS entry points and system variables are predefined (CHPUT, CHGMOD, WRTVDP,
LDIRVM, GTSTCK, FORCLR, JIFFY…), and numbers can be written &H1B00 and &B1010 as
in MSX BASIC, as well as $1B00, 1B00h and %1010. The assembler is this site’s
Z80 assembler (labels, local .labels, ORG, EQU, DB, DW,
DS, expressions, every undocumented instruction).
Debugging
Beside the editor are the screen, the controls — Run/Continue (F5), Pause (F6), Step (F11), Step over (F10), Step out (Shift+F11), Run to cursor (Ctrl+F10), Reset — the registers (type to change one), the flags (click to flip), the code around PC, the stack and watches. Click a line number to set a breakpoint (●); right-click it to run to that line. When the program stops, ▶ marks the line in the editor; inside the BIOS the panel says which slot the code is in.
-
Debugger — registers with the alternate set, interrupt state and whether the VDP is asking for an interrupt, the scan line and T-state, a disassembly that names BIOS calls and system variables (
CALL CHPUT,LD A,(FORCLR)), breakpoints, and memory as the CPU sees it through the slots (click a byte to change it). -
VDP — registers R0–R7 decoded (click to change), the status register, the mode and table addresses, the pattern table, the sprite attribute table, and the 16 KB of video memory. Point at the screen to see the name, pattern and colour addresses under the pointer.
-
Sound — the PSG registers as frequencies, mixer and volumes; the SCC’s channels and waves.
-
Slots — port $A8, which slot each 16 KB page shows, every slot’s contents and the cartridge’s current banks. Tick Expand slot 3 to watch secondary slots at work.
-
Tape — the files on the tape, and the tape that
CSAVE/BSAVE"CAS:"write (with your own BIOS), to download.
The machine
An MSX1 as C-BIOS’s own MSX1 configuration describes it: slot 0 the BIOS (and the C-BIOS logo ROM), slots 1 and 2 cartridges, slot 3 64 KB of RAM. The Z80 runs at 3.58 MHz with the MSX’s extra wait state on every opcode fetch; a frame is 262 lines of 228 T-states (313 at 50 Hz) and the picture is drawn line by line, so changes in mid-frame (border colour, registers) show where they happen.
-
TMS9918A — Graphic 1 and 2, Multicolour and Text, plus the undocumented mixed modes; sprites 8 × 8 or 16 × 16, magnified, with the early-clock bit, at most four per line (the fifth sets 5S with its number), collisions (transparent sprites collide too), and the frame interrupt. Colours are the RGB values MAME and openMSX use.
-
AY-3-8910 — three tones, noise and the envelope, with the joystick ports on register 14.
-
8255 PPI — slot select, the keyboard matrix (international layout) and the key click.
-
Cartridges — plain ROMs placed by their header, and the MegaROM mappers ASCII 8, ASCII 16, Konami and Konami SCC with the SCC’s five wave-table channels.
BIOS
C-BIOS 0.29a ships with this page under its BSD-style licence — © 2002–2011 BouKiCHi, Reikan, Maarten ter Huurne, Albert Beevendorp, Patrick van Arkel, Manuel Bilderbeek, Joost Yervante Damad, Jussi Pitkänen and Eric Boon; the full licence is in NOTICE.txt beside the ROMs. The toolbar chooses its 60 Hz or 50 Hz version. For MSX BASIC, drop the 32 KB BIOS + BASIC ROM of an MSX1 you own on the BIOS tab: it stays in this browser (IndexedDB) and is never uploaded.
Keys
Keys map by position onto the international MSX keyboard: Shift, Ctrl, Alt (GRAPH), right Alt (CODE), Caps Lock, F1–F5 (outside the debugger’s F5/F6/F10/F11), Esc, Tab, End (STOP), Page Up (SELECT), Backspace (BS), Insert, Delete, Home and the cursor keys. The Keyboard tab can put the arrows on joystick 1 instead (Space fires). A gamepad drives joystick 1. The on-screen keyboard is for phones.
Limits
-
MSX1 only: no V9938 (MSX2) video, memory mapper or RTC. No disk drive, no MSX-MUSIC, no printer.
-
The VDP’s VRAM access timing isn’t modelled (real MSX1 code must leave time between `OUT`s in the visible area; here every write lands).
-
Tapes load only through the BIOS routines (instantly); custom turbo loaders in machine code don’t work, and there are no WAV tapes.
-
Sound is generated a frame at a time; SCC register changes take effect per frame. The PSG volume curve is an approximation.
-
Mapper detection is a heuristic: if a game doesn’t start, pick the mapper by hand.
Linking to an example
Share link copies a URL with the example (or your source), the tab, the BIOS and the arrow keys — never cartridges, tapes or ROMs.
| Parameter | Values |
|---|---|
|
|
|
the tab: |
|
|
|
|
|
|
For example ?example=sprite-limit&mode=vdp&run=1
opens the fifth-sprite example running with the VDP tab showing the status register, and
?example=scc&mode=sound&run=1 plays the SCC.
Feedback is a gift. Something to improve, a feature to add, or a bug? Tell me.
Runs entirely in your browser; nothing you type leaves this page.