@0 508 // jmp start 000 // i: 0 # outer loop index 000 // ascii0: 0 # ascii digits must be in consecutive incrementing addresses 000 // ascii1: 0 000 // ascii2: 0 000 // ascii3: 0 000 // fib0: j: 0 # fib[n]; clobbered by ascii printer for inner loop index 000 // fib1: x: 0 # fib[n+1]; clobbered by ascii printer for digit being printed 000 // fib2: 0 # fib[n+2] 116 // start: acc= @fib # for the toy indirect jump to fib 306 // store @fib0 170 // acc= 0x70 301 // store @i 001 // loop: cla 281 // ladd i @i 400 // ifeq 0 586 // jmp i @fib0 # toy indirect jump to fib 040 // tx 003 // cla ++acc 201 // ladd @i 301 // store @i 577 // jmp loop 301 // fib: store @i # zero, it is known 370 // store 0x70 # 0x70 is now beginning of Fibonacci sequence (0) 003 // cla ++acc 371 // store 0x71 # 0x71 is 1 170 // fibloop: acc= 0x70 201 // ladd @i 306 // store @fib0 001 // cla 286 // ladd i @fib0 # next fib number to print 602 // ascii @ascii0 # LSB of ASCII rep 603 // ascii @ascii1 604 // ascii @ascii2 605 // ascii @ascii3 # MSB of ASCII rep 104 // acc= 4 306 // store @j 005 // scan: cla --acc 206 // ladd @j 4ff // ifeq -1 508 // jmp print 306 // store @j 102 // acc= @ascii0 206 // ladd @j 307 // store @x 001 // cla 287 // ladd i @x 430 // ifeq 0x30 574 // jmp scan 102 // print: acc= @ascii0 206 // ladd @j 307 // store @x 001 // cla 287 // ladd i @x 040 // tx 005 // cla --acc 206 // ladd @j 4ff // ifeq -1 502 // jmp space 306 // store @j 574 // jmp print 120 // space: acc= 0x20 040 // tx 170 // acc= 0x70 201 // ladd @i 306 // store @fib0 003 // cla ++acc 206 // ladd @fib0 # compute &fib[i+1] 307 // store @fib1 003 // cla ++acc 207 // ladd @fib1 # compute &fib[i+2] 308 // store @fib2 001 // cla 286 // ladd i @fib0 287 // ladd i @fib1 # compute fib[i+2] 388 // store i @fib2 # store it 003 // cla ++acc 201 // ladd @i 432 // ifeq 50 502 // jmp fullydone 301 // store @i 548 // jmp fibloop 121 // fullydone: acc= 0x21 040 // tx 000 // halt @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