make verify # reassembles the 17 modules with pasmo and rebuilds the three .dsk, compared by sha1
make test # tests/test_disco.py: what is claimed about the disks, checked on the disks
You need the three dumps from the TOSEC collection (Snatcher (1988)(Konami)(JP)(Disk N of 3)[SCC].dsk), which are not distributed, with these sha1:
| Disk | sha1 |
|---|---|
| 1 | fc08624f1a85f44e333f13304069def6889b4898 |
| 2 | 30c7fe07d320abb281ba5d473d853bfa7785248b |
| 3 | c088e3e1b0d771c42b1c474c064be146afc6564e |
tools/rehace_dsk.py builds each disk from the reassembled modules and the rest of its files: all three come
out identical byte for byte.
The disks do not use MSX-DOS: the loader carries a table of 71 files (0xC6CC, one word each: the disk in the
top 3 bits and the sector in the next ones) that covers the three disks whole, with no gaps. tools/mapa.py says
what each one is (and a test checks that none is left unexplained):
| Files | What they are |
|---|---|
| 00-02 | sector 0 of each disk (the boot) |
| 03-0D, 44-46 | code: the 17 modules (below) |
| 0E-10 | each disk's text pages |
| 11-13 | each disk's script (pages at odd positions) |
| 14-16 | each disk's picture lists (0x60-byte records read by f08) |
| 17-19 | the script scenes (0x200-byte records; a header with 11 entries) |
| 1A-1C | the menus (0x500 bytes) |
| 1D-1F | script lists (0xA00 bytes) |
| 20-22 | the graphics records (they say which graphics file and from where) |
| 23-3A | the graphics, eight files per disk |
| 3B-3D | the kanji font: glyphs, another piece and an index of 1,612 codes |
| 3E-40 | each disk's music |
| 41 | the data of the credits program (f0A) |
| 42 | sound driver data |
| 43 | the saved games |
| Module | Disk | ORG | Bytes | What it is |
|---|---|---|---|---|
| f00 | 1 | 0xC000 | 512 | sector 0 of disk 1: the boot |
| f01, f02 | 2, 3 | 0xC000 | 512 | sector 0 of disks 2 and 3 (they jump to 0xB000 without checking) |
| f03 | 1 | 0xB000 | 512 | sector 1: reads the loader |
| f04 | 1 | 0xC000 | 5,632 | the loader: files, banks, interrupt, keyboard, sound, VDP |
| f05 | 1 | 0x4000 | 16,384 | the engine, in the cartridge's banks 0-1: the script, the text, the objects |
| f06 | 1 | 0x8000 | 1,536 | the start-up |
| f0B | 1 | 0xD200 | 512 | loads the kanji font into RAM and f08 into VRAM |
| f46 | 1 | 0x8000 | 1,024 | bank 2 routines |
| f0D | 1 | 0x8000 | 7,680 | the sound driver, in banks 6-7 |
| f08 | 1 | 0x7000 | 4,096 | the graphics: kept in VRAM (0x18000) and put at 0x7000 when needed |
| f09 | 1 | 0x7000 | 512 | saving and loading the game |
| f07 | 2 | 0x9000 | 2,048 | the shooting range (Junker's Eye) |
| f0C | 1 | 0x9400 | 1,024 | the 9-cell aim |
| f45 | 3 | 0x9400 | 1,024 | another aim, which moves in 8 directions |
| f0A | 2 | 0x8000 | 14,336 | another program: the credits, with compressed text |
| f44 | 1 | 0x6000 | 4,608 | Konami's debugger, never loaded (Curiosities) |
In all, 35,104 bytes of code and 27,360 of data inside the modules; 2,194 routines and 18,020 instructions with 7,593 comments (42.1%), no weak routine (a test keeps watch).
Sector 0 of disk 1 hooks H.STKE and reads sector 1 at 0xB000; that one reads sectors 2-12 (the loader) at 0xC000 and jumps there. The loader looks for the sound cartridge in the slots, reads the engine into its banks 0 and 1 and the sound driver into 6 and 7, hooks H.KEYI and sits waiting: everything else happens in the interrupt, which every frame gives the sound one step and, every other frame, the engine.
The cartridge is an SCC+ with 64 KB of RAM and no ROM at all, in 8 banks of 8 KB: the engine (0-1), its variables (2-3), a read cache (4-5) and the sound driver (6-7). Banks are switched by writing to 0x5000, 0x7000, 0x9000 and 0xB000; the mode register (0xBFFE) decides whether writes go to the RAM (0x30) or to those registers (0x20).
The engine interprets a script of 16-bit words: 0xFFxx is an order and the words after it, its parameters.
Scenes (file 17) ask for a picture (0x65), a menu (0x5F), text pages (0x57) and the next scene (0x60); the
variables live in bits and bytes at 0xB800, 0xBB00-0xBB50 and 0xA850-0xA8A0. The text has an interpreter of its
own (0x76B4). That is what tools/guion.py reads for the map.
| Tool | What it does |
|---|---|
| tools/snatcher_run.py | the game, running: a Z80 (tools/z80run.py), a V9938 in SCREEN 7, the slots, the SCC+ with its RAM, interrupts, and the disk served from the .dsk files |
| tools/dibujos.py | paints every picture of the script by running the engine's loading routine (0x440D); the JUNKER reception, checked against openMSX: 0 bytes different in the whole frame and the same palette |
| tools/guion.py, tools/mapa_escenas.py, tools/mapa_web.py | the script on the disks, the map and its page |
| tools/texto.py | the whole text, into textos/ |
| tools/omsx_recorre.tcl | walks through the game in openMSX with the sound cartridge, pressing keys according to the game's state and changing disks when it asks |
| tools/modulos.py, cruce.py, mkasm.py, explica.py | the module table, the tracing and the commented listing |