The cartridge

16,384 bytes, anchored in page 2 (0x8000-0xBFFF). All 16,384 are accounted for, and they break down like this:

rangebyteswhat it is
0x8000-0x800F16the AB header
0x8010-0xA3609,041the MSX-BASIC program, tokenised
0xA362-0xAFFF3,231the interpreter's variable table
0xB000-0xBF9F4,000the course data: all nine holes
0xBFA0-0xBFFF96nothing: nobody reads them

The header declares TEXT and nothing else

41 42 00 00 00 00 00 00 10 80 00 00 00 00 00 00
 A  B   INIT   STATEMENT   TEXT=0x8010   DEVICE

INIT zero, STATEMENT zero, DEVICE zero. The only thing the cartridge says is TEXT=0x8010, meaning "there is a BASIC program here, run it". And the interpreter runs it from the ROM itself, without copying it to RAM.

The program

246 lines, 718 statements, 9,041 tokenised bytes. Not one CALL or USR to real machine code: the only call, USR(0) in line 30000, points at address 0, so pressing STOP resets the machine.

The variable table: the boot trick

Between the program and the course data sit 3,231 bytes that are neither code nor authored data: they are the interpreter's variable tables, exactly as they were left in memory during a real session of the game. That is the trick that lets a BASIC cartridge with no INIT routine boot at all: the ROM carries the program and its state already set up.

tools/variables.py reads them. Out come 98 plain variables (0xA362 to 0xA728) and nine arrays (0xA729 onwards), in the same order the program creates them. And the session frozen inside was playing hole 2:

H  = 2        the hole
ZM = 0xB37A   the course read pointer, already on hole 3
HX = 60       hole 2's flag...
HZ = 139      ...with line 117's one-metre adjustment already taken off
P  = 3        its par
S8 = 12       twelve strokes in all, eleven of them on hole 1

That those figures agree with the course data is a check on the reading done from outside the program, and it is wired up as a test.

The last array does not fit: C1() starts at 0xAFA1 and would need 25 bytes more than are left. From 0xB000 on comes the course data, and it eats the rest. It does not matter: the interpreter rebuilds all those arrays when it runs the DIM in line 20.

The course data

Exactly 4,000 bytes, from 0xB000 to 0xBF9F, with the nine holes packed one behind the other. How they are read is in Findings.

holeaddressbytesholeaddressbytes
10xB00053260xB8BC444
20xB21435870xBA78438
30xB37A44680xBC2E408
40xB53845290xBDC6474
50xB6FC448