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.

Two falls in the house are replayed on every life until the game is over. The room-select cheat, the copy protection and scraps of the source code are all still in memory, one byte or one call away from working.

01 · Bug

Bug: one jump off the Watch Tower costs all nine lives

When Willy dies he goes back to where he came into the room, in the state he came in. If he came in falling, he falls again.

RoomHeightFall countDeadlySpare lives

The fall code at $11FB, ported and run on the cells of the two rooms, the Watch Tower above We Must Perform a Quirkafleeg: two pixels and one count each update, the count tested each time Willy reaches a whole cell, and the cells under his feet looked at by the rules of $12E9. The jump over the wall is left out, and the fall starts where the jump leaves Willy, in column 3 at height $48. In the game the same jump takes all nine lives, one landing after another, and the game goes back to the title.

On every room entry, $2E7C saves a checkpoint of eight values that the death sequence at $38EF puts back: Willy's state, height, fall count, phase, column, room, frame and place in a jump. Coming in through the top of a room, $2DC6 puts him at height 0, still falling, and keeps his count. So the checkpoint holds Willy in mid-air. Willy cannot steer a fall, and if that fall ends in a deadly landing, every life replays it and ends the same way.

The Watch Tower's roof is a platform with a low wall at each end. Jump left over the wall and the jump ends level with the roof, over nothing. Willy falls five cells to the bottom of the room, which takes 20 counts, and carries them into the room below. A count of 17 at a whole cell marks a fall deadly, so he dies when he lands on the stair seven cells further down, and starts again at the top with his 20 counts. Even a count of 0 would not save him there, because a seven-cell fall is deadly on its own.

The Entrance to Hades does the same with guardians. Walk left along the floor of The Security Guard and Willy drops off its end, through a gap, into room 6, where the guardians in his path kill him on the way down. He restarts at the top of the room, falling, and meets them again. In one game that took the nine lives in ten entries into the room. Had he got past them, he could never have left: all four of room 6's exits lead back to room 6.

The Entrance to Hades, its walls spelling DIE MORTAL, with Willy falling towards a devil's face at the top left
On the seventh of the nine falls into the Entrance to Hades: Willy, top left, just above the guardians, with two spare lives left on the status line.

02 · Secret

Secret: put back one byte, and ↑ F A C E S takes Willy to any room

The room-select cheat is all still there at $1BBC. Its first instruction has been overwritten with an RTS, so it returns as soon as it is called.

The room the two digits choose, drawn by the port of the room builder from How it works (A room is 256 bytes). The first digit, 0 to 5, picks the tens from the table at $1C46, and the second the units, so the cheat reaches every room from 0 to 59 and no other.

The player code calls $1BBC on every tick. With its first byte back as $A5, which makes the first instruction LDA $43, it looks at the keys the scan at $3791 has decoded. ↑ on its own starts it. The sound goes quiet and interrupts go off while it waits for F, A, C, E and S, each pressed on its own, and any other letter makes it give up. The border turns white, the two digits choose the room, and Willy goes there through $1027, the same way he would through an exit. He keeps his place on the screen unless one of the old room's exits names the new room, because $2DC6 places him by that exit. The cheat means to put the border's colour back afterwards, but stores it in $D014 instead of $D020; the new room sets the border anyway.

With the byte restored, ↑ FACES 5 7 takes Willy to The Beach, 4 9 to the Watch Tower and 0 5 to The Security Guard. To try it, put the byte back from the emulator's monitor before starting a game:

> 1bbc a5

03 · Bug

Bug: four of the sixteen arrows never fly

The arrows are 16 records of four bytes at $2403. The loop that flies them stops after 15, and three of those 15 name a room the house does not have.

RecordAtRoom it namesFlies

The 16 records, read from the game's bytes. Over 600 frames in each room, sprite 6 shows an arrow in no frame in The Beach, in 83 in Cuckoo's Nest and in 51 in I'm Sure I've Seen This Before.

$314D starts its count at 15 and stops when the count reaches 0 ($3247), so the sixteenth record, at $243F, is never looked at. The arrow in a record flies only while Willy is in the room its first byte names, less bit 7 ($315D). Records 7, 11 and 12 name room 99, $63, and the house has rooms 0 to 59, so the loop passes over those three in every room.

04 · Secret

Secret: the copy protection is still in the game, and its answers are the game's own code

The game first came with a card of coloured squares, and asked for a code from it before it would start. This release never calls the card's code, but all of it is there at $3A02, and the card can be worked out from it.

The whole card, worked out the way $3B20 works out one cell: the low two bits of each of four bytes from $2C57 plus four times the cell's number, shown red, green, blue and yellow as the card's keycaps are ($3A74). Click a cell for its colours and the bytes they come from.

The card has 20 rows, 0 to 19, and 18 columns, A to R: 360 cells of four colours each. The code picks a row and a column at random from SID voice 3's oscillator ($3B12), prints ENTER CODE AT GRID LOCATION with the cell's name, and works out the four colours it expects from the four bytes at $2C57 plus four times the cell's number ($3A61). $2C57 is where the game's initialiser starts, so the answers are the first 1,440 bytes of the game's own code, read two bits at a time. The player types 1 to 4 for each colour and presses Return. A wrong code gets a second cell, and a second wrong code turns the screen red and stops ($3C6B).

The crackers' start-up at $080D goes straight to the title, so none of this runs. With the processor sent to $3A02 in the middle of a game, the card asks for A14, cell 252. Its bytes, $3047-$304A, give green, yellow, green and green, and those four are accepted: the code puts its success header at $8000 and the title started. That header points RESTORE back at the title, but a reset jams the processor at $A005, because it leaves BASIC's ROM switched in where the title should be. Whether a printed card shows these colours is not known; it would only if it was made from the same build of the code.

05 · Bug

Bug: the bed Maria guards does nothing

Maria leaves the Master Bedroom after 50 of the 80 items, as How it works shows (Maria leaves after 50 items). With her gone, Willy can walk to the bed, but nothing in the code is waiting for him there. The only flag the items set, $0400, is read by one routine, the one that draws Maria ($3284), and the game goes on until the clock reaches twelve or the lives run out.

The Master Bedroom with Willy standing on the bed, and no Maria
With $0400 set: Willy on the bed and Maria gone. Two hundred frames later nothing has happened.

06 · Bug

Bug: a hazard never kills Willy on a rope

While Willy holds a rope, a touch between his sprite and the pixels of any cell ($D01F) sends the code at $1B96 to look at the cells round him. It means to kill him on a hazard, kind 3, and let him pass air, kind 0. It reads the cells from the screen, though, where a cell is a character code, $20 to $26, and never 0 or 3. So any cell he touches counts as something solid, and he lets go and falls, hazard or not. How it works shows the rope itself (A rope is 34 drawings of three sprites). This one is traced in the code; it was not tried in play.

07 · Secret

Secret: + and − set the volume, while the music plays

The title's instructions give the keys for walking, jumping, pausing and the music, and leave two out. Every 15 frames, while the music is on, the play interrupt reads + and −, which raise and lower the volume in $5F between 0 and 15, starting from 12 ($34EC). In one game + took it from 12 to 15, and − from 15 to 10. With the music turned off with Return, the keys do nothing: the same branch walks the spare lives along the status line, and they stand still too.

08 · Bug

Bug: Willy never turns round on the spot

The code for standing and walking, and the code for the rope, each have a branch that turns Willy round where he stands ($1091, $1ABC), taken when $4B is $FE. The key scan sets $4B to $FE only when the direction held, $49, exclusive-ORed with $60 gives $FE ($382C). The only store to $60 comes after that test passes, and the game's clearing of the zero page at $2C93 stops at $5F, so $60 stays 0. The test then needs $49 to be $FE, and the game only ever stores $FF there for left, 1 for right and 0.

09 · Bug

Bug: five conveyors stand still, and one turns the wrong way

The play interrupt makes conveyors move by rotating a byte of every room's conveyor glyph, in the room records themselves: 19 rows to the right from the pointers at $2271 and 22 to the left from $2297. Then it copies the current room's glyph to the screen's glyph $25. Five rooms with a conveyor have no pointer in either table: Ballroom West, the Master Bedroom, the Emergency Generator, the Conservatory Roof and The Bow. Their conveyors still carry Willy, the way the room's record says, but never move on screen. West of Kitchen's top row is in the right-hand table while its record sends Willy left. The glyph at $7928 changes within 60 frames in The Bathroom and stays the same in the Master Bedroom.

Halfway up the East Wall has a conveyor its record does not hold at all. The record gives the room a ramp of six cells, from row 2, column 6, down to the right; once the room is drawn, $30E1 turns those six cells into conveyor cells, at addresses written into the code, and sets the conveyor to carry right. They keep the ramp's colour.

10 · Leftovers

The source of the rope code was saved with the game

The game was saved straight from memory, with whatever the programmer's tools had left there. Five scraps of the assembly-language source survive in gaps between the data.

Each scrap decoded from the game's bytes, ASCII with bit 7 cleared, $0D a new line and $09 a tab, beside the shipped code it matches, from the listing.

The longest, at $9A80, is the source of $1AED-$1B3E, the code that moves Willy along a rope and lets him go, line for line but for one jump: the source has JMP NRPCHK twice, where the code jumps to $107B at $1B0B and to $107E at $1B34. It is written with macros: POKE stores a value, STZ stores a zero, TRA copies one place to another, and IFNOT compares and branches. And it names the variables: FLAGS for the player's state, FALLCNT and DEADFALL for the fall count and its deadly flag, RYCNTR for Willy's place on the rope, SHEETUP for the room above, and JUMPREQ, MANXDIR and JPDIR for the jump. The scrap at $80CF is the four instructions at $1510, DEC MANYPOS twice and DEC CLIMB twice: Willy's height and the counter that takes him up a stair. The one at $6BC0 begins Willy's shape: its nine bytes are the left-hand bytes of the first nine rows of his first frame, at $4180. The initialiser at $768D is close to the shipped one at $2C57 without being the same: it switches BASIC out by clearing bit 0 of $01, where the shipped code stores $36, and takes its steps in another order.

Other things came along with them: