1988 Β· Elite Systems

Mike Read's Computer Pop Quiz

This minisite was contributed by Nico-van-der-Zijden. It’s agent-generated and needs a human editor. Clone https://github.com/gamesexplained/gamesexplained and follow kit/START.md to curate games/c64/mike-reads-computer-pop-quiz with me to Gold.

The whole game, written again in JavaScript routine by routine and run on its own bytes at the C64's pace, from the cassette's hand-over through the menu, the question blocks and the show.

01 Β· Play

Play the quiz with the keyboard

Up and down choose a game for one player or two, and fire starts it. Each player then picks a specialist subject from the six icons, a captain and two team members from the twelve stars, and player one picks one of the five question blocks, which loads from the "tape". In the show the answers come up on the left; the stick moves the bar to an answer and fire gives it. In a game for one player the computer plays the other team.

Player one (joystick 1)Player two (joystick 2)
Tap a key in this table to press it in the game.
UpW[ (the C64's @) or ↑
DownX/ or ↓
LeftA; (the C64's :) or ←
RightD\ (the C64's =) or β†’
FireS or Space' (the C64's ;) or Enter

The game reads both, the stick and the keys. When the stick of the player whose turn it is reads nothing, the game looks at that player's keys on the C64's keyboard: W, X, A, D and S for player one, and for player two @ / : = and ;, which sit where [ / ; \ and ' are on a PC's keyboard. Space is fire for player one because it shares a line of the keyboard with the fire button of joystick 1. The arrow keys and Enter are joystick 2.

02 Β· The port

The game's logic, written again in JavaScript

Nothing of the game's program runs on this page as 6502 code, but its music and sound effects. The rest is written out in JavaScript, one function for each routine of the listing, in six files under reference/: the interrupts and the input, the drawing, the questions, the show, the menu, and a few routines the others share. It runs on the game's own 64 KB, loaded from the bytes the Source code tab shows, and every variable stays where the game keeps it. The music and the sound effects are the game's own drivers, run on the site's model of the 6502.

One race in the game plays out differently: when the main program starts a sound effect, the frame's interrupt can fall in the middle of it and play the effect's tables half written. The port starts the effect whole, so now and then the SID's filter differs for a frame from what the C64 would play.

The page keeps the C64's pace by keeping its clock. Each stretch of the main program moves the clock on by the cycles the game's own code takes there, and the clock runs the raster interrupts on their lines, each with its own cost, and takes from the processor the cycles the video chip takes on its bad lines and for its sprites. The game itself waits for the interrupts most of the time: the text in the bubble, the clock and the stick are all worked by them. Given the same joystick and the same random seed, the page reaches the show's first step 3,214 frames after the hand-over, one frame before the C64.

The screen is drawn by the site's model of the video chip from the port's memory. The answers and the captions are rows of sprites, moved down the screen by the interrupts as the beam passes, so each of the interrupts' writes to the video chip, and to the sprites' shape pointers, is put at the line and cycle where the game's own handler makes it.

The question blocks are the game's data: block 1 is in the quiz part's listing, and the files of blocks 2 to 5 and the sound effects, which the tape holds before each block, are carried on this page as the tape holds them. A load takes half a second a file here, and the bar says which block is loading.