8-bit Computer - Assembler <

Hover over components to see details. Click on components to open Datasheet.

Image Full Resolution 5472x3648

Assembler and Loader program

The Assembler consists of the Assembler program 8bcas which assembles your program to binary code, and the Loader program 8bcload to load the binary code to the 8-bit Computer through the 16-bit Shift Register Breadboard. I used an Raspberry Pi 4 Model B with OpenBSD installed to control the Shift Register pins. The GPIO pins of the Raspberry Pi are programmed with the OpenBSD GPIO framework through ioctl(2) on /dev/gpio*. While 8bcas should be portable to compile on most UNIX like Operating Systems, 8bcload would require Operating System specific adaptions to work.

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)