The cartridge

titleThe Maze of Galious (Knightmare II; ガリウスの迷宮), Konami, 1987
numberRC-749
machineMSX1 (TMS9918), SCREEN 2
size131,072 bytes: 16 banks of 8 KB
mapperKonami without SCC (Konami4)
soundPSG, three channels
sha256420c42c18006eb5dbb25efa5b83e340d740824c15a714929a945c0db51f97280

The header is AB with INIT at 0x4095. At 0x4010 there is a second header, CD followed by 07 49, which is what the Game Master looks for. The game does not touch any V9938 register: it is an MSX1 game.

The mapper

Bank 0 is fixed at 0x4000-0x5FFF. The other three windows are selected by writing the bank number to 0x6000, 0x8000 and 0xA000. There is not a single write to 0x5000, 0x7000, 0x9000 or 0xB000, the registers of the SCC mapper: that is why it is Konami4.

There are 32 writes to the mapper (tools/reconocimiento.py): 11 to 0x6000, 11 to 0x8000 and 10 to 0xA000. Banks are set three at a time (p00:416C-0x41E1: 1-2-3, 4-5-6, 7-8-9, 10-11-12 and 13-14-15) or one at a time, and all of them follow the rule: each bank always goes to the same window. So the listing splits into sixteen modules, each with its org:

windowbanks
0x4000 (fixed)0
0x60001, 4, 7, 10, 13
0x80002, 5, 8, 11, 14
0xA0003, 6, 9, 12, 15

The code crosses banks in four places: an instruction starts at the end of one bank and ends in the next (p00:5FFF, p01:7FFE, p04:7FFF and p08:9FFF); the listing splits each one into two defb. The interrupt sets banks 13 and 14 for the sound and on the way out restores the previous ones from their copies in RAM (0xF0F1-0xF0F3).

What each bank holds

bankcodewhat it holds
07,808 Bthe start-up, the interrupt, the dispatcher, the game's 21 states, the graphics readers (rle, entries, flipped copies), building the room and what goes on it, the status bar
17,282 Bthe character and its poses, life and experience, the logo and the title, the story, the demos, GAME OVER and ZEUS, the item screen
27,162 Bthe special rooms (hints and shops), the password, the keyboard and the words, the bosses' names, the world doors
37,644 Bthe character in the room: walking, ladders, weapons, water, hits, the pink orbs, the hidden items, the bosses; Konami's mark
46,452 Bthe figures: how each type moves
57,798 Bmore figures and their movement tables
64,660 Bmore figures; the items in each room
7—the rooms of the 11 maps (8 × 5 blocks) and the 172 blocks of 4 × 4 characters
8739 Bthe walls and ladders of the worlds; the rest of the rooms and the bosses' frames
91,873 Bthe castle doors; the figures in each room, the neighbours (0xA9EF), the Konami logo
10—the character entries for each place and the 64 sprite sets
11—the sprite patterns and which set each room loads
12—character patterns and colours in rle: the bosses' graphics and the seal in their room
131,351 Bthe sound: 23 tunes, 48 effects and the player
14—the music scores, the bosses' mosaics (0x9E0A), the font and the title sign
15844 Bthe ending, the water and the boss's smoke; the messages

In total, 53,613 bytes of code and 77,459 of data: 100% of the cartridge accounted for (make sanity).

The VRAM

The game runs in SCREEN 2 with the registers at 0x4C5B: name table at 0x3800, colours at 0x0000 (R3 = 0x7F), patterns at 0x2000 (R4 = 7), sprite attributes at 0x3B00 and their patterns at 0x1800. Sprites are 16 × 16. R7 is 0xE4 (blue background) on the logo and 0xE0 (black) afterwards.

The screen is built in a copy in RAM (0xED00) and p00:54F3 uploads it with LDIRVM. A room takes rows 4 to 23; rows 0 to 3 are the status bar.

The RAM that matters

addresswhat it is
0xE000 / 0xE001the game state and its step
0xE003the frame counter
0xE020the boss's name guessed
0xE027ZEUS typed
0xE041 / 0xE042the map (1 the castle, 2-11 the worlds) and the room
0xE046 / 0xE048 / 0xE04Aarrows, coins and keys, in BCD
0xE052 / 0xE056Aphrodite's and Popolon's life
0xE050 / 0xE054Aphrodite's and Popolon's experience
0xE06F + typeeach item's flag
0xE0D2 / 0xE0D3the boss's state and which boss
0xE500 / 0xE501the character's state and who is playing (0 Aphrodite)
0xE690the special room (hint or shop)
0xE800the figures, 32 bytes each
0xEC80 / 0xED00the copies of the sprite table and the name table