1989 · Activision · Discoveries

Power Drift

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

The time bonus is counted out in the wrong number system, so a stage that ends with the clock's seconds at exactly 45 pays 256,000 points, more than any other time.

01 · Text

Secret: a note in front of the first instruction

The game's code starts at $0834. The 52 bytes before it are text that nothing reads.


  

The bytes at $0800-$0833 (signature_text), as text: a return is a new line, and $05, the code for white text, is left out.

The loader's last instruction jumps to $0834, just past the text. The copyright line on the select screen names Activision, Sega and Chris Butler. What "pbj gma89" stands for is not known.

02 · The time bonus

Bug: the time bonus is counted out in hexadecimal

After a stage won, the panel shows a bonus of 45 minus the seconds on the clock, and counts it into the score a thousand points at a time. The count runs in the wrong number system, so the bonus pays more than it shows, the panel shows letters, and 45 seconds exactly pays the most of all.

The line is drawn with the panel's own characters and colours, from str_bonus ($10CD) with the two bonus digits in its 9th and 10th places, as draw_bonus_digits writes them. What it shows, and what it pays, come from a port of show_bonus and count_bonus written for this page. test_bonus.js runs the game's own routines on the kit's simulator for every second from 0 to 59, with three values of the minutes, and checks that the port shows the same digits at every count and pays the same points. In the emulator, with the seconds set to 20, the bonus showed 25, counted 37 times and left 37,000 points.

The panel showing BONUS 1B000
The count partway through in the emulator: BONUS 1B000. The bonus started at 25 and has counted down past 20 into 1F, 1E, 1D, 1C and 1B.

The clock keeps its seconds as two decimal digits in one byte, a form called binary-coded decimal: 20 seconds is the byte $20. The processor has a decimal mode in which adding and subtracting work on such bytes. show_bonus ($10B4) turns it on and subtracts the seconds from $45, so 20 seconds leaves $25, which the panel shows as 25. It never looks at the minutes, so a race of 2 minutes 20 seconds earns the same bonus as one of 20 seconds. A race of more than 45 seconds into its minute wraps round below 0: 46 seconds shows 99 and 59 shows 86.

count_bonus ($10DA) then repeats, once a frame: turn decimal mode on, add 1,000 points, draw the score, take 1 off the bonus, draw the bonus. But draw_score ends by turning decimal mode off (CLD at $34AE), so every subtraction is plain binary. Counted down in binary, the byte $25 takes 37 steps to reach 0, not 25, and on the way the panel shows 1F, 1E and so on down to 1A, then 0F to 0A: the digits 10 to 15, which the panel's alphabet draws as the letters A to F. The bonus pays its two digits read as a hexadecimal number, counting in sixteens with A to F as the digits after 9, in thousands of points.

So a slow race pays best. Seconds of 46 to 59 show 99 to 86 and pay 153,000 to 134,000 points. Exactly 45 seconds shows 00; the count takes 1 off before it checks for 0, so the byte goes round through FF and the bonus pays 256,000 points, more than any other time. A race of 44 seconds shows 01 and pays 1,000.

03 · The clock

The race clock runs about 40 % fast

The clock on the panel counts the game's own pictures, not time. Ten seconds of play put about fourteen and a half seconds on it.

Run in the emulatorVideo framesRace framesClock moved
Standing, and with up held, in several runs500166 to 17714 to 15 s

500 PAL video frames are ten seconds. Race frames counted with a checkpoint on race_frame_loop; the clock read from $53DF-$53E1 before and after.

race_clock adds 1 to a hidden digit after the seconds every other race frame. The digit runs from 0 to 5, so a second on the clock is 12 race frames. A race frame is one whole picture of the view, drawn while the other screen is shown, and it takes about three of the video chip's 50 frames a second, so the race makes about 17 a second. Twelve race frames take about 0.7 seconds.

The fast clock does not change the order of the race, since every kart moves on the same race frames. It does change the time bonus, which reads the seconds on the clock.

04 · Sound effects

Secret: an engine sound the game never plays

The sound driver holds four effects. The game starts only two of them, and the fourth is an engine's hum that keeps itself going.

A search of the code for every write to sound_effect ($B805) finds the value 2, when the place changes or a rival comes alongside, and 3, for a spin, and otherwise only the driver itself. Effect 4 is a steady tone with a pulse that sweeps up and down, and its last command jumps back to repeat it. Starting it sets $B808, and while that is set, the end of any other effect starts effect 4 again (sound_end_effect). The only routine that clears it, sound_engine_off ($C01C), is called by nothing. It sounds like an engine.

Effect 1 has no writer either. It is the only pattern that uses command 36, which reads the keyboard's port at $DC01 and then ignores what it read (cmd_effect_release). Both can be heard on the How it works tab.

05 · Jumps

In the air, the stick does nothing

A jump fixes the kart's sideways drift at the moment it leaves the ground.

From the 7th to the 21st step of a jump piece the kart is in the air, and piece_jump sets $53E8. While it is set, move_player leaves out the steering and every change of speed; only fire still changes gear. It still adds the road's sideways slide at $30 to the kart's place across the road, and nothing changes $30 in the air, so the kart keeps sliding the way the stick last pushed it on the ground until it lands.

06 · Unused pictures

Two sprites of stripes that nothing shows

Sprites $A1 and $A2 sit in the part of a view screen that is never shown, and no table or routine points a sprite at them.

Sprites $A1 and $A2 from $E840 and $E880, drawn in multicolour, as the race draws every sprite, with the race's two shared sprite colours, black and light grey, and white for their own colour, which nothing gives them.

The video chip finds a sprite's picture at 64 times its pointer in the video bank at $C000. Pointers $A0 to $A2 land in rows 0 to 4 of the view screen at $E800, which is never shown, since the panel takes those rows from another screen; so the game keeps three sprites there. $A0 is the last driver's head looking back. The other two hold only bands of stripes.