@0 // Reset state is acc=0 idx=0 000 // loop: acc= 0 # Print from 0x70 until we find a 0x00 byte 170 // ladd i 0x6a 300 // ifeq 0 402 // jmp fib f44 // ++idx tx 4fa // jmp loop f20 // fib: idx # N.B. acc is 0 at this point (we got here from ifeq 0) 270 // store 0x70 # 0x70 is now beginning of Fibonacci sequence (0) 001 // acc= 1 271 // store 0x71 # 0x71 is 1 000 // fibloop: acc= 0 f10 // swap 332 // ifeq 50 42b // jmp fullydone 26f // store 0x6f # 0x6f is current index into Fibonacci sequence f10 // swap 170 // ladd 0x70 # Load next unprinted number in Fibonacci sequence f10 // swap 000 // acc= 0 f10 // swap 56b // ascii 0x6b # LSB of ASCII rep 56c // ascii 0x6c 56d // ascii 0x6d 56e // ascii 0x6e # MSB of ASCII rep 004 // acc= 4 f10 // swap f08 // scan: --idx 000 // acc= 0 16b // ladd 0x6b f10 // swap 300 // ifeq 0 412 // jmp allzeroes f10 // swap 330 // ifeq 0x30 4f7 // jmp scan f40 // done: tx f10 // swap 300 // ifeq 0 404 // jmp space f12 // --acc swap 000 // acc= 0 16b // ladd 0x6b 4f8 // jmp done 020 // space: acc= 0x20 f40 // tx 000 // acc= 0 f20 // idx 16f // ladd 0x6f f10 // swap 402 // jmp nextfib f10 // allzeroes: swap 4ef // jmp done 170 // nextfib: ladd 0x70 # Load just-printed Fibonacci number 171 // ladd 0x71 # Add about-to-print Fibonacci number 272 // store 0x72 # Store n+2 Fibonacci number f04 // ++idx 4d1 // jmp fibloop 021 // fullydone: acc= 0x21 f40 // tx f80 // halt @6a 070 // 6a: constant 0x070 000 // 6b: LSB of ASCII rep 000 // 6c: USB of ASCII rep 000 // 6d: USB of ASCII rep 000 // 6e: MSB of ASCII rep 000 // 6f: next index to store in memory image of Fibonacci sequence @70 048 // H # later: start of in-memory Fib sequence 065 // e 06c // l 06c // l 06f // o 02c // , 020 // ' ' 077 // w 06f // o 072 // r 06c // l 064 // d 021 // ! 00a // \n 000