Programs/Spins · 20 November 2026 · array 4,898

Psion Spins: a Christmas slot machine for the Organiser II

Five reels, twenty lines and Santa, in 6303 machine code, on one 32K Datapak that plays on every Organiser II from the 8K CM to the LZ64. The credits are play money: nothing can be bought, sold or cashed. This report shows the screens as the emulator drew them, the game and its maths, how the program is put together, and where every byte goes.

A spin on the LZ64
95.73%return, counted exactly from the reel strips
4,898 Bthe game’s array, every model, with two-part music (was 5,774)
1,122 Bleft over on a blank 8K CM (was 246)
27,418 Bused of the 32K Datapak
0differences from the reference in 2 × 100,000 spins
29 ROMsCM, XP, LA, LZ, LZ64 versions started and played
1 · What you see

Screens

The four-line LZ and LZ64 show five reels by four rows, the two-line CM, XP and LA five by two; the reels take every other column and the panel the rest. Every screen below is the emulator's own: the character in each cell and the eight defined characters at that moment, captured by tests/tour.js and drawn here dot for dot (letters in a dot font). Characters 0 to 3 hold the pictures (Mrs Claus, a reindeer, a bell, a house), 4 to 7 the stage: the spinning drums, the symbol landing, Santa himself.

Keys at the reels

EXE
Spin. During a spin every reel stops at once; during any animation, skip it (the result is the same)
UP, DOWN
The line bet: 1, 2, 5, 10 (a spin is 20 line bets)
A
Autoplay: 10, 25, 50 spins, or until the Xmas Spins
P, L, S
Pay table, line viewer, statistics
G
After a win: gamble it
MODE
The menu
ON
Stops autoplay; otherwise asks “Leave?”

The menu (MODE)

Settings

Animation
Full, Quick, Off
Santa's styles
All, Standard
Sound
On, Soft, Off
Music
On, Off
Glass speed
8, 10, 12, 15 frames a second
Show wins
Lines, Total
Autoplay stops
On a feature, on a big win, never
Idle scenes
On, Off

The credits, bet, settings, statistics and random state are saved in A:SANSAV after every spin, before its animation starts, so switching off mid-show loses nothing.

2 · The game

Five reels, twenty lines, one Santa

The rules

  • Each reel is a strip of 32 symbols; the stops come from a 32-bit xorshift generator, the top 5 bits for each reel.
  • A line pays for 3, 4 or 5 of a kind from reel 1, left to right; the pay is per line bet.
  • Santa lands only on reel 1. Anywhere in its window, the whole reel is wild, and he walks across to deliver: every house becomes a present, and wild too.
  • Houses are wild only with Santa (or in the Xmas Spins).
  • Stars scatter and pay no line: 3, 4 or 5 anywhere start 10, 12 or 15 Xmas Spins.
  • In the Xmas Spins reel 1 is wild throughout, reels 2-5 turn on their own strips, houses are wild, and each star on reels 3 or 5 adds a spin. The whole feature is worked out when it starts, then played back.

Pays, per line bet

Symbol345

The pictured symbols are the game's own defined characters; the others are letters.

Counted exactly from the stripsFour lines (LZ)Two lines (CM)
Return to player95.732%95.726%
Santa lands1 spin in 8
Xmas Spins start1 spin in 62.3
Free spins a feature, on average13.5
100,000 spins in the emulator (sampled)94.6%98.6%

The spec gives each grid its own base strips. Counting every combination of stops gives its figures exactly, which confirmed the reading of its rules. The two sampled returns differ from the exact one by sampling error: one 233× win moves 100,000 spins by a few points.

3 · How it is built

A resident kernel, everything else read in when needed

The game is one 4,898-byte OPL integer array, the same on every model, holding 6303 machine code. The kernel stays; the screens, the effects, the scenes and their data wait on the pack and come into one shared region when they are needed.

Starting

  1. SANTA (OPL) checks the free memory and says “SANTA NEEDS n BYTES MORE RAM” if it is short.
  2. SANTAG makes the array and pokes in a small bootstrap.
  3. The bootstrap reads the kernel, its fixer and its fix-ups from SANK in one go; the fixer relocates the kernel to wherever the array landed.
  4. The kernel reads the model byte and loads DRV2 or DRV4, loads A:SANSAV, and the title plays.

A spin

  1. OV_BANK takes the stake (or says it cannot).
  2. OV_GAME draws the stops and pays everything, the Xmas Spins included.
  3. OV_BANK settles and saves.
  4. OV_SPINFX plays the spin to the result already drawn.
  5. With Santa: OV_HOME picks his style and tune, OV_WALK walks him across, OV_HOME turns the houses to presents and brings him home.
  6. OV_WINFX shows the wins and counts them up; a big or huge win plays its scene (OV_SCENE); the Xmas Spins replay from their saved random state with OV_XFX.
  7. OV_REST waits for the next key.

The screen model

What every cell should show (kv_under) against what the LCD shows (kv_shown). A frame sends only what changed, straight to the display controller, and the 8 defined characters from a shadow copy. Pictures (0-3) are only redrawn in place; the stage (4-7) moves.

The frame player

A frame draws, then sounds for the rest of its length a tick (1/120 s) at a time; the drawing time, measured on the free-running counter since the last frame ended, is taken off. Frames keep time within 1% with sound on, soft or off.

The sound engine

A tone is a loop of 32 + 4S cycles: all 45 notes from E4 to C8 within 0.7% of pitch. On top: pulse width (bells that ring and die away; the Soft setting), slides, arpeggios, noise, clicks and vibrato. A tune has two parts, melody and bass (one byte a note each): while both sound the melody has two ticks in three and the bass one, the bass keeps quiet in the gap at the end of each melody note (so repeated notes sound apart), and the time the extra work takes is charged so the tune keeps time. A tune and an effect play together, the effect heard.

Scripts and the compositor

Scenes are data: scripts/*.scr, assembled by tools/script.py into blobs the resident script reader plays. Santa (5 by 16 dots) is drawn by the compositor into a moving window of the four stage characters, one dot at a time, with a one-dot halo, over whatever the cells show.

The units on the pack

UnitCodeData after itWhat it does

“Data after it”: what the overlay reads in just above its own code (the tune buffer, 80 bytes, counted in). Every overlay has relocation fix-ups stored with it on the pack.

4 · The show

Animation and sound

14 scenes

10 ways to walk

Santa's delivery picks a style at random (or always the standard walk): walk, heavy sack, tiptoe, skip, ice, sledge, and the stretch goals' pogo stick, moonwalk, carried by a reindeer and parachute. Each has its four poses, footfall, tune and manner. With no house showing he looks both ways, shrugs and goes back.

16 tunes, 43 effects

Twelve carols (the jukebox plays any), three win fanfares and Auld Lang Syne for New Year, each with a bass line written for this game. The emulator has no buzzer, so the recordings below were made from the game's own sound engine by tools/sounds.js: the same notes and cycle counts, written to WAV.

5 · Where the bytes go

RAM

A blank CM's 8,192 bytes while the game runs

Measured (tests/m_mem.js): the most padding with which SANTA still starts and plays on a blank 3.3-ROM CM is 1,122 bytes; an LZ has at least 2,000 to spare. The game itself runs short at 1,172 (m_mem2.js, with SANTA’s check made to pass): SANTA asks for 5,268 free (5,148 once A:SANSAV exists) and refuses cleanly 48 bytes before that.

The array, 4,898 bytes

And 256 bytes of variables outside it, in the launchers’ code that never runs again once the game has started, as Connect 4 and Reversi do: SANTAG’s code before its USR call, just below the array (its copy of the bootstrap string among it), holds the screen model and the number’s digits, 175 of 178 bytes; SANTA’s code before its call of SANTAG, just above, holds Santa’s pose and halo and the script stack (44 of 45), and its “NEEDS” message the wins and the 32-bit work (37 of 41). The start-up code checks that the launchers’ code that does run again is where the build put it (SPINS ERROR 3 if SANTAG is run by itself), and tests/t_hidden.js checks it on all 29 ROMs.

Kernel code, 3,001 bytes, by file

One region, every overlay

Region R holds one overlay, the data it reads in just after its code, and the playing tune in the top 121 bytes (HARK, the longest, with its bass). The spec planned a fixed overlay slot and a separate 600-byte scene buffer; sharing one region is smaller. Each walk style has its own small blob, and OV_SPINFX plays no tune, so needs no tune buffer. OV_WALK, with the tune buffer above it, sets the size.

Overlays against the 1,514-byte region

Solid: code. Hatched: the data read in after it, and the tune buffer. The line is the region's end.

6 · The pack

The 32K Datapak

Three files: SANTA, SANTAG and SANK. SANK is the kernel block (the kernel, its fixer and fix-ups, read in one go) and then area B: an index of 71 items and every overlay, driver and data item, each found through the index. The spec's SANB0-3 became sections of this one file. There is room for 5,350 bytes more.

Area B, 23,036 bytes

7 · 20 November, later

The RAM round: 925 bytes, every screen the same

A pass through the whole program for RAM. Each change was checked by tests/t_trace.js: thousands of screens, frame by frame, against the first build’s, with the game’s results checked spin for spin as before.

BeforeAfterHow
Kernel code3,3802,990The script reader keeps only the 19 commands the scenes use, and they no longer return a carry; one byte a note; numbers by dividing by ten instead of a table of powers; the command table on the pack
Variables in the array579276Dead ones gone; OV_GAME’s own in OV_GAME; the wins one byte a line; 256 bytes into the launchers’ code
Region R1,7211,489OV_WALK read every style’s poses and effects (and five tunes it never used): now one small blob a style; OV_SPINFX needs no tune buffer
The array5,7744,849
Spare on a blank CM2461,172

Two-part music came afterwards and took 126 bytes back; a second, smaller round of cuts won 115 of them again (below): the array is 4,898 (after the title-tune fix and the AUTO marker, below) and a blank CM has 1,122 spare.

A crash, fixed

OV_WINFX’s line cells, characters and text buffer (21 bytes) were declared after the label where its line table is read in. Once one winning line had been shown, lines 1 to 5 read garbage rows and put wrote outside the screen, into the screen driver’s code. It showed most at Quick, so in autoplay, during the Xmas Spins.

Santa’s throw, fixed

A load between a flag test and its branch reset the zero flag, so in every walk style Santa threw with the tiptoe’s finger-to-lips pose. Now he throws properly, and hushes only on tiptoe.

7½ · 20 November, later still

Cuts, then trying to break it

Three cuts that change nothing seen or heard took 115 bytes off the kernel: the Xmas Spins’ set-up and counting moved into OV_GAME, each overlay call in the main loop became a short call and two bytes, the tone set-up’s three range clamps share one routine, and 15 short branches the assembler had quietly made long were brought back in range. Then new tests set out to break the game rather than confirm it, and found three bugs.

The Organiser switched off mid-play

It counts down its switch-off time (5 minutes as it comes) and only the game’s key waits set that back. Autoplay, a long Xmas Spins or the snow run without one, so it switched off in the middle; on again the screen was blank, then garbled. Now every frame sets it back, and it switches off only in the game’s own wait, which redraws everything.

…and never at rest on a two-line model

The 5-minute idle count lived in the rest screen’s own image, so each idle scene (every 80 s) started it again, and a CM left at rest would have run its batteries flat. The count is now kept over the scenes and the snow, and the snow ends by itself.

Advent only once

The doors are bits in the save, and nothing cleared them: after one December, no door opened again. The save now keeps the year they were opened in.

Afterwards: the title tune, and AUTO

Heard on the first listen: the opening Jingle Bells was hard to recognise. Its repeated notes are told apart only by a silent tick at each note’s end, and the bass filled that silence. Now the bass keeps quiet there, the gap is 3 ticks on longer notes, and the melody has two ticks in three. And during autoplay the panel says AUTO through every spin, and the autoplay list (or the menu, after Spin) no longer leaves its letters between the reels while the spin plays. The winning line’s text (“LINE 12 +1234”) was longer than the panel and lost its last digits; it is now “L12 +120”, line left and pay right, as the other panel lines.

Survived

Damaged save files (a new player); settings out of range in a save whose sum agrees (now put right as read); credits from 0 to 4.29 billion (from a billion the panel shows the last 8 digits); the pack pulled out (back to the Organiser’s menu); slot C; EXE held for a minute (73 spins); no stray memory write in over an hour of random play.

8 · How it was checked

Tests and measurements

All in a headless copy of the Jape emulator (tools/emu.js) driven from Node, against the real ROMs. node tests/run_all.js runs the main suite in a few minutes; the long ones run on their own.

TestWhat it showsResult
t_linefastThe 6303's way to pay a line equals brute forceAll 161,051 lines
t_game, t_longOV_GAME against the JavaScript reference, spin for spin; stop chi-squared100,000 spins on each grid, 0 differences; chi-squared well under the 99.9% point on every reel
t_soundPitch of every note; frame lengths with each sound and setting45 notes within 0.7%; frames within 1%
t_walk, t_deliveryThe compositor; Santa's deliverypass
t_flowWhole plays (a Santa spin, a feature, a win): the credits end right on both modelspass
t_save, t_auto, t_xmasday, t_stretchThe save file, autoplay, Christmas Day, the stretch goalspass
t_skipEXE at every moment of a play ends in the same state as no keypass
t_stressRandom keys at random moments; credits shown equal credits at every rest20 minutes each, CM and LZ64
t_romsStarts, plays a spin with Santa, leaves cleanlyAll 29 ROMs
m_mem, m_mem2The memory margin on the smallest machines1,122 B on a CM; ≥2,000 on an LZ
t_watchEvery memory write the game’s own code makes, during long random play with random settings: anything outside its own places reported with the instruction; the kernel and driver checked unchanged after every key15 to 20 minutes each on CM, XP, LZ, LZ64: none
t_breakExperiments: two Decembers of advent; damaged saves; credits from 0 to 4.29 billion; the pack pulled; idle until the Organiser switches off; long autoplay; slot C; the 250-spin cap against the reference; the tune buffer while tunes play; EXE held a minutefound the three bugs below; now all pass
t_traceEvery screen, frame by frame, of a set of plays (Full, Quick, Off; all ten walk styles; every scene; the menus) against another build’s, the cosmetic random bytes pinned6,080 screens (LZ64) and 4,837 (CM) the same as the first build’s
t_hiddenThe variables in the launchers’ code: the code that runs again intact after play, leaving clean, starting again resumesAll 29 ROMs
Measured
A spin at Full animationabout 2.5 s to the last reel; Santa's delivery about 4 s more
Frame rate8, 10, 12 or 15 a second (Glass speed); the spin's drums at 30
Tuneskeep their tempo whatever the Glass speed; only animation frames scale
9 · Against the spec

What was built, and where it differs

Stretch goals, in the spec's order

Differences from the spec

  • Interrupts stay on during notes. The spec masks the 50 ms keyboard interrupt; the emulator drops a timer interrupt that falls due while masked, so keys and the clock would stop. On the Organiser this costs a small gap in a note every 50 ms: the first thing to judge by ear.
  • Memory: the array is 4,898 bytes (planned 5,600), though the sound engine and the overlays are bigger than planned: the region is shared and 256 bytes of variables live in the launchers’ code.
  • Every position wild cannot happen with the spec's strips; its scene plays from the Scenes menu.
  • Scenes are simpler and mostly shorter than planned; their art is a first draft, to be judged on real glass.
  • Christmas Day gives 250 credits; the advent gift is three free spins at the line bet; the gamble is offered once per base win.
  • One data file, SANK, with an index, instead of SANB0-3.
Still to do, on real Organisers (CM, XP 32K, LZ, LZ64): whether Santa's one-dot steps and the drums read as motion or smear on the glass (Glass speed is the setting to try); the keyboard interrupt's gap in notes, pulse width, loudness; battery drain over a session.