Skip to the content
2 layers99.1 × 99.1 mmRAM, the printed circuit board in 3D

Handmade CPU. See README.md

Size
99.1 × 99.1 mm
Copper layers
2
Thickness
1.6 mm
Parts
32
Nets
67
Pads
211
Tracks, vias
775, 15
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
2 Sep 2020
Updated
3 Jul 2026

Overview

RAM is an open-source printed circuit board by TheJustMoose, from the TheJustMoose/74HCPU repository on GitHub. It is a 2-layer board of 99.1 × 99.1 mm with 32 parts on 67 nets, routed with 775 tracks and 15 vias.

It is built around the 74HC00D, W27C512-45Z and IRLML5203. Its parts include 7 ICs, 6 resistors, 6 connectors, 3 capacitors and 3 diodes.

Main components

3

README

README.md

74HCPU

Not a very scary instruction set discrete logic processor.

  • 8 bit data
  • 16 bit address / 64KB RAM
  • 17 bit address (in V register) / 128KW Dual Bank Video RAM
  • 16 instructions
  • 8 data registers and 4 pointer registers in 2 banks
  • 1 flags register in IO port
  • 32 input ports and 32 output ports (You can write a constant to the first 8 ports. Only registers can be written to the remaining ports.)
  • Assembled from 74HCxx series ICs!

Soft!

ASM UEMUL [blocked]

CPU structure

CPU structure

How this CPU works?

CPU tacts

Layers of PCBs

Instruction list

The words 'instruction' and 'command' mean the same thing.

text
|----------------------------------------------|f|-------------------------------------------------------------|
|   HIGH BYTE    |    LOW BYTE   |  HIGH BYTE  |l|                                                             |
|F E D C  B A 9 8 7 6 5 4 3 2 1 0|   (again)   |a|                    SHORT DESCRIPTION                        |
|   4   +   3 + 1 + 3  +    5    = 16          |g|                                                             |
|----------------------------------------------|s|-------------------------------------------------------------|
|   ADD |  DST |1|    CONST or   | 01 0000 0001|*| Add a constant to a register (This is one command, not two) |
|   ADD |  DST |0| SRC |-|Z|z|I|i| 00 0000 0000|*| Add a register to a register (same OpCode, different bit 8) |
|----------------------------------------------| |-------------------------------------------------------------|
|  ADDC |  DST |C| SRC |F|Z|z|I|i| 10 0001 0000|*| ADD a constant or register and CARRY FLAG to a register     |
|   AND |  DST |C| SRC |-|Z|z|I|i| 20 0010 0000|*| Bitwise AND a constant or register with a register          |
|    OR |  DST |C| SRC |-|Z|z|I|i| 30 0011 0000|*| Bitwise OR a constant or register with a register           |
|   XOR |  DST |C| SRC |-|Z|z|I|i| 40 0100 0000|*| Bitwise XOR a constant or register with a register          |
|   MUL |  DST |C| SRC |-|Z|z|I|i| 50 0101 0000|*| MULtiply a constant or register by a register.              |
|   UNO |  DST |0|-|TYP|F|-|-|-|-| 60 0110 0000|*| Unary commands INV, SWAP, LSR, LSRC                         |
|   MOV |  DST |C| SRC |*|Z|z|I|i| 70 0111 0000| | MOV a constant or register to a register                    |
|   LPM |  DST |0|EXT|D|U|-|-|-|W| 80 1000 0000| | Load Program Memory - Read data from [commands] ROM         |
|    LD |  DST |V|EXT|D|U|OFFSET4| 90 1001 0000| | LoaD data from RAM to a register                            |
|    IN |  DST |  PORT   |Z|z|I|i| A0 1010 0000| | INput data from port to a register                          |
|--------------|8-7-6-5-4|-------|-------------| |-------------------------------------------------------------|
|   OUT | PORT |1|    CONST or   | B1 1011 0001| | Output const to a port (This is one command, not two)       |
|   OUT | PORT |0| SRC |PRT|X|O|o| B0 1011 0000| | Output register to a port (same OpCode, different bit 8)    |
|----------------------------------------------| |-------------------------------------------------------------|
|    ST |  SRC |V|EXT|D|U|OFFSET4| C0 1100 0000| | STore a register to a RAM                                   |
|   CMP |  DST |C| SRC |-|   -   | D0 1101 0000|+| CoMPare a constant or register with a register              |

* - means ZF, CF, HCF flags, + - means GF, EQ, LF flags

Registers

74HCPU has two register banks. First bank has 8 arithmetic registers. Second bank has 4 pointers (which can be used as 8 arithmetic registers). You can change the active bank by writing BF bit of the flags register.

Bank0 (8 pcs 8 bits registers):
NameName
R7R6
R5R4
R3R2
R1R0
Bank1 (4 pcs 16 bit registers):
NameUsage
VVideo Pointer (17 bits)
SPStack Pointer (16 bits)
YPointer 1 (16 bits), e.g. Destination
XPointer 0 (16 bits), e.g. Source
16 bit pointers
NameName
VHVL
SPHSPL
YHYL
XHXL
or 8 bit registers

Also, you can use the registers of bank 1 in the same way as bank 0: R0, R1, ... R7 (R7 will store the high half of SP, R6 the low half).

Flags register

BitFlag NameUsageReason
7-reserved-
6BFBankYou can write it
5GFGreaterCompare (CMP)
4~EQEqual (inverted)Compare (CMP)
3LFLessCompare (CMP)
2ZFZeroArithmetic
1CFCarryArithmetic
0HCFHalf CarryArithmetic

ADD, ADDC, AND, OR, XOR, MUL are binary commands

You can use it:
CMD Rd, Rs
Where Rd is destination register.
And Rs is source register.
These commands work like this:
Rd := Rd CMD Rs
For example, ADD command does this:
ADD R0, R1 -> R0 := R0 + R1
Also you can use immediate value:
CMD Rd, CONST
(You can use CONST with any command: ADD, ADDC, AND, OR, XOR, MUL, MOV...)

The only exception to the use of the Rd register is MUL command.
A pair of registers is needed to store the multiplication results.
For example:
MUL R1, R2 will store result into R1:R0 pair.
That is, R1:R0 := R1 * R2.

MUL Examples

text
  Rd select output Pair:
      _________
  Rd /         \ Pair   Rd   Rs
     |         \/
MUL R0, R1 -> R1:R0  := R0 * R1
MUL R1, R0 -> R1:R0  := R1 * R0
MUL R1, R2 -> R1:R0  := R1 * R2
MUL R1, R7 -> R1:R0  := R1 * R7
MUL R2, R3 -> R3:R2  := R2 * R3
MUL R2, R7 -> R3:R2  := R2 * R7
....
Register pairs

The MUL command uses the following register pairs to store result:
R1:R0 (when Rd is R0 or R1)
R3:R2 (when Rd is R2 or R3)
R5:R4 (when Rd is R4 or R5)
R7:R6 (when Rd is R6 or R7)
Rd is used to select output register pair.

Instruction options

C - Low byte [of command] contains constant value (1) or options (0).
Z - Will reset high nibble of SRC register before use.
z - Will reset low nibble of SRC register before use.
I - Will invert high nibble of SRC register before use.
i - Will invert low nibble of SRC register before use.
F - Set CF flag to TRUE while executing command.
W - Command will work with word, not byte.
V - Command will work with Video RAM.
D - Down, decrease pointer after command.
U - Up, increase pointer after command.
OFFSET4 - 4 bit size int offset to current pointer.
O - Out will write to high nibble of port.
o - Out will write to low nibble of port.
X - Out will toggle bits of port by mask in register.
SRC - Index of source register (0-7).
DST - Index of destination register (0-7).
TYP - Kind of unary operation (0-3).
EXT - Index of pointer register (0-3).
PORT + PRT - 5 bit of port index.

UNO - unary commands

There are four unary commands: LSR, LSRC, INV, SWAP.
LSR shift register bits to the right. CF flag get value of right (low) bit.
LSRC do same, but left (high) bit get value of CF.
SWAP simply swap the nibbles.
INV simply invert all the bits.

LPM - Load Program Memory

This command read (1 byte of) data from ROM, not RAM. And this command write data to register.
The data stores in the same ROM that stores the commands themselves. Also you can use LPMW to read the whole 16 bit word from ROM and store data to register pair.

LD, ST - Memory commands

LD - LoaD data from memory
ST - STore data to memory
V - 0 for RAM and 1 for Video RAM
SRC - register to read
DST - register to write
EXT - register pair which store pointer to memory
D - Decrement pointer after use
U - Increment pointer after use
OFFSET4 - 4 bit integer offset (-8...+7)
(CPU will read/write memory with address ptr(EXT) + OFFSET4)
Examples:

text
LD R0, X    ; read memory data from X pointer into the R0 register
ST Y, R1    ; write data from R1 into memory with address from Y pointer
ST YI, R1   ; write data and increment Y pointer
ST YD, R1   ; write data and decrement Y pointer
ST Y+5, R1  ; write data into memory address Y+5
LDV R7, V   ; read data from Video RAM with address V and store it into R7 (R7:R6 pair)
LDV R7, V+1 ; **disabled** command, you can use displacement only with X, Y and SP pointers

BRNCH - Branch commands

CALL - call a function by offset
AFCALL - call a function to an absolute address
RET - return to the address stored on the stack
RETI - return from interrupt to the address stored on the stack
JMP - go by offset
NOP - no operation (do nothing)
STOP - the processor will stop executing the program
JL, JE, JNE, JG, JZ, JNZ, JC, JNC, JHC, JNHC - conditional jump instructions
JL - jump if less
JE - jump if equal
JNE - jump if not equal
JG - jump if greater
JZ - jump if zero
JNZ - jump if not zero
JC - jump if carry
JNC - jump if not carry
JHC - jump if half carry
JNHC - jump if not half carry

Parts

32
QtyValueFootprintReferences
474LS283Package_DIP:DIP-16_W7.62mmU1, U3, U4, U5
4MountingHoleMountingHole:MountingHole_3.2mm_M3H1, H2, H3, H4
30.1uFCapacitor_THT:C_Disc_D7.5mm_W5.0mm_P10.00mmC1, C2, C3
310kResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR4, R5, R6
31kResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR1, R2, R3
3Conn_01x09_MaleConnector_PinHeader_2.54mm:PinHeader_1x09_P2.54mm_VerticalJ1, J2, J3
3LEDLED_THT:LED_Rectangular_W5.0mm_H2.0mmD1, D2, D3
2SolderJumper_3_Bridged12Jumper:SolderJumper-3_P1.3mm_Open_Pad1.0x1.5mm_NumberLabelsJP1, JP2
174HC00Package_DIP:DIP-14_W7.62mmU6
1CY62256-70PCPackage_DIP:DIP-28_W15.24mmU2
1Conn_01x03_MaleConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ4
1Conn_01x08_MaleConnector_PinHeader_2.54mm:PinHeader_1x08_P2.54mm_VerticalJ5
1IRLML5203Package_TO_SOT_SMD:SOT-23Q1
1Screw_Terminal_01x02TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2_1x02_P5.00mm_HorizontalJ6
1W27C512Package_DIP:DIP-28_W15.24mmU7

More from TheJustMoose/74HCPU

12
  • 2 layers156.2 × 97.8 mmRegs, the printed circuit board in 3D

    Regs

    TheJustMoose/74HCPU

    Handmade CPU. See README.md

    128 parts2
  • 2 layers152.4 × 152.4 mmRegs v2, the printed circuit board in 3D

    Regs v2

    TheJustMoose/74HCPU

    Handmade CPU. See README.md

    116 parts2
  • 2 layers99.1 × 99.1 mmPorts, the printed circuit board in 3D

    Ports

    TheJustMoose/74HCPU

    Handmade CPU. See README.md

    79 parts2
  • 2 layers160 × 99.1 mmRegs v5, the printed circuit board in 3D

    Regs v5

    TheJustMoose/74HCPU

    Handmade CPU. See README.md

    51 parts2
  • 4 layers99.1 × 99.1 mmMUX8x1-v5, the printed circuit board in 3D

    MUX8x1-v5

    TheJustMoose/74HCPU

    Handmade CPU. See README.md

    51 parts2
  • 2 layers160 × 99.1 mmMUX8x1-100x150-r2, the printed circuit board in 3D

    MUX8x1-100x150-r2

    TheJustMoose/74HCPU

    Handmade CPU. See README.md

    50 parts2
  • 2 layers149.9 × 99.1 mmROM, the printed circuit board in 3D

    ROM

    TheJustMoose/74HCPU

    Handmade CPU. See README.md

    46 parts2
  • 2 layers34.3 × 55.9 mmSTACK16, the printed circuit board in 3D

    STACK16

    TheJustMoose/74HCPU

    Handmade CPU. See README.md

    43 parts2
  • 2 layers152.4 × 152.4 mmMUX, the printed circuit board in 3D

    MUX

    TheJustMoose/74HCPU

    Handmade CPU. See README.md

    43 parts2
  • 2 layers71.1 × 42.5 mmReg, the printed circuit board in 3D

    Reg

    TheJustMoose/74HCPU

    Handmade CPU. See README.md

    41 parts2
  • 2 layers134.6 × 162.6 mmMUX, the printed circuit board in 3D

    MUX

    TheJustMoose/74HCPU

    Handmade CPU. See README.md

    41 parts2
  • 2 layers81.9 × 68.6 mmEndPlate, the printed circuit board in 3D

    EndPlate

    TheJustMoose/74HCPU

    Handmade CPU. See README.md

    39 parts2

Similar boards

  • 2 layers254 × 160 mmDeck65, the printed circuit board in 3D

    Deck65

    and3rson/deck65

    Simple SBC based on 65c02s

    183 parts16GPL-3.0
  • 2 layers149.9 × 74.9 mmAbn6502, the printed circuit board in 3D

    Abn6502

    kitspace-test-repos/kicad6-file-collection

    93 partsMIT
  • 2 layers20.5 × 37.7 mm82S1xx W27C512 Adapter, the printed circuit board in 3D

    82S1xx W27C512 Adapter

    SukkoPera/OldPromAdapter

    Replace 82s126/82s129/82s131 PROMs with (E)EPROMs

    5 parts18
  • 2 layers99.1 × 99.1 mmQL Qsound10x10, the printed circuit board in 3D

    QL Qsound10x10

    alvaroalea/QL_QsoundQprint_clone

    A clone board of the Sound card for the Sinclair QL Computer.

    23 parts11
  • 2 layers99.7 × 149.9 mmBeta128 r0.3, the printed circuit board in 3D

    Beta128 r0.3

    alvaroalea/betadisk-clone

    Clone of the Beta 128 Disk Interface for ZX Spectrum

    89 parts7
  • 2 layers40.6 × 44.5 mmQL Minerva MK2, the printed circuit board in 3D

    QL Minerva MK2

    alvaroalea/QL_Minerva_MK2

    Clone of the Board of ROM + RTC for Sinclair QL Computer

    16 parts6
  • 2 layers101.6 × 65.3 mmMsx eprom cartridge 3.1, the printed circuit board in 3D

    Msx eprom cartridge 3.1

    msx-solis/MSX-EEPROM-Cartridge-64k-v3

    Simple MSX ROM cartridge up to 64k

    10 parts6
  • 2 layers450 × 130 mmRobotron, the printed circuit board in 3D

    Robotron

    radiolok/robotron_s6130

    All about Robotron S6130 Daisy Wheel typewriter

    201 parts6BSD-2-Clause

Questions

How big is the RAM PCB?

It measures 99.1 × 99.1 mm and has 2 copper layers, 1.6 mm thick.

What parts does the RAM use?

32 parts, built around the 74HC00D, W27C512-45Z and IRLML5203. 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.

Where can I download the RAM KiCad files?

From the TheJustMoose/74HCPU repository on GitHub, at the commit this page was made from: the board is hard/!RAM/RAM.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the RAM design in my own project?

Its repository states no licence, so its author keeps all rights: ask TheJustMoose before reusing the design.