Skip to content
Manic Microbes

Reference · ISA version 13

All 64 instructions.

Stack effects are written ( before -- after ) with the top of stack rightmost. A ⟨t⟩ marks an instruction that consumes a template.

What each cell carries

A cell executes a fixed number of instructions per tick — sixteen by default — and each costs energy. HALT yields the rest of the budget and refunds part of its cost, which makes dormancy something a lineage can evolve into.

Data stack16 × i16Circular. Popping an empty stack yields zero; pushing a full one overwrites the oldest entry.
Call stack8 × u16Circular, for the same reason.
Registers16 × i16Addressed modulo 16, so every index is legal.
Scratch RAM64 wordsAddressed modulo 64.
PA, PBu16Source and destination pointers, for copying genome bytes.
LNunsignedCopy-length counter. Saturates at zero rather than wrapping.
IPu16Instruction pointer. Wraps modulo genome length.

Templates, literals, stack and memory

0x00–0x0F

The two NOPs are not filler. They are the letters templates are written in, which is why a genome that looks like padding is usually addressing.

ByteNameStack effectNotes
0x00NOP0( -- )template letter 0
0x01NOP1( -- )template letter 1
0x02IMM<t>( -- v )push the template's value
0x03ZERO( -- 0 )
0x04ONE( -- 1 )
0x05DUP( a -- a a )
0x06DROP( a -- )
0x07SWAP( a b -- b a )
0x08OVER( a b -- a b a )
0x09ROT( a b c -- b c a )
0x0ALOAD( addr -- v )scratch RAM
0x0BSTORE( v addr -- )scratch RAM
0x0CRLOAD( idx -- v )register
0x0DRSTORE( v idx -- )register
0x0ERAND( -- v )hashed, not streamed — see determinism
0x0FSETBADGE( v -- )set own public badge, 15 bits. Inherited at division; anything touching can read it; the engine does nothing with it (ISA 4, took the reserved slot)

Arithmetic and logic

0x10–0x1F

All saturating. Division and modulo by zero yield zero. Nothing here can fault, because nothing in the machine can fault.

ByteNameStack effectNotes
0x10ADD( a b -- a+b )
0x11SUB( a b -- a−b )
0x12MUL( a b -- a×b )
0x13DIV( a b -- a÷b )0 if b = 0
0x14MOD( a b -- a mod b )0 if b = 0
0x15NEG( a -- −a )
0x16ABS( a -- |a| )
0x17MIN( a b -- min )
0x18MAX( a b -- max )
0x19SHL( a n -- a≪n )n is an address: reduced mod 16
0x1ASHR( a n -- a≫n )arithmetic, sign preserved
0x1BAND( a b -- a∧b )
0x1COR( a b -- a∨b )
0x1DXOR( a b -- a⊕b )
0x1ENOT( a -- ¬a )
0x1FCMP( a b -- sign )−1, 0 or 1

Control flow and replication machinery

0x20–0x2F

Jumps search for the complement of their template rather than an address, which is why cutting a genome in half tends to produce two working halves instead of two crashes.

ByteNameStack effectNotes
0x20JMPF<t>( -- )forward to the complement
0x21JMPB<t>( -- )backward to the complement
0x22JMPZ<t>( a -- )if a = 0
0x23JMPNZ<t>( a -- )if a ≠ 0
0x24CALL<t>( -- )jump and push a return offset
0x25RET( -- )pop a return offset
0x26GENE<t>( -- )the template is the gene's promoter
0x27EXPRESS<t>( -- )call the nearest-matching promoter
0x28SKIPZ( a -- )if a = 0, skip the next instruction and its template
0x29SETPA( v -- )source pointer
0x2ASETPB( v -- )destination pointer
0x2BSETLN( v -- )copy counter; clamps at 0
0x2CGLEN( -- n )own genome length
0x2DLOOPLN<t>( -- )jump back while LN ≠ 0
0x2EHALT( -- )yield the rest of the tick, and get some of its cost back
0x2FRESERVED_1( -- )no-op

Body and world

0x30–0x3F

The stack effects here happen whether or not the world can satisfy them. A genome's stack discipline must not depend on whether the cell running it owns a chloroplast.

ByteNameStack effectNotes
0x30BUILD( param type slot -- )begin constructing an organelle
0x31TEAR( slot -- )dismantle, recover matter
0x32OSET( v idx slot -- )control input
0x33OGET( idx slot -- v )read an output
0x34OTYPE( slot -- type )
0x35EAT( amount chem -- got )from local fluid
0x36EMIT( amount chem -- sent )to local fluid
0x37BUD( size -- ok )allocate a daughter buffer; sets PB = 0
0x38COPYB( -- )daughter[PB] = genome[PA]; PA++, PB++, LN−−
0x39SPLIT( -- )finalise division
0x3AJOIN( key kind handle -- ok )attempt a junction
0x3BLEAVE( jidx -- )dissolve a junction
0x3CJXFER( amount what jidx -- moved )transfer over a soft junction
0x3DJLEN( v jidx -- )junction rest length — this is muscle
0x3ESETKEY( v -- )own receptor key, v & 0x7F
0x3FINJECT( jidx -- ok )write a byte into another cell's nucleus

Versioning

The ISA version is stamped into every save file, scenario and archived genome. Changing the opcode table changes the meaning of every genome ever stored, so an archived species is replayed under the version it evolved in rather than reinterpreted under a newer one. This page documents ISA version 13.