Actions

Editing IC10/instructions

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
<noinclude>
 
See [[IC10]] for the primary page for the IC10 instruction set. This page lists all available instructions
 
</noinclude>
 
 
 
== Utility ==
 
== Utility ==
  
{{ICInstruction|instruction=alias|description=Labels register or device reference with name, device references also affect what shows on the screws on the IC base.|syntax=alias str r?{{!}}d?
+
{{MipsInstruction|instruction=alias|description=Labels register or device reference with name, device references also affect what shows on the screws on the IC base.|syntax=alias str r?{{!}}d?
|example=
+
|example={{MIPSCode|
{{ICCode|
 
 
alias dAutoHydro1 d0
 
alias dAutoHydro1 d0
 
alias vTemperature r0
 
alias vTemperature r0
 +
}}
 +
}}
 +
{{MipsInstruction|instruction=define|description=Creates a label that will be replaced throughout the program with the provided value.|syntax=define str num
 +
|example={{MIPSCode|
 +
move r0 42 # Store 42 in register 0
 
}}}}
 
}}}}
{{ICInstruction|instruction=define|description=Creates a label that will be replaced throughout the program with the provided value.|syntax=define str num
+
{{MipsInstruction|instruction=hcf|description=Halt and catch fire.|syntax=hcf}}
|example=
+
{{MipsInstruction|instruction=sleep|description=Pauses execution on the IC for a seconds|syntax=sleep a(r?{{!}}num)}}
{{ICCode|
+
{{MipsInstruction|instruction=yield|description=Pauses execution for 1 tick|syntax=yield}}
define ultimateAnswer 42
 
move r0 ultimateAnswer # Store 42 in register 0
 
}}}}
 
{{ICInstruction|instruction=hcf|description=Halt and catch fire|syntax=hcf}}
 
{{ICInstruction|instruction=sleep|description=Pauses execution on the IC for a seconds|syntax=sleep a(r?{{!}}num)}}
 
{{ICInstruction|instruction=yield|description=Pauses execution for 1 tick|syntax=yield}}
 
  
 
== Mathematical ==
 
== Mathematical ==
  
{{ICInstruction|instruction=abs|description=Register = the absolute value of a|syntax=abs r? a(r?{{!}}num)
+
{{MipsInstruction|instruction=abs|description=Register = the absolute value of a|syntax=abs r? a(r?{{!}}num)
 
|example=
 
|example=
{{ICCode|
+
{{MIPSCode|
define negativeNumber -10
+
add r0 r0 1 # increment r0 by one
abs r0 negativeNumber # Compute the absolute value of -10 and store it in register 0
+
}}
}}}}
+
}}
{{ICInstruction|instruction=add|description=Register = a + b.|syntax=add r? a(r?{{!}}num) b(r?{{!}}num)
+
{{MipsInstruction|instruction=add|description=Register = a + b.|syntax=add r? a(r?{{!}}num) b(r?{{!}}num)}}
|example=
+
{{MipsInstruction|instruction=ceil|description=Register = smallest integer greater than a|syntax=ceil r? a(r?{{!}}num)}}
{{ICCode|add r0 r0 1 # increment r0 by one}}
+
{{MipsInstruction|instruction=div|description=Register = a / b|syntax=div r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICCode|
+
{{MipsInstruction|instruction=exp|description=Register = exp(a) or e^a|syntax=exp r? a(r?{{!}}num)}}
define num1 10
+
{{MipsInstruction|instruction=floor|description=Register = largest integer less than a|syntax=floor r? a(r?{{!}}num)}}
define num2 20
+
{{MipsInstruction|instruction=log|description=Register = base e log(a) or ln(a)|syntax=log r? a(r?{{!}}num)}}
add r0 num1 num2 # Add 10 and 20 and store the result in register 0
+
{{MipsInstruction|instruction=max|description=Register = max of a or b|syntax=max r? a(r?{{!}}num) b(r?{{!}}num)}}
}}}}
+
{{MipsInstruction|instruction=min|description=Register = min of a or b|syntax=min r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=ceil|description=Register = smallest integer greater than a|syntax=ceil r? a(r?{{!}}num)
+
{{MipsInstruction|instruction=mod|description=Register = a mod b (note: NOT a % b)|syntax=mod r? a(r?{{!}}num) b(r?{{!}}num)}}
|example=
+
{{MipsInstruction|instruction=move|description=Register = provided num or register value.|syntax=move r? a(r?{{!}}num)}}
{{ICCode|
+
{{MipsInstruction|instruction=mul|description=Register = a * b|syntax=mul r? a(r?{{!}}num) b(r?{{!}}num)}}
define floatNumber 10.3
+
{{MipsInstruction|instruction=rand|description=Register = a random value x with 0 <= x < 1|syntax=rand r?}}
ceil r0 floatNumber # Compute the ceiling of 10.3 and store it in register 0
+
{{MipsInstruction|instruction=round|description=Register = a rounded to nearest integer|syntax=round r? a(r?{{!}}num)}}
}}}}
+
{{MipsInstruction|instruction=sqrt|description=Register = square root of a|syntax=sqrt r? a(r?{{!}}num)}}
{{ICInstruction|instruction=div|description=Register = a / b|syntax=div r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=sub|description=Register = a - b.|syntax=sub r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=exp|description=exp(a) or e^a|syntax=exp r? a(r?{{!}}num)}}
+
{{MipsInstruction|instruction=trunc|description=Register = a with fractional part removed|syntax=trunc r? a(r?{{!}}num)}}
{{ICInstruction|instruction=floor|description=Register = largest integer less than a|syntax=floor r? a(r?{{!}}num)}}
 
{{ICInstruction|instruction=log|description=base e log(a) or ln(a)|syntax=log r? a(r?{{!}}num)}}
 
{{ICInstruction|instruction=max|description=Register = max of a or b|syntax=max r? a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=min|description=Register = min of a or b|syntax=min r? a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=mod|description=Register = a mod b (note: NOT a % b)|syntax=mod r? a(r?{{!}}num) b(r?{{!}}num)
 
|example=
 
{{ICCode|
 
mod r0 10 20
 
# Expected: r0 = 10
 
  
mod r1 22 20
+
=== Trigonometric ===
# Expected: r1 = 2
 
  
mod r2 22 -20
+
{{MipsInstruction|instruction=acos|description=Returns the angle (radians) whose cosine is the specified value|syntax=acos r? a(r?{{!}}num)}}
# Expected: r2 = 18
+
{{MipsInstruction|instruction=asin|description=Returns the angle (radians) whose sine is the specified value|syntax=asin r? a(r?{{!}}num)}}
 
+
{{MipsInstruction|instruction=atan|description=Returns the angle (radians) whose tan is the specified value|syntax=atan r? a(r?{{!}}num)}}
mod r2 22 -10
+
{{MipsInstruction|instruction=atan2|description=Returns the angle (radians) whose tangent is the quotient of two specified values: a (y) and b (x)|syntax=atan2 r? a(r?{{!}}num) b(r?{{!}}num)}}
# Expected: r2 = 18
+
{{MipsInstruction|instruction=cos|description=Returns the cosine of the specified angle (radians)|syntax=cos r? a(r?{{!}}num)}}
}}}}
+
{{MipsInstruction|instruction=sin|description=Returns the sine of the specified angle (radians)|syntax=sin r? a(r?{{!}}num)}}
{{ICInstruction|instruction=move|description=Register = provided num or register value.|syntax=move r? a(r?{{!}}num)
+
{{MipsInstruction|instruction=tan|description=Returns the tan of the specified angle (radians) |syntax=tan r? a(r?{{!}}num)}}
|example=
 
{{ICCode|move r0 42 # Store 42 in register 0}}}}
 
{{ICInstruction|instruction=mul|description=Register = a * b|syntax=mul r? a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=rand|description=Register = a random value x with 0 <= x < 1|syntax=rand r?}}
 
{{ICInstruction|instruction=round|description=Register = a rounded to nearest integer|syntax=round r? a(r?{{!}}num)}}
 
{{ICInstruction|instruction=sqrt|description=Register = square root of a|syntax=sqrt r? a(r?{{!}}num)}}
 
{{ICInstruction|instruction=sub|description=Register = a - b.|syntax=sub r? a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=trunc|description=Register = a with fractional part removed|syntax=trunc r? a(r?{{!}}num)}}
 
 
 
=== Mathematical / Trigonometric ===
 
 
 
{{ICInstruction|instruction=acos|description=Returns the angle (radians) whos cos is the specified value|syntax=acos r? a(r?{{!}}num)}}
 
{{ICInstruction|instruction=asin|description=Returns the angle (radians) whos sine is the specified value|syntax=asin r? a(r?{{!}}num)}}
 
{{ICInstruction|instruction=atan|description=Returns the angle (radians) whos tan is the specified value|syntax=atan r? a(r?{{!}}num)}}
 
{{ICInstruction|instruction=atan2|description=Returns the angle (radians) whose tangent is the quotient of two specified values: a (y) and b (x)|syntax=atan2 r? a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=cos|description=Returns the cosine of the specified angle (radians)|syntax=cos r? a(r?{{!}}num)}}
 
{{ICInstruction|instruction=sin|description=Returns the sine of the specified angle (radians)|syntax=sin r? a(r?{{!}}num)}}
 
{{ICInstruction|instruction=tan|description=Returns the tan of the specified angle (radians) |syntax=tan r? a(r?{{!}}num)}}
 
  
 
== Stack ==
 
== Stack ==
  
{{ICInstruction|instruction=clr|description=Clears the stack memory for the provided device.|syntax=clr d?}}
+
{{MipsInstruction|instruction=clr|description=Clears the stack memory for the provided device.|syntax=clr d?}}
{{ICInstruction|instruction=clrd|description=Seeks directly for the provided device id and clears the stack memory of that device|syntax=clrd id(r?{{!}}num)}}
+
{{MipsInstruction|instruction=get|description=Using the provided device, attempts to read the stack value at the provided address, and places it in the register.|syntax=get r? d? address(r?{{!}}num)}}
{{ICInstruction|instruction=get|description=Using the provided device, attempts to read the stack value at the provided address, and places it in the register.|syntax=get r? d? address(r?{{!}}num)}}
+
{{MipsInstruction|instruction=getd|description=Seeks directly for the provided device id, attempts to read the stack value at the provided address, and places it in the register.|syntax=getd r? id(r?{{!}}num) address(r?{{!}}num)}}
{{ICInstruction|instruction=getd|description=Seeks directly for the provided device id, attempts to read the stack value at the provided address, and places it in the register.|syntax=getd r? id(r?{{!}}num) address(r?{{!}}num)}}
+
{{MipsInstruction|instruction=peek|description=Register = the value at the top of the stack|syntax=peek r?}}
{{ICInstruction|instruction=peek|description=Register = the value at the top of the stack|syntax=peek r?}}
+
{{MipsInstruction|instruction=poke|description=Register = the value at the top of the stack|syntax=poke address(r?{{!}}num) value(r?{{!}}num)}}
{{ICInstruction|instruction=poke|description=Stores the provided value at the provided address in the stack.|syntax=poke address(r?{{!}}num) value(r?{{!}}num)}}
+
{{MipsInstruction|instruction=pop|description=Register = the value at the top of the stack and decrements sp|syntax=pop r?}}
{{ICInstruction|instruction=pop|description=Register = the value at the top of the stack and decrements sp|syntax=pop r?}}
+
{{MipsInstruction|instruction=push|description=Pushes the value of a to the stack at sp and increments sp|syntax=push a(r?{{!}}num)}}
{{ICInstruction|instruction=push|description=Pushes the value of a to the stack at sp and increments sp|syntax=push a(r?{{!}}num)}}
+
{{MipsInstruction|instruction=put|description=Using the provided device, attempt to write the provided value to the stack at the provided address.|syntax=put d? address(r?{{!}}num) value(r?{{!}}num)}}
{{ICInstruction|instruction=put|description=Using the provided device, attempts to write the provided value to the stack at the provided address.|syntax=put d? address(r?{{!}}num) value(r?{{!}}num)}}
+
{{MipsInstruction|instruction=putd|description=Seeks directly for the provided device id, attempts to write the provided value to the stack at the provided address.|syntax=putd id(r?{{!}}num) address(r?{{!}}num) value(r?{{!}}num)}}
{{ICInstruction|instruction=putd|description=Seeks directly for the provided device id, attempts to write the provided value to the stack at the provided address.|syntax=putd id(r?{{!}}num) address(r?{{!}}num) value(r?{{!}}num)}}
 
  
 
== Slot/Logic ==
 
== Slot/Logic ==
  
{{ICInstruction|instruction=l|description=Loads device LogicType to register by housing index value.|syntax=l r? d? logicType
+
{{MipsInstruction|instruction=l|description=Loads device LogicType to register by housing index value.|syntax=l r? d? logicType|example=
|example=
 
 
Read from the device on d0 into register 0
 
Read from the device on d0 into register 0
{{ICCode|l r0 d0 Setting}}
+
{{MIPSCode|l r0 d0 Setting}}
 
Read the pressure from a sensor
 
Read the pressure from a sensor
{{ICCode|l r1 d5 Pressure}}
+
{{MIPSCode|l r1 d5 Pressure}}
 
This also works with aliases. For example:
 
This also works with aliases. For example:
{{ICCode|
+
{{MIPSCode|
 
alias Sensor d0
 
alias Sensor d0
 
l r0 Sensor Temperature
 
l r0 Sensor Temperature
}}}}
+
}}
{{ICInstruction|instruction=ld|description=Loads device LogicType to register by direct ID reference.|syntax=ld r? id(r?{{!}}num) logicType}}
+
}}
{{ICInstruction|instruction=lr|description=Loads reagent of device's ReagentMode where a hash of the reagent type to check for. ReagentMode can be either Contents (0), Required (1), Recipe (2). Can use either the word, or the number.|syntax=lr r? d? reagentMode int}}
+
{{MipsInstruction|instruction=ld|description=Loads device LogicType to register by direct ID reference.|syntax=ld r? id(r?{{!}}num) logicType}}
{{ICInstruction|instruction=ls|description=Loads slot LogicSlotType on device to register.|syntax=ls r? d? slotIndex logicSlotType
+
{{MipsInstruction|instruction=lr|description=Loads reagent of device's ReagentMode where a hash of the reagent type to check for. ReagentMode can be either Contents (0), Required (1), Recipe (2). Can use either the word, or the number.|syntax=lr r? d? reagentMode int}}
 +
{{MipsInstruction|instruction=ls|description=Loads slot LogicSlotType on device to register.|syntax=ls r? d? slotIndex logicSlotType
 
|example=
 
|example=
 
Read from the second slot of device on d0, stores 1 in r0 if it's occupied, 0 otherwise.
 
Read from the second slot of device on d0, stores 1 in r0 if it's occupied, 0 otherwise.
{{ICCode|ls r0 d0 2 Occupied}}
+
{{MIPSCode|ls r0 d0 2 Occupied}}
 
And here is the code to read the charge of an AIMeE:
 
And here is the code to read the charge of an AIMeE:
{{ICCode|
+
{{MIPSCode|
 
alias robot d0
 
alias robot d0
 
alias charge r10
 
alias charge r10
ls charge robot 0 Charge
+
ls charge robot 0 Charge  
}}}}
+
}}
{{ICInstruction|instruction=s|description=Stores register value to LogicType on device by housing index value.|syntax=s d? logicType r?
+
}}
 +
{{MipsInstruction|instruction=s|description=Stores register value to LogicType on device by housing index value.|syntax=s d? logicType r?{{!}}num
 
|example=
 
|example=
{{ICCode|
+
{{MIPSCode|
 
s d0 Setting r0
 
s d0 Setting r0
}}}}
+
}}
{{ICInstruction|instruction=sd|description=Stores register value to LogicType on device by direct ID reference.|syntax=sd id(r?{{!}}num) logicType r?}}
+
}}
{{ICInstruction|instruction=ss|description=Stores register value to device stored in a slot LogicSlotType on device.|syntax=ss d? slotIndex logicSlotType r?}}
+
{{MipsInstruction|instruction=sd|description=Stores register value to LogicType on device by direct ID reference.|syntax=sd id(r?{{!}}num) logicType r?}}
{{ICInstruction|instruction=rmap|description=Given a reagent hash, store the corresponding prefab hash that the device expects to fulfill the reagent requirement. For example, on an autolathe, the hash for Iron will store the hash for ItemIronIngot.|syntax=rmap r? d? reagentHash(r?{{!}}num)}}
+
{{MipsInstruction|instruction=ss|description=Stores register value to device stored in a slot LogicSlotType on device.|syntax=ss d? slotIndex logicSlotType r?{{!}}num}}
  
=== Slot/Logic / Batched ===
+
=== Batched ===
  
{{ICInstruction|instruction=lb|description=Loads LogicType from all output network devices with provided type hash using the provide batch mode. Average (0), Sum (1), Minimum (2), Maximum (3). Can use either the word, or the number.|syntax=lb r? deviceHash logicType batchMode
+
{{MipsInstruction|instruction=lb|description=Loads LogicType from all output network devices with provided type hash using the provide batch mode. Average (0), Sum (1), Minimum (2), Maximum (3). Can use either the word, or the number.|syntax=lb r? deviceHash logicType batchMode}}
|example=
+
{{MipsInstruction|instruction=lbn|description=Loads LogicType from all output network devices with provided type and name hashes using the provide batch mode. Average (0), Sum (1), Minimum (2), Maximum (3). Can use either the word, or the number.|syntax=lbn r? deviceHash nameHash logicType batchMode}}
{{ICCode|lb r0 HASH("StructureWallLight") On Sum}}}}
+
{{MipsInstruction|instruction=lbns|description=Loads LogicSlotType from slotIndex from all output network devices with provided type and name hashes using the provide batch mode. Average (0), Sum (1), Minimum (2), Maximum (3). Can use either the word, or the number.|syntax=lbns r? deviceHash nameHash slotIndex logicSlotType batchMode}}
{{ICInstruction|instruction=lbn|description=Loads LogicType from all output network devices with provided type and name hashes using the provide batch mode. Average (0), Sum (1), Minimum (2), Maximum (3). Can use either the word, or the number.|syntax=lbn r? deviceHash nameHash logicType batchMode}}
+
{{MipsInstruction|instruction=lbs|description=Loads LogicSlotType from slotIndex from all output network devices with provided type hash using the provide batch mode. Average (0), Sum (1), Minimum (2), Maximum (3). Can use either the word, or the number.|syntax=lbs r? deviceHash slotIndex logicSlotType batchMode}}
{{ICInstruction|instruction=lbns|description=Loads LogicSlotType from slotIndex from all output network devices with provided type and name hashes using the provide batch mode. Average (0), Sum (1), Minimum (2), Maximum (3). Can use either the word, or the number.|syntax=lbns r? deviceHash nameHash slotIndex logicSlotType batchMode}}
+
{{MipsInstruction|instruction=sb|description=Stores register value to LogicType on all output network devices with provided type hash.|syntax=sb deviceHash logicType int}}
{{ICInstruction|instruction=lbs|description=Loads LogicSlotType from slotIndex from all output network devices with provided type hash using the provide batch mode. Average (0), Sum (1), Minimum (2), Maximum (3). Can use either the word, or the number.|syntax=lbs r? deviceHash slotIndex logicSlotType batchMode}}
+
{{MipsInstruction|instruction=sbn|description=Stores register value to LogicType on all output network devices with provided type hash and name.|syntax=sbn deviceHash nameHash logicType int}}
{{ICInstruction|instruction=sb|description=Stores register value to LogicType on all output network devices with provided type hash.|syntax=sb deviceHash logicType r?
+
{{MipsInstruction|instruction=sbs|description=Stores register value to LogicSlotType on all output network devices with provided type hash in the provided slot.|syntax=sbs deviceHash slotIndex logicSlotType int}}
|example=
 
{{ICCode|sb HASH("StructureWallLight") On 1}}}}
 
{{ICInstruction|instruction=sbn|description=Stores register value to LogicType on all output network devices with provided type hash and name.|syntax=sbn deviceHash nameHash logicType r?}}
 
{{ICInstruction|instruction=sbs|description=Stores register value to LogicSlotType on all output network devices with provided type hash in the provided slot.|syntax=sbs deviceHash slotIndex logicSlotType r?}}
 
  
 
== Bitwise ==
 
== Bitwise ==
  
{{ICInstruction|instruction=and|description=Performs a bitwise logical AND operation on the binary representation of two values. Each bit of the result is determined by evaluating the corresponding bits of the input values. If both bits are 1, the resulting bit is set to 1. Otherwise the resulting bit is set to 0.|syntax=and r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=and|description=Performs a bitwise logical AND operation on the binary representation of two values. Each bit of the result is determined by evaluating the corresponding bits of the input values. If both bits are 1, the resulting bit is set to 1. Otherwise the resulting bit is set to 0.|syntax=and r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=nor|description=Performs a bitwise logical NOR (NOT OR) operation on the binary representation of two values. Each bit of the result is determined by evaluating the corresponding bits of the input values. If both bits are 0, the resulting bit is set to 1. Otherwise, if at least one bit is 1, the resulting bit is set to 0.|syntax=nor r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=nor|description=Performs a bitwise logical NOR (NOT OR) operation on the binary representation of two values. Each bit of the result is determined by evaluating the corresponding bits of the input values. If both bits are 0, the resulting bit is set to 1. Otherwise, if at least one bit is 1, the resulting bit is set to 0.|syntax=nor r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=not|description=Performs a bitwise logical NOT operation flipping each bit of the input value, resulting in a binary complement. If a bit is 1, it becomes 0, and if a bit is 0, it becomes 1.|syntax=not r? a(r?{{!}}num)
+
{{MipsInstruction|instruction=not|description=Performs a bitwise logical NOT operation flipping each bit of the input value, resulting in a binary complement. If a bit is 1, it becomes 0, and if a bit is 0, it becomes 1.|syntax=not r? a(r?{{!}}num)}}
|note=
+
{{MipsInstruction|instruction=or|description=Performs a bitwise logical OR operation on the binary representation of two values. Each bit of the result is determined by evaluating the corresponding bits of the input values. If either bit is 1, the resulting bit is set to 1. If both bits are 0, the resulting bit is set to 0.|syntax=or r? a(r?{{!}}num) b(r?{{!}}num)}}
This is a bitwise operation, the NOT of 1 => -2, etc. You may want to use seqz instead}}
+
{{MipsInstruction|instruction=sla|description=Performs a bitwise arithmetic left shift operation on the binary representation of a value. It shifts the bits to the left and fills the vacated rightmost bits with a copy of the sign bit (the most significant bit).|syntax=sla r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=or|description=Performs a bitwise logical OR operation on the binary representation of two values. Each bit of the result is determined by evaluating the corresponding bits of the input values. If either bit is 1, the resulting bit is set to 1. If both bits are 0, the resulting bit is set to 0.|syntax=or r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=sll|description=Performs a bitwise logical left shift operation on the binary representation of a value. It shifts the bits to the left and fills the vacated rightmost bits with zeros.|syntax=sll r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=sla|description=Performs a bitwise arithmetic left shift operation on the binary representation of a value. It shifts the bits to the left and fills the vacated rightmost bits with a copy of the sign bit (the most significant bit).|syntax=sla r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=sra|description=Performs a bitwise arithmetic right shift operation on the binary representation of a value. It shifts the bits to the right and fills the vacated leftmost bits with a copy of the sign bit (the most significant bit).|syntax=sra r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=sll|description=Performs a bitwise logical left shift operation on the binary representation of a value. It shifts the bits to the left and fills the vacated rightmost bits with zeros.|syntax=sll r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=srl|description=Performs a bitwise logical right shift operation on the binary representation of a value. It shifts the bits to the right and fills the vacated leftmost bits with zeros|syntax=srl r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=sra|description=Performs a bitwise arithmetic right shift operation on the binary representation of a value. It shifts the bits to the right and fills the vacated leftmost bits with a copy of the sign bit (the most significant bit).|syntax=sra r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=xor|description=Performs a bitwise logical XOR (exclusive OR) operation on the binary representation of two values. Each bit of the result is determined by evaluating the corresponding bits of the input values. If the bits are different (one bit is 0 and the other is 1), the resulting bit is set to 1. If the bits are the same (both 0 or both 1), the resulting bit is set to 0.|syntax=xor r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=srl|description=Performs a bitwise logical right shift operation on the binary representation of a value. It shifts the bits to the right and fills the vacated leftmost bits with zeros|syntax=srl r? a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=xor|description=Performs a bitwise logical XOR (exclusive OR) operation on the binary representation of two values. Each bit of the result is determined by evaluating the corresponding bits of the input values. If the bits are different (one bit is 0 and the other is 1), the resulting bit is set to 1. If the bits are the same (both 0 or both 1), the resulting bit is set to 0.|syntax=xor r? a(r?{{!}}num) b(r?{{!}}num)}}
 
  
 
== Comparison ==
 
== Comparison ==
  
{{ICInstruction|instruction=select|description=Register = b if a is non-zero, otherwise c|syntax=select r? a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)
+
{{MipsInstruction|instruction=select|description=Register = b if a is non-zero, otherwise c|syntax=select r? a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
|example=
 
{{ICCode|
 
select r1 r0 10 100
 
}}
 
|note=
 
This operation can be used as a simple ternary condition}}
 
  
=== Comparison / Device Pin ===
+
=== Compare Device Pin ===
  
{{ICInstruction|instruction=sdns|description=Register = 1 if device is not set, otherwise 0|syntax=sdns r? d?}}
+
{{MipsInstruction|instruction=sdns|description=Register = 1 if device is not set, otherwise 0|syntax=sdns r? d?}}
{{ICInstruction|instruction=sdse|description=Register = 1 if device is set, otherwise 0.|syntax=sdse r? d?}}
+
{{MipsInstruction|instruction=sdse|description=Register = 1 if device is set, otherwise 0.|syntax=sdse r? d?}}
  
=== Comparison / Value ===
+
=== Compare Value ===
  
{{ICInstruction|instruction=sap|description=Register = 1 if abs(a - b) <= max(c * max(abs(a), abs(b)), float.epsilon * 8), otherwise 0|syntax=sap r? a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
+
{{MipsInstruction|instruction=sap|description=Register = 1 if abs(a - b) <= max(c * max(abs(a), abs(b)), float.epsilon * 8), otherwise 0|syntax=sap r? a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=sapz|description=Register = 1 if abs(a) <= max(b * abs(a), float.epsilon * 8), otherwise 0|syntax=sapz r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=sapz|description=Register = 1 if abs(a) <= max(b * abs(a), float.epsilon * 8), otherwise 0|syntax=sapz r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=seq|description=Register = 1 if a == b, otherwise 0|syntax=seq r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=seq|description=Register = 1 if a = b, otherwise 0|syntax=seq r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=seqz|description=Register = 1 if a == 0, otherwise 0|syntax=seqz r? a(r?{{!}}num)}}
+
{{MipsInstruction|instruction=seqz|description=Register = 1 if a = 0, otherwise 0|syntax=seqz r? a(r?{{!}}num)}}
{{ICInstruction|instruction=sge|description=Register = 1 if a >= b, otherwise 0|syntax=sge r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=sge|description=Register = 1 if a >= b, otherwise 0|syntax=sge r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=sgez|description=Register = 1 if a >= 0, otherwise 0|syntax=sgez r? a(r?{{!}}num)}}
+
{{MipsInstruction|instruction=sgez|description=Register = 1 if a >= 0, otherwise 0|syntax=sgez r? a(r?{{!}}num)}}
{{ICInstruction|instruction=sgt|description=Register = 1 if a > b, otherwise 0|syntax=sgt r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=sgt|description=Register = 1 if a > b, otherwise 0|syntax=sgt r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=sgtz|description=Register = 1 if a > 0, otherwise 0|syntax=sgtz r? a(r?{{!}}num)}}
+
{{MipsInstruction|instruction=sgtz|description=Register = 1 if a > 0, otherwise 0|syntax=sgtz r? a(r?{{!}}num)}}
{{ICInstruction|instruction=sle|description=Register = 1 if a <= b, otherwise 0|syntax=sle r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=sle|description=Register = 1 if a <= b, otherwise 0|syntax=sle r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=slez|description=Register = 1 if a <= 0, otherwise 0|syntax=slez r? a(r?{{!}}num)}}
+
{{MipsInstruction|instruction=slez|description=Register = 1 if a <= 0, otherwise 0|syntax=slez r? a(r?{{!}}num)}}
{{ICInstruction|instruction=slt|description=Register = 1 if a < b, otherwise 0|syntax=slt r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=slt|description=Register = 1 if a < b, otherwise 0|syntax=slt r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=sltz|description=Register = 1 if a < 0, otherwise 0|syntax=sltz r? a(r?{{!}}num)}}
+
{{MipsInstruction|instruction=sltz|description=Register = 1 if a < 0, otherwise 0|syntax=sltz r? a(r?{{!}}num)}}
{{ICInstruction|instruction=sna|description=Register = 1 if abs(a - b) > max(c * max(abs(a), abs(b)), float.epsilon * 8), otherwise 0|syntax=sna r? a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
+
{{MipsInstruction|instruction=sna|description=Register = 1 if abs(a - b) > max(c * max(abs(a), abs(b)), float.epsilon * 8), otherwise 0|syntax=sna r? a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=snan|description=Register = 1 if a is NaN, otherwise 0|syntax=snan r? a(r?{{!}}num)}}
+
{{MipsInstruction|instruction=snan|description=Register = 1 if a is NaN, otherwise 0|syntax=snan r? a(r?{{!}}num)}}
{{ICInstruction|instruction=snanz|description=Register = 0 if a is NaN, otherwise 1|syntax=snanz r? a(r?{{!}}num)}}
+
{{MipsInstruction|instruction=snanz|description=Register = 0 if a is NaN, otherwise 1|syntax=snanz r? a(r?{{!}}num)}}
{{ICInstruction|instruction=snaz|description=Register = 1 if abs(a) > max(b * abs(a), float.epsilon), otherwise 0|syntax=snaz r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=snaz|description=Register = 1 if abs(a) > max(b * abs(a), float.epsilon), otherwise 0|syntax=snaz r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=sne|description=Register = 1 if a != b, otherwise 0|syntax=sne r? a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=sne|description=Register = 1 if a != b, otherwise 0|syntax=sne r? a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=snez|description=Register = 1 if a != 0, otherwise 0|syntax=snez r? a(r?{{!}}num)}}
+
{{MipsInstruction|instruction=snez|description=Register = 1 if a != 0, otherwise 0|syntax=snez r? a(r?{{!}}num)}}
  
 
== Branching ==
 
== Branching ==
  
{{ICInstruction|instruction=j|description=Jump execution to line a|syntax=j int
+
{{MipsInstruction|instruction=j|description=Jump execution to line a|syntax=j int}}
|example=
+
{{MipsInstruction|instruction=jal|description=Jump execution to line a and store next line number in ra|syntax=jal int}}
{{ICCode|j 0 # jump line 0}}
+
{{MipsInstruction|instruction=jr|description=Relative jump to line a|syntax=jr int}}
{{ICCode|
 
j label # jump to a label
 
 
 
label:
 
# your code here
 
}}}}
 
{{ICInstruction|instruction=jal|description=Jump execution to line a and store next line number in ra|syntax=jal int
 
|example=
 
jal provides a way to do function calls in IC10 mips
 
 
 
{{ICCode|
 
move r0 1000
 
move r1 0
 
start:
 
jal average
 
s db Setting r0
 
yield
 
j start
 
 
 
average:
 
add r0 r0 r1
 
div r0 r0 2
 
j ra # jump back
 
}}}}
 
{{ICInstruction|instruction=jr|description=Relative jump to line a|syntax=jr int}}
 
  
=== Branching / Device Pin ===
+
=== Branch Device Pin ===
  
{{ICInstruction|instruction=bdns|description=Branch to line a if device d isn't set|syntax=bdns d? a(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bdns|description=Branch to line a if device d isn't set|syntax=bdns d? a(r?{{!}}num)}}
{{ICInstruction|instruction=bdnsal|description=Jump execution to line a and store next line number if device is not set|syntax=bdnsal d? a(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bdnsal|description=Jump execution to line a and store next line number if device is not set|syntax=bdnsal d? a(r?{{!}}num)}}
{{ICInstruction|instruction=bdse|description=Branch to line a if device d is set|syntax=bdse d? a(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bdse|description=Branch to line a if device d is set|syntax=bdse d? a(r?{{!}}num)}}
{{ICInstruction|instruction=bdseal|description=Jump execution to line a and store next line number if device is set|syntax=bdseal d? a(r?{{!}}num)
+
{{MipsInstruction|instruction=bdseal|description=Jump execution to line a and store next line number if device is set|syntax=bdseal d? a(r?{{!}}num)
 
|example=
 
|example=
{{ICCode|
+
{{MIPSCode|
#Store line number and jump to line 32 if d0 is assigned.
+
bdseal d0 32 #Store line number and jump to line 32 if d0 is assigned.
bdseal d0 32
+
}}
 +
{{MIPSCode|
 +
bdseal d0 HarvestCrop #Store line in ra and jump to label HarvestCrop if device d0 is assigned.
 +
}}
 
}}
 
}}
{{ICCode|
+
{{MipsInstruction|instruction=brdns|description=Relative jump to line a if device is not set|syntax=brdns d? a(r?{{!}}num)}}
#Store line in ra and jump to label HarvestCrop if device d0 is assigned.
+
{{MipsInstruction|instruction=brdse|description=Relative jump to line a if device is set|syntax=brdse d? a(r?{{!}}num)}}
bdseal d0 HarvestCrop
 
}}}}
 
{{ICInstruction|instruction=brdns|description=Relative jump to line a if device is not set|syntax=brdns d? a(r?{{!}}num)}}
 
{{ICInstruction|instruction=brdse|description=Relative jump to line a if device is set|syntax=brdse d? a(r?{{!}}num)}}
 
  
=== Branching / Comparison ===
+
=== Branching Comparison ===
  
{{ICInstruction|instruction=bap|description=Branch to line d if abs(a - b) <= max(c * max(abs(a), abs(b)), float.epsilon * 8)|syntax=bap a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num) d(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bap|description=Branch to line d if abs(a - b) <= max(c * max(abs(a), abs(b)), float.epsilon * 8)|syntax=bap a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num) d(r?{{!}}num)}}
{{ICInstruction|instruction=brap|description=Relative branch to line d if abs(a - b) <= max(c * max(abs(a), abs(b)), float.epsilon * 8)|syntax=brap a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num) d(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bapal|description=Branch to line d if abs(a - b) <= max(c * max(abs(a), abs(b)), float.epsilon * 8) and store next line number in ra|syntax=bapal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num) d(r?{{!}}num)}}
{{ICInstruction|instruction=bapal|description=Branch to line c if a != b and store next line number in ra|syntax=bapal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num) d(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bapz|description=Branch to line c if abs(a) <= max(b * abs(a), float.epsilon * 8)|syntax=bapz a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=bapz|description=Branch to line c if abs(a) <= max(b * abs(a), float.epsilon * 8)|syntax=bapz a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bapzal|description=Branch to line c if abs(a) <= max(b * abs(a), float.epsilon * 8) and store next line number in ra|syntax=bapzal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=brapz|description=Relative branch to line c if abs(a) <= max(b * abs(a), float.epsilon * 8)|syntax=brapz a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
+
{{MipsInstruction|instruction=beq|description=Branch to line c if a = b|syntax=beq a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=bapzal|description=Branch to line c if abs(a) <= max(b * abs(a), float.epsilon * 8) and store next line number in ra|syntax=bapzal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
+
{{MipsInstruction|instruction=beqal|description=Branch to line c if a = b and store next line number in ra|syntax=beqal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=beq|description=Branch to line c if a == b|syntax=beq a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
+
{{MipsInstruction|instruction=beqz|description=Branch to line b if a = 0|syntax=beqz a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=breq|description=Relative branch to line c if a == b|syntax=breq a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
+
{{MipsInstruction|instruction=beqzal|description=Branch to line b if a = 0 and store next line number in ra|syntax=beqzal a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=beqal|description=Branch to line c if a == b and store next line number in ra|syntax=beqal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bge|description=Branch to line c if a >= b|syntax=bge a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=beqz|description=Branch to line b if a == 0|syntax=beqz a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bgeal|description=Branch to line c if a >= b and store next line number in ra|syntax=bgeal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=breqz|description=Relative branch to line b if a == 0|syntax=breqz a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bgez|description=Branch to line b if a >= 0|syntax=bgez a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=beqzal|description=Branch to line b if a == 0 and store next line number in ra|syntax=beqzal a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bgezal|description=Branch to line b if a >= 0 and store next line number in ra|syntax=bgezal a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=bge|description=Branch to line c if a >= b|syntax=bge a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bgt|description=Branch to line c if a > b|syntax=bgt a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=brge|description=Relative jump to line c if a >= b|syntax=brge a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bgtal|description=Branch to line c if a > b and store next line number in ra|syntax=bgtal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=bgeal|description=Branch to line c if a >= b and store next line number in ra|syntax=bgeal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bgtz|description=Branch to line b if a > 0|syntax=bgtz a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=bgez|description=Branch to line b if a >= 0|syntax=bgez a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bgtzal|description=Branch to line b if a > 0 and store next line number in ra|syntax=bgtzal a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=brgez|description=Relative branch to line b if a >= 0|syntax=brgez a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=ble|description=Branch to line c if a <= b|syntax=ble a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=bgezal|description=Branch to line b if a >= 0 and store next line number in ra|syntax=bgezal a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=bleal|description=Branch to line c if a <= b and store next line number in ra|syntax=bleal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=bgt|description=Branch to line c if a > b|syntax=bgt a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)
+
{{MipsInstruction|instruction=blez|description=Branch to line b if a <= 0|syntax=blez a(r?{{!}}num) b(r?{{!}}num)}}
|example=
+
{{MipsInstruction|instruction=blezal|description=Branch to line b if a <= 0 and store next line number in ra|syntax=blezal a(r?{{!}}num) b(r?{{!}}num)}}
An example of a '''Schmitt''' trigger, turning on a device if the temperature is too low, and turning it off if it's too high and finally
+
{{MipsInstruction|instruction=blt|description=Branch to line c if a < b|syntax=blt a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
doing nothing if the temperature is within the desired range.
+
{{MipsInstruction|instruction=bltal|description=Branch to line c if a < b and store next line number in ra|syntax=bltal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICCode|
+
{{MipsInstruction|instruction=bltz|description=Branch to line b if a < 0|syntax=bltz a(r?{{!}}num) b(r?{{!}}num)}}
alias sensor d0
+
{{MipsInstruction|instruction=bltzal|description=Branch to line b if a < 0 and store next line number in ra|syntax=bltzal a(r?{{!}}num) b(r?{{!}}num)}}
alias device d1
+
{{MipsInstruction|instruction=bna|description=Branch to line d if abs(a - b) > max(c * max(abs(a), abs(b)), float.epsilon * 8)|syntax=bna a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num) d(r?{{!}}num)}}
 
+
{{MipsInstruction|instruction=bnaal|description=Branch to line d if abs(a - b) <= max(c * max(abs(a), abs(b)), float.epsilon * 8) and store next line number in ra|syntax=bnaal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num) d(r?{{!}}num)}}
define mintemp 293.15
+
{{MipsInstruction|instruction=bnan|description=Branch to line b if a is not a number (NaN)|syntax=bnan a(r?{{!}}num) b(r?{{!}}num)}}
define maxtemp 298.15
+
{{MipsInstruction|instruction=bnaz|description=Branch to line c if abs(a) > max (b * abs(a), float.epsilon * 8)|syntax=bnaz a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
 
+
{{MipsInstruction|instruction=bnazal|description=Branch to line c if abs(a) > max (b * abs(a), float.epsilon * 8) and store next line number in ra|syntax=bnazal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
start:
+
{{MipsInstruction|instruction=bne|description=Branch to line c if a != b|syntax=bne a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
yield
+
{{MipsInstruction|instruction=bneal|description=Branch to line c if a != b and store next line number in ra|syntax=bneal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
l r0 sensor Temperature
+
{{MipsInstruction|instruction=bnez|description=branch to line b if a != 0|syntax=bnez a(r?{{!}}num) b(r?{{!}}num)}}
# If the temperature < mintemp, turn on the device
+
{{MipsInstruction|instruction=bnezal|description=Branch to line b if a != 0 and store next line number in ra|syntax=bnezal a(r?{{!}}num) b(r?{{!}}num)}}
blt r0 mintemp turnOn
+
{{MipsInstruction|instruction=brap|description=Relative branch to line d if abs(a - b) <= max(c * max(abs(a), abs(b)), float.epsilon * 8)|syntax=brap a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num) d(r?{{!}}num)}}
# If the temperature > maxtemp, turn off the device
+
{{MipsInstruction|instruction=brapz|description=Relative branch to line c if abs(a) <= max(b * abs(a), float.epsilon * 8)|syntax=brapz a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
bgt r0 maxtemp turnOff
+
{{MipsInstruction|instruction=breq|description=Relative branch to line c if a = b|syntax=breq a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
j start
+
{{MipsInstruction|instruction=breqz|description=Relative branch to line b if a = 0|syntax=breqz a(r?{{!}}num) b(r?{{!}}num)}}
 
+
{{MipsInstruction|instruction=brge|description=Relative jump to line c if a >= b|syntax=brge a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
turnOn:
+
{{MipsInstruction|instruction=brgez|description=Relative branch to line b if a >= 0|syntax=brgez a(r?{{!}}num) b(r?{{!}}num)}}
s device On 1
+
{{MipsInstruction|instruction=brgt|description=relative jump to line c if a > b|syntax=brgt a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
j start
+
{{MipsInstruction|instruction=brgtz|description=Relative branch to line b if a > 0|syntax=brgtz a(r?{{!}}num) b(r?{{!}}num)}}
turnOff:
+
{{MipsInstruction|instruction=brle|description=Relative jump to line c if a <= b|syntax=brle a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
s device On 0
+
{{MipsInstruction|instruction=brlez|description=Relative branch to line b if a <= 0|syntax=brlez a(r?{{!}}num) b(r?{{!}}num)}}
j start
+
{{MipsInstruction|instruction=brlt|description=Relative jump to line c if a < b|syntax=brlt a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
}}}}
+
{{MipsInstruction|instruction=brltz|description=Relative branch to line b if a < 0|syntax=brltz a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=brgt|description=relative jump to line c if a > b|syntax=brgt a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
+
{{MipsInstruction|instruction=brna|description=Relative branch to line d if abs(a - b) > max(c * max(abs(a), abs(b)), float.epsilon * 8)|syntax=brna a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num) d(r?{{!}}num)}}
{{ICInstruction|instruction=bgtal|description=Branch to line c if a > b and store next line number in ra|syntax=bgtal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
+
{{MipsInstruction|instruction=brnan|description=Relative branch to line b if a is not a number (NaN)|syntax=brnan a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=bgtz|description=Branch to line b if a > 0|syntax=bgtz a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=brnaz|description=Relative branch to line c if abs(a) > max(b * abs(a), float.epsilon * 8)|syntax=brnaz a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=brgtz|description=Relative branch to line b if a > 0|syntax=brgtz a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=brne|description=Relative branch to line c if a != b|syntax=brne a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
{{ICInstruction|instruction=bgtzal|description=Branch to line b if a > 0 and store next line number in ra|syntax=bgtzal a(r?{{!}}num) b(r?{{!}}num)}}
+
{{MipsInstruction|instruction=brnez|description=Relative branch to line b if a != 0|syntax=brnez a(r?{{!}}num) b(r?{{!}}num)}}
{{ICInstruction|instruction=ble|description=Branch to line c if a <= b|syntax=ble a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
 
{{ICInstruction|instruction=brle|description=Relative jump to line c if a <= b|syntax=brle a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
 
{{ICInstruction|instruction=bleal|description=Branch to line c if a <= b and store next line number in ra|syntax=bleal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
 
{{ICInstruction|instruction=blez|description=Branch to line b if a <= 0|syntax=blez a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=brlez|description=Relative branch to line b if a <= 0|syntax=brlez a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=blezal|description=Branch to line b if a <= 0 and store next line number in ra|syntax=blezal a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=blt|description=Branch to line c if a < b|syntax=blt a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)
 
|example=
 
An example of a '''Schmitt''' trigger, turning on a device if the temperature is too low, and turning it off if it's too high and finally
 
doing nothing if the temperature is within the desired range.
 
{{ICCode|
 
alias sensor d0
 
alias device d1
 
 
 
define mintemp 293.15
 
define maxtemp 298.15
 
 
 
start:
 
yield
 
l r0 sensor Temperature
 
# If the temperature < mintemp, turn on the device
 
blt r0 mintemp turnOn
 
# If the temperature > maxtemp, turn off the device
 
bgt r0 maxtemp turnOff
 
j start
 
 
 
turnOn:
 
s device On 1
 
j start
 
turnOff:
 
s device On 0
 
j start
 
}}}}
 
{{ICInstruction|instruction=brlt|description=Relative jump to line c if a < b|syntax=brlt a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
 
{{ICInstruction|instruction=bltal|description=Branch to line c if a < b and store next line number in ra|syntax=bltal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
 
{{ICInstruction|instruction=bltz|description=Branch to line b if a < 0|syntax=bltz a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=brltz|description=Relative branch to line b if a < 0|syntax=brltz a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=bltzal|description=Branch to line b if a < 0 and store next line number in ra|syntax=bltzal a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=bna|description=Branch to line d if abs(a - b) > max(c * max(abs(a), abs(b)), float.epsilon * 8)|syntax=bna a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num) d(r?{{!}}num)}}
 
{{ICInstruction|instruction=brna|description=Relative branch to line d if abs(a - b) > max(c * max(abs(a), abs(b)), float.epsilon * 8)|syntax=brna a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num) d(r?{{!}}num)}}
 
{{ICInstruction|instruction=bnaal|description=Branch to line d if abs(a - b) <= max(c * max(abs(a), abs(b)), float.epsilon * 8) and store next line number in ra|syntax=bnaal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num) d(r?{{!}}num)}}
 
{{ICInstruction|instruction=bnan|description=Branch to line b if a is not a number (NaN)|syntax=bnan a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=brnan|description=Relative branch to line b if a is not a number (NaN)|syntax=brnan a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=bnaz|description=Branch to line c if abs(a) > max (b * abs(a), float.epsilon * 8)|syntax=bnaz a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
 
{{ICInstruction|instruction=brnaz|description=Relative branch to line c if abs(a) > max(b * abs(a), float.epsilon * 8)|syntax=brnaz a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
 
{{ICInstruction|instruction=bnazal|description=Branch to line c if abs(a) > max (b * abs(a), float.epsilon * 8) and store next line number in ra|syntax=bnazal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
 
{{ICInstruction|instruction=bne|description=Branch to line c if a != b|syntax=bne a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
 
{{ICInstruction|instruction=brne|description=Relative branch to line c if a != b|syntax=brne a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
 
{{ICInstruction|instruction=bneal|description=Branch to line c if a != b and store next line number in ra|syntax=bneal a(r?{{!}}num) b(r?{{!}}num) c(r?{{!}}num)}}
 
{{ICInstruction|instruction=bnez|description=branch to line b if a != 0|syntax=bnez a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=brnez|description=Relative branch to line b if a != 0|syntax=brnez a(r?{{!}}num) b(r?{{!}}num)}}
 
{{ICInstruction|instruction=bnezal|description=Branch to line b if a != 0 and store next line number in ra|syntax=bnezal a(r?{{!}}num) b(r?{{!}}num)}}
 

Please note that all contributions to Unofficial Stationeers Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Unofficial Stationeers Wiki:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)

Templates used on this page: