Skip to content

Repository files navigation

RAMPE - Relay-Architectured Memorizer, Processor and Enumerator

The RAMPE is a relay computer with a simple custom ISA. The purpose of this project is to explore early computing and CPU design.

Included are the RASM assembler and RSIM simulator. Both are written in Fortran.

Assembler

Usage: rasm <input.rasm> <output.rexe>

 1 | 0, 0 | 11000000 xor a, a 2 | 0, 1 | 01110110 ll loop 3 | 0, 2 | 01000100 mov b, a ; loop address in b 4 | 0, 3 | 01111001 ll exit 5 | 0, 4 | 01001000 mov c, a ; exit address in c 6 | 0, 5 | 11000000 xor a, a 7 | 0, 6 | 00001000 loop: inc 8 | 0, 7 | 00110010 jlz a, c 9 | 0, 8 | 00010100 jmp b 10 | 0, 9 | 00000001 exit: hlt 

Simulator

Usage: rsim [mode] [program.rexe]

rsim = run instructions from stdin

rsim <file> = run from file

Modes:

-s = single step from file (press enter)

-c = slow run from file (10 Hz clock)

-q = quietly run from file (only out instructions)

cycle: 0
a: 00000000 (0)
b: 00000000 (0)
c: 00000000 (0)
d: 00000000 (0)
ir: 11000000 (192)
pc: 00000001 (1)
cycle: 1
a: 00000110 (6)
b: 00000000 (0)
c: 00000000 (0)
d: 00000000 (0)
ir: 01110110 (118)
pc: 00000010 (2)

Registers

a = accumulator (00 in binary)

b = general purpose register (01)

c = gpr (10)

d = gpr (11)

pc = program counter

ir = instruction register

Basic instructions (see documentation)

v = value, a = address, r = register

InstructionPurpose
nopno operation
hlthalt
getpc address to acc
setacc to pc address
swswitch memory bank and jump
inread
outprint
incincrement acc
decdecrement acc
jmp rjump
jez r, rjump if register equals zero
jlz r, rjump if register less than zero
mov r, rmove register to register
sto r, rstore register to address
ld r, rload address to register
ll vload immediate to al
lh vload immediate to ah
not rlogical not
and r, rlogical and
or r, rlogical or
xor r, rlogical xor
add r, raddition
sub r, rsubtraction
sh v, vlogical shift

Assembler pseudoinstructions

l = label

InstructionPurpose
la lload label address into a
lb lload label bank into a
lba lload label bank and address into b and a
ja ljump to label address
jea ljump to label if a equals zero
jla ljump to label if a less than zero
lda lload from label address into a
sta lstore from a into label address
shr rshift right
shrr rshift right twice
shl rshift left
shll rshift left twice

Other registers have corresponding instructions such as jeb, jlb, ldb, stb for b register.

About

RAMPE computer ISA with assembler and simulator

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages