1981 · Nintendo

Popeye

This minisite was contributed by icyriver2023. It’s agent-generated and needs a human editor. Clone https://github.com/gamesexplained/gamesexplained and follow kit/START.md to curate games/gnw/popeye with me to Gold.

A 4-bit chip with 65 cells of memory runs a clock with an alarm, and two games. Every object on the screen is one segment, and everything that falls moves by a chain of calls that passes a single bit from cell to cell.

01 · The game

Catch what Olive Oyl throws

Popeye stands in a boat at the bottom of the screen. Olive Oyl, at the top left, throws bottles, pineapples and cans down three paths, and Popeye moves left and right under them to catch each one.

Left: Game A, 13 seconds in, two items falling. Right: the clock, which shows the time while the game plays itself. Both are drawn from the segments the chip lit, on MAME's outlines of the segments.

Each catch is a point. An item that falls past Popeye drops into the sea with a splash. Bluto sits in a boat at the side and swings a mallet from the left or a fist from the right: Popeye standing under the blow is knocked into the sea. Three miss marks end the game. Game A and Game B differ in how fast Olive throws and in whether Bluto changes boats.

There is no picture in the usual sense. The screen is 72 fixed shapes printed on the LCD, each one on or off. Popeye in the middle is one shape, the third can down its path is another. Animation is lighting one shape and putting out the one before.

02 · A replay

The game moves one path at a time

Step through 45 seconds of Game A, played by the game's own program. Each frame is one change of the screen.

Moves this stepFallingWaiting at the bottomScore

The player here moves under the lowest item. A frame is kept each time $0640 draws a screen that differs from the last. The readout is the chip's own cells: $100A, $1009, $1029 and $1015. At 18.4 s the player walks into Bluto's mallet.

The game runs in steps, and each step moves only one of the three paths: bottles on the first, pineapples on the second, cans on the third ($012B). So an item moves one place every third step, and the three paths move in turn, never together. The step itself is short. Most of the time between steps is a delay loop that counts down and does nothing else ($03AA), and it reads the controls between counts, so Popeye moves as soon as a button is pressed, not on the next step.

03 · One screen, rebuilt from memory

Every segment is one bit

Click a bit to light its segment, or a segment to find its bit. The picture is drawn from these cells alone.

The cells are the chip's memory as it drew a screen just after the replay above ends. The page turns them into segments with a port of $0640, the game's drawing routine.

The LCD has nine 4-bit latches for each of its two sets of segments. To draw, the game shifts a cell into the latches nine times, copies them, and shifts nine more for the second set ($0640). Rows 0 and 1 of memory are the picture, a cell for each latch, and the three digits come from the chip's own table of digit shapes. Bit 0 of $1005, $1006 and $1007 light a spare segment beside each digit, which this unit wires to the colon, the first miss mark and Bluto's raised fist.

Since an object is a bit, moving it is moving a bit. The chip has an instruction to test a bit, but none to move one, so the game exchanges the carry flag with one bit at a time ($043B to $043E). A call puts the carry into a place and takes out what was there. A chain of calls down a path moves every item on it one place in a single pass, and a new item thrown at the top is just the carry going in first.

04 · Olive's throws

How many items fall, and when

Each step the game decides whether Olive throws an item onto the path whose turn it is ($00CA).

Items fallingGame AGame B
nonealways throwsalways throws
at the level's limit or morenevernever
below the limit, the clock's seconds ending in 8 or 9nevernever
below the limit, fewer than 3always5 times in 16
below the limit, 3 or more5 times in 165 times in 16

"5 times in 16" is the chip's divider, a counter of its crystal that steps 16 times a second, read when the step comes ($0413). The limit is the level, in section 06. A path whose top place is already lit gets no new item.

The game counts the items falling in $1009. A throw adds one; a catch or a fall into the sea takes one away. The count can drift from the screen, so whenever no item is lit anywhere the game sets it back to 0 ($0696).

05 · Catching and missing

Two items in the sea make one miss

An item at the bottom of its path waits there, over Popeye's head on that side, for two steps.

Left: a can waits at the bottom on the right while Popeye stands in the middle. Right: two steps later it has fallen in, and its splash stays lit. Game A, with Popeye left standing still.

A bit for each path in $1029 says an item is waiting. After each step of a path and each move, the game checks the path in front of Popeye: a waiting item there is caught, scores a point and recomputes the difficulty ($030C). One still waiting two steps later falls into the sea ($0140, $018B, $01E1).

The first item to fall in counts nothing. It sets a flag and leaves its splash on the screen. The second one counts a miss mark and clears the splashes ($0192). Bluto is less forgiving: every time he knocks Popeye into the sea it is a whole miss. The marks light from the right, and the third ends the game.

06 · Difficulty

The game gets easier at every hundred points

Move the score. The level is the hundreds digit plus the tens digit, so 199 is level 5 and 200 is level 3.

LevelMost items falling at onceDelay before a stepA step takes

The level for every score from 0 to 999, from the game's own rule at $0080. With no sound playing, a step takes about 770 cycles plus 210 for each pass of the delay, at 16,384 cycles a second.

After every catch the game works out the level from the score ($0080): the hundreds and tens digits added, mapped to 1 to 9 through a run of LAX instructions it jumps into part way, and one more when the units digit is 4 to 7. The level is also the most items that may be falling before Olive stops throwing extra ones, and it picks the delay before each step, from 10 passes of the delay loop at level 4 or below down to 3 at level 10, the highest the score can reach.

A game starts with a delay of 11 and a limit of 0, which lets only one item fall at a time until the first catch sets both.

07 · Bluto

Bluto swings on the seconds since you last pressed a button

Bluto's mallet on the left and fist on the right each come down in two moves, three steps apart, and go back up on the step after.

Every shape of Bluto and his weapons lit at once: the mallet up, halfway and down on the left, the fist up, halfway and down on the right, and Bluto in either boat.

A swing starts when two things hold ($03C4). The first is bit 1 of a count of seconds since a button last changed, which the game keeps to send an idle unit back to its clock: the bit is set for two seconds in every four. The second is that the number of items falling is even. With the weapon down, Popeye on that side is knocked in, and so is a Popeye who steps into it ($0352, $0367).

In Game B Bluto changes boats, from the mallet on the left to the fist on the right and back, at most once every ten seconds and only with his weapon up ($0395). In Game A he stays on the left for the whole game.

A knock-down stops the game for a while: the next steps only count down $1043 from 8, turning Popeye into his splash at 7, counting the miss at 3, and putting him back on the side he fell at 1 ($0100).

08 · Sound

Sound: one pin, toggled by the program

Press a button to hear the game's own sound routine, recorded at the buzzer's pin.

Each sound is the list of moments the chip's R1 pin changes while its routine runs ($02AE, $02A7), played here as a square wave.

The piezo buzzer is wired straight to one output pin, so a tone is the program flipping that pin in a loop and its pitch is a count of instructions. The tone loop flips it every 3 instructions, about 2.7 kHz ($02B5). All the sounds are that one pitch and differ only in length: the routine takes a code and runs a pass for each value from the code up to 15, each pass a little longer than the one before, so a larger code is a shorter sound.

SoundCodeLength
a catch140.10 s
the bonus's beep110.22 s
an item into the sea90.29 s
a miss counted80.31 s
Popeye knocked in50.38 s

A step whose path moved or received an item adds a click, 16 writes to the pin ($02A7). Out of a game the unit makes no sound at all except the alarm.

09 · Controls

Left and right are read between the counts of the delay

The four buttons on the front sit on one row of the chip's inputs; left and right have pins of their own.

Time, Game A, Game B and Alarm are read through the R4 row ($0505). A change counts when two readings in a row agree. Pressing Game A shows Game A's best score, and the game starts only when the button is let go ($0540). Once a game is under way the game does not read those four buttons at all until it is over.

Left and right are read by their own test instructions, on each pass and between the counts of the delay ($03D6). Each new press moves Popeye one place; holding the button does nothing more. After the game is over Popeye still moves, unless Bluto's blow ended it (Discoveries).

10 · The clock and the alarm

The clock plays the game by itself

Out of a game the unit is a clock, and the game runs in it at about a step a second.

Twenty seconds of the clock: each frame is one redraw, once a second.

The clock keeps time on the chip's 1 Hz flag, set by a 15-bit counter of the 32,768 Hz crystal ($0200). Each second it runs one step of the game with a limit of 3 items. Popeye walks one place toward each item as it passes a point on its path, at most once a second ($0340), and no miss is ever counted. Between seconds the chip stops its own clock with CEND and waits for the next second or a button ($0030).

Alarm switches to the alarm's time, and each press turns the alarm on or off; the bell beside Olive is lit while it is on. Left and right then set the alarm's hours and minutes. Holding Time in the clock shows the alarm's time too ($06C0). After ACL, the reset button, every segment is lit and left and right set the time. In both settings a held button repeats about four times a second ($03D6).