
Instruction
jes/scamp-cpu
A homebrew 16-bit CPU with a homebrew Unix-like-ish operating system.

A homebrew 16-bit CPU with a homebrew Unix-like-ish operating system.
Storage is an open-source printed circuit board by jes, from the jes/scamp-cpu repository on GitHub, published under the Unlicense licence. It is a 2-layer board of 237.5 × 102.9 mm with 25 parts on 122 nets, routed with 538 tracks and 59 vias.
It is built around the 74HC245D. Its parts include 8 capacitors, 7 connectors, 6 ICs and 2 resistors.
SCAMP is my homebrew 16-bit CPU. It stands for something like "Simple Computing and Arithmetic Microcoded Processor".
The CPU is very primitive. It doesn't support interrupts, and has no MMU, and no concept of privilege levels. It currently runs at 1 MHz, above that the CompactFlash interface falls over. It runs a homebrew operating system, with a homebrew programming language and compiler, and can self-host the kernel and all of the system utilities. The environment tastes a bit like an early Unix, but works like CP/M. I used the computer to complete almost all of Advent of Code 2021.
My Advent of Code solutions are here: https://github.com/jes/aoc2021
I have some blog posts here: https://incoherency.co.uk/blog/tags/cpu.html and a web-based emulator available here: https://incoherency.co.uk/scamp/
Here are some pictures:

And here's a video with some explanation and an example session on real hardware:
It is a 16-bit CPU. The bus is 16-bit, registers are 16-bit, addresses are 16-bit, and memory contents are 16-bit. The upper 8 bits of an instruction select the opcode, and the lower 8 bits are available for small immediate values. There is no support for: cache, interrupts, virtual memory, DMA, privilege rings, floating point, and ~anything else that is not strictly necessary.
Here is a diagram of the architecture:

For more information, see doc/UCODE.md and doc/ISA.md.
The easiest way to try it out is to use the web-based emulator at https://incoherency.co.uk/scamp/
If you want to run it locally, first you'll need to build everything. Try make -j in the root directory of this
repository. It probably won't work on the first attempt because it works with multiple different Makefiles that have
annoying dependencies. Just run make -j twice or three times. If that doesn't do the trick, run make in sys/ first, and then run
it in .. Once you get to the point that it is only complaining about emcc, you're done, unless you also
want to build the web-based emulator.
Having built everything, you can go into kernel/ and start it in the emulator with ./run:
~/scamp-cpu/kernel $ ./run
make: 'os.disk' is up to date.
SCAMP boot...
.......................................................OK
starting kernel...
loading init...
____ ____ _ __ __ ____ __
/ ___| / ___| / \ | \/ | _ \ / /__ ___
\___ \| | / _ \ | |\/| | |_) / / _ \/ __|
___) | |___ / ___ \| | | | __/ / (_) \__ \
|____/ \____/_/ \_\_| |_|_| /_/ \___/|___/
$If you know how to use Unix you'll probably understand how to use it. If you know how to use CP/M you'll probably understand how it works.
If you want, you can write SLANG programs using kilo and compile them with slc. You've probably never written
SLANG before. You can learn how to use it by reading programs under /src (or sys/ in the repo). It's mostly
like C but with fewer features and less safety.
I did these tasks, but working on several steps at a time (i.e. I didn't wait until after I had built the entire computer before thinking about microcode or the operating system):
I suspect the computer will never be "finished", but some things I still want to work on are:
var x = 5 at global scope should not take any code to initialise)const x = 5 should lead to x being replaced with the constant value 5 where possible)If you happen to want to work on any of the above, I'd be happy to help you!
I thoroughly recommend the Nand2Tetris course. https://nand2tetris.org/
If you want to do the exercises from Nand2Tetris without learning what a hardware-description language is, and without going through all the lectures, you can play https://nandgame.com/
Ben Eater's videos on 8-bit CPU design are excellent and heavily influenced the design of my CPU.
I found the YouTube playlist for Nicolas Laurent's compiler class quite helpful in writing the parser for the compiler.
The Build Your Own Text Editor is a fantastic tutorial that walks you through implementing antirez's kilo editor.
Balazs Markus's 8250 UART example is helpful.
Daniel Tufvesson has a post that is a good starting point for understanding the 8-bit CompactFlash interface.
PickledDog has a description of an improvement to the RC2014 CompactFlash card that might be helpful. Also Bill Shen's comment on the RC2014 mailing list.
Michał Cierniak has a good blog post about CompactFlash + 8255 interface card with lots of detail on how his CompactFlash interface works.
James Sharman is building an interesting 8-bit pipelined CPU, and has good videos with lots of explanation on how it works.
SCAMP is featured on the Homebrew CPU ring which also features many other interesting homebrew CPU designs.
You can email me on james@incoherency.co.uk or read my blog: [https://incoherency.co.uk/].
| Qty | Value | Footprint | References |
|---|---|---|---|
| 8 | C | Capacitor_THT:C_Disc_D6.0mm_W2.5mm_P5.00mm | C1, C2, C3, C4, C5, C6, C7, C8 |
| 3 | Conn_01x02 | Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical | J3, J5, J7 |
| 2 | 7400 | Package_DIP:DIP-14_W7.62mm_Socket | U1, U2 |
| 2 | 74HC245 | Package_DIP:DIP-20_W7.62mm_Socket | U4, U5 |
| 2 | Conn_02x20_Odd_Even | storage:cfcard | J2, J4 |
| 2 | R | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R1, R2 |
| 1 | 74LS08 | Package_DIP:DIP-14_W7.62mm_Socket | U6 |
| 1 | Conn_01x03 | Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical | J6 |
| 1 | Conn_02x08_Counter_Clockwise | Package_DIP:DIP-16_W7.62mm_Socket | U3 |
| 1 | Conn_02x30_Counter_Clockwise | Connector_PinSocket_2.54mm:PinSocket_2x30_P2.54mm_Horizontal | J1 |
The 23 most common of 25 parts.
It measures 237.5 × 102.9 mm and has 2 copper layers, 1.6 mm thick.
25 parts, built around the 74HC245D. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the jes/scamp-cpu repository on GitHub, at the commit this page was made from: the board is kicad/storage/storage.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.
Its repository publishes it under the Unlicense licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).

jes/scamp-cpu
A homebrew 16-bit CPU with a homebrew Unix-like-ish operating system.

jes/scamp-cpu
A homebrew 16-bit CPU with a homebrew Unix-like-ish operating system.

jes/scamp-cpu
A homebrew 16-bit CPU with a homebrew Unix-like-ish operating system.

jes/scamp-cpu
A homebrew 16-bit CPU with a homebrew Unix-like-ish operating system.

jes/scamp-cpu
A homebrew 16-bit CPU with a homebrew Unix-like-ish operating system.

slu4coder/Minimal-64x4-Home-Computer
My DIY TTL home computer with VGA and PS/2 and 4x the processing power of a Commodore C64 or Apple II.

slu4coder/Minimal-UART-Computer-1-2
Legacy: Version 1 and 2 of my TTL-only CPU featuring UART I/O, an expansion port, 512KB SSD at up to 10MHz clock speed

crmaykish/mackerel-68k
A series of single-board Motorola 68k computers with support for modern Linux

slu4coder/Minimal-64-Home-Computer
Legacy: Full TTL-only home computer with VGA and PS/2 and twice the processing power of a Commodore 64
Pixelvation/Pixelvation
This GitHub repository is the current home of Pixelvation and will be updated whenever there's some significant new development.

Board-Folk/MegaCD-Main-BD
Reproductions of main board PCBs for Sega's Mega CD/Sega CD add-on for the Mega Drive/Genesis console.


slu4coder/Minimal-UART-Computer-3
Version 3 of my educational DIY TTL computer built around a UART serial interface - now with blinkenlights!