Another World VM
Another World VM Port
A port of Delphine Software’s Another World (1991) running natively on the Technics KN5000 keyboard. The game’s original bytecode interpreter is reimplemented in TLCS-900/H2 assembly, executing the unmodified game data of the MS-DOS release on the KN5000’s hardware.
Project Page: felipesanches.github.io/technics-anotherworld Source: GitHub
Overview
| Property | Value |
|---|---|
| Target CPU | TMP94C241F (TLCS-900/H2) @ 16 MHz |
| Display | MN89304 VGA controller, 320x240 @ 8bpp |
| Input | Control panel buttons via SC1 synchronous serial |
| Build Targets | Standalone maincpu ROM (2 MB). An HDAE5000 extension build (512 KB) compiles, but the game’s 974 KB of resources do not fit, so at most the intro can run that way |
| Game Data | Original MS-DOS release resources (MEMLIST.BIN + BANK01-BANK0D: bytecode, polygons, palettes, bitmaps) |
The KN7000 port, on the real instrument
The same VM also runs on the Technics KN7000, rewritten for its Panasonic MN10300 CPU. One build is a program for the project’s SD loader: the stock firmware starts it from the SD card through STYLE CONVERT and one loader floppy. That build runs on the owner’s KN7000:
- Speed. The first run on the unit, on 2026-10-20, managed 1.5 frames per second, because the LCD frame is slow to write. A blit that writes only the pixels that changed brought it to 19-21 frames per second over a whole run, 25-30 at best.
- Sound. The game plays its own samples on the KN7000’s effects DSP: an eight-voice mixer of
ours runs inside the firmware’s DSP kernel, and the 93 sounds go into the DSP’s SDRAM once per
power-on. A second mode plays them as MIDI notes on the instrument’s tone generator, written into
the firmware’s MIDI IN 1 receive ring. PART SELECT RIGHT 2 switches between the two and off. Its
music player produces the intro’s sync marks (variable
0xF4) in every mode. Both modes have played on the owner’s instrument. - Controls. Since its third round (2026-10-21) the keybed alone plays the game: F5 and C6 left and right, A♭5 or B♭5 up, A5 down, C4 and below the action; PART SELECT RIGHT 1 mutes the instrument’s own notes for those keys. The sample bank is also coded, so it loads in 11.6 s in MAME where it took 25.9. That round has run only in MAME so far.
- Memory. It loads each part’s files from the card when the part starts and keeps everything in the RAM the firmware leaves to a converter. It never touches the battery-backed panel memories.
The details, with the memory map, the controls and the unit’s own speed figures, are on Your Own Code on a Stock KN7000. A second KN7000 build, a ride-along in the SP7001 SD plug-in, is silent and runs in MAME only (SP7001 homebrew).
The KN5000 style-converter build
Since 2026-10-22 the KN5000 VM also runs on a stock KN5000, as a style converter: AW.CNV, with
the game’s files on the same floppy, started from DISK MENU > STYLE CONVERT. It runs in MAME on
firmware v5 to v10, with the controls on the panel and on the keybed and the game’s sound on the
instrument’s own voices; it has not run on a real KN5000 yet. The details are on
Your Own Code on a Stock KN5000. The game’s own samples, as
on the KN7000, would need the KN5000’s effects DSP:
DSP Sample Playback — Research Plan.
The rest of this page is about the KN5000 port’s standalone ROM builds, and the VM they share with the converter.
Architecture
The game uses a bytecode virtual machine originally designed for the Amiga (Motorola 68000). The VM interprets big-endian bytecode on a little-endian CPU, requiring byte-swap operations (EX W, A) on every 16-bit fetch.
VM Execution Model
- 64 threads with cooperative multitasking (no preemption)
- Each thread has a program counter stored in
THREADS_DATA - Register
XIXtracks the current bytecode position during execution - Thread scheduling happens at frame boundaries via
NEXT_THREAD
Bytecode Opcodes
All 27 opcodes (0x00-0x1A) are implemented:
| Range | Category | Examples |
|---|---|---|
| 0x00-0x05 | Variables and calls | MOVCONST, MOV, ADD, ADDCONST, CALL, RET |
| 0x06-0x0A | Flow control | PAUSETHREAD (break), JMP, SETVEC, DJNZ, CONDJMP |
| 0x0B-0x10 | Palette, threads and pages | SETPALETTE, RESETTHREAD, SELECTVIDEOPAGE, FILLVIDEOPAGE, COPYVIDEOPAGE, BLITFRAMEBUFFER |
| 0x11-0x12 | Threads and text | KILLTHREAD, DRAWSTRING |
| 0x13-0x17 | Arithmetic and logic | SUB, AND, OR, SHL, SHR |
| 0x18-0x1A | Sound and resources | PLAYSOUND, LOADRESOURCE, PLAYMUSIC |
| 0x40/0x80 | Video | Polygon/sprite rendering |
Video Rendering
Four 320x200 game pages (64,000 bytes each, one per 64 KB slot) support double-buffered rendering; the 320x200 image is drawn 20 lines down on the 320x240 LCD:
- Polygon engine: Interprets vertex lists from video data resources, drawing filled convex polygons
- Bitmap loader: Decompresses full-screen images (ByteKiller algorithm)
- Palette: 16 colors, 4-bit per channel (0x0RGB format), mapped to MN89304’s 4-bit DAC
Memory Layout
Maincpu target (standalone ROM):
| Address | Size | Contents |
|---|---|---|
| 0x010000 | 64 KB | VM variables, thread data (the stack grows down from 0x001000, below this block) |
| 0x020000 | 64 KB | Page buffer 0 |
| 0x030000 | 64 KB | Page buffer 1 |
| 0x040000 | 64 KB | Page buffer 2 |
| 0x050000 | 64 KB | Page buffer 3 |
| 0x060000 | — | Offscreen buffer (used by vga_init) |
| 0xE00000 | 2 MB | Program ROM (code + game resources) |
Extension target (HDAE5000 slot):
| Address | Size | Contents |
|---|---|---|
| 0x200000 | 64 KB | VM variables, thread data, stack |
| 0x210000 | — | Offscreen buffer |
| 0x240000-0x27FFFF | 4 x 64 KB | Page buffers 0-3 |
| 0x280000 | 512 KB | Extension ROM |
Input System
The KN5000’s control panel buttons are read via SC1 synchronous serial at 250 kHz. The game polls three button segments each frame (CPL_SEG10’s HELP and OTHER PARTS/TR open the help screen and the password part):
| KN5000 Button | Segment | Bit | Game Action |
|---|---|---|---|
| Part Select: RIGHT 2 | CPR_SEG4 | 1 | Jump (UP) |
| CONDUCTOR: LEFT | CPR_SEG4 | 4 | Move LEFT |
| CONDUCTOR: RIGHT 2 | CPR_SEG4 | 5 | Crouch (DOWN) |
| CONDUCTOR: RIGHT 1 | CPR_SEG4 | 6 | Move RIGHT |
| VARIATION 4 | CPL_SEG4 | 3 | ACTION (run/kick/draw gun) |
The converter build also reads the keybed: the firmware’s interrupt path still writes each key’s
note and velocity into the main CPU’s note ring (0x202CB), which the game drains each frame. F4 and
C5 move left and right, A♭4 or B♭4 is up, A4 down, C3 and below the action
(details).
Serial Protocol
Each button query is a 4-byte exchange:
- Send command byte (
0xE0for right panel,0x20for left panel) - Send segment number (
0x04) - Send dummy byte (
0xFF) — response header received - Send dummy byte (
0xFF) — button bitmap received
The TX complete flag (INTES1 bit 7) is polled between bytes. The baud rate generator (BR1CR = 0x14) provides the 250 kHz clock — not the TO2 trigger, which would be corrupted by Timer 1 system tick interrupts.
Frame Timing
A hardware timer provides frame pacing:
- Timer 0/1 cascade at 12,500 Hz (80 µs per tick)
INTT1ISR incrementsSYSTEM_TICKScounterBLIT_FRAMEBUFFERpauses forvar[0xFF]slices of 20 ms (250 ticks each), stamps the time, then shows the page, as the reference engine does: the whole frame’s work counts toward the pause (until 2026-10-23 the page was shown first and the next frame timed from the end of the thread loop, so frames ran about 1.5 times too long; the converter build measured 124 ms for an 80 ms frame, now 85)- DJNZ fallback counter bounds the wait if the timer does not run
- The converter build counts the firmware’s own 488 Hz Timer 1 ticks at
0x0409instead (10 a slice)
Game Parts
The game consists of multiple “parts”, each with its own set of resources (bytecode, video data, palettes):
| Part | ID | Description |
|---|---|---|
| 0 | Protection/Logo | Interplay logo, copy protection (bypassed) |
| 1 | Intro | Opening cinematic |
| 2 | Water | First gameplay level |
| 3 | Prison | Escape sequence |
| 4 | Citadel | Main exploration |
| 5-7 | Arena/Baths | Later levels |
| 8-9 | Password | Password entry screen |
Part switching loads new resources and reinitializes the VM. Copy protection checks (parts 0, 2, 4, 8-9) are bypassed by pre-setting VM variables at startup.
Build and Test
cd technics-anotherworld/
make # Build maincpu ROM + create MAME ROM set
make extension # Build as HDAE5000 extension ROM (resources do not fit: intro only)
make test TARGET=extension # Run the extension build (plain `make test` runs the maincpu build)
Requirements:
- ASL Macro Assembler 1.42 Beta (
aslandp2bin; Makefile variableASL_PATH, default../../tools/asl) - Original KN5000 ROMs (for MAME ROM set). Pass their directory as
ORIGINAL_ROMSand the ROM-set output directory asROMSET_BASE: the Makefile’s defaults are paths on the author’s machine - The MS-DOS game data files (MEMLIST.BIN and BANK01-BANK0D) in
game_data/MSDOS/;tools/extract_resources.pyextracts the resources from them - A checkout of kn5000-roms-disasm at
../../kn5000-roms-disasm(Makefile variableDISASM_REPO), whosearchive/asl/sources the build includes
Implementation Status
| Feature | Status |
|---|---|
| All VM opcodes (0x00-0x1A) | Implemented |
| Polygon rendering | Working |
| Bitmap decompression | Working (ByteKiller) |
| Palette management | Working (4-bit DAC) |
| Frame timing | Working (hardware timer, 12,500 Hz cascade) |
| Part switching | Working (all protection checks bypassed) |
| Input (directions + action) | Working (SC1 serial to cpanel HLE) |
| MAME control panel | Fully working — both left and right panels |
| Copy protection bypass | Working (var[0xBC], var[0xDC], var[0xF2]) |
| Sound effects | On the instrument’s voices in the converter build (above); stub in the ROM builds |
| Music | On the instrument’s voices in the converter build, sync marks in var 0xF4; stub in the ROM builds |
The MAME KN5000 driver’s control panel HLE (High Level Emulation) was developed alongside this VM. All serial communication bugs discovered during VM development were fixed while maintaining compatibility with the original KN5000 firmware. See the Serial Firmware Compatibility report for details.
Technical Challenges
Endianness
The original game was designed for the big-endian Motorola 68000. Every 16-bit value fetched from bytecode must be byte-swapped (EX W, A after LD WA, (XIX)) on the little-endian TLCS-900.
4-bit Palette DAC
The MN89304’s RAMDAC is 4-bit (0-15), not 6-bit like standard VGA. The game’s 4-bit palette values (0x0RGB format) map directly without scaling.
Copy Protection
The original game includes protection checks that read specific VM variables. These are bypassed by initializing var[0xBC], var[0xDC], and var[0xF2] to expected values at startup.
Indexing with a whole register
CHECK_THREAD_REQUESTS walked the 64 threads with LD A, 0 but indexed the thread table with all of
WA. On the frame a part switch ran, W still held what initForPart left in it, so that frame’s 64
thread updates went 0x2800 bytes past the thread table. In the converter build that is the middle of
the new part’s bytecode, and dying or climbing out of the lake froze the game; the ROM builds wrote
elsewhere. Fixed 2026-10-22 (LD WA, 0); the other loops already cleared W.
FREEZE Semantics
The VM’s thread freeze mechanism is persistent: CHECK_THREAD_REQUESTS applies thread->state = thread->requested_state every frame without clearing the request. The REQUESTED_STATE is initialized to NOT_FROZEN. RESET_THREAD type 0 = unfreeze, type 1 = freeze. This matches the reference implementation — threads stay frozen until explicitly unfrozen by another thread’s opcode.
Related Pages
- CPU Subsystem — TMP94C241F architecture
- Display Subsystem — MN89304 VGA controller
- Control Panel Protocol — Button/LED serial protocol
- Memory Map — KN5000 address space
- HDAE5000 — Extension board (alternative build target)
- Your Own Code on a Stock KN5000 — the style-converter build
- DSP Sample Playback — Research Plan