~ CPU INSIDE CPU INSIDE CPU ~

a single-file vibe demo // learnwithkody / 03 cyc 0 — Hz
— ips
three machines, one screen. the OUTER 8-bit CPU (left) executes a tiny kernel. the TINY OS (middle) round-robins two cooperative tasks: a marquee and a hosted emulator. the INNER 4-bit CPU (right) is being emulated, instruction-by-instruction, by 8-bit assembly running on the outer CPU. recently-touched RAM cells glow; PC is yellow, SP is cyan.

OUTER 8-BIT CPU layer 1 // host

A00
B00
C00
D00
PC0000
SPFF
FLAGS ZNCI
RAM 256Bhot 0
cold warm hot PC SP
cycles 0 ins 0 halts 0 calls 0

TINY OS layer 2 // hosted in layer 1

MODEKERNEL
TICKS0
QUANTUM8

SCHEDULER :: ROUND-ROBIN

TASK 0 MARQUEE
pc=—
TASK 1 INNER-CPU
pc=—
OUT PORT :: /dev/marquee
last syscall: none  ctx-switches: 0
OS PAGE :: RAM[80..FF]scrub
kernel sees layer-1 RAM directly

INNER 4-BIT CPU layer 3 // emulated by layer 2

R00
R10
PC0
FLAGS ZC
RAM 16 NIBBLESstep 0
ISA8 ops, 4-bit nibble code
PROGRAMCOUNT-TO-15
NEXT INS
OUTPUT
inner steps 0 loops 0