Under the hood

Rebuilding the three disks

make verify     # reassembles the 19 modules with pasmo and rebuilds the three .dsk, compared by sha1
make test       # tests/: the module table, the boot and what the web says, checked on the disks

You need the three disk images, which are not distributed, in disk/ as disco1.dsk, disco2.dsk and disco3.dsk, with these sha1:

Disk sha1
1, Opening Disk 155702d3d41b8f8b3d4659d42aa474ce12f4d3c9
2, Game Disk A 9877150e691d41b615683684cf0b78fc84649d37
3, Game Disk B 9ab94b449cb3b2c7ea7f87c2f03eebfacddc4019

tools/rehace_dsk.py builds each disk from the reassembled modules and the rest of its sectors: all three come out identical byte for byte.

Disks without files

The disks have no file system: sector 0 starts with EB 05 00 and has no MSX-DOS table. The MSX's disk ROM reads it at 0xC000 and calls 0xC01E, and from there on everything is read by sector number, with the disk system's function 0x2F (DE = first sector, H = how many) to fixed addresses. What is in each sector is known only from the code that asks for it, so every read was followed in the code and measured while running (tools/cobertura.py): on disks 2 and 3 every sector is accounted for; on disk 1 there are 10 left without a reader (Curiosities).

The loader keeps the screen, the keyboard, the music and the disk, and runs the rest through a table of steps; each program is loaded at 0x0200 (and 0x4000 when it is in two pieces), on top of the previous one; the results, at 0x0800, on top of the race.

The 19 modules

Module Disk Sectors Runs at Bytes What it is
arr1, arr2 1, 2 0 0xC000 512 sector 0: reads the loader
arr3 3 0 0xC000 512 sector 0 of disk B: asks for disk A and reads its loader
carg1 1 4-11 0x8000 4,096 the loader of the Opening Disk
carg2 2 4-11 0x8000 4,096 the loader of the game, also for disk B
pre1, pre2 1, 2 2-3 0x4000 1,024 the Konami logo
tit1, tit2 1, 2 1424-1426, 880-883 0x0200 1,536 / 2,048 the title screen
intro1 1 16-47 0x0200 16,384 the tour of the menus
demo1a, demo1b 1 1040-1102 0x0200, 0x4000 32,256 the demonstration race
son1 1 912-927 0x9000 8,192 the Opening Disk's music (FM)
son2fm 2 768-783 0x9000 8,192 the game's music with MSX-MUSIC (FM)
son2 2 800-812 0x9000 6,656 the game's music without it (PSG)
juego2 2 16-46 0x0200 15,872 the menus: modes, circuits, car, Grand Prix
carr3a, carr3b 3 24-86 0x0200, 0x4000 32,256 the race
res3 3 960-978 0x0800 9,728 the results, which write the season to disk A

The loader chooses the music by itself: it looks for MSX-MUSIC in the slots (the texts APRL and OPLL of its ROM) and reads son2fm if it finds it, son2 if not.

In all, 77,378 bytes of code and 67,518 of data inside the modules; 5,011 routines and 39,025 instructions, with 23,330 comments (59.8%).

The split screen

The race screen is two screens in one. The video chip interrupts the program at a line of the screen (line interrupt, register 19): above it, the landscape and the road; below it, the cockpit, with another page of video memory and another scroll. During the road part the program changes the horizontal scroll (registers 26 and 27, which only the V9958 of the MSX2+ has) on every line, and that is the bend. With the screen two pages wide (register 25), the landscape turns round without being drawn again.

The Grand Prix on disk

At the end of each race of the season, res3 writes sector 1088 of disk A with the disk system's function 0x30: a byte with the number of entries in use and up to four entries of 128 bytes (the next race, the settings, the name, the order of the drivers and their points, in BCD). The menu program reads it back to continue the season.

The tools

Tool What it does
tools/f1run.py the game running: a Z80 (tools/z80run.py), a V9958 (tools/msx2run.py), the slots, the interrupts and the disks served from the .dsk files, writes included
tools/foto.py, tools/gif.py paint a frame like the MSX does (split screen, scroll per line, sprites) and record played GIFs
tools/yjk.py paints the SCREEN 12 pictures from the disk sectors
tools/planos.py, tools/circuitos.py the circuit maps (decompressed as the game does) and the circuit table
tools/modulos.py, cruce.py, vivo.py, mkasm.py the module table, the tracing (with what was run in f1run) and the commented listing
tools/rehace_dsk.py rebuilds the three disks from the listings
tools/cobertura.py which sectors the game reads and what the others are

The race and pictures were checked against openMSX: the upper half of the race screen gives 0 points different in 5 of 6 frames compared; the title's video memory, 0 bytes different of 131,072.