1987 · Imagine

Arkanoid: discoveries

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

Two things the code shows and a player never sees: how the capsules are chosen, and a protection check the game scrambles before it can run.

01 · Capsules

Secret: the capsules are dealt by the clock

When a brick breaks, choose_capsule ($B2E6) looks at the low byte of a frame counter that counts up 50 times a second, and that one number sorts every broken brick into three groups.

Lives Frame counter high byte $0241
Silver and gold bricks in the round

Each bar is the share of 10,000 broken bricks that gave that capsule, with the frame counter, the ball's X and its height drawn at random, and each result fed back as the "last capsule". The chooser on this page is a port of $B204-$B21B.

Frame counter $0201What falls
$A0-$FF and $0A-$1F (118 frames of 256)nothing
$20-$9F (128 frames)S or C: bits 0-1 of the counter XOR the ball's X give S once in four, C three times in four
$00-$09 (10 frames)the first that applies: B if bit 1 of the lives is set, L if $0241 is $12 or more, D if the round has four or more silver and gold bricks, E if the ball is in the upper half of the screen, else S or C as above

Then $B209-$B219 apply two rules. A capsule of the same type as the last one is bumped up by one, so a second C in a row arrives as an E, and a second S as a C. And the extra life, P, is never chosen directly: the only way to get one is a B when the last capsule was also a B. A capsule falls at all only when no other is falling and exactly one ball is in play ($B1E5-$B204).

The lives test reads the count as stored, in binary-coded decimal, so with 2, 3, 6 or 7 lives the rare window gives the Break capsule, and with 1, 4, 5, 8 or 9 it never does. The laser only becomes possible once $0241, the counter's high byte, reaches $12: 18 × 256 frames, a little over 90 seconds.

TypeLetterEffectCode
1Sball speed down by one, never below 1$A8BA
2Ccatch: the ball sticks to the Vaus until fire, or until the counter reaches $80$A8AC, $AA76
3Ethe Vaus grows from width 4 to 12$AA44, $AD4B
4Dthree balls, and the speed up by one$A8CD
5Llaser, two shots at a time$A870, $A5F3
6Ban exit opens in the right wall; leaving through it ends the round$A868, $A41F
7Pan extra life, up to 99$A882

Catching any capsule first switches off catch, laser, break and the enlarged Vaus (cancel_powers, $AA17). A capsule caught is worth 1,000 points ($A9DD).

02 · Protection

Secret: the protection scrambles its own second check

The game starts at $9400 and hides its first steps behind undocumented opcodes: a NOP with an operand at $9404 and another at $095A, which a disassembler that knows only the documented set shows as data. The bytes after the JSR $B9C3 at $095D look like the continuation and never run, because $B9C3 leaves by JMP $F000.

The start-up then sends a byte out through the first CIA's serial port and waits for the chip to report it sent ($5F42), a test of the hardware rather than the disk. Both routines erase themselves when they finish: $5F42 fills itself with $01, and $B9C3 overwrites its first 40 bytes with $20.

On the way it XORs 97 bytes at $BA0A with a key at $A71A, which is live game code. The bytes at $BA0A are a longer serial-port check, and in the file they are plain code: the XOR turns them into noise. The game never calls that check in this build, and the flag it would set, $0944, is the trigger for a routine that wipes memory ($A523). The only other writer of the flag is a checksum over $9500-$A5FF at $F9BC, which the game never calls either, so the wipe never runs.