1984 · First Star Software

Boulder Dash

This minisite was contributed by air, 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/boulder-dash with me to Gold.

The cave is built from characters, and the creatures move by rewriting their own characters.

01 · Rockford

Rockford walks, blinks and taps his foot

Rockford is one tile of four characters, like everything else in the cave. At every step of the animation the game draws those four characters again from tables of frames, so he moves on the spot without a sprite.

The routine at $7BC2 writes his upper two characters ($3260) from one table and his lower two ($32E0) from another, 16 bytes for each phase. Walking left takes them from $64E8 and $6568, walking right from $65E8 and $6668. Moving up or down keeps the way he last faced. Standing still, he shows the plain standing characters $42, $43, $52 and $53, with the eyes from $63E8 while he blinks and the feet from $6468 while he taps. A phase lasts two frames, as for the creatures below. The colours are cave A's.

Whether he blinks or taps is left to chance. At the start of each cycle of eight phases, while the joystick is centred, there is one chance in four that he blinks for that cycle, and one in sixteen that he starts tapping his foot, or stops if he was tapping already ($7C04). Once he starts tapping he keeps on until the next one-in-sixteen chance or until he moves, and any move stops both.

02 · The creatures

Four animated pictures, eight phases each

The firefly, butterfly, amoeba and diamond move by changing the shape of their own characters, not by moving a picture around.

The 16 by 16 picture is a tile of four characters. Each phase of the frame tables holds 16 bytes for the upper row and 16 for the lower, and the routine at $7C61 copies the current phase into the character set at $3100-$33AF once for each step of the animation ($7E8F), which comes every second frame, 25 times a second on a European machine, the speed Play shows. The colours are cave A's.

Caves A to P only pay for the pictures they use. The mask byte for each of them ($8740) says whether fireflies, butterflies or the amoeba are present, and the routine rebuilds those sets only when their bit is set. The bonus caves have no mask byte and rebuild all three; the diamond and Rockford are always rebuilt. This keeps the work of each animation step small.

03 · Character sets

Two sets, copied into place at start

The program keeps two character sets in its file and copies them to where the VIC chip reads them when it starts ($8D11). The text set of 118 characters holds the digits, letters and the title's pieces. The tile set of 128 characters holds the cave's tiles. Characters of the tile set from $20 up that are animated hold a picture in the file that is none of the eight phases (the diamond's is an outline), and the frame routine overwrites them as the game runs.

Text set, characters $00 to $75 in rows of 16 (drawn black and white)

Tile set, characters $00 to $7F in rows of 16 (cave A's colours)

04 · Colour

Four colours a cave, three from its header

The cave tiles use the VIC chip's multicolour character mode, in which each pair of pixels picks one of four colours. One is the background, black. Two come from the cave's header (bytes 19 and 20, written to $D022 and $D023 at $8226), and the fourth is the colour held in colour memory, which the header's byte 21 also sets. This is why each cave looks different with the same shapes: cave A pairs orange and dark grey with white, and the bonus caves choose others.

Two screen regions with different settings share the display: the status line at the top and the cave below it. The raster interrupt ($8A0C) switches the VIC registers between them by writing from two small tables ($89A4 for play, $899C for the title).

05 · Scrolling

A window on an 80 by 44 character buffer

The cave is 40 by 22 cells of 2 by 2 characters, which is larger than the screen shows at once. The game draws all of it into a character buffer 80 characters wide and 44 high at $4003 and shows a window of it, scrolling it two pixels at a time with the VIC's scroll registers and moving the window's start by a character when the fine position wraps ($7878, $78F1). Two screens at $0C00 and $2C00 are copied to in turn, by routines copied into $9E00 and $9F00 at start.

The window follows Rockford: the scroll speed is set from the row and column of the window where he stands ($79E2), and stops at the cave's edges ($796D).

06 · The loading picture

The Stars and Stripes in the shape of the United States

Statesoft's 1984 cassette loads its picture with the screen switched off, then puts it up whole, 74 seconds into the tape: the American flag cut to the shape of the United States, STATESOFT across it in black, and below, on white, PRESENTS Boulder Dash ©1984. It stays up, in silence, for 53 seconds.

The cassette's own bytes, drawn as the video chip draws them, with the border as the loader painted it in that one frame.

The stripes are the loader's. It moves the border on to the next of the C64's sixteen colours each time it reads a bit from the tape, so every stripe is one pulse of the signal: a thin stripe a short pulse, a thick one a long pulse.