Commodore 64 · 1985 · Activision

Little Computer People

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/little-computer-people with me to Gold.

A man and his dog live in a house that is a single picture loaded with the program. He runs on 128 small state machines, reads what you type through 156 words and 34 rules, adds up your manners, and keeps a clock of his own.

01 · The house

One picture, loaded whole

The house is a multicolour bitmap that arrives with the program: 8,000 bytes of pixels at $6000, 1,000 colour pairs at $5C00, and 1,000 colours for colour RAM. A file cannot load colour RAM, so the crack copies them in from $CC00 before the game starts. The game never draws the house. It redraws only the spots that change.

Drawn by this page from the three blocks of the snapshot. Moving parts are the cells the game redraws in place, each by its own routine. Objects are the 16 doors, drawers and props that have frames of their own, drawn by $96ED from the tables at $97F0. Places are the 54 fixed spots the figures walk to, from $1D36, $1D6D and $1DA4.

02 · The cast

183 images, packed three bytes at a time

Every image that moves is unpacked when it is needed from $E5C1–$FFB9. A count byte either copies that many literal rows of three bytes or repeats one row that many times. The 183 images take 6,649 bytes instead of 11,529. The small objects shrink most, some to 8 bytes; a body pose takes about 44.

Decoded by this page from the packed bytes, with the colours of the snapshot: light green body, blue ($D025) and skin ($D026). Click an image. Outline adds the black sprite the game builds behind the body, the dog and the head at run time ($12B7): every pixel of the silhouette is spread one pixel each way. Facing left is the mirror the game makes at run time ($135F); no image is stored twice.

The person on screen is four hardware sprites: his body, his head, and a black outline behind each. The dog is two and anything he carries is one. The main loop shares the eight sprites out once a pass, nearest figure first ($0FD2), and writes them at raster line $FA. There is no raster multiplexing.

His head comes in three sets of fifteen images, one set for each mood ($0D65): happy, content and sad.

His face in the three moods, captured in the emulator

The three moods, captured in the emulator with the mood byte $035F set to 0, 1 and 2.

03 · Talking to him

156 words, 34 rules and a score for manners

Every word he knows carries five bytes of concept bits, and words with the same bits are synonyms. As you type, the bits of each word are added to the sentence, and after every word the game tries its 34 rules in order. A rule fires when all of its bits are there. Then the sentence gets a score, and the score decides whether he does it.

A copy of the parser at $C040: words are split at anything that is not a letter, looked up in list 1 ($C234, verbs, feelings and manners) and then list 2 ($C5E0, things, rooms and games), and tested against the rules at $C96A after every word ($C1C5). The score adds 3, 1 or 0 for his mood and 0 to 3 at random.

At 8 or more the main loop empties the queue of waiting requests and he does this one at once; at 12 or more he turns to face you first (activity 46). Below 8 the request waits in a 16-entry queue at $E12A: from 4 to 7 the activity chooser takes it later, and below 4 it stays there until a request that scores 8 or more empties the queue. In the emulator, with his mood set to sad, "light a fire" scored 4 and was still waiting 25 seconds later, and "please light a fire" scored 8 and started at once.

All 34 rules

Struck-out words can never be found: WHAT'S because the apostrophe splits it, and the second entries of START, LIKE, APATHETIC and IS because the lookup stops at the first. A rule that needs one of them can never fire.

04 · His day

128 activities and a chooser

Everything he does is an activity: a small state machine whose phase picks a handler from a table. The table sits in the code right after the call that uses it, as a list of handler addresses minus one. The call does not come back: the routine pushes the chosen address and returns to that instead ($3F0C). There are 103 of these tables. The activity number lives in $8D9B and is dispatched through a table of 128 at $8DC9.

Nine minutes left alone, from the snapshot, with the activity number sampled four times a second in the emulator. Activity 0, the chooser, appears only for a moment between the others.

When an activity ends, the chooser ($E13F) decides what comes next, in this order: a request from a CTRL key, a typed request, food and water, bed, the activities fixed to the time of day, the morning and evening lists, and then a random pick from lists that depend on the time of day, the weekday and his routine setting.

The house clock

Every 256 frames a counter steps down from 9, and at 0 the house clock ticks ($09EB): 2,304 frames. Twelve ticks make an hour, so a day in the house is 12 × 24 × 2,304 frames. Timed in the emulator, one tick is 45,287,427 cycles, exactly 2,304 PAL frames or 45.97 seconds, which makes his day 3 hours 41 minutes long. The time you type at the start sets only the wall clock in the study.

Food, water and illness

Hunger and thirst each rise from 0 to 3 on their own timers, every 20 ticks and every 15. A need that rises from 2 makes him ill: his skin turns green (sprite multicolour $D026 = 5). The illness gets a level worse every twelve ticks and ends once both needs are below 3 ($392F). He looks after his needs before anything else, so with food and water in the house he eats, drinks and recovers. With the cupboard and the tank empty, in the emulator the illness rose one level each house hour, and at level 3 he went to bed.

Ill and in bed

Ill, in bed on the middle floor: the green is his skin colour.

On the phone in the easy chair

Answering the phone, which also rings by itself every 32 to 63 ticks.

05 · The keys

Eight CTRL keys

The game reads the keyboard matrix itself, from the main loop, not the interrupt ($05C7): a key has to stay down until a pass of the loop comes round. CTRL with a letter gives its control code, and $2B54 turns each code into a delivery, a ring or a request.

KeyThe manualThe codeIn the emulator
CTRL Ffood at the front dooractivity 44 fills the kitchen cupboard ($3028); ignored while the cupboard is full ($30B4 = $0F)nothing at first; activity 44 at once with the cupboard part empty
CTRL Wfills the water tankone line a press, up to 11 of the tank's 12 ($2B51)5 to 11, then no further
CTRL Arings the alarm clockthe bell rings ($2B4E); ignored while a record playsbell and sound; he carries on
CTRL Ddog foodactivity 33 fetches it, 34 fills the bowl33 at once
CTRL Cthe phone ringsactivity 25: he sits in the easy chair and talks25 at once
CTRL Ppetting, in the easy chairat the chair, the arm pats him and his mood becomes happy ($2C39); elsewhere activity 6 walks him there6 at once
CTRL Ra recordactivity 50 takes it to the stereo50 at once
CTRL Ba bookactivity 51 takes it to the study51 at once

06 · Letters

Two letters, chosen by the cupboard and the tank

Ask him to write and he goes to the typewriter in the attic and types a letter into the band above the roof. There are two bodies. The thank-you comes only while there is both food in the cupboard and water in the tank ($55C4); otherwise he writes the complaint. Both are signed "Your Friend".

The thank-you letter

"Thank you for keeping me well stocked with food and water."

The complaint letter

"Please notice that my supplies are running low. I can't stay happy and healthy without your support."

The letter is put together at $7F40, which is the record player's work area. The complaint is 158 characters long and writes over the copy of the SID registers the player keeps at $7FCD. It does no harm, because he switches the record off before he starts to type.

07 · The music

Four piano pieces, and a record played upside down

Two sound drivers share the SID. One plays the records on the attic stereo, clocked by a CIA timer. The other plays the piano and all the effects, ticked by the raster interrupt. Both drivers' note tables are exact for an NTSC machine, so on PAL everything plays about two-thirds of a semitone flat.

Recorded from the SID in the emulator, one frame at a time for 20 seconds, with each piece forced where the game picks it at random ($AB1F for the piano, $AB14 for the records). Played back here with plain waveforms; the timing is the machine's own.

The piano pieces are Mozart's Sonata in C, K. 545, Beethoven's Für Elise, the fugue in C minor from the first book of Bach's Well-Tempered Clavier, and a fourth piece that has not been identified. Activity 78 picks one at random, and while he plays, the game builds his image from three part images chosen by which keys the driver is holding down ($1585).

Record tune 2 is tune 0 upside down

The steps between the first notes of the melody, in semitones, as the SID played them: record tune 0 in the upper row and tune 2 in the lower, up for a step up. Every step of tune 2 is the step of tune 0 with its sign turned over, and in tune 2 all three voices play that melody in octaves.

The squawks

Whenever his mouth opens wide, the mouth routine ($24C8) asks for sound $15. Each call starts with a random syllable of noise through one of four band-pass filters and goes on with a random phrase of gliding notes. During one phone call in the emulator that happened 24 times.

08 · Secrets, quirks and bugs

Things the manual never told you

Secret: CTRL F does nothing until he has eaten

The food delivery is refused while all four places in the cupboard are full ($2B5C), and the cupboard starts full. Once he has eaten, the key works.

Secret: "please" is worth four points

PLEASE is a rule on its own, worth four points on top of whatever the request scores. For most requests that is the difference between now and later, and for some between later and never.

The time you type sets only the wall clock

The house keeps its own hour, which starts at 15 whatever you type ($0379). The am/pm byte is counted up and never read.

His random numbers start from "Zeke"

The four bytes of the random number generator's state ($0414) arrive holding the letters Z, e, k, e. Just before them, "Billy Bob Binkle" ($03FC) arrives too, and nothing in the program reads it.

The games are only in the dictionary

CARDS, POKER, WAR, ANAGRAMS and HANGMAN are words he knows, and they lead to activity 126, which is the chooser. No routine, table or image in the program belongs to a card game.

Some words can never be understood

WHAT'S has an apostrophe, which ends a word. START, LIKE, APATHETIC and IS are listed twice, and only the first entry is ever found, so the rule that needs the second can never fire.

A quarter of his squawks play uninitialised memory

Four of the sixteen phrase pointers for one channel ($B7FE) point at $FF00, memory nothing ever writes.

Nonsense puts your last request back in the queue

The parser never clears its list of actions ($C00B), so a sentence that matches no rule puts the previous request in the queue again. In the emulator three nonsense sentences after "hello" left three more greetings waiting.

Leave him alone and the screen goes dark

After ten periods of 65,536 frames without a key, about 3.6 hours, the screen blanks ($0589), and illness cannot start. The counter is 8-bit: after 93 hours it wraps and both come back.

The water tank never fills its top line

It has twelve lines, and CTRL W stops adding water at eleven ($2B54).

09 · Where it lives

From the jump table to the vectors

WhereWhat
$0340–$08D2jump table, settings, cold start, time prompt, keyboard, raster interrupt
$0931–$13EEmain loop, house clock, illness, figure sprites
$16AE–$3F3Awalking and the dog, activities, house events, sound requests, typing, record tunes, the switch
$3F3B–$46BCthe record player's driver
$5000–$5BF7font, eating, letters, the computer
$6000–$7F3Fthe house picture
$8020–$8D98the four piano pieces
$8D99–$AFFBactivity dispatch, activities, house objects and their frames
$B000–$BFFCthe piano and effects driver, text output, request scan
$C000–$CB8Athe parser, its words and rules
$CC00–$CFE7the house's colour RAM
$D000–$DD8Ethe effects driver's interpreter and data, in the RAM under the I/O chips
$E000–$E452dancing, the chooser, the piano
$E453–$FFB9the 183 packed images