pouët.net

OPUS 7.09 by Avenue

  .------------------------------------------------------------------------.
  |                                                                        |
  |      ####   #####   ##  ##   ####       ######     ####    ####        |
  |     ##  ##  ##  ##  ##  ##  ##             ##     ##  ##  ##  ##       |
  |     ##  ##  #####   ##  ##   ####         ##      ##  ##   #####       |
  |     ##  ##  ##      ##  ##      ##       ##       ##  ##      ##       |
  |      ####   ##       ####   #####        ##    #   ####    ####        |
  |                                                                        |
  |                     a   t w o - d i s k   d e m o                      |
  |                 for  the  unexpanded-ish  Amiga  500                   |
  |                                                                        |
  |                     A V E N U E   .   12 / 2026                        |
  |                                                                        |
  `------------------------------------------------------------------------'


  Title ........ OPUS 7.09
  By ........... Avenue
  Released ..... 6 December 2026
  Platform ..... Amiga 500, OCS, 68000 @ 7.09 MHz, PAL
  Type ......... Demo (trackmo), 2 disks, boots from DF0:
  Runtime ...... about 7 minutes


--[ REQUIREMENTS ]----------------------------------------------------------

  * Amiga 500 with OCS (ECS works too), PAL
  * Kickstart 1.3
  * 1 MB of RAM: 512 KB Chip + 512 KB Slow (trapdoor) is the reference.
    1 MB Chip or 512 KB Chip + 512 KB Fast work as well - the demo
    relocates itself and keeps exactly the same timing.
  * One floppy drive. Disk 2 is detected on its own in DF0: or DF1:,
    no key press, no mouse click. Two drives = no swap at all.

  Real hardware or a cycle-exact emulator setting, please. Everything in
  here is timed against the beam and against the disk drive.

  About the disk images: the disks use a custom track format with
  960 KB per disk (12 sectors per track), which does not fit into a
  standard 880 KB ADF. The images are therefore extended ADFs
  (UAE-1ADF, raw MFM tracks, ~2 MB each). They run in WinUAE and
  FS-UAE. For real disks, write them with a tool that handles raw
  MFM tracks, e.g. Greaseweazle.


--[ WHAT THIS IS ]----------------------------------------------------------

  My last release hit the drives in 1992. I was 17. Twice seventeen
  years later I came back to finish the job - with a new kind of
  toolchain. Every byte of our own 68000 code and every note in this
  production was written by an AI (Claude) under my direction: I set the
  ideas, the architecture, the hardware tricks and the budgets; the
  machine built prototypes, counted cycles and optimised. The music
  replay, the base of the track loader and the boot-block depacker are
  the work of others - see STANDING ON SHOULDERS.

  Yes, this demo leans heavily on offline precalculation. No, it is not
  a movie player. Nothing on these disks is a bitmap animation. What
  runs on your A500 is a set of domain-specific decoders, renderers and
  a scheduler that keeps drive, depackers, Blitter, Copper, Paula and
  CPU busy at the same time. Listen to the drive while it runs.

  We also dropped the 50 fps dogma on purpose. The parts run at
  rock-steady 25, 16.7 or 12.5 fps - in mostly 5 bitplanes, with true
  anti-aliased edges. Depth instead of cheap speed.


--[ UNDER THE HOOD ]--------------------------------------------------------

  1. TWO-TIER SCENE CODECS

     Every scene family has its own codec, and every codec has two tiers:

       disk tier ....  entropy-coded, built for minimum size
       RAM tier .....  a second, compact format the 68000 can execute
                       at full speed, built by the loader

     The loader does not "depack a file". It transcodes from one
     representation into the other.

     a) Span codec (shaded, dithered 3D objects)

        - Frames are described per screen column as spans: flat runs,
          gradient runs, edge words with sub-pixel coverage and shape
          words. A learned per-sequence symbol table replaces raw data.
        - Disk tier: table-based asymmetric numeral systems (tANS), one
          state step per symbol, context = class of the previous symbol,
          field-wise packed symbol tables, escapes for one-off symbols.
        - RAM tier: direct-threaded code. The stream is a list of 16-bit
          handler addresses plus operands; the dispatcher is
          "movea.w (a0)+,a4 / jmp (a4)". Handler families are generated,
          one specialised routine per run length and column state.
          Runs of edge words are fused into single handlers.
        - Ordered-dither and edge-blend lookup tables are not stored
          anywhere. They are computed once on the Amiga and shared by
          all scenes that use them.
        - The decoder writes chunky words; chunky-to-planar conversion
          is split between CPU and Blitter and restricted to the dirty
          window of each frame.
        - A handful of residual correction words per frame removes the
          last visible quantisation errors.

     b) Contour codec (flat-shaded "ink" animation)

        - Frames are stored as vector outlines, not pixels: strands of
          arc segments (slope jump + curvature in 16.16 fixed point)
          and analytic end caps evaluated from a square-root table.
        - The CPU only toggles XOR edge bits, four sub-scanlines per
          pixel line. One exclusive-fill Blitter pass over interleaved
          bitplanes turns the edges into filled areas - and because the
          four sub-lines land in different planes, anti-aliasing falls
          out of the palette for free. Zero bytes of AA data.
        - Disk tier: tANS with ~20 adaptive contexts, cap prediction
          from the previous frame, "same strand as before" back
          references, per-register palette fitting and a short list of
          correction pixels for hairline details.
        - RAM tier: byte-coded strands driving generated per-type inner
          loops; pixel position and fraction are carried in separate
          registers, so a toggle is one table lookup and one bchg.
        - Triple buffering: the Blitter fills and clears inside the
          level-3 interrupt while the CPU already traces the next frame.
          Streams are random-access and can be played backwards.

     c) Delta codec (path-traced and simulated sequences)

        - Inter-frame deltas against a reference image or against the
          buffer contents two frames back, with a perceptual tolerance
          chosen per region; skip / copy / literal runs.
        - Long words go through a two-level dictionary shared by all
          streams of a scene (224 one-byte codes, 1,370 two-byte codes),
          the rest is escaped raw.
        - Post-processing in the kernel: palette-class remapping,
          Copper-split colour bands, masked patches for parts that move
          independently, and mirrored / reversed playback to get more
          motion out of the same frames.

     On top of all three: ZX0 for code and tables, with a reversible
     pre-filter chosen per file by search, kernels stored as deltas
     against kernels that are already in memory, and earlier data used
     as the dictionary for later data.


  2. PLAYBACK ENGINE

     - Blitter and CPU work in parallel, all the time. Blits are
       queued and chained from the blitter interrupt, CPU work is
       scheduled into the DMA slots the Blitter leaves over.
     - Adaptive but fixed frame pacing: every part locks to a divider
       of 50 Hz and never drops a frame.
     - 5 bitplanes almost everywhere, extra-half-brite and dual
       playfield where they pay off, per-line Copper palette splits,
       Copper-driven sprites without sprite DMA, hardware sprites as
       overlays and particles.
     - Self-generating code: most inner loops are emitted at load time
       from the stream's own statistics, then thrown away with the part.
     - The handler block lives below $8000, so every jump target in a
       stream fits into a sign-extended 16-bit absolute address.


  3. SIMULATION AND PHYSICS

     - Wave dots: a lattice-Boltzmann fluid simulation, depth-tested
       against the rendered scene and replayed as a particle stream.
       2,215 dots per frame, plotted by the CPU into EHB planes, with a
       dual-playfield reflection underneath.
     - Rigid-body dynamics: 300 discs under gravity with multi-body
       collision detection, impulse-based collision response,
       restitution and Coulomb friction, solved under a pixel-exclusion
       constraint (no two bodies ever share a pixel). Replayed as an
       event stream; every body is one OR-blit, sorted by plane mask so
       the Blitter skips planes a body does not touch.
     - Fluid: a FLIP (fluid-implicit-particle) solver with two-way
       coupled floating bodies, pressure-integral buoyancy, Taubin mesh
       smoothing and a level-set morph that closes the loop seamlessly.
     - Motion capture: skeletal BVH data retargeted onto our own jointed
       figures, rendered as contours.
     - Halftone: amplitude-modulated dot screens whose cells are tracked
       as individual objects, so a picture can morph, jitter or fall
       apart dot by dot.
     - Offline shape morphing via blended signed distance fields.


  4. LOADING, DEPACKING, SCHEDULING

     - No DOS. The boot block loads a track loader, the track loader
       loads everything else. Custom long-track format: 12 sectors and
       6,144 bytes per track, 960 KB per disk. Both disks are full.
     - The whole demo is one precomputed work list: LOAD / DEPACK /
       CALL / WAIT / PART entries, laid out by an offline planner that
       simulates drive speed, depack speed and the memory map second by
       second.
     - Continuous background streaming: the drive keeps reading while
       effects run. Data arrives in whole-track segments into ping-pong
       buffers and is depacked in 8 KB pieces in the idle time of the
       running part.
     - No idle CPU time is wasted. While one scene is on screen, the
       scenes after it are being loaded, transcoded and precalculated:
       tANS tables, threaded streams, dither tables, generated code.
     - Parts hand over without a blank frame: the last image of a part
       stays on screen while its memory is already being reused.
     - Start-time gates: every part has a target start time on the music
       clock. A fast drive or Fast RAM never makes the demo run ahead.
     - A generated ZX0 depacker: four decoder copies (one per bit
       phase), unrolled copy paths, block order found by profile-guided
       search. 2.1 times the speed of the classic 88-byte routine,
       about 28 cycles per output byte.


  5. MEMORY ARCHITECTURE

     - A fixed, hand-planned memory map for every second of the demo,
       checked by a planner that knows the lifetime of every block.
       No allocator, no fragmentation.
     - A shared base of code and data stays resident: loader, music,
       depackers, stream players, common screens and objects. Scenes
       borrow from it instead of bringing their own copies.
     - Code and data stay packed in memory until the moment they are
       needed; scratch buffers of one part are the load buffers of the
       next.
     - RAM-type independence: 2,907 absolute addresses in 30 files are
       patched by a relocator living in the unused exception vectors
       ($100-$3FF). The relocation tables for the whole demo take
       250 bytes.


  6. AUDIO

     - Two tracks, "Nacht" and "Magnet 2", replayed with LSP.
     - 48 KB on disk for both: sample bank as 4-bit IMA ADPCM plus ZX0,
       decoded once after loading.
     - Half of the instruments are not on the disks at all - kicks,
       basses and stabs are synthesised at start-up.
     - Tick-level tricks: 4-tick rows where nothing happens to shrink
       the LSP stream, alternating 7/5-tick rows for swing at no cost.
     - The arrangement is cut to the effects on the exact PAL clock
       (49.92 Hz, not 50).


  7. HOW IT WAS BUILT

     - Offline: Blender / Cycles path tracing with 4x4 sub-pixel
       sampling, Mantaflow, k-means palette search in Oklab snapped to
       the 12-bit OCS grid, numpy for everything else.
     - Every kernel was first run in a cycle model: a 68000 core with
       exact timing tables plus our own Blitter and Copper models.
       Output had to be bit-identical to a Python reference before a
       single frame was shown on WinUAE - and pixel-identical in
       screenshots afterwards.
     - Around 90 % of the code went through several measured
       optimisation rounds. Several kernels are in their sixth version.


--[ CREDITS ]---------------------------------------------------------------

  Concept, architecture, direction ...... Avenue
  Code .................................. Claude (AI), directed by Avenue
  Music ................................. Claude (AI), Paula mix by Avenue
  Graphics, 3D, simulations ............. Avenue + Claude

  AI models used: Claude Opus 5.5 and Claude Fable 5.2 (Anthropic).

  Probably the first two-disk Amiga 500 demo fully coded by an AI.
  If you know an earlier one - tell me, I want to see it.


--[ STANDING ON SHOULDERS ]-------------------------------------------------

  This production builds on the work of others. Thank you.

  * LSP - LightSpeedPlayer
    by Arnaud Carre (Leonard / Oxygene), MIT licence.
    The fastest Amiga music replay there is. Used with our own CIA
    timing frame.
    https://github.com/arnaud-carre/LSPlayer

  * LDOS - Leonard Demo Operating System
    by Arnaud Carre (Leonard / Oxygene), MIT licence.
    Our track loader is derived from the LDOS track loader.
    https://github.com/arnaud-carre/ldos

  * ZX0 - optimal data compression format
    by Einar Saukas.
    https://github.com/einar-saukas/ZX0

  * salvador (ZX0 packer) and unzx0_68000 (the 88-byte depacker)
    by Emmanuel Marty, zlib licence.
    Our fast depacker reads the same format; the 88-byte routine
    still unpacks the fast one at boot.
    https://github.com/emmanuel-marty/salvador
    https://github.com/emmanuel-marty/unzx0_68000

  * The dancers
    The motion of the dancing figures comes from the CMU Graphics Lab
    Motion Capture Database (subjects 05 and 60/61), BVH conversion by
    B. Hahne. The figures themselves are our own.

    "The data used in this project was obtained from mocap.cs.cmu.edu.
     The database was created with funding from NSF EIA-0196217."

  * Tools: vasm, WinUAE, Musashi, Blender, Mantaflow, Python / numpy.


--[ TO THE PURISTS ]--------------------------------------------------------

  I hear you, and I respect your craft. Hand-tuned machine code is an
  art form worth preserving. I used to love doing it myself.

  But the hacker spirit was never about following rules. It was about
  using whatever exists to get more out of the machine than anyone
  thought was in there. This demo is not meant to replace anybody. It
  is an invitation.

  The Amiga is not a museum piece. It is still a canvas.

                                                With love and respect,
                                                Avenue, December 2026

----------------------------------------------------------------------------