Example:
$ cat fibonacci.asm LDI 1 ; Init var-b with '1' STA 14 ; LDI 0 ; Init A register with '0' ADD 14 ; Add var-b and A register JC 0 ; If carry start over OUT ; Display Sum on LED STA 15 ; Store Sum to var-c LDA 14 ; Copy var-b to var-a STA 13 ; LDA 15 ; Copy var-c to var-b STA 14 ; LDA 13 ; Load var-a to A register JMP 3 ; Loop ; var-a: left fibonacci number ; var-b: right fibonacci number ; var-c: temporary buffer $ 8bcas -o fibonacci.8bc fibonacci.asm 0: LDI 1 1: STA 14 2: LDI 0 3: ADD 14 4: JC 0 5: OUT 6: STA 15 7: LDA 14 8: STA 13 9: LDA 15 10: STA 14 11: LDA 13 12: JMP 3 Output file written to fibonacci.8bc Machine memory used up 13 bytes Assembling done $ doas 8bcload fibonacci.8bc Memory Addr 0: Memory value=0x51 (81) Memory Addr 1: Memory value=0x4e (78) Memory Addr 2: Memory value=0x50 (80) Memory Addr 3: Memory value=0x2e (46) Memory Addr 4: Memory value=0x70 (112) Memory Addr 5: Memory value=0xe0 (224) Memory Addr 6: Memory value=0x4f (79) Memory Addr 7: Memory value=0x1e (30) Memory Addr 8: Memory value=0x4d (77) Memory Addr 9: Memory value=0x1f (31) Memory Addr 10: Memory value=0x4e (78) Memory Addr 11: Memory value=0x1d (29) Memory Addr 12: Memory value=0x63 (99)