Documentation for HMMM
(Harvey Mudd Miniature Machine) Last update: 2025 Quick reference: Table of Hmmm Instructions
Instruction Description Aliases System instructions halt Stop! None read rX Place user input in register rX None write rX Print contents of register rX None nop Do nothing None Setting register data setn rX N Set register rX equal to the integer N (-128 to +127) None addn rX N Add integer N (-128 to 127) to register rX None copy rX rY Set rX = rY mov Arithmetic add rX rY rZ Set rX = rY + rZ None sub rX rY rZ Set rX = rY - rZ None neg rX rY Set rX = -rY None mul rX rY rZ Set rX = rY * rZ None div rX rY rZ Set rX = rY // rZ (integer division; rounds down; no remainder) None mod rX rY rZ Set rX = rY % rZ (returns the remainder of integer division) None Jumps! jumpn N Set program counter to address N None jumpr rX Set program counter to address in rX jump jeqzn rX N If rX == 0, then jump to line N jeqz jnezn rX N If rX != 0, then jump to line N jnez jgtzn rX N If rX > 0, then jump to line N jgtz jltzn rX N If rX < 0, then jump to line N jltz calln rX N Copy addr. of next instr. into rX and then jump to mem. addr. N call Interacting with memory (RAM) pushr rX rY Store contents of register rX onto stack pointed to by reg. rY None popr rX rY Load contents of register rX from stack pointed to by reg. rY None loadn rX N Load register rX with the contents of memory address N None storen rX N Store contents of register rX into memory address N None loadr rX rY Load register rX with data from the address location held in reg. rY loadi, load storer rX rY Store contents of register rX into memory address held in reg. rY storei, store
Table of Contents
Hmmm is implemented as a single program written in Python. By default, hmmm will assemble and run a file written in the Hmmm assembly language. There are options that to assemble a program without executing it, to run a previously assembled program, and to invoke a built-in debugger.
Installing Hmmm
hmmm
Using Hmmm
The Basics
python hmmm
... continue reading