These instructions allow cells to test the state of their environment, do arithmetic operations. Move, Look, Reproduce, etc...
| ABS | ADD |
| BR | |
| CLEARB | CMOVE |
| CONSUME | DEC |
| DIE | DIV |
| GOSUB | GOTO |
| INC | LD |
| LOOK | |
| MOD | MUL |
| NEG | NEW |
| OMOVE | POLL |
| REPRODUCE | RETURN |
| SEND | SETB |
| SUB | SWAP |
| ABS - Absolute Value | |||
| Description: | Computes the absolute value of the src register. | ||
| Addressing modes: | ABS <dst> | Compute absolute value of register <dst> and place result in <dst>. | |
| ABS <src> -> <dst> | Compute absolute value of register <src> and place result in <dst>. | ||
| Status Flags: | Z | Set: Result is zero. Clear: Result non-zero | |
| NG | Set: Result < 0; Clear: result >= 0. | ||
| Examples: |
ABS R0 ABS N -> R3 | ||
| ADD - Addition | |||
| Description: | Add two operands and store result in dst register | ||
| Addressing modes: | ADD <src> -> <dst> | Adds the <src> register to <dst> and places the result back in <dst>. | |
| ADD <src1>, <src2> -> <dst> | Adds the two operands <src1> and <src2> and places the result into <dst>. | ||
| ADD #immediate -> <dst> | Adds the value #immediate to the register <dst> and places the result back into <dst>. | ||
| Status Flags: | Z | Set: Result is zero. Clear: Result non-zero | |
| NG | Set: Result < 0; Clear: result >= 0. | ||
| Examples: |
ADD R0 -> R3 ADD #100 -> R3 ADD R0, R1 -> R2 | ||
| CLEARB - Clear bit flag | ||
| Description: | Sets one of the 16 bit flags to 0. | |
| Addressing modes: | CLEARB <flag> | The specified <flag> will be cleared (set to 0). |
| Status Flags: | The flag specified to this instruction will be cleared. | |
| Examples: |
CLEARB F0 CLEARB F7 CLEARB MN CLEARB Z | |
| CONSUME - Consume | |||
| Description: |
The cell executing this instruction will examine its
surrounding in all directions (north, south, east and west).
If any adjacent location contains another cell, or organic material, this material will be consumed by the cell. The organism will gain energy based on what was eaten. If living material was eaten, then Eat Living energy units will be given to the organism. If organic material was eaten, then the amount given by Eat Organic will be added to the organisms energy. | ||
| Addressing modes: | CONSUME | Consume surrounding material and executes the next instruction. | |
| CONSUME label | Consumes surrounding material. If anything was actually consumed then the label is taken. | ||
| Status Flags: | Z | Set: Living cell was eaten. Clear: Organic material eaten. Unchanged: Nothing was eaten. | |
| Examples: |
CONSUME foobar CONSUME | ||
| DEC - Decrement | |||
| Description: | Decrement 1 from src register. | ||
| Addressing modes: | DEC <dst> | Decrement <dst> and place result back in <dst>. | |
| DEC <src> -> <dst> | Decrement <src> register and place result in the <dst> register. | ||
| Status Flags: | Z | Set: Result is zero. Clear: Result non-zero | |
| NG | Set: Result < 0; Clear: result >= 0. | ||
| Examples: |
DEC R0 DEC N -> R3 | ||
| DIE - cellular death | ||
| Description: |
The cell executing this instruction will be killed off
from the organism. If the organism has only 1 cell, then
this instruction effectively kills the organism too.
When the cell is killed it is converted to organic material which can then be eaten by other organisms, or the same organism. | |
| Addressing modes: | DIE | Kill this cell. |
| Status Flags: | None modified | |
| Examples: |
DIE | |
| DIV - Divide | |||
| Description: | Divide two operands and store result in dst register. | ||
| Addressing modes: | DIV <src> -> <dst> | Divides the <dst> register by <src> and places the result back in <dst>. | |
| DIV <src1>, <src2> -> <dst> | Divides <src1> by <src2> and places the result into <dst>. | ||
| DIV #immediate -> <dst> | Divides the register <dst> by #immediate and places the result back into <dst>. | ||
| Status Flags: | Z | Set: Result is zero. Clear: Result non-zero | |
| NG | Set: Result < 0; Clear: result >= 0. | ||
| Examples: |
DIV R0 -> R3 DIV #100 -> R3 DIV R0, R1 -> R2 | ||
| GOSUB - jump to subroutine | ||
| Description: | Jump to subroutine, save current program counter on stack. When the corresponding RETURN instruction is executed, program execution resumes at the instruction following the GOSUB. | |
| Addressing modes: | GOSUB label | Change execution to the instruction located at label. The program counter is saved on the stack |
| Status Flags: | None modified | |
| Examples: |
GOSUB foobar | |
| GOTO - jump to address | ||
| Description: | The next instruction is determined by the address operand of the GOTO instruction. | |
| Addressing modes: | GOTO label | Change program execution to the instruction located at label. |
| Status Flags: | None modified | |
| Examples: |
GOTO foobar | |
| INC - Increment | |||
| Description: | Increment-by-one from src register. | ||
| Addressing modes: | INC <dst> | Increment <dst> and place result back in <dst>. | |
| INC <src> -> <dst> | Increment <src> register and place result in the <dst> register. | ||
| Status Flags: | Z | Set: Result is zero. Clear: Result non-zero | |
| NG | Set: Result < 0; Clear: result >= 0. | ||
| Examples: |
DEC R0 DEC N -> R3 | ||
| LD - Load register | ||
| Description: | Loads a value into a register, the value can be another register, or an immediate value. | |
| Addressing modes: | LD <src> -> <dst> | The contents of register <src> are loaded into <dst>. |
| LD #immediate -> <dst> | The value #immediate will be loaded into <dst>. | |
| Status Flags: | No status flags are modified by this instruction | |
| Examples: |
LD R0 -> R3 LD N -> R2 LD #102 -> R3 | |
| MOD - Integer modulus | |||
| Description: | Divide two operands and store remainder in dst register. | ||
| Addressing modes: | MOD <src> -> <dst> | Divides the <dst> register by <src> and places the remainder in <dst>. | |
| MOD <src1>, <src2> -> <dst> | Divides <src1> by <src2> and places the remainder into <dst>. | ||
| MOD #immediate -> <dst> | Divides the register <dst> by #immediate and places the remainder into <dst>. | ||
| Status Flags: | Z | Set: Result is zero. Clear: Result non-zero | |
| NG | Set: Result < 0; Clear: result >= 0. | ||
| Examples: |
MOD R0 -> R3 MOD #100 -> R3 MOD R0, R1 -> R2 | ||
| MUL - Multiply | |||
| Description: | Multiply two operands and store result in dst register. | ||
| Addressing modes: | MUL <src> -> <dst> | Multiply the <dst> register and <src> and places the result in <dst>. | |
| MUL <src1>, <src2> -> <dst> | Multiply <src1> by <src2> and places the result into <dst>. | ||
| MUL #immediate -> <dst> | Multiply the register <dst> and #immediate. Places the result into <dst>. | ||
| Status Flags: | Z | Set: Result is zero. Clear: Result non-zero | |
| NG | Set: Result < 0; Clear: result >= 0. | ||
| Examples: |
MUL R0 -> R3 MUL #100 -> R3 MUL R0, R1 -> R2 | ||
| NEG - Negate | |||
| Description: | Negate register | ||
| Addressing modes: | NEG <dst> | Negate <dst> and place result back in <dst>. | |
| NEG <src> -> <dst> | Negate <src> register and place result in the <dst> register. | ||
| Status Flags: | Z | Set: Result is zero. Clear: Result non-zero | |
| NG | Set: Result < 0; Clear: result >= 0. | ||
| Examples: |
NEG R0 NEG N -> R3 | ||
| RETURN - return from subroutine | ||
| Description: | Return from a subroutine. A program counter is loaded with the value on the top of the stack. Use this in conjunction with the GOSUB instruction. | |
| Addressing modes: | RETURN | Return to the instruction following the most recent GOSUB. |
| Status Flags: | None modified | |
| Examples: |
RETURN | |
| SETB - Set bit flag | ||
| Description: | Sets one of the 16 bit flags to 1. | |
| Addressing modes: | CLEARB <flag> | The specified <flag> will be set (set to 1). |
| Status Flags: | The flag specified to this instruction will be set. | |
| Examples: |
SETB F0 SETB F7 SETB MN SETB Z | |
| SUB - Subtraction | |||
| Description: | Subtracts two operands and store result in dst register | ||
| Addressing modes: | SUB <src> -> <dst> | Subtract the <src> register from <dst> and places the result back in <dst>. | |
| SUB <src1>, <src2> -> <dst> | Subtracts the register <src2> from <src1> and places the result into <dst>. | ||
| SUB #immediate -> <dst> | Subtracts the value #immediate from the register <dst> and places the result back into <dst>. | ||
| Status Flags: | Z | Set: Result is zero. Clear: Result non-zero | |
| NG | Set: Result < 0; Clear: result >= 0. | ||
| Examples: |
SUB R0 -> R3 SUB #100 -> R3 SUB R0, R1 -> R2 | ||
| SWAP - Exchange values | ||
| Description: | The contents of the two registers will be exchanged. | |
| Addressing modes: | SWAP <reg1>, <reg2> | Exchange the values in registers <reg1> and <reg2> |
| Status Flags: | No status flags are modified by this instruction | |
| Examples: |
SWAP R0, R2 SWAP N, S | |
![]() |
![]() |
![]() |
| Organisms and Cells... | Getting Started... | |
![]() |
||
| Last changed: Dec 26, 2001 | Evolve (c) 2001 Ken Stauffer | ken@stauffercom.com |