Making the Timex do more by drawing less

Lessons from Sinistar, with Berzerk, Beast Horizons, and TSWriter

7 October 2026 · Sinistar v58 · Based on recorded emulator measurements

Getting arcade-style graphics onto the Timex Sinclair 2068 requires more than translating game logic. The processor must position sprites, combine overlapping objects, restore backgrounds, manage color, and deliver the finished picture without showing the intermediate work.

Sinistar has made those costs particularly visible. Its large animated face, moving rocks, scrolling starfield, explosions, and speech compete for the same 3.528 MHz Z80. Some improvements required elaborate preparation and specialized assembly code. Others came from an embarrassingly simple realization: the computer was doing work that the picture did not require.

Building the picture

The ports use Extended Color Mode: 256×192 pixels, with two colors available in each horizontal 8×1-pixel cell. This gives much finer color control than ordinary 8×8 attributes, but it means managing both a 6,144-byte bitmap and a 6,144-byte color plane.

Sinistar generally builds affected portions of the finished picture in working RAM. Transparent sprite pixels preserve the background; opaque pixels replace it. Objects are combined in the required order, then changed regions are compared with the display and only changed final bytes are published.

That avoids a visible “erase, then redraw” sequence. Publication also has to respect display timing: correct screen memory after drawing does not guarantee that the display beam never saw an unfinished picture.

All of this costs time before the final screen write. In several profiles, composition and comparison dominated the workload, while actual publication consumed only a small percentage. Making the final copy faster could therefore address only a fraction of the problem.

Trading cartridge space for speed

A sprite positioned between byte boundaries normally needs its bits shifted across adjacent bytes. Pre-shifting performs that work ahead of time, producing eight versions aligned at offsets zero through seven.

At runtime, the renderer selects the version for x mod 8 and uses the screen address for the remaining horizontal position. Eight copies therefore support every horizontal location, not just eight positions.

The original 60 Hz Sinistar demonstration illustrates the storage tradeoff:

Prepared bitmap graphicsCopiesStorage
Three Sinistar mouth poses × eight alignments248,736 bytes
Thirty-two player headings × eight alignments2569,216 bytes
Total28017,952 bytes

Those are bitmap bytes alone—about 27% of a 64 KiB cartridge, before code, color information, speech, and animation instructions.

Precomputation can also describe changes between pictures. An early interactive pursuit renderer stored 72 transition cases: eight starting pixel alignments, each with nine possible movements of −1, 0, or +1 pixel on the two axes. Compressed into 5,007 bytes, these described affected spans and color cells relative to the sprite’s old position. Their tested preparation/publication cost averaged 12.3% lower than the preceding separated-rectangle path.

Unlike a prerecorded movie, these transitions could be relocated to eligible positions chosen by the running game. Larger movements and complicated overlaps still needed a general fallback.

Demo and storage · Pursuit renderer

Caching a monster under construction

An assembling Sinistar adds another difficulty: its shape changes as pieces arrive, and other objects must remain visible through the unfinished gaps.

The later renderer uses two 4 KiB RAM cache areas. One supplies the current picture while the other prepares its replacement. Each contains eight shifted bitmap phases, overlap information, and compact transparency-mask data. The bitmaps alone occupy 2,856 bytes per cache; repeated mask patterns allow all eight mask phases to fit alongside them.

Preparation is spread over 26 picture updates, followed by a complete cache swap. This avoids displaying a half-prepared image, although newly delivered pieces must wait for preparation to finish.

Caching raised a fixed-overlap assembly fixture from about 6 fps to 19 fps. Correct transparency was more expensive than simply covering everything with a black rectangle. Precomputing the mask phases subsequently improved a changing-alignment overlap test from 8.62 to 9.81 fps, while fixed scenes became slightly slower.

That is a recurring tradeoff: moving work out of drawing makes the draw cheaper, but cache construction, lookup, and invalidation remain real costs. Assembly cache design.

The obvious rule that needed to become an explicit requirement

“Don’t draw what cannot be seen” sounds elementary. Yet it needs to govern the entire rendering pipeline.

The strongest example was an offscreen, speaking Sinistar. The program unpacked all 52 rows, reconstructed its shifted body, and shifted its mouth graphics. Only afterward did the drawing routine discover that the clipped rectangle had zero width.

The final picture was correct. No invisible pixels reached the display. Nevertheless, preparation wasted approximately 151,919 processor cycles—43.06 milliseconds.

Moving the visibility check ahead of that work reduced the hidden preparation path to 27 cycles. In a controlled hidden-speaking test, picture rates rose from roughly 9.6–10.5 fps to 19.3 fps. Movement, animation state, and audio could continue without preparing invisible graphics; necessary cleanup of the old visible image was preserved.

Other savings applied the same principle more locally:

The distinction matters: avoiding unnecessary screen writes is not enough if unnecessary decoding, shifting, copying, and comparison have already happened.

This was also a weakness in the AI-assisted development process. Attention repeatedly went toward improving existing routines before questioning whether they should run. Tests checking only the final pixels could not expose that waste. Useful performance requirements must include the work that should not occur: no preparation for invisible sprites, no writes for unchanged fields, and no repaint of a picture about to be replaced. Recent Sinistar changes.

Big wins—and much work for small gains

Retaining unchanged rocks was an important improvement. Instead of rebuilding them completely, the renderer repaired only rows affected by other objects. One controlled three-rock pursuit fixture improved from 7.93 to 11.49 fps, about 45%. But continuously scrolling flight improved only 8.09→8.15 fps: moving the camera invalidated much of the retained work.

Clipping provided another opportunity. Rocks cut off at the top or bottom originally fell back to general unpacking and composition. Letting their compiled drawing programs process only visible rows improved a particular three-rock mining fixture from 13.74 to 19.28 fps. The broader stress workload barely changed.

Some technically substantial optimizations produced modest overall gains:

OptimizationImprovement inside the affected workWider result
Reject distant rock collisions before bank switchingAbout 71% fewer cycles in sampled collision checksRoughly 3% gain in controlled three-rock scenes
Leaner rectangle clearing and rock drawingClearing about 11% cheaper; 180 cartridge bytes recoveredAbout 0.5% more pictures in the broad stress run
Faster explosion shifting using four-bit operationsAbout 20–26% cheaper unpack/shift/color work at selected alignmentsAbout 5% faster in the player-death fixture
Specialized v58 shifted-face compositorAbout 19% fewer cycles including clipping and bankingAbout 2–7% faster in demanding complete scenes

Radar preparation improved by replacing 64 general-purpose horizontal dot calls with masked byte spans and simplifying coordinate extraction. The complete isolated radar operation fell from 21.27 to 13.94 ms. Because radar updates intermittently, that is not a comparable percentage increase in game speed.

Some sophisticated ideas lost outright. Additional dirty-span tracking introduced more bookkeeping than it saved. A conditional-copy experiment slowed its benchmark and was rejected.

Small savings can also produce a surprisingly large frame-rate jump when they cross a display deadline. One controlled mining test rose from 19.28 to 28.10 fps after modest preparation savings. It could finish in fewer refresh intervals; the processor had not suddenly become 46% more efficient.

What the frame rates actually mean

The scripted Sinistar demonstration reaches 60.11 pictures per second by preparing its precise sequence, star changes, and color changes in advance. Early interactive pursuit experiments progressed from roughly 7 to 12 fps, then into the 20–30 fps range in particular reduced workloads, with differences between emulators.

Those experiments lacked much of the eventual game’s workload. The latest v58 measurements are more representative of natural scrolling:

Current scenarioFuse 1.10.0TSRun
Normal mining / assembly5.75 fps6.51 fps
Fast mining / assembly7.98 fps9.34 fps
Normal pursuit5.46 fps6.14 fps
Fast pursuit12.85 fps14.22 fps
Fast pursuit with repeated speech and shooting9.49 fps10.80 fps

These measure 120 completed pictures after warmup. Assembly retains the worker; pursuit tests disable it. Fast mode changes population behavior, including retiring offscreen rocks after awakening, so part of its advantage comes from reducing the active workload.

The same current cartridge still reaches 19.27 fps in Fuse with one fixed-position visible rock and no Sinistar. That result remains valid, but it does not describe moving through a populated world with a visible, speaking enemy.

Emulator timing differences also change the world positions sampled during a run. Neither column is a physical-hardware measurement. Current performance report.

Berzerk and the advantage of a stationary maze

Berzerk can exploit its mostly static background. XOR drawing lets the same sprite pattern remove its earlier contribution, and a combined update applies:

screen = screen XOR old sprite XOR new sprite

That combines removal and replacement. If image, position, and alignment are unchanged, the blit can be skipped while retaining necessary collision bookkeeping. A historical stationary-player phase fell from about 27,467 to 8,305 cycles.

Later work avoided unnecessary masking of the player’s own bullet trails and retained calculated addresses for restoration. A measured no-redraw case fell from 6.45 ms to 0.082 ms.

Here too, the most dramatic result came from skipping an operation whose prerequisites were absent. Berzerk’s individually scheduled actors also make a single whole-screen “fps” figure less informative than their achieved movement and service rates. Berzerk project.

The same lesson in landscapes and text

The Shadow of the Beast study, Beast Horizons, combines prepared scrolling strips at different speeds to create parallax. Eight rock phases provide one-pixel motion; other layers use four phases. A crucial improvement buffered only the runner’s 32×40-pixel rectangle, allowing scenery elsewhere to go directly to the display.

The early Beast demo ran at about 12 updates per second. Later versions achieved roughly 24 rock-scrolling updates per second, with runner/ground updates every second update. Six runner poses occupy 2,880 bytes, and the complete demo fits a 64 KiB cartridge. Beast project.

TSWriter applies the same reasoning to editing. Drawing just an appended letter reduced one measured refresh from 327 ms to 15.3 ms. Scrolling retains existing pixels and draws the incoming line. Selection changes invert only altered spans.

An especially simple fix stopped repainting the old page when dismissing a menu immediately before changing page width. One fixture became 2.2 times faster. Correct output had concealed a completely unnecessary intermediate repaint. TSWriter project.

What more memory could allow

TSPico provides 512 KiB of SRAM and 512 KiB of flash, with some flash used by its operating system, plus SD storage. Software must explicitly support its interface and banking; the entire capacity is not simultaneously visible in the Z80’s 64 KiB address space. These capacities are documented in the TS Pico Manual, 3 December 2023, General Description and Operation.

Additional memory could retain more shifted speaking poses, construction stages, masks, and transition programs. For perspective, twenty assembly stages with eight 357-byte bitmap phases would require 57,120 bytes for bitmaps alone—almost an entire existing cartridge, before masks, colors, code, or sound.

More RAM could hold those prepared results without repeatedly replacing a small cache. SD storage could supply larger artwork and audio libraries between scenes. TSWriter could retain more glyphs, layout checkpoints, document data, and undo history.

But extra capacity does not increase screen bandwidth or remove bank-switching overhead. The next useful rendering gains must reduce composition and comparison together, preserve reusable results during motion, and reject unnecessary work early.

More storage can buy prepared graphics. More RAM can preserve them. Neither substitutes for asking, before doing the work, whether the next picture needs it.