- Home
- IC10 academy
- Glossary & quick reference
Learn · IC10
Glossary & quick reference
Terms from alias to yield – and every instruction with its syntax at a glance.
Terms
- alias
-
Gives a register or pin a name.
Lesson 9: define and alias: code with names - Batch mode
-
How lb/lbn combine many values: Average, Sum, Minimum, Maximum, Count.
Lesson 11: Batch modes and the NaN trap - Checker (linter)
-
Part of the IC10 coder that shows errors and traps while you type.
Lesson 17: Debugging and common traps - Data network
-
Every device connected to the housing by data cable. lb/lbn/sb/sbn reach them without pins.
Lesson 10: HASH() and named devices: lbn and sbn - db
-
The housing itself as a device. Has its own values such as Setting and its own stack.
Lesson 1: Chip and housing - define
-
Gives a fixed number a name. Costs no register.
Lesson 9: define and alias: code with names - Game version
-
Compacted version without comments and blank lines so a program fits the limits.
Lesson 17: Debugging and common traps - Hash / HASH()
-
A number computed from a name (CRC32). HASH("…") computes it when loading – for prefabs and device names.
Lesson 10: HASH() and named devices: lbn and sbn - Hysteresis
-
Control with two thresholds so a device does not keep switching on and off.
Lesson 12: Hysteresis: heating without flicker - IC housing
-
The structure the chip goes into. Needs power and a data cable, has the pins d0–d5.
Lesson 1: Chip and housing - IC10
-
The programmable chip (integrated circuit). Sits in the IC housing and runs your program.
Lesson 1: Chip and housing - Jump (absolute/relative)
-
j, beq, bgt … jump to a label. br… instructions and jr jump by a number of lines.
Lesson 7: Labels and jumps - Kelvin
-
Temperature unit in the game. 0 °C = 273.15 K.
Lesson 3: Math: move, add, sub, mul, div - Label
-
Jump target: a name with a colon, alone on its line.
Lesson 7: Labels and jumps - LogicSlotType
-
Name of a value in a slot, e.g. Occupied or Quantity.
Lesson 14: Slots: what sits in the compartments - LogicType
-
Name of a device value, e.g. Temperature, On or Setting. Case matters.
Lesson 5: LogicTypes: what devices reveal - Main loop
-
The part of the program between the start label and j start that repeats forever.
Lesson 6: yield and the main loop - NaN
-
“Not a number”. Appears e.g. with Average and no matching device. Catch it with snan/bnan.
Lesson 11: Batch modes and the NaN trap - Pin (d0–d5)
-
Fixed device slots on the housing, assigned with a screwdriver. Six of them.
Lesson 4: Reading and switching devices: l and s - Prefab
-
Internal name of a device type, e.g. StructureGasSensor.
Lesson 10: HASH() and named devices: lbn and sbn - ra
-
Return address (r17). jal stores the line after the call here.
Lesson 16: Subroutines with jal and ra - ReferenceId
-
Fixed number of every device. Readable with l r0 d0 ReferenceId and usable as a device reference.
Lesson 4: Reading and switching devices: l and s - Register
-
Storage slot for one number. r0–r15 are free, sp and ra have special jobs.
Lesson 2: Registers and numbers - Slot
-
Compartment of a device, numbered from 0.
Lesson 14: Slots: what sits in the compartments - sp
-
Stack pointer (r16). Points to the next free slot on the stack.
Lesson 15: The stack: push, pop, peek - Stack
-
512 extra storage slots per chip, usable as a pile (push/pop) or directly (get/put).
Lesson 15: The stack: push, pop, peek - Subroutine
-
Block of code called with jal that returns with j ra.
Lesson 16: Subroutines with jal and ra - Tick
-
One game computation step, 0.5 seconds. At most 128 instructions per tick.
Lesson 6: yield and the main loop - yield
-
Ends the current tick. Belongs in every main loop.
Lesson 6: yield and the main loop
Instructions by group
Short version of all current instructions. The full description lives in the IC10 coder under “Docs”.
Program
| Syntax | Meaning |
|---|---|
| alias name r?|d? | Gives a register or pin a readable name of your own. |
| define name value | Gives a fixed number a name. |
| hcf | Stops the chip immediately with an error. |
| sleep a | Pauses the chip for a number of seconds. |
| yield | Pauses the chip for exactly one tick (0.5 seconds). |
Math
| Syntax | Meaning |
|---|---|
| abs r? a | Makes a positive (absolute value). |
| acos r? a | Angle (radians) whose cosine is a. |
| add r? a b | Adds two numbers: a + b. |
| asin r? a | Angle (radians) whose sine is a. |
| atan r? a | Angle (radians) whose tangent is a. |
| atan2 r? a b | Angle (radians) to a point from y (a) and x (b). |
| ceil r? a | Rounds a up to the next whole number. |
| clamp r? a min max | Limits a to the range from min to max. |
| cos r? a | Cosine of an angle in radians. |
| div r? a b | Divides a by b: a / b. |
| exp r? a | Computes e to the power of a. |
| floor r? a | Rounds a down to the next whole number. |
| lerp r? a b c | Blends between a and b by the ratio c (0 to 1). |
| log r? a | Natural logarithm of a (base e). |
| max r? a b | Takes the larger of two numbers. |
| min r? a b | Takes the smaller of two numbers. |
| mod r? a b | Remainder of a division: a mod b. |
| move r? a | Copies a number or a register's content into a register. |
| mul r? a b | Multiplies two numbers: a * b. |
| pow r? a b | Raises a to the power of b. |
| rand r? | Creates a random number from 0 up to just below 1. |
| round r? a | Rounds a to the nearest whole number. |
| select r? a b c | Picks b if a is not 0, otherwise c. |
| sgn r? a | Sign of a: -1, 0 or 1. |
| sin r? a | Sine of an angle in radians. |
| sqrt r? a | Takes the square root of a. |
| sub r? a b | Subtracts b from a: a - b. |
| tan r? a | Tangent of an angle in radians. |
| trunc r? a | Cuts off the decimal part of a. |
Compare
| Syntax | Meaning |
|---|---|
| sap r? a b c | Sets the register to 1 if a and b are approximately equal (tolerance c). |
| sapz r? a b | Sets the register to 1 if a is (practically exactly) 0, otherwise to 0. |
| sdns r? device | Sets the register to 1 if no device is set on the pin, otherwise to 0. |
| sdse r? device | Sets the register to 1 if a device is set on the pin, otherwise to 0. |
| seq r? a b | Sets the register to 1 if a is exactly equal to b, otherwise to 0. |
| seqz r? a | Sets the register to 1 if a is exactly 0, otherwise to 0. |
| sge r? a b | Sets the register to 1 if a is greater than or equal to b, otherwise to 0. |
| sgez r? a | Sets the register to 1 if a is greater than or equal to 0, otherwise to 0. |
| sgt r? a b | Sets the register to 1 if a is greater than b, otherwise to 0. |
| sgtz r? a | Sets the register to 1 if a is greater than 0, otherwise to 0. |
| sle r? a b | Sets the register to 1 if a is less than or equal to b, otherwise to 0. |
| slez r? a | Sets the register to 1 if a is less than or equal to 0, otherwise to 0. |
| slt r? a b | Sets the register to 1 if a is less than b, otherwise to 0. |
| sltz r? a | Sets the register to 1 if a is less than 0, otherwise to 0. |
| sna r? a b c | Sets the register to 1 if a and b clearly differ (tolerance c). |
| snan r? a | Sets the register to 1 if a is NaN (not a valid number), otherwise to 0. |
| snanz r? a | Sets the register to 0 if a is NaN, otherwise to 1 – so 1 = valid. |
| snaz r? a b | Sets the register to 1 if a is not (practically exactly) 0, otherwise to 0. |
| sne r? a b | Sets the register to 1 if a is not equal to b, otherwise to 0. |
| snez r? a | Sets the register to 1 if a is not 0, otherwise to 0. |
Branch
| Syntax | Meaning |
|---|---|
| bap a b c line | Jumps to a label if a is approximately equal to b. |
| bapal a b c line | Calls a subroutine if a is approximately equal to b (return address in ra). |
| bapz a b line | Jumps to a label if a is (practically exactly) 0. |
| bapzal a b line | Calls a subroutine if a is (practically exactly) 0 (return address in ra). |
| bdns device line | Jumps to a label if no device is set on the connection. |
| bdnsal device line | Calls a subroutine if no device is set (return address in ra). |
| bdnvl device logicType line | Jumps to a label if the device cannot provide this value. |
| bdnvs device logicType line | Jumps to a label if the device cannot accept this value. |
| bdse device line | Jumps to a label if a device is set on the connection. |
| bdseal device line | Calls a subroutine if a device is set (return address in ra). |
| beq a b line | Jumps to a label if a equals b. |
| beqal a b line | Calls a subroutine if a equals b (return address in ra). |
| beqz a line | Jumps to a label if a equals 0. |
| beqzal a line | Calls a subroutine if a equals 0 (return address in ra). |
| bge a b line | Jumps to a label if a is greater than or equal to b. |
| bgeal a b line | Calls a subroutine if a is greater than or equal to b (return address in ra). |
| bgez a line | Jumps to a label if a is greater than or equal to 0. |
| bgezal a line | Calls a subroutine if a is greater than or equal to 0 (return address in ra). |
| bgt a b line | Jumps to a label if a is greater than b. |
| bgtal a b line | Calls a subroutine if a is greater than b (return address in ra). |
| bgtz a line | Jumps to a label if a is greater than 0. |
| bgtzal a line | Calls a subroutine if a is greater than 0 (return address in ra). |
| ble a b line | Jumps to a label if a is less than or equal to b. |
| bleal a b line | Calls a subroutine if a is less than or equal to b (return address in ra). |
| blez a line | Jumps to a label if a is less than or equal to 0. |
| blezal a line | Calls a subroutine if a is less than or equal to 0 (return address in ra). |
| blt a b line | Jumps to a label if a is less than b. |
| bltal a b line | Calls a subroutine if a is less than b (return address in ra). |
| bltz a line | Jumps to a label if a is less than 0. |
| bltzal a line | Calls a subroutine if a is less than 0 (return address in ra). |
| bna a b c line | Jumps to a label if a is not approximately equal to b. |
| bnaal a b c line | Calls a subroutine if a is not approximately equal to b (return address in ra). |
| bnan a line | Jumps to a label if a is not a number (NaN). |
| bnaz a b line | Jumps to a label if a is not 0. |
| bnazal a b line | Calls a subroutine if a is not 0 (return address in ra). |
| bne a b line | Jumps to a label if a does not equal b. |
| bneal a b line | Calls a subroutine if a does not equal b (return address in ra). |
| bnez a line | Jumps to a label if a does not equal 0. |
| bnezal a line | Calls a subroutine if a does not equal 0 (return address in ra). |
| brap a b c offset | Jumps d lines forward or back if a is approximately equal to b. |
| brapz a b offset | Jumps c lines forward or back if a is (practically exactly) 0. |
| brdns device offset | Jumps a lines forward or back if no device is set. |
| brdse device offset | Jumps a lines forward or back if a device is set. |
| breq a b offset | Jumps c lines forward or back if a equals b. |
| breqz a offset | Jumps b lines forward or back if a equals 0. |
| brge a b offset | Jumps c lines forward or back if a is greater than or equal to b. |
| brgez a offset | Jumps b lines forward or back if a is greater than or equal to 0. |
| brgt a b offset | Jumps c lines forward or back if a is greater than b. |
| brgtz a offset | Jumps b lines forward or back if a is greater than 0. |
| brle a b offset | Jumps c lines forward or back if a is less than or equal to b. |
| brlez a offset | Jumps b lines forward or back if a is less than or equal to 0. |
| brlt a b offset | Jumps c lines forward or back if a is less than b. |
| brltz a offset | Jumps b lines forward or back if a is less than 0. |
| brna a b c offset | Jumps d lines forward or back if a is not approximately equal to b. |
| brnan a offset | Jumps b lines forward or back if a is NaN (not a number). |
| brnaz a b offset | Jumps c lines forward or back if a is not 0. |
| brne a b offset | Jumps c lines forward or back if a does not equal b. |
| brnez a offset | Jumps b lines forward or back if a does not equal 0. |
| j line | Always jumps to a label - no condition. |
| jal line | Calls a subroutine and remembers the way back in ra. |
| jr offset | Always jumps a fixed number of lines forward or back. |
Devices
| Syntax | Meaning |
|---|---|
| l r? device logicType | Reads a value from a device into a register. |
| lr r? device reagentMode reagentHash | Reads how much of an ingredient (reagent) a device has or needs. |
| ls r? device slotIndex logicSlotType | Reads a value from a slot of a device. |
| rmap r? d? reagentHash | Finds the item a device accepts for a given ingredient (reagent). |
| s device logicType value | Writes a value from a register to a device. |
| ss device slotIndex logicSlotType value | Writes a value to the item sitting in a slot of a device. |
Batch
| Syntax | Meaning |
|---|---|
| lb r? deviceHash logicType batchMode | Reads a value from all devices of one type on the data network. |
| lbn r? deviceHash nameHash logicType batchMode | Reads a value from all devices of one type with a given name. |
| lbns r? deviceHash nameHash slotIndex logicSlotType batchMode | Reads a slot value from all devices of one type with a given name. |
| lbs r? deviceHash slotIndex logicSlotType batchMode | Reads a slot value from all devices of one type on the data network. |
| sb deviceHash logicType value | Writes a value to all devices of one type on the data network. |
| sbn deviceHash nameHash logicType value | Writes a value to all devices of one type with a given name. |
| sbs deviceHash slotIndex logicSlotType value | Writes a slot value to all devices of one type on the data network. |
Memory
| Syntax | Meaning |
|---|---|
| clr d? | Clears the whole memory (stack) of a device on a pin. |
| clrd id | Clears the memory (stack) of a device via its ReferenceId. |
| get r? device address | Reads a number from a device's memory, e.g. another chip. |
| peek r? | Reads the top number of the stack without removing it. |
| poke address value | Writes a number to a specific place in the stack. |
| pop r? | Takes the top number off the stack and puts it in a register. |
| push a | Puts a number on top of the stack. |
| put device address value | Writes a number into a device's memory, e.g. another chip. |
Bits
| Syntax | Meaning |
|---|---|
| and r? a b | Bitwise AND: only bits that are 1 in both a and b. |
| ext r? a b c | Extracts a bit field from a: starting at bit b, c bits long. |
| ins r? a b c | Inserts the lowest c bits of a into the register at bit b. |
| nor r? a b | Bitwise NOT-OR: bits that are 0 in both a and b. |
| not r? a | Bitwise NOT: flips every bit of a. |
| or r? a b | Bitwise OR: bits that are 1 in a or in b. |
| rol r? a b | Rotates the bits of a left by b places. |
| ror r? a b | Rotates the bits of a right by b places. |
| sla r? a b | Shifts the bits of a left by b places (same as sll). |
| sll r? a b | Shifts the bits of a left by b places. |
| sra r? a b | Shifts the bits of a right, keeping the sign. |
| srl r? a b | Shifts the bits of a right, filling in zeros on the left. |
| xor r? a b | Bitwise exclusive OR: bits that differ between a and b. |