HDGL SUBSTRATE — TURING-COMPLETE INSTRUCTION SET
=================================================
Programs are plain ASCII text files written to LBA 18 of the USB drive.
One character = one instruction. Whitespace, CR, LF stop reading.
Maximum program size: 510 characters.

AT BOOT
  1. Substrate runs: Omega=phi emerges, settle genome Pi_d(Omega) fires
  2. LBA 18 is read from USB
  3. If first byte is printable ASCII: program executes
  4. Program returns to substrate orbit loop when done

ACCUMULATOR OPS (fp80, 10-byte extended precision)
  n    acc = 1
  o    acc = Omega (phi, the emerged fixed point)
  0-9  acc = digit
  t    acc = T(acc) = 1 + 1/acc  (the substrate operator)
  +    acc += 1
  -    acc -= 1
  *    acc *= acc  (square)
  /    acc = 1/acc
  p    print acc as decimal (8 decimal places)
  s    print full substrate state (Omega, Lambda, Ether, Genome)

TAPE OPS (512-cell tape at 0xA600, byte cells)
  >    move tape head right
  <    move tape head left
  .    tape[head] += 1
  ,    tape[head] -= 1
  @    print tape[head] as decimal integer
  $    print tape[head] as ASCII character
  ?    acc = tape[head]  (load cell to accumulator)
  =    tape[head] = acc  (store accumulator to cell, truncated to byte)

CONDITIONAL BRANCH (Turing complete)
  [    if tape[head] == 0, skip forward to matching ]
  ]    if tape[head] != 0, jump back to matching [

LOOP CONTROL
  L    mark loop-from-here (repeated programs jump to this point)
  l    mark program as looping (restart from L each cycle)
  F    run full integer Fibonacci ladder (F(1)..F(739), never-ending)

PROGRAMS (in programs/ directory)
  fib.txt       Never-ending Fibonacci integer ladder (F(739)=154 digits, ratio=phi)
  phi.txt       Converge to phi via T-iterations: 2.0, 1.5, 1.666, ... 1.61803398
  count.txt     Countdown from 5 to 0 using tape conditional loop
  hello.txt     Print "Hello, World!" using arithmetic and tape ASCII output
  tape_add.txt  Copy cell[0]=5 to cell[1] using tape loop (proves data movement)

WRITING A PROGRAM TO USB (metal)
  dd if=programs/hello.txt of=/dev/sdX bs=512 seek=18 conv=notrunc

QEMU TEST
  qemu-system-x86_64 -drive file=hdgl_tc.img,format=raw,if=ide -m 32M

TURING COMPLETENESS
  [ ] provide conditional branching.
  > < . , provide unbounded cell access (512 cells, extendable).
  Together: equivalent to Brainfuck = Turing complete.
  Any computable function can be expressed as a txt file on the USB.

NEXT: from this foundation, the OS grows one instruction at a time.
