1984 · Datasoft

Bruce Lee

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

A floor is a colour, a copy protection burns slowly inside the jump sound, and the bonus-life check compares a number one byte at a time.

Terrain by colour

The game finds the floor by looking at the pixels

There is no map of floors, walls, and nets anywhere in the game. Every pass, terrain_test ($5212) takes the outline of each fighter’s current frame, shifts it to where he stands, and ANDs it with the pixels of the room characters under it, four character rows deep (touch_test, $537E).

A multicolour pixel has one of four values, and each value the outline touches becomes a flag (touch_flags, $5431). Bit 0 means a pixel of colour %01, bit 1 of %10, and the third colour, %11, gives bit 3 in a character whose colour RAM is black and bit 2 in any other. Bit 2 is the solid surface: what a fighter stands on ($1F7E) and what he climbs (climb_step, $1DEC).

So the artist decided where Bruce can stand by how the rooms were painted. A net is climbable because of the colour its strands are drawn in and the colour RAM of their characters: the same strands in a character coloured black would set bit 3 instead.

A bonus-life slip

The extra fall compares the score one byte at a time

A fall is added at 40,000 points and then every 30,000 ($438B, $438E). The score is a 24-bit number in three bytes ($41-$43), and add_score ($312C) gives the fall only when each of the score’s three bytes is at least the matching byte of the threshold.

That is not the same as the score being at least the threshold. 40,000 is $009C40. A score of 40,200 is $009D08: higher, but its low byte, $08, is below $40, so no fall. So 39,900 + 100 = 40,000 and 40,150 + 125 = 40,275 earn the fall, while 40,100 + 100 = 40,200 and 65,400 + 200 = 65,600 do not.

The fall is only delayed: the next score whose bytes all clear the threshold gives it. The same slip comes with every threshold. The second fall is due at 70,000, $011170, and a score of 70,150, $011206, does not earn it.

Copy protection

A slow fuse in the jump sound

The game checks a block of bytes that its loader leaves at $CF00-$CFB1 in several places. At start-up, check_cf8f ($512F) hangs unless two of them are $B9, and another check ($06DD) writes over memory for ever unless six of them XOR to zero. Every frame, protect_fill ($1703) wrecks memory unless the loader’s mark $32 is in $02.

The cleverest check is hidden in jump_sound ($1FC4). While a byte worked out from the block is zero ($1166, set from $CF79 XOR $CF99), every jump moves the operands of another check one byte along. After $99 jumps it writes a TXS instruction over the first byte of the random-number routine, which wrecks the stack the next time it runs. A second byte, $2007, drives the same kind of fuse against the CLC at $1FFE.

In the copy studied neither byte is zero, so nothing burns. A copy whose protection bytes were wrong would play normally at first, then crash some 150 jumps in.

Left alone

The game pauses itself and cycles its colours

With no stick or fire touched for 128 x 256 frames, about eleven minutes, the game pauses itself, shows PAUSED, and saves the room’s colours (idle_count, $1628). While it waits, the room’s colours are the saved ones XORed with a count that goes up every 256 frames, so they change every five seconds or so until a stick moves (idle_colour_cycle, $1645).

Hidden text

REV.2, by RJF

Pressing V in play writes “BRUCE LEE (C) 1984 DATASOFT REV.2 BY RJF” over the top row, and pressing it again clears it (show_version, $1B68). The line is in the game’s own character codes ($4707), so it does not show up as text in a search of the program. The initials match Ron J. Fortier’s.

Leftovers

Traces of an earlier build

Room 10’s routine has 22 NOP instructions in the middle of it (room_10, $3C90). Twenty-two bytes is exactly the length of the block in room 11’s routine that sets the moving hazard going when a lantern is taken (room_11, $3CC0), as if a copy of that block had once been in room 10 and was blanked out.

The music player’s second song points into the sound-effect code, and two of the fifteen effect scripts, 3 and 8, are never asked for (Music).