Under the hood

Getting started

A commented disassembly of Hyper Sports 1, Konami's RC-715 for the MSX, a 16 KB cartridge that maps into page 1 (0x4000-0x7FFF). It reassembles into the exact ROM, byte for byte, and every one of its 16,384 bytes is accounted for.

The cartridge is not here

No repository ships the game. Put your own dump in the root as hypersports1.rom, 16384 bytes, sha256

440dae57676a98b5a3dd29f3e97b9c83a8cbe58a3d3f2172c6072d07e6f00754

make comprueba checks it.

What each command does

make            trace the flow, build the listing, reassemble it, run the tests
make verify     the test that decides: reassembling has to give the ROM back
make sanity     that not one byte is left unexplained, and no data reads as code
make densidad   how much is commented, routine by routine
make web        rebuild this website from the ROM and the notes

How it is put together

The listing is not hand-edited: tools/mkasm.py builds it from a flow trace and a file of notes anchored to addresses, so the comments survive a re-trace. The tracer follows the flow from the entry points; the ones it cannot deduce on its own -the interrupt hook and the inline jump tables- are declared in src/hypersports1.entries, each with its reason.

The cartridge

16 KB in page 1 (0x4000-0x7FFF), with no bank switching. The "AB" header declares only INIT (0x4077).

What INIT does

INIT sets interrupt mode 1, writes a jp into the H.KEYI hook (0xFD9A) pointing at 0x402C, puts the stack at 0xE400, clears the work RAM 0xE000-0xE3FF, and then falls into a jr to itself at 0x40A4. From that point on the main program does nothing: the interrupt, once per frame, runs the whole game.

The screen

SCREEN 2. The cartridge does not store whole screens: it stores scripts. The name table is filled by the interpreter at 0x405E, and the pattern and colour tables by the run-length decompressor at 0x440D.

The RAM map

Everything the game touches lives from 0xE000 up, under the stack at 0xE400:

The code

The state machine

The interrupt (0x402C) calls 0x40A6 every frame. It reads 0xE000, the main state, and with it a jump through the table at 0x40C2 reaches one of the handlers; the high byte, 0xE001, is the sub-state. Bit 6 of 0xE002 marks the demo, and 0x40A6 pushes as the return address either the game handler (0x430A) or the demo one (0x44C9) before jumping to the state handler.

Two drawing interpreters

Nothing on screen is a stored bitmap. Two interpreters build the VRAM:

Two players in one place

The event runs on the block at 0xE050. When the turn changes, 0x413E swaps that block with the one at 0xE080 in a single 32-byte routine, so every other routine always works on 0xE050 without caring who is playing.

The sound

0x7C3D is the per-frame player: three eleven-byte channel records at 0xE010, each reading its melody with a small command interpreter and writing the PSG through the BIOS. It is the framework Konami reused across its MSX cartridges, with its tone table and effects at the end of the ROM.

In the emulator

The listing and every number on this site come from the binary and are reproducible with make. Nothing here was measured by eye.

Running it

openmsx -machine Philips_VG_8020 -cart hypersports1.rom

An MSX1 machine is enough; the cartridge maps into page 1 and drives everything from the frame interrupt.

What can be measured

To confirm a state or a timing, put a breakpoint and watch the RAM the notes name: 0xE000 is the main state, 0xE052 the event, 0xE054 the attempts left. The per-frame cost of a routine is the difference of machine_info time between a breakpoint at its entry and one at its ret, times 3579545 for Z80 cycles.

Output paths in any Tcl script must be Windows paths, never /tmp.

The two scripts in this repository

make vram runs both. Neither needs anyone to play: the attract mode plays all four events on its own from power-on, and it is deterministic —two independent runs give byte-identical dumps.

What does NOT work: screenshots

openMSX's screenshot lags behind the Tcl script, and does not match the VRAM read of the same instant. Checked twice, and with the machine paused too: asking for the trampoline scene produced the previous event's screen, and asking for the horizontal bar produced the start-up logo. VRAM, read synchronously with debug read_block, is from the instant asked for, and that is why this site's images are drawn from it and from the ROM, never from a capture.

Code shared with other Konami cartridges

This disassembly has been compared, instruction by instruction, with every other Konami one in the series. A block counts when the same instructions, at least six of them from a label to its ret or its unconditional jump, are in both cartridges; the addresses are left aside, because they change from one cartridge to the next. Of the other 57, 42 have at least one block in common with this one; these are the ones that share the most:

Cartridge Blocks Instructions For example (here = there)
Magical Tree 25 341 MANEJADOR_DEMO (0x44C9) = atiende_el_menu
Circus Charlie 21 276 MANEJADOR_DEMO (0x44C9) = atiende_el_menu
Cabbage Patch Kids 17 210 LEE_TECLADO (0x44A4) = LEE_EL_TECLADO
Konami’s Mahjong Dojo 15 186 SUMA_BONUS_7BE3 (0x7BE3) = carga_los_canales
Comic Bakery 12 174 MANEJADOR_DEMO (0x44C9) = atiende_el_menu
Hyper Olympic 1 9 105 SUMA_BONUS_7BE3 (0x7BE3) = MONTA_UN_CANAL
Hyper Olympic 2 9 105 SUMA_BONUS_7BE3 (0x7BE3) = MONTA_UN_CANAL
Super Cobra 9 117 DESCOMPRIME_A_TERCIOS_4748 (0x4748) = SUBE_LOGOTIPO
Konami's Ping Pong 7 88 LEE_TECLADO (0x44A4) = lee_teclado_1
Road Fighter 7 76 SUMA_BONUS_7C17 (0x7C17) = enciende_o_apaga_canales

The whole matrix, the 58 cartridges against each other, is on The routines in the series database, along with the method and the program that measures it.