Getting started

A commented disassembly of 3D Golf Simulation - Normal Edition, the golf game T&E Soft released for the MSX in 1983: a 16 KB cartridge mapped into page 2 (0x8000-0xBFFF).

Except there is nothing here to disassemble. The cartridge holds not one Z80 instruction: what is inside is a 246-line MSX-BASIC program that the machine's interpreter runs straight out of the ROM. So the listing is the detokenised program, and the proof that it is exact is not reassembling it: it is retokenising it and checking that the same 9,041 bytes come back.

The cartridge is not here

No repository distributes the game. Put your own dump in the root as 3dgolf.rom, 16384 bytes, sha256

95d4e9dd82e60c614a471520d4e22ede94a5440a48f62376df62a74f093a8514

make comprueba checks it.

What each command does

make            builds the listing, retokenises it, cross-checks the data and runs the tests
make verify     the test that decides: retokenising must give the ROM back
make verifica   the three cross-checks on the course data
make densidad   how much of the listing is explained
make sanity     what each of the nine holes holds, counted from the data
make graficos   draws the nine holes from the cartridge's own bytes
make emulador   takes the VRAM dumps from openMSX (slow: see below)
make vram       compares what was drawn against those dumps
make web        rebuilds this site

How it is put together

src/3dgolf.bas is not edited by hand. tools/monta_bas.py builds it by joining the program freshly read from the binary with the comments in tools/comentarios_3dgolf.py. The reason is concrete: the program carries high bytes - the golfer's stances, the panel's labels - and an ordinary text editor runs them through UTF-8 and silently replaces them with the replacement character. It happened the first time the file was touched, and the error surfaced twenty lines further down.

The images are not captures either: tools/campo.py draws them by running in Python the program's own subroutines - 4000 for the plan view, 5000 for the 3D view, 7000 for the scaling - on an emulation of the SCREEN 2 display with its colour attributes. If the format were misunderstood, noise would come out instead of a golf course.

A warning about emulating it

The game writes the golfer's stances and the panel's labels with high bytes, which are the right graphics only on a Japanese MSX. On a European machine the course comes out the same - it is geometry - but those labels come out as other symbols. And the cartridge has to be anchored in page 2: see In the emulator.