1990 · Domark

The Spy Who Loved Me

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/the-spy-who-loved-me with me to Gold.

What the code shows that the screen does not: a development link left in, signs that show a tenth, and a price that goes down as the damage goes up.

02 · A slip of a zero

Signs worth ten times what they say

Shooting an enemy makes a sign float up from it with the points it scored. The points go straight into the score's hundreds (add_score), so an object worth 5 in its table adds 500 to the score, and one worth 10 adds 1,000. The signs, though, are sprite frames that read 50 and 100 (score_popup, sprites). Every sign shows a tenth of what was scored, which a player watching the score climb could see.

Running over a person follows the same rule the other way. hit_person takes 500 off the score, stopping at zero rather than letting it go negative, plays a sound, and floats up a sign reading -50. Commodore Format's review said a bystander costs 50 points, the figure on the sign.6

03 · Arithmetic

Armour that costs less the more it is damaged

The armour replacement has no fixed price: the shop works it out from the damage. A car a point below three-quarters armour pays 1 token, and a car a point above pays 8.

The armour is a byte from 255, full, down to 0 (armour). show_item takes the damage, 255 minus the armour, divides it by 8 to get 0 to 31, clears the bit worth 8 with the mask $17, and adds 1. With 191 armour left: the damage is 64, divided by 8 that is 8, the mask clears it to 0, and the price is 1. With 192 left: 63, then 7, which the mask keeps, and the price is 8. The prices are counted in decimal digits, two to a byte, so a byte above 9 in either half would not be a price at all; the mask keeps both halves in range by clearing the bit worth 8. That bit is also the one that is set for a damage of 64 to 127 or 192 to 255, so the price climbs from 1 to 8 tokens over the first quarter of the damage, falls back to 1 and climbs to 8 again over the second, then jumps to 11 and climbs to 18 twice over the second half.

Armour leftPrice in tokens
255 to 1921 to 8
191 to 1281 to 8 again
127 to 6411 to 18
63 to 011 to 18 again

04 · Bought early, given late

Weapons that wait for the sea bed

The miniature lasers, the side rear bolts, and the torpedoes go into stores of their own when they are bought (shop_items), not into the weapons the fire button uses. Only when the sea bed starts does section_3 move them across. On the coast road, where the truck is, they do nothing, and a car that never buys the sub capability has paid for them in vain (the shop). Losing a life throws them away: after_death empties all three stores before the stage starts again, and on the sea bed itself the restart takes the ones in use too (reset_car), with no truck there to buy more. A death on the coast road also takes the sub capability, so the 75 tokens have to be found again (lives).

05 · Unheard sounds

Two effects nothing plays

The music player holds sixteen tunes, six bytes each in tune_table, and every sound in the game is one of them, started by play_tune. No call starts tune 6 or tune 7, so neither is heard in the game. You can play both on the Music tab.

The player also has a branch that leaves the third voice alone for tunes from 40 up, which a check at $EA82 tests; with sixteen tunes, that never happens. The theme and the effects never sound together: while the theme is on, a call for an effect only starts the theme again once it has ended, and pressing C= swaps the theme for the effects, playing tune 8 to say so (read_keyboard, the music switch).

06 · Saving bytes

Instruments that share a byte

Each of the player's instruments is ten bytes of settings, but they are stored nine bytes apart (set_instrument). The last byte of one instrument is the first byte of the next, so every instrument but the last shares a byte with its neighbour: an instrument's tenth byte, which the player copies to $E9DA, is also the next instrument's first, its pulse sweep. One value has to serve both.

07 · A closed door

RESTORE does nothing

On a C64 the RESTORE key goes straight to the processor's non-maskable interrupt, which a game cannot switch off. The game points that interrupt at a single RTI, return from interrupt (nmi_ignore), so pressing the key changes nothing.