Shreyan Chaubey

Index

Experiment · Computation

MTM-8

A 5-bit CPU that runs as a Turing machine.

Open MTM-8 (external) AutomataStudio (external) Source on GitHub (external)

MTM-8 is a small accumulator CPU. It isn’t hardware, and it isn’t an emulator in the usual sense. The whole CPU is a Turing machine with eight tapes, and AutomataStudio runs it. You write assembly, turn it into a tape, and watch the machine work through it.

Terms used here

Turing machine
A simple model of a computer. A head moves along a tape, reading and writing one symbol at a time, following a fixed table of rules.
Tape
The machine's memory: a row of cells, each holding one symbol. MTM-8 uses eight of them.
Accumulator
The register where arithmetic results are kept.

The machine

Word size
5 bits, so numbers from 0 to 31
Memory
32 words of RAM
Registers
A (accumulator) and X (index)
Instructions
19
Closest real chip
A 5-bit MOS 6502

Instructions

MTM-8 instructions by group
GroupInstructions
Arithmetic and logicADD SUB AND ORA EOR CMP
Memory and indexLDA STA TAX TXA STX LDX
Control flowBCS SKP JMP JSR RTS JMPX HLT

Run a program

  1. Write assembly in the editor. Labels, ; comments and the .acc and .flag directives work.
  2. Assemble it. You get a tape string.
  3. Download the .automaton file and open it in AutomataStudio.
  4. Paste the tape and run it.
  5. Read the result. Tape 2 holds the accumulator and tape 5 holds RAM.

There is also a library of example programs you can load and change.

The app loads only when you ask, so this page stays fast.

The MTM-8 assembler and program library. Open it in a new tab for more room.

Limits

MTM-8 is released under the MIT licence.

Reader settings

Theme