✅ Project Goal
Create a modular stackable 8-bit computer, compatible with:
- DCPU-8 v0.1 (your custom ISA)
- Stack-based function calls (
CALL,RET,PUSH,POP) - Plug-and-play PCBs that connect via a 40-pin backplane
🧱 Module Overview
Each module is a separate PCB. They all plug into a main bus board or stack vertically with headers.
| PCB Module | Function | Features |
|---|---|---|
| 1. Clock | 555 Timer / Manual button / Speed switch | Step/Run modes |
| 2. Control Unit | Microcode EEPROM sequencer | ROM-based finite state controller |
| 3. Registers | A, B, IR, MAR, OUT, SP | 74LS173 or 74LS161 |
| 4. ALU + Flags | Basic ALU (ADD, SUB, AND, OR, XOR) + Z | Using 74LS181 or discrete gates |
| 5. Memory | EEPROM (program) + SRAM (data) | 28C256 + 62256 or similar |
| 6. Stack Module | Stack Pointer, Stack RAM access | SP register, decrement/increment logic |
| 7. Output Display | LEDs or 7-segment from OUT register | Visual debug |
| 8. System Bus | Backplane or vertical headers | Shared control/data/address lines |
🔌 Shared Bus Design
A 40-pin dual-row connector (2×20) can be used between all boards. Here’s a typical pin assignment:
| Pin Range | Signal Type | Notes |
|---|---|---|
| 0–7 | Data Bus (D0–D7) | Bidirectional |
| 8–15 | Address Bus (A0–A7) | Unidirectional |
| 16 | CLK | Clock |
| 17 | RST | Reset |
| 18 | Z Flag | Zero Flag |
| 19 | C Flag | Carry Flag |
| 20 | IR Enable | Instruction Register load |
| 21–29 | Custom Control Lines | e.g., Memory Enable, Write, etc. |
| 30–31 | GND, Vcc | Power lines |
You can route these on a vertical header or horizontal backplane (à la RC2014).
🔁 Stack & CALL/RET Implementation
- Stack Pointer (SP) register uses a counter IC (e.g.,
74LS193) and is mapped to a dedicated RAM range (e.g.,0xF0–0xFF) CALLpushes return address onto stack, then jumpsRETpops return address back into PCPUSHandPOPwork with A/B registers and SP
These are microcoded in the Control Unit using EEPROM (e.g., 28C16/28C64).
💾 Program Example: DCPU-8 Adder with CALL
Let’s say your ROM contains this:
assemblyCopyEdit00: 01 10 ; LOAD B, [0x10]
02: 00 11 ; LOAD A, [0x11]
04: 40 ; ADD A, B
05: 20 12 ; STORE A, [0x12]
07: 60 0A ; CALL function @ 0x0A
09: FF ; HALT
; Subroutine
0A: 10 2A ; A = 0x2A (load literal or via [mem])
0C: 20 13 ; STORE A, [0x13]
0E: 61 ; RET
🛠️ Tools You’ll Use
| Tool | Use |
|---|---|
| KiCad / EasyEDA | Schematic and PCB layout |
| JLCPCB / OSH Park | Manufacturing boards |
| 28C256 / 62256 | EEPROM and RAM (program & data) |
| 74LS / 74HC series | Logic chips (registers, ALU, control) |
| Header pins & stack spacers | Connect modules in stack/backplane |
🚀 Suggested Build Order
- Clock Board – verify manual & automatic clock control
- Bus Board – shared headers, power rails
- Registers Board – implement A, B, OUT
- Memory Board – EEPROM for program + SRAM for data
- Control Unit – EEPROM-based microcode sequencer
- ALU Board – logic for ADD, SUB, AND, etc.
- Stack Module – with SP + stack memory
- Output Board – LED or display from OUT register