Monkey Academy (1984)

A 16 KB cartridge from 1984, taken apart byte by byte. The whole game runs inside the interrupt, the five levels are five scripts of three to five bytes, the digit that gets hidden depends on the one you can see, and the fruit gets thrown back and forth.

Konami · 1984 · An RC-702 16 KB cartridge · MSX1 · page 1 · Dump fdf62cfa…

There is not one screenshot here. Every picture is drawn by repeating what the cartridge does: video memory is rebuilt with its own copies and then the calls that paint each thing are replayed. Everything else —the listing and the numbers— comes from the binary and is reproducible with make.

The game in numbers

100%of the binary explained
8distinct stages, repeating
5levels: five scripts
8,962bytes of code
7,422bytes of data
0bytes unidentified

What turned up when we took it apart

The whole game runs inside the interrupt

INIT writes jp 0x4038 into the H.KEYI hook and drops into a two-byte jr $ at 0x419B. That empty loop is the main program: from then on everything —the sound, the sprites, the controls and one step of the game— happens inside the interrupt, one step per frame, and 0xE005 is the lock that keeps a slow step from cutting the music.

The digit that gets hidden depends on the one you can see

0x7253 picks the position of the ? by subtracting a random 0-15 from the value of the equation's first digit. With a 9 in front it can land on any of the first ten positions; with a 1 in front, only in the first operand.

Measured in the emulator with 400 level-1 equations: zero exceptions, 238 with the ? in the first two positions and only 67 in the result.

Five levels, five scripts

All that tells one level from another is three to five bytes at 0x712B: 0A 0E (+ =), 0B 0E (− =), 0D 0E (÷ =), 0C 0E (× =) and 0C 10 0A 11 0E (× ( + ) =). The generator decides the rest on seeing the symbol, in BCD: division is built from the quotient and multiplication is repeated addition.

And a random choice of alternative scripts is cancelled with a xor a (0x6FBC): always the first one.

The fruit gets thrown back and forth

You pick it by jumping into it (100 points) and throw it with the button the way you face, along one of the two arcs at 0x742F/0x7451. A fruit in the air kills whatever it hits: the crab, which shows a 500, or the monkey.

Only the third crab jumps (0x616F), so only it grabs and throws fruit, and that is why a fruit carried by a crab always follows the sprite at 0xE0C8: the code takes it for granted.

The 22 sprites are in VRAM twice

INIT copies six sprites to 0x1800 and then the 22 to 0x18C0 without reloading HL: COPIA_A_VRAM preserves it. The game uses the second set —the monkey is pattern 0x18, the crab 0x30— and the first six get overwritten by whichever sprite set is due: normal, fruit on the head, or holding the card.

The professor top right is the player's monkey in dark red, and the one that brings the answer by balloon on the third miss is the same monkey climbing, mirrored, in cyan.

Sound 0xA1 is silence

The three entries for 0xA1 in the track table point at the same 0xFF: three mute tracks that shut the three channels. And the effects belong to the monkey: an actor other than the monkey can only request number 9, the crab dying (0x78F7). Crab footsteps and jumps make no sound.

What the cartridge draws

Each of these pictures is a routine of the cartridge replayed outside it: the tiles are loaded the way the ROM loads them and then whatever paints them is called, with its own pointers and its own video addresses. Under each caption is the address of the routine that draws it.

0x4C77 — the title, painted one pixel row at a time into tiles 0xB8-0xFF from the drawing at 0x4CD0, with the three colour bands of 0x4C5F; the KONAMI of 0x6C42 and the menu of 0x6B99
0x4C77 — the title, painted one pixel row at a time into tiles 0xB8-0xFF from the drawing at 0x4CD0, with the three colour bands of 0x4C5F; the KONAMI of 0x6C42 and the menu of 0x6B99
0x7595 — LEVEL SELECT: PLAYER n and the five lines of 0x75D0, each with its key. It comes up at the start and after every stage cleared
0x7595 — LEVEL SELECT: PLAYER n and the five lines of 0x75D0, each with its key. It comes up at the start and after every stage cleared
0x49B4 — stage 1: the platforms of 0x6705, the ten cards of 0x50AE tucked in (edge only), the fruit of 0x6806, the flowers of 0x6B42 and the panel; on top, the demo's equation in the symbols of 0x7207
0x49B4 — stage 1: the platforms of 0x6705, the ten cards of 0x50AE tucked in (edge only), the fruit of 0x6806, the flowers of 0x6B42 and the panel; on top, the demo's equation in the symbols of 0x7207
0x6685 — stage 3, with the green bar: the platform tile is 0x05 + (stage / 2) & 3, four colours taking turns
0x6685 — stage 3, with the green bar: the platform tile is 0x05 + (stage / 2) & 3, four colours taking turns
0x6685 — stage 6, blue. The eight stages are indexed by (stage − 1) & 7 and repeat; what changes afterwards is the crabs' speed
0x6685 — stage 6, blue. The eight stages are indexed by (stage − 1) & 7 and repeat; what changes afterwards is the crabs' speed
0x6685 — stage 8, yellow, the last distinct one
0x6685 — stage 8, yellow, the last distinct one
0x5040 — the ten 3x2 card blocks with their digit, and below one tucked in (only the edge of 0x5082), one open with the edge under it, and one half way down
0x5040 — the ten 3x2 card blocks with their digit, and below one tucked in (only the edge of 0x5082), one open with the edge under it, and one half way down
0x7207 — the nineteen equation symbols in 2x2 blocks: the digits, plus, minus, times, divide, equals, a blank, the brackets and the question mark
0x7207 — the nineteen equation symbols in 2x2 blocks: the digits, plus, minus, times, divide, equals, a blank, the brackets and the question mark
0x5156 — the tiles decompressed by RLE in the first third, plus the twelve of 0x5EFF at 0xB8-0xC3
0x5156 — the tiles decompressed by RLE in the first third, plus the twelve of 0x5EFF at 0xB8-0xC3
0x40C3 — the 64 sprites as INIT leaves them: the 22 of 0x56BF twice, their mirrors from 38, the monkey facing left at 32-37 and the face, the apple and the card at 60-63
0x40C3 — the 64 sprites as INIT leaves them: the 22 of 0x56BF twice, their mirrors from 38, the monkey facing left at 32-37 and the face, the apple and the card at 60-63