instruction set manual

[MP]  Memory Position  ·  P0 P1 P2 P3
[V]   Value  ·  0-9  |  "a-z"  |  TRUE  FALSE

Data & Memory

  • READ [MP]display register value
  • PRINT [MP]display register value
  • INPUT [MP]read user input into register
  • WRITE [MP] [V]store value into register
  • MOVE [MP] [MP]copy value between registers

Arithmetic

  • ADD [MP] [MP] [MP]dest = a + b
  • SUB [MP] [MP] [MP]dest = a - b
  • MULT [MP] [MP] [MP]dest = a * b
  • DIV [MP] [MP] [MP]dest = a / b
  • INC [MP]increment by 1
  • DEC [MP]decrement by 1
  • SHL [MP] [MP]shift left — multiply by 2
  • SHR [MP] [MP]shift right — divide by 2

Logic

  • AND [MP] [MP] [MP]true if both are true
  • OR [MP] [MP] [MP]true if at least one is true
  • NOT [MP]inverts the logical value
  • XOR [MP] [MP] [MP]true if exactly one is true
  • BT [MP] [MP] [MP]dest = a > b
  • ST [MP] [MP] [MP]dest = a < b
  • EQUAL [MP] [MP] [MP]dest = a == b

Control Flow

  • JUMP [MP]jump to line stored in register
  • JUMPC [MP] [MP]jump if condition is true
  • CALL [V]call subroutine at line V
  • RETreturn from subroutine
  • NOPno operation

Stack

  • PUSH [MP]push register value onto stack
  • POP [MP]pop stack value into register

SUPER TINY COMPUTER

v1.0  ·  4-register virtual machine

program input

$
1

output

memory log

IP P0 P1 P2 P3

cpu internals

INPUT
$