This repository does not include the game. It includes the tools that, from your own image of the cartridge, rebuild the commented listing, reassemble it and check that the ROM comes out byte for byte.
nemesis2.rom. Its sha256:
227113f94d9900cb48d2f9e88627224dd8cc3d9504614a01e94cf6b23ba508dc.make, python3 and the pasmo assembler.make comprueba # the ROM's sha256
make # trace, generate the listing, reassemble and run the tests
make densidad # how many instructions are commented, bank by bank
make sanity # the budget: not one byte unassigned
make verify reassembles the sixteen banks and compares them with the ROM: it
has to say OK: la ROM entera reproducible byte a byte.
src/nemesis2_pNN.asm: the listing of each bank (p00 to p15).src/pNN.notes: the names, comments and data blocks of each bank. The
listing is generated from here.tools/anota.py and tools/anotaciones.py: the names of the routines and
of the RAM, and the automatic comments.tools/cartucho.py: what the tracer needs to know about the mapper.tools/dibuja.py, tools/vram.py, tools/titulo.py, tools/objetos.py,
tools/enemigos.py, tools/nave.py, tools/final.py: the pictures, drawn
from the ROM.python tools/dibuja.py mapas work/dibujos
python tools/titulo.py png work/dibujos/titulo.png --escala 2
python tools/objetos.py work/dibujos/objetos
python tools/enemigos.py png work/dibujos/enemigos
python tools/nave.py png work/dibujos/armas/nave.png
python tools/final.py png work/dibujos/final --escala 3
A first-generation MSX: the TMS9918 VDP in SCREEN 2, the PSG and the SCC the
cartridge carries itself. The VDP registers come from the table at
p00:5D1D: names at 0x3800, colours at 0x0000, patterns at 0x2000, sprite
attributes at 0x3B00 and their patterns at 0x1800.
It is Konami's with SCC: sixteen 8 KB banks. Bank 0 is fixed at 0x4000 and
the other three slots are chosen by writing to 0x7000, 0x9000 and 0xB000
(p00:4108-p00:415D). The game keeps a copy of each in
0xF0F1-0xF0F3, and the interrupt puts them back from there
(p00:4050). Writing 0x3F to 0x9000 brings up the SCC registers at 0x9800
(p04:71D3).
INIT (p00:4090) installs the H.KEYI hook and stays in jr $: the whole game
runs inside the interrupt (p00:4023). First comes the sound, with banks
4-5-6 (p04:6934). Then, if the previous frame has finished (0xE1C5), a
game frame starts: the previous frame's screen goes to the VRAM
(p00:5D2A) and then the game state runs (p00:5601).
It lives in bank 4. There are 8 channels of 40 bytes from 0xE000: 3 for the
PSG and 5 for the SCC. There are 67 sounds, each with its header of channels
and priority (p04:6612); a score only takes a channel if its priority is not
lower than the one playing (p04:655D). Scores have 31 commands
(p04:6D27) and the SCC uses its own waveforms (p04:6000). In the pause,
sound 0xF3 saves the channels and 0xF2 puts them back (p04:65DE,
p04:65A1).
The game uses 0xE000-0xEFFF, which INIT clears. The 12 enemies are
64-byte records at 0xE600, the 10 bullets are at 0xE900 and the ship's 9
shots at 0xE470. The screen is built in RAM, at 0xED00, and copied whole
to the VRAM every frame (p01:77F1). The sprites are ordered at 0xE280
and each frame starts from a different one (p01:77B6), so they flicker
instead of vanishing.
100% of the 131,072 bytes is explained: 41,242 of code and 89,830 of data. The seven banks with code have 2,630 routines and labels, and 8,602 of their 19,811 instructions are commented: 43.4%, with no routine below 10%. There are 1,361 named routines and 327 RAM addresses, each with the address that justifies it.
The game has 11 states (p00:5615): the intro, the title, the demo, the start
of the game, a life, the game, the loss of a life, GAME OVER, the return
after the interior, the pause and the ending. The game frame (p00:416D)
goes through the banks in order: the scroll, what appears, the ship, its
weapons, the enemies, the collisions, the boss, the sprites and the screen.
Each stage has its lists ordered by scroll column: the enemies
(p14:9A67), the turrets (p14:9554), the character objects
(p12:BA12), the special capsules (p12:BB72) and the blocks
(p01:7248). On top of that, each 32-column stretch picks one or two of the
11 filler generators (p14:99C7, p01:6E07), and each stage has a wave of
6 enemies in a group (p01:6E1D): shooting down the whole wave leaves a
capsule (p02:8988).
There are 65 types, each with a 7-byte record (p00:4F4C): how many sprites
it uses or whether it is made of characters, its hits, its box, its drawing
and its colour. Each type has a routine to come out (p00:4DF3) and another
for each frame (p01:63CD). When they fall, almost all leave type 0x26, the
explosion, which according to its data turns into the power meter capsule
or into the one that destroys everything (p02:9660).
The names of the routines and of the RAM are in tools/anotaciones.py, and
tools/anota.py carries them to every call and every access in the listing.
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 57, 51 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) |
|---|---|---|---|
| Salamander - Operation X | 210 | 2,809 | sonido (p00:4AE4) = pide_sonido |
| Nemesis 3 - The Eve of Destruction | 189 | 2,373 | descomprime_otra_direccion (p00:4A86) = rle_con_direccion |
| Parodius | 169 | 2,385 | sonido (p00:4AE4) = pide_sonido |
| Nemesis / Gradius | 76 | 1,025 | angulo_a_f000 (p02:9467) = mide_la_distancia_a_la_nave |
| F-1 Spirit — The Way to Formula 1 | 51 | 834 | ondas_del_scc (p04:71E2) = SCC_FORMAS_ONDA |
| The Maze of Galious | 49 | 612 | lee_caracteres (p00:4675) |
| King's Valley II | 49 | 702 | canales_del_scc (p04:715C) |
| The Pro Yakyuu Gekitotsu Pennant Race | 39 | 550 | sonido (p00:4AE4) |
| Shalom: Knightmare III | 34 | 403 | envolvente_del_psg (p04:6FDC) = envolvente_al_psg |
| Gekitotsu Pennant Race 2 | 33 | 465 | cabeza_abajo (p00:45EA) = voltea_arriba_abajo |
The whole matrix, the 58 cartridges against each other, is on The routines in the series database, along with the method and the program that measures it.