Files
R8Forge/docs
dsh 4f7fa63048 hardware: the medium needs +-1 iteration, not random access -- but our loops are long
Correcting an over-specification: ip only ever moves by one, and a bracket scan is
made of one-step moves, so any medium that can be iterated forwards and backwards
will do.  Taking that further, the backward half is removable too: keep a five bit
LIFO of loop entry positions, push on [ when the low bit is one, and on ] always
pop -- the popped position is the matching [, and if the low bit is one we jump
back to it (it re-runs) and otherwise carry on.  [ with a zero low bit still scans
forward, which it would anyway.  That is equivalent to the reference scan for
well formed tapes, and since scans do not count as steps the four VMs still agree
on step counts.  So a forward-only medium can execute directly.

What actually rules media out is speed.  The runtime loops in our programs are
enormous: the calculator main loop wraps almost the whole 51378 instruction tape,
so every character read walks the entire tape.  A paper tape reader at 50-300
characters per second would need 170-1000 seconds per keystroke; an audio
cassette around 130 s; magnetic tape or floppy class (30-500 k chars/s) gives 0.1
to 1.7 s; RAM needs no walk at all.  So paper tape is a demo medium (the 577
instruction hello tape is about two seconds), and the practical machine stores
the tape in RAM or block RAM.  The medium table and this analysis are in section
9, the loop-stack variant in section 4.
2026-11-20 15:56:08 +08:00
..