8-tape accumulator CPU · mtm-cpu.automaton

MTM–5 Assembler

Word
5 bit
RAM
32 words
Opcodes
19
Registers
A, X

Assembly

1
Ready.

Tape

 

Tape strip

One cell per instruction. Gold underline marks a control transfer; green edge marks a jump target.

Programs

Load one, then edit it.

Instruction set

Arithmetic & logic — 5-bit immediate
OpMnemonicEffect
AADD nA = A + n
SSUB nA = A − n
NAND nA = A & n
OORA nA = A | n
XEOR nA = A ^ n
CCMP nflag set if A ≥ n
Memory & index
OpMnemonicEffect
LLDA addrA = RAM[addr]
TSTA addrRAM[addr] = A
UTAXX = A
VTXAA = X
ESTXRAM[X] = A
DLDXA = RAM[X]
Control flow
OpMnemonicEffect
JBCS dskip d ahead if flag set
MSKP dskip d ahead, always
PJMP ngo to instruction n
KJSR ncall instruction n
RRTSreturn
WJMPXgo to instruction X
!HLThalt — the accepting state
Reading a tape

A program is ^flag#seed# then instructions, ending !. flag is f or g; seed is the 5-bit starting accumulator. Every operand carries a trailing #.

Directives: .acc n, .flag f|g. ; starts a comment, label: marks an instruction.

What will catch you