Debugger launch
{
"version": "0.2.0",
"configurations": [
{
"type": "ic10",
"request": "launch",
"name": "Debug ic10",
"program": "${fileWorkspaceFolder}${pathSeparator}${fileBasenameNoExtension}.ic10",
"stopOnEntry": true,
"trace": false
}
]
}
counter left lines
new snippets
icX is a programming language translated to ic10 used to simplify the programming of ic10 microprocessors in the Stationeers game.
use loop
var on = d1.Open
d0.On = on
# Text after a # will be ignored to the end of the line
icX will automatically replace variable names with register names
---icX
var a = 10
---ic10
move r0 10
Using alias
---icX
use aliases
var a = 10
---ic10
alias a r0
move a 10
Using define
---icX
use constants
const PI = 3.14
---ic10
define PI 3.14
inc
---icX
var a = 0
a++
---ic10
move r0 0
add r0 r0 1
dec
---icX
var a = 0
a--
---ic10
move r0 0
sub r0 r0 1
Constants will be calculated automatically
---icX
var x = 5 + 5 * 2
---ic10
move r0 15
---icX
const x = 2 + 2
const y = x + 2
var z = y + 2
---ic10
move r0 8
Binary operations with variables
---icX
var k = 2
var y = 5
var x = y + y * k
---ic10
move r0 2
move r1 5
mul r15 r1 r0
add r2 r1 r15
add r2 r2 5
Binary logical operations used (<, >, ==, !=, <=, >=, &, |, ~=)
---icX
var a = 0
var b = 0
if a >= 0
b = 1
else
b = 0
end
---ic10
move r0 0
move r1 0
sgez r15 r0
beqz r15 if0else
beq r15 1 if0
if0:
move r1 1
j if0exit
if0else:
move r1 0
if0exit:
---icX
var a = 0
while a >= 10
a++
end
---ic10
move r0 0
while0:
sge r15 r0 10
beqz r15 while0exit
add r0 r0 1
j while0
while0exit:
---icX
d0.Setting = 1 # Set device param
var a = d0.Setting # Load device param into a register
var b = d0.slot(a).PrefabHash # Using a slot of the device
a = d(5438547545).Setting(Sum) # Batch load, where 5438547545 is hash of the device
d(5438547545).Setting = b # Batch configuration
---ic10
s d0 Setting 1
l r0 d0 Setting
ls r1 d0 r0 PrefabHash
lb r0 5438547545 Setting Sum
sb 5438547545 Setting r1
To write a function, use the function keyword
{function name}()
function {function name}
{code}
end
---icX
use loop
var a = 0
example()
var on = d1.Open
d0.On = on
function example
move a 1
end
---ic10
move r0 0
jal example
l r1 d1 Open
s d0 On r1
j 0
example:
move r0 1
j ra
To easily write in stack, use the stack keyword
---icX
stack 342423 432423 54534 6567
---ic10
push 342423
push 432423
push 54534
push 6567
For each stack
---icX
var YourVariabele = 0
foreach YourVariabele
if a == 6567
var b = 5
end
end
---ic10
move sp 0 # reset counter
while0:
peek r0 # get value to YourVariabele
#------- block code ---------
seq r15 r0 6567
beqz r15 if0exit
move r1 5
if0exit:
#------- block code ---------
breqz r0 2 # end of cycle
add sp sp 1 # increment counter
j while0
In addition to use aliases and use constant, the following constructs are supported:
To loop the application, use use loop
---icX
move r0 0
jal example
l r1 d1 Open
s d0 On r1
j 0
example:
move r0 1
j ra
---ic10
move r0 0
jal example
l r1 d1 Open
s d0 On r1
j 0
example:
move r0 1
j ra
Use use comments to transfer your comments to ic10 code
---icX
use comments
# Example
var a = 0
var on = d1.Open
# Example
d0.On = on
test()
function test
var c = 1
end
---ic10
# ---icX User code start---
# Example
move r0 0
l r1 d1 Open
# Example
s d0 On r1
jal test
# ---icX User code end---
jr 4
test:
move r2 1
j ra
alias SolarSensor d0
alias SolarPanel d1
alias LedVertical d2
alias LedHorizontal d3
var SOLAR_HASH = d1.PrefabHash
var verical = 180
var horizontal = 180
main:
updateLED()
setSolarPanels()
yield
j main
function setSolarPanels
d(SOLAR_HASH).Vertical = verical
d(SOLAR_HASH).Horizontal = horizontal
end
function updateLED
d2.Setting = verical
d3.Setting = horizontal
end