Penguin Adventure

A 128 KB Konami4 MegaROM from 1986, the sequel to Antarctic Adventure. Twenty-four stages, a shop, a gambling machine and two hidden keyboard codes.

Konami · 1986 · Cartridge RC-743, 128 KB · MSX1 · Konami4, no SCC · Dump 525608aa…

There is not a single screenshot here. The screens are drawn by running in Python the same routines the cartridge runs on the Z80: its decompressor, its painter and its masked painter. The rest —the listing and the numbers— comes out of the binary and is reproduced with make.

The game in numbers

100 %of the binary explained
830named labels
44.7 %of the instructions, commented
0routines under 10 %
32,317bytes of code
98,755bytes of data

What turns up when you take it apart

The good ending depends on how many times you pause

The finding is Manuel Pazos’s, who told it at a talk; what this disassembly adds is where it is written and the exact rule. p02:81EE bumps a counter every time you enter pause, and when stage 24 ends p02:82DE takes its low two bits and subtracts one: if nothing is left, the princess comes out alive.

So you have to have paused 1, 5, 9, 13… times —the remainder of dividing by four has to be 1— and never pausing gives you the bad ending. The count survives losing a life, but CONTINUE wipes it. Both texts are in the ROM: YOU HAVE SUCCEEDED IN RESCUING THE PRINCESS and YOU HAVE FAILED TO RESCUE THE PRINCESS.

Two keyboard codes: NORIKO and KAZUMI

You type them on the title screen and they turn on CONTINUE, which does not exist without them. p02:9522 watches NINE keys with the BIOS SNSMAT and keeps the last six pressed in a queue; p02:9634 compares them against two six-byte patterns. And the nine watched keys —A, I, K, M, N, O, R, U and Z— are exactly the letters needed to spell those two names and no others.

They do not do the same thing: NORIKO leaves 0xFE in 0xF0F7 and KAZUMI 0xFF, and with exactly 0xFE the game-over wipe skips 143 bytes, so NORIKO also keeps what you are carrying.

The cherry is the likeliest symbol and the only one that counts alone

The gambling machine's reels take their symbol from the Z80's R register —the memory refresh counter— masked to four bits, and use that index into the sixteen-entry table at 0x7B34. The cherry takes five of the sixteen slots: 31.2 % per reel, and at least one on 67.5 % of the spins.

And the payout code at p01:7AF0 treats it apart: every reel showing a cherry bumps a counter, and the first three multipliers in the table are 1, 2 and 4. Every other symbol pays only on three of a kind: ×8, ×10, ×15, ×20 and the jackpot. It is the classic cherry rule, written in Z80.

Santa Claus gives things away, and the angry shopkeeper charges double

Falling into the middle of a mode 3, 4 or 5 crevasse (p01:72F2) opens the shop, and the mode is the shopkeeper. All three sell the same —the stage's seven-item list, 0xAF90— but each with his own price table: the usual one (0x6FD5), the double one (0x6FE5, except item 7, which goes from 17 to 32 and not 34) and Santa Claus’s, all zeros (0x6FF5), who closes the shop after the first purchase (p01:6F09): he gives one thing away. There are 41 shops on 18 stages: 18 usual, 20 expensive and three Santas, on stages 6, 12 and 21.

And every shopkeeper talks: MAY I HELP YOU? GET WHATEVER YOU LIKE., HEY YOU! YOU MUST BUY SOMETHING FROM ME!! and WELCOME! I WILL GIVE YOU A JEWEL.; press END and they say goodbye, the angry one with BUY MORE! WAIT! DAMN IT!!. The six screens are drawn from the tables and checked against 14 openMSX dumps: zero differences.

Six warps, hidden in crevasses

The warnings script at 0xB046 turns the object that comes out after its distance into a crevasse and attaches two bytes: the mode and the list. With mode 2, falling in and pressing down (p02:999C) leads to the WARP, a 0x150-step run through backdrop 9, and when it ends p03:B94A reads the 17-byte record at 0xB79B picked by the list and adds stages. There are six: 1 to 6, 6 to 9, 9 to 12, 13 to 15, 15 to 18 and 18 to 21, all six measured in openMSX. And on the map before every stage they show up as dotted roads (0x8D85).

Twenty-four stages, not thirteen

Thirteen is what the cartridge declares to the Konami Game Master in its second header, the one at 0x4010. The game says otherwise: p02:8328 compares the stage with 0x19 and the three script tables —terrain, creatures and the third one— close at exactly 24 entries. And LEVEL 2 is a whole different design, without a single matching section.

The clock runs whether you move or not

0xE08B is not the stage length: it is the time. p02:922D takes one off it every 32 frames whether you move or not, below 0x15 it beeps every other frame, and when the stage ends p02:94D1 turns it into points 0x20 at a time. What goes down with the terrain is something else, 0xE08D, and the nine end-of-stage cues come from it.

Which is why the item at p03:B31E, which adds 0x50 in BCD, does not make the run longer: it gives extra time. It is the only thing in the whole cartridge that touches that counter once the stage is up.

The curves are read, but the angle is computed

The 24-step circle and the 32-step parabola are written in the ROM and read back. But to aim at the player, bank 9 does real trigonometry: p09:ACE3 is a 16-by-8 division by subtract-and-shift —the Z80 has no div— and p09:ACBA an arctangent that looks the quotient up in a table of eight tangents in 8.8 format, 11.25 degrees apart. The angle comes out in the house's 256 units of a circle.

It switches banks with interrupts enabled

With a semaphore at 0xE005. No static tracer follows that: it is where 14 KB of invented code in banks 12 and 13 came from, and they had to be declared by hand. The 0xFF padding at the tail of a bank does something similar: 0xFF is rst 38h, so the tracer walked out into the neighbouring bank through the back door.

What it draws

None of these images is a screenshot: tools/graficos.py draws them from the ROM.

The Japanese title screen, built with the cartridge's own steps: script 0xB5A8 from bank 6 into the three thirds of the pattern table, the sprites from p07 0x9846 and the lettering from p13 0xBAB2.
The Japanese title screen, built with the cartridge's own steps: script 0xB5A8 from bank 6 into the three thirds of the pattern table, the sprites from p07 0x9846 and the lettering from p13 0xBAB2.
And the one for the rest of the world. The cartridge picks one or the other from the BIOS country byte (0x002B): the difference is ONE extra script, 0xA463, and it only touches the lettering.
And the one for the rest of the world. The cartridge picks one or the other from the BIOS country byte (0x002B): the difference is ONE extra script, 0xA463, and it only touches the lettering.
The penguin, seen from behind and black, in the poses of the 0xA91D table over the patterns each terrain loads. Top to bottom: on land, on ice, swimming (pose 10 plus a splash that alternates every 16 frames, p02:9A1D), under the sea (poses 7, 8 and 9) and in space, with the colours p03:A778 forces on it.
The penguin, seen from behind and black, in the poses of the 0xA91D table over the patterns each terrain loads. Top to bottom: on land, on ice, swimming (pose 10 plus a splash that alternates every 16 frames, p02:9A1D), under the sea (poses 7, 8 and 9) and in space, with the colours p03:A778 forces on it.
The ten creatures of the stage scripts, each at its four sizes and, if it flaps, in both steps, with its class and the stages that spawn it. Class 7 is invisible: p09:B8B3 gives it colour 0 unless 0xE16A is carried.
The ten creatures of the stage scripts, each at its four sizes and, if it flaps, in both steps, with its class and the stages that spawn it. Class 7 is invisible: p09:B8B3 gives it colour 0 unless 0xE16A is carried.
The dinosaur that closes every third stage, at the five sizes it has as it approaches: the 0xA76B strips p01:6697 copies at 0x20, 0x10, 5, 2 and 0 from the goal. The backdrop picks its colour.
The dinosaur that closes every third stage, at the five sizes it has as it approaches: the 0xA76B strips p01:6697 copies at 0x20, 0x10, 5, 2 and 0 from the goal. The backdrop picks its colour.
The fight, state 7: the four blocks fall, the dinosaur throws (0xB212) and after twenty hits the ice cracks and it sinks (0xAE0A, 0xADA2, 0xAB60). Below, its nine drawings at 0xA842: three steps by three sides, because it looks towards the penguin.
The fight, state 7: the four blocks fall, the dinosaur throws (0xB212) and after twenty hits the ice cracks and it sinks (0xAE0A, 0xADA2, 0xAB60). Below, its nine drawings at 0xA842: three steps by three sides, because it looks towards the penguin.
The p03:AA80 scenes: the tree after stage 12 and, after stage 24, the good and the bad endings, with their messages. 32-column screens from bank 13 painted from the middle outwards; in the bad ending the 0xB963 piece takes the princess's place.
The p03:AA80 scenes: the tree after stage 12 and, after stage 24, the good and the bad endings, with their messages. 32-column screens from bank 13 painted from the middle outwards; in the bad ending the 0xB963 piece takes the princess's place.
The map before every stage: the road travelled in red, the penguin on the current stage and the warps taken as dotted roads (p02:8AEC, 0x8FE7, 0x8D85).
The map before every stage: the road travelled in red, the penguin on the current stage and the warps taken as dotted roads (p02:8AEC, 0x8FE7, 0x8D85).
What moves in the scenes: the penguin walks in from behind and goes up one row every four frames (p03:ACE6); in the tree the apple falls and bounces (0xAD88), in the good ending it jumps (0xADBA) and in the bad one it cries (0xADD7 and 0xADEF).
What moves in the scenes: the penguin walks in from behind and goes up one row every four frames (p03:ACE6); in the tree the apple falls and bounces (0xAD88), in the good ending it jumps (0xADBA) and in the bad one it cries (0xADD7 and 0xADEF).
Space, the bonus stage: the Earth, the penguin and the meteorites, objects built from characters (0x15 to 0x19) with sixteen drawings that grow until they leave by one side.
Space, the bonus stage: the Earth, the penguin and the meteorites, objects built from characters (0x15 to 0x19) with sixteen drawings that grow until they leave by one side.
The WARP, backdrop 9: a mode-2 crevasse and pressing down lead to this cave and from there to another stage. There are six: 1 to 6, 6 to 9, 9 to 12, 13 to 15, 15 to 18 and 18 to 21 (0xB79B).
The WARP, backdrop 9: a mode-2 crevasse and pressing down lead to this cave and from there to another stage. There are six: 1 to 6, 6 to 9, 9 to 12, 13 to 15, 15 to 18 and 18 to 21 (0xB79B).
The three hidden shops, state 12: the usual shopkeeper, the one who charges double and Santa Claus, each with his greeting (0xB038, 0xB065 and 0xB0DD) and, below, his farewell when you press END. The items and the prices come from the stage's list (0xAF90) and the shopkeeper's table (0x6FD5, 0x6FE5 and 0x6FF5); the purse on the left only shows up when you have points.
The three hidden shops, state 12: the usual shopkeeper, the one who charges double and Santa Claus, each with his greeting (0xB038, 0xB065 and 0xB0DD) and, below, his farewell when you press END. The items and the prices come from the stage's list (0xAF90) and the shopkeeper's table (0x6FD5, 0x6FE5 and 0x6FF5); the purse on the left only shows up when you have points.
The sixteen items, drawn with the status-bar characters (0xB71B, four per item from 0xB2), with their usual and expensive prices. Nobody sells 14 or 15: they are the prizes of the stage 6 secret (p03:BE7D) and the stage 13 secret (p03:BEC0).
The sixteen items, drawn with the status-bar characters (0xB71B, four per item from 0xB2), with their usual and expensive prices. Nobody sells 14 or 15: they are the prizes of the stage 6 secret (p03:BE7D) and the stage 13 secret (p03:BEC0).
The winged fish you catch in space, in the sixteen steps of the 0xA545 list. Below, the two colours the extra-life one flickers between (p01:6A04).
The winged fish you catch in space, in the sixteen steps of the 0xA545 list. Below, the two colours the extra-life one flickers between (p01:6A04).
The twenty-four LEVEL 1 stages, walked step by step from their tables: eight views of the road per stage, start to goal, with what the terrain script puts on it and the curves; below, each stretch's creatures.
The twenty-four LEVEL 1 stages, walked step by step from their tables: eight views of the road per stage, start to goal, with what the terrain script puts on it and the curves; below, each stretch's creatures.
One of the eight stage backdrops, built the way the game builds it: the ten pieces of p02:966B with their colour table, the p01:6000 map and the ground animation.
One of the eight stage backdrops, built the way the game builds it: the ten pieces of p02:966B with their colour table, the p01:6000 map and the ground animation.
The gambling machine, showing three cherries. The payout table is painted on the machine itself and says exactly what the code says: one cherry ×1, two ×2, three ×4, and every other symbol pays only in threes.
The gambling machine, showing three cherries. The payout table is painted on the machine itself and says exactly what the code says: one cherry ×1, two ×2, three ×4, and every other symbol pays only in threes.
The six reel symbols, with how many of the sixteen slots in the table at 0x7B34 fall to each. The cherry gets five: it is the most likely symbol and the only one that counts on its own.
The six reel symbols, with how many of the sixteen slots in the table at 0x7B34 fall to each. The cherry gets five: it is the most likely symbol and the only one that counts on its own.