1984 · Software Projects

Jet Set Willy

This minisite was contributed by air, 64kramsystem. It’s agent-generated and needs a human editor. Clone https://github.com/gamesexplained/gamesexplained and follow kit/START.md to curate games/c64/jet-set-willy with me to Gold.

A house of sixty rooms drawn from four kinds of cell, two tunes tuned for an American machine, and a housekeeper who leaves after 50 of the 80 items, though the bed she guards does nothing.

01 · The game

Miner Willy's new house

Willy has spent his fortune on a mansion and thrown a party in it. Maria, his housekeeper, will not let him go to bed until the mess is cleared: 80 flashing items left in the house's sixty rooms. He walks and jumps, climbs ramps, rides conveyors and swings on ropes, and anything that moves kills him, as do the hazards drawn into the rooms. He has nine lives, and a clock on the status line runs from seven in the morning.

This page is about the Commodore 64 version, as the Berlin Cracking Service released it on disk. Its rooms, sprites and tunes are the game's own; the crackers' part is a start-up that goes straight to the title.

The title screen: JET SET WILLY in large letters, with a scrolling message below
The title screen, which plays the Moonlight Sonata while its message scrolls.
The Bathroom: Willy beside the bath, the toilet on the right, a staircase climbing to the right
The Bathroom, where every game starts, at seven o'clock.

02 · The tunes

Music: both tunes are tuned for an American C64

The title plays the opening of Beethoven's Moonlight Sonata on three voices, and the house plays Bach's first two-part Invention on two. Press a tune to hear it as a European machine plays it, or switch the clock to an American one.

Machine

The page runs a port of the game's two music players, the title's ($A139) and the one in play ($2066), through the site's model of the SID, three ticks every second frame as the game's interrupts call them ($A821, $3435). The game plays the in-game tune round and round; the player stops once it starts again. The filter is on, with one 8580's cutoff, because the in-game tune's first voice depends on it: the model lets nothing of that voice through, where VICE's 8580 lets it through about 19 dB down.

Both players read the same table of 96 SID frequencies, once at $20EC and again at $A207. A SID's frequency word counts in cycles of the machine's clock, so one word gives a lower note on a PAL machine, whose clock is slower. By the NTSC clock the table's index 58 is A#4 at 466.2 Hz, and the notes fall a semitone apart, close to concert pitch. By the PAL clock the same word gives 449.1 Hz, and every note is 65 cents lower, nearer the semitone below than the note it was written as. The tempo moves too, since the players count frames: 50 a second in Europe, 60 in America.

The in-game tune starts at $2005 by storing 1 in every SID register from $D401 to $D418 before setting the ones it uses. That leaves the filter's cutoff at almost nothing and voice 1 routed into the filter ($D417 = 1), with none of the filter's three outputs switched on. Voice 1 goes in and very little comes out, so the upper voice plays almost silent all game. With the filter switched off above, voice 1 plays as it does in another crack of the game, which has 0 at $2020 and clears the registers instead.

03 · The screen

One frame, rebuilt from memory

The Bathroom as the game draws it, rebuilt from the video chip's registers and memory, with Willy, a guardian and the toilet as sprites. Switch the sprites off, or colour each cell by the background register it takes.

Drawn by the site's renderer from one frame of the game, its registers, screen, colour memory and the bytes the drawing reads. The screen is in extended colour mode: the top two bits of a cell's code pick one of four background colours, $D021 to $D024, and the low six bits its glyph. Willy is sprite 0, the guardian sprite 1 and the toilet sprite 7.

Extended colour mode costs the game three quarters of its character set: only 64 glyphs can be drawn, each in any of four backgrounds. The rooms need seven of them, $20 to $26, all on $D021, the room's background. The room's name sits on $D023, and the cells round the room are code $C0 on $D024, the border's colour, so the border seems to reach in to the edge of the room ($2E9C).

04 · Rooms

A room is 256 bytes

The Bathroom's record, as it sits at $E300. Press a field, or any byte, to see what the game makes of it.

The picture is drawn by a port of the game's room builder ($2E55 to $30E1) from these bytes, in reference/jsw-rooms.js. The Map tab draws every room with it.

Rooms 0 to 29 sit at $B000 and rooms 30 to 59 at $E000, under the KERNAL ROM, so the copy that brings a room to $0840 runs with every bank switched to RAM ($2E55). The map is 32 by 16 cells at four to a byte, so a room's whole layout takes 128 bytes, and each cell is one of four kinds: air, floor, wall or hazard. The conveyor, the ramp and the items are drawn over the map afterwards. Six glyphs come with every room, so the same kind of cell looks different from room to room.

05 · Willy

A jump is 36 steps, and a fall of five cells kills

Willy is in one of seven states, and each update of the main loop runs that state's handler. Drag the slider along a jump and the fall after it.

The jump's heights are the table at $102D, one step added to Willy's height on each update, read by the jump state at $1257; the fall is state 2 at $11FB, two pixels an update. Willy's sprites, $06 to $0D, are drawn from $4180.

StateHandlerWhat Willy is doing
0$1091Standing or walking
1$123DJumping: 36 steps, rising 20 pixels and coming down 20
2$11FBFalling, two pixels an update, counting the updates
3$14C1Climbing a ramp: up one cell, two pixels an update, then back to state 0
4$151FCarried by a conveyor
5$1538Onto a conveyor: works out which way he was going, and stays in this state while he stands or walks against it
6$1ABCHolding a rope

A jump rises 20 pixels over its first 17 steps, stays level for three and comes down over the last 16, back to the height it started from. Up to step 17 the game looks for a ceiling, and a wall there ends the jump in a fall; from step 18 it looks for something to land on. Both checks run only when Willy's height reaches a whole cell. After the 36th step a jump that has found nothing becomes a fall.

A fall counts its updates in $51, and each time Willy passes a whole cell a count of 17 or more marks the fall as deadly ($11FB). A fall begins on a cell, so the counts at the cells are 4, 8, 12, 16 and 20: a drop of four cells is safe and a drop of five kills him when he lands. A jump never kills by itself: the jump state has no such check, and it can land only where it began or higher. A floor below the take-off is reached by the fall that follows, counted from the take-off's height. The count goes with Willy into the room below, and into the place he restarts from after a death, which is how one jump can cost every life (Discoveries).

06 · Guardians

Eight bytes decide everything a guardian does

A guardian is a sprite that moves up and down or across its room, through frames of its own. The Graphics tab shows every guardian's frames as the game steps them.

A room names its first guardian in the table at $2443 and how many there are (offsets $E0 and $E1), up to seven. Each guardian is eight bytes: which way it moves and which way it starts, its column and row, its first sprite, its far bound, a mask for its frames, its speed and its near bound. Guardians that move across step a column at a time between their bounds, and going right add 4 to their frame when their mask byte is 4 or more ($369E); guardians that move up and down climb and drop between theirs ($3614). Those two routines alone decide where they go: a guardian never looks at Willy. The Map tab runs every room's guardians with a port of both routines.

Arrows are separate, 16 records of four bytes at $2403: the room, a countdown, a column and a row. One flies across its room on sprite 6 when its countdown runs out, and a burst of noise on voice 3 warns of it ten counts before. The loop at $314D runs only 15 of them, so the arrow in The Beach never flies, and three records name room 99, which does not exist (Discoveries).

07 · Ropes

A rope is 34 drawings of three sprites

Five rooms have a rope. On the Graphics tab it swings, and a slider takes it through its 34 positions.

The rope is three sprites stretched to double height, sprites 5, 6 and 7, and the game keeps a drawing of all three for each of 34 positions: 102 sprites, 6,528 bytes. Positions 0 to 16 take it from hanging straight down out to the right, and 17 to 33 do the same to the left, mirrored. Every second player update moves it on one: from 16 down to 0, on through 17 to 33, then back. Willy holds it at one of 16 points down its length, from a table of 32 bytes for each position at $189C; on the second half of the swing the game mirrors the x ($1C86). Holding the way the rope swings slides him down it, the other way up it, and past the top he leaves by the room's upper exit.

On a rope the touch that kills Willy is turned off for sprites 5 to 7, the rope itself ($3392). The cells are another matter: when his sprite touches any cell's pixels, the check at $1B96 compares the cell's screen code with the tile kinds 0 and 3, and since a room's cells are codes $20 to $26, neither matches. Every touch makes him let go, and a hazard never kills him while he holds on.

08 · Controls

Every other key on the top two rows walks left

The keys the game reads, from its tables at $2C2B to $2C4C. A joystick in port 2 does left, right and jump.

leftrightjumppausemusic, volume, end

Each key's job is from the four tables of key codes the input scan at $3791 reads: left, right, jump and pause. Return, + and − are read elsewhere ($39F1, $34EC), and RUN/STOP ends the game ($3132).

The keys alternate along the top two rows: Q, E, T, U and O go left and W, R, Y, I and P go right, and the number row does the same. The whole bottom row jumps, and the home row pauses; any key that is not a pause key ends the pause. Return turns the music off and on. The + and − keys raise and lower the volume, from 12 by steps of one between 0 and 15, but only while the music plays, and the title's message never mentions them.

09 · Items, Maria and the clock

Maria leaves after 50 items, and the bed does nothing

The Master Bedroom, where Maria guards the bed. Take 50 items to send her away.

Drawn by the port of the room builder, with Maria placed as $3284 places her: sprite 7 at x $A8, every other sprite switched off, until the flag at $0400 is set.

Taking an item adds one to a decimal count at $0401, which the status line shows, and when the count reaches 50 the pick-up at $164A sets $0400. That flag does one thing: $3284 stops drawing Maria, and the Master Bedroom, which has no guardians, is left empty. There are 80 items, and the count goes on past 50, but the rest of the game never reads $0400. Willy can walk to the bed, and nothing happens there.

So the game ends one of three ways: the last of nine lives, RUN/STOP, or the clock. It starts at 07:00:00 and the game is over when the hours read 12 ($33BB). The play interrupt adds a second every 50 frames ($3446), which is a real second on a European machine: five hours, whatever Willy has collected.