RegisterMachineGenome Instruction Set

RegisterMachineGenome has an instruciton set made up of 21 simple instructions and a single accumulator register.

Move memory pointer forward one position
Move memory pointer back one position
Move memory pointer to location specified by accumulator (also starts execution)
Add memory value at current position to accumulator
Multiply accumuator with memory value at current position
Divide accumuator by memory value at current position (divide by zero results in zero)
Bitwise AND accumulator with memory value at current position
Bitwise OR accumulator with memory value at current position
Bitwise XOR accumulator with memory value at current position
Bitwise left shift accumulator value
Bitwise right shift accumulator value
Increment accumulator
Decrement accumulator
Store accumulator to memory at current position and zero accumulator
Set accumulator to -1, 0, or 1 depending on whether memory value is less than, equal to, or greater than accumulator
Jump to matching REP (}) if accumulator is zero
Jump back to matching LOOP ({) if accumulator is nonzero
Read from current I/O channel into accumulator
Write accumulator to current I/O channel
Set I/O channel to current accumulator value
Stop execution until a GO (g) instruction is reached and zero accumulator

All instructions such as ADD, SUB, MUL, AND, etc. that operate on the accumulator place their results in the accumulator as well. Instructions such as GO and SCH that set locations based on the value of the accumulator wrap if the accumulator is out of range and take the absolute value if the accumulator is negative. (e.g. GO uses abs(a) % sizeof(memory))

When execution starts, the virtual machine is in "intron" state, meaning that it doesn't execute anything until a GO instruction is encountered. (GO doubles as a "start gene" instruction.) The genome virtual machine then enters "exon" state and executes instructions until a STOP instruction is encountered. A STOP instruction places the GVM back into intron state and zeros the memory pointer, channel, and accumulator values. STOP has this effect no matter where it occurs, even inside a false {} block. The resetting of state upon encountering a STOP instruction means that seperate blocks delimited by GO and STOP can function independently of each other, permitting modularity to evolve.

The RegisterMachineGenome instruction set was very loosely based on a toy programming language called Brainfuck.

<< Back to About