Under the hood

Getting started

The ROM is not distributed. You need the Japanese one (GoodMSX, sha256 658ad7ef..., 262,144 bytes) at the root of the repository as shalom.rom.

make comprueba    # the ROM's sha256
make              # the listing, the byte-for-byte rebuild, sanity and the tests
make verify       # just the rebuild: the 32 banks must give back the ROM
make test         # the tests
make densidad     # how much is commented, bank by bank
make imagenes     # the website pictures, from the ROM (Python with PIL)
make musica       # the MP3s and the music pages (Python with numpy and lameenc)
make web          # the HTML pages

You need pasmo to reassemble and Python 3.

Where things are

The cartridge

A 256 KB MegaROM with Konami's mapper without SCC (Konami4): bank 0 is fixed at 0x4000, and 0x6000, 0x8000 and 0xA000 choose the bank of their window. There are 32 banks of 8 KB. The cartridge never writes to 0x5000/0x7000/0x9000/0xB000, the SCC ones.

Start-up

INIT at 0x41A3 sets the H.STKE hook, which jumps to 0x41B5. The interrupt (H.KEYI) goes to 0x404C: it sets banks 29-30-31 and runs the music (p29:6449) and, unless it is already inside, the game frame.

The bank sets

The routines at p00:40F9-414F set the banks three at a time: 1-2-3, 4-5-6, 7-8 (at 0x8000 and 0xA000), 9-10-11, 12-13-14, 15-16-17, 18-19-20, 21-22-23, 24-25-26 and 27-28; the sound uses 29-30-31.

What each bank holds

Banks What
0 the core: mapper, screen, texts, rooms, sound
1-3 game states, the character, events and answers, saving
4-6 logo, title, story, opening scene, the font, menus
7-8 the characters in the rooms
9-11 room drawings, the action scenes and their bosses
12-14 room tiles, status panel, password
15-17 the map of rooms 0x000-0x1FF
18-20 sprites, rooms 0x200 onwards, scene graphics
21-28 the texts and the graphics of scenes 1-4
29-31 the sound engine and the music

The states

p01:64DF: 0 logo, 1 title, 2 demo (script p11:BD12), 3 and 4 the game (names, loading, opening scene), 5 playing, 6 an ending, 7 return, 8 the game's ending (p09:6C23).

The controls

0xE008: bits 0-3 the cursors, 4 fire or space, 5 button 2 or M (menu), 6 RETURN, 7 F5 (mutes the letter sound, 0xF0FA).

Saving

Password (bank 14), tape (BIOS 00E1-00F0), disk (BDOS 0x0F, 0x16, 0x10, 0x1A, 0x26, 0x27, p03:BCC4) and another cartridge with "YZ" at 0x4010 (p01:60CB, it talks to it through 0x8000).

The code

The listing reassembles byte for byte with make verify: the 32 banks give back the whole ROM. Everything is explained (code, or data with whoever reads it) and 42.7 % of the instructions carry a comment; no routine is below 10 % and there is no call to an unnamed routine.

How it is made

What draws (from the tables, with our own code)

Tool What
pantalla.py the VRAM: RLE, thirds and the picture with the TMS9918 palette
titulo.py the logo and the title
salas.py, mundo.py each room and the world
personajes.py Shalom and his GIF
actores.py the characters in the rooms
historia.py, escena.py the story and the opening scene
accion.py the action scenes and their bosses
marcador.py the status-panel pictures
textos.py the texts with the font table
musica.py the music, running the cartridge's engine
imagenes.py every picture of the website

What checks (does not draw)

Code shared with other Konami cartridges

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, 48 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)
Konami’s Game Master 2 67 917 mezclador (p29:6C07) = sonido_mezclador
King's Valley II 54 735 orden_eb (p29:69C0)
Salamander - Operation X 49 614 bytes_a_vram (p00:59C2) = lista_a_vram
Parodius 45 567 arranca_canal (p29:60C0) = carga_canal
Hai no Majutsushi - Mahjong 2 43 553 cartucho_en_8000 (p00:40BD)
The Pro Yakyuu Gekitotsu Pennant Race 43 539 cartucho_en_8000 (p00:40BD) = cartucho_en_pagina_2
Nemesis 3 - The Eve of Destruction 41 521 cartucho_en_8000 (p00:40BD)
F-1 Spirit — The Way to Formula 1 35 395 arranca_canal (p29:60C0) = SONIDO_CANAL
Nemesis 2 34 403 envolvente_al_psg (p29:6BD9) = envolvente_del_psg
Gekitotsu Pennant Race 2 31 401 orden_eb (p29:69C0)

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.