The cartridge is a 128 KB MegaROM, 16 banks of 8 KB with the Konami
with SCC mapper. Each bank is one file of the listing (src/quarth_pNN.asm)
with its own org, where the mapper puts it to run it (tools/paginas.py).
make verify assembles the 16 with pasmo and joins them: out comes the whole
ROM, byte for byte (sha256 5f6048c6...). make sanity checks what
reassembling does not cover: that every byte is explained as traced code or
as data with its reader, and make test runs the tests.
The code is in banks 0, 1, 2 and 4; the rest are graphics, scores and
tables. The ROM is not in the repository: it has to be put in the root as
quarth.rom (the good GoodMSX dump, [!], sha1 0c625910...).
Writing to 0x5000, 0x7000, 0x9000 and 0xB000 puts a bank at
0x4000, 0x6000, 0x8000 and 0xA000; copies of what is in place are
kept at 0xE000-0xE003. The program works with bank 0 at 0x4000 and puts
the others in with a few switching routines (p00:4430, p00:4447...). The
sound puts 4, 5, 6 and 7 in the four slots, the 0x4000 one included.
Since the sound takes bank 0 out of 0x4000, the interrupt cannot run
from the ROM: at start-up four pieces of bank 0 are copied to RAM
(p00:404E):
| In RAM | From | What it is |
|---|---|---|
0xC000 |
p00:4257 |
the interrupt (H.KEYI jumps here) |
0xC070 |
p00:415D |
reads the VDP and sets the split-screen registers |
0xC180 |
p00:40AD |
puts a sound in the queue and hands the queue to the engine |
0xC200 |
p00:40D7 |
the sound engine start-up |
On each interrupt (0xC000): if it is the line one, 0xC070 sets the
registers of the bottom part and ends; if it is the vertical blank, it puts
in the sound banks, runs one engine frame, hands it the queued sounds, puts
the previous banks back (0xE000-0xE003) and runs the game frame
(p00:42BC). Meanwhile the main program just waits (p00:40AB).
0xC713 says how the screen is split (p02:8070: 2 in 2P MODE 2, 1 in the
others):
p00:41FB). The screen is blanked for a moment while the registers
change.p00:423D).0xC700 is the program state (p00:42C0, dispatched with the table behind
the call, p00:43E4): 0 logo, 1 title, 2 menu, 3 game, 4 the ending and 5
getting the demo ready; 0xC701, the step within each. In the game, 0xC780
is its step (p02:8000): 0 set-up, 1 the stage, 2 screen on, 3 fade-in,
4 play, 5 stage cleared, 6 on to the next, 7-10 lost and the continue
countdown, 11-12 over, 13 to the ending and 14 the pause.
| Where | What |
|---|---|
0xC000-0xC23F |
the interrupt and the pieces copied from bank 0 |
0xC400-0xC661 |
the sound engine: eight channels of 0x40 bytes and its state |
0xC700, 0xC701 |
the program state and its step |
0xC707-0xC70A |
both players' controls |
0xC713 |
how the screen is split |
0xC720 |
the sound queue (16) |
0xC732-0xC73C |
the demo: whether it is one, which, and where its recordings are |
0xC780 |
the game step |
0xC788-0xC793 |
field 1: speed, position, top row, laps of 16 rows |
0xC798-0xC7A3 |
the same for field 2 (2P MODE 2) |
0xC7B0, 0xC7B3 |
each player's score, in BCD |
0xC800, 0xC820 |
the two players' records |
0xC840, 0xC880 |
their shots, four each |
0xC8C0, 0xCA40 |
24 records of what happens in each field (rectangles, stage cleared...) |
0xCBC1-0xCBE0 |
the rectangle being looked for: corners, height, width, formations inside |
0xCC00 |
field 1: 32 rows of 16 cells (and its other half at 0xCE00) |
0xD000 |
field 2 (and 0xD200) |
0xD800, 0xD880 |
the attributes of the bottom and top sprites |
0xDBE9-0xDBF2 |
the configuration: mode, LEBEL, BGM, PLAYER, STAGE, SPEED |
0xE000-0xE003 |
the banks in place |
Everything on this site is made by code in tools/:
omsx_graba.tcl and lanza_graba.ps1, with the scripts in
tools/guiones: the cartridge in openMSX, logging on every frame the
state, the registers, the palette and the VRAM that changes (and, on the
line interrupt, the registers and the bottom sprite table).pinta_omsx.py: paints each recorded frame in SCREEN 5 or SCREEN 4, with
both parts of the split screen; secuencias.py puts the GIFs together.musica.py and motor_musica.py: the music, running the cartridge's sound
engine; lanza_psg.ps1, omsx_psg.tcl and coteja_psg.py, the check
against openMSX.msx2run.py, z80run.py and partida.py: the cartridge run on a Z80 with
the VDP, for the checks (who reads a piece of data, who runs a routine,
while playing).bancos.py, lectores.py, presupuesto.py and the rest used by make:
the code tracing and each piece of data's reader.Against four openMSX screenshots taken in the same recording as the demos
(tools/coteja_foto.py, which looks for the most similar painted frame among
the five around it):
| Screenshot | Demo | Different pixels |
|---|---|---|
| frame 1,500 | the first (1P MODE) | 0 |
| frame 5,300 | the second (2P MODE 1) | 2 |
| frame 9,666 | the third (2P MODE 2) | 57: a shot that is in the screenshot and not here |
| frame 10,200 | the third | 66: a column of blocks |
To get there: colour 0 is the border colour (unless transparency is on), on the split screen the line registers arrive four lines late and one blanked line is left below (the screen is blanked while they change), and 2P MODE 2 is in SCREEN 4. What is left in the two-player ones is not explained: it is an open question (the openMSX screenshot may not be from the same moment as the logged VRAM).
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 60, 46 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) |
|---|---|---|---|
| Metal Gear 2: Solid Snake | 112 | 1,944 | es_nota (p04:42D3) |
| The Pro Yakyuu Gekitotsu Pennant Race | 43 | 739 | copia_caja_logica (p00:48BF) = copia_logica |
| Space Manbow | 38 | 631 | copia_caja_logica (p00:48BF) = orden_copia_logica |
| Konami’s Game Master 2 | 37 | 750 | manda_caja (p00:4862) = vdp_lmmc |
| Ganbare Goemon! Karakuri Dōchū | 35 | 578 | copia_caja_logica (p00:48BF) = lmmm |
| The Treasure of Usas | 35 | 592 | copia_caja_logica (p00:48BF) = copia_con_operacion |
| Hinotori | 34 | 542 | copia_caja_logica (p00:48BF) = lmmm |
| Hai no Majutsushi - Mahjong 2 | 34 | 391 | graficos_dir (p00:4573) = vuelca_lista_vram |
| Gekitotsu Pennant Race 2 | 32 | 441 | llena_caja (p00:474F) = borra_bloque_vram |
| Vampire Killer | 31 | 557 | copia_caja_logica (p00:48BF) = copia_con_operacion |
The whole matrix, the 61 cartridges against each other, is on The routines in the series database, along with the method and the program that measures it.