Getting started

This repository holds a commented disassembly of Super Cobra for the MSX (Konami, 1983, cartridge RC-705). Everything here comes out of the binary and can be regenerated from it.

What you need

The ROM goes in the root, as supercobra.rom. Exactly 8192 bytes:

sha256  062aeefd04e6ac28f565c15bd1010fc2a007bfbe8d3898ff8586778462091470

make comprueba checks it.

The commands

make                # trace, listing, reassembly, checks and tests
make listado        # rebuilds src/supercobra.asm from the annotations
make verify         # reassembles and compares with the ROM, byte for byte
make sanity         # nothing declared as data may come out as code,
                    # and no byte may be left unassigned
make test           # the checks
make imagenes       # rebuilds the drawings by reading the ROM
make web            # rebuilds this site

What is in each folder

src/supercobra.entriesthe entry points, each with its justification
src/supercobra.nocodethe ranges the tracer must not read as code
src/supercobra.notesthe only file edited by hand: all the annotations
src/supercobra.asmthe listing, generated by tools/mkasm.py
tools/the tracer, the listing generator and the measuring tools
tests/the checks on the listing and the annotations
docs/this site

How to read the listing

Annotations are anchored to an address, so they survive a retrace. The directives follow theNestruo's guidelines:

La label and what the routine does
Ca comment on that line
Ba block header before that address
Da data range, with its name and its explanation
Fthe row width of a data block

How it was done

The tracer follows the real flow from the entry points. What cannot be deduced statically —the interrupt hook, the two tables embedded behind a call— is declared by hand in the .entries, with the reason written next to it.

This cartridge also has two routines that are never reached by a call: 0x4691 does a push hl with the address of one of them, and the dispatcher ends in jp (hl), so the ret of the state routine lands there. Without that, 0x488B and 0x49EA stayed declared as data while being code.

There is no assumption dressed up as a fact here. What is not known is in Open questions, and it says so.

Reproducibility

make verify reassembles the listing and compares the result with the original ROM. It has to come out identical, byte for byte. And make sanity then checks what reassembly cannot catch: that no range declared as data is being read as code, and that not a single one of the 8192 bytes is left unassigned.