We are currently experiencing issues with email delivery; this is being resolved as quickly as possible.

stationeers.de Mod workshop · Dominik1199
DE Sign in
  1. Home
  2. IC10 academy
  3. Registers and numbers

Chapter 1 · First steps

Registers and numbers

The chip’s 16 storage slots and every way to write a number.

Lesson 2 of 18 7 min

The chip has no “declare a variable”. Instead there are registers: fixed storage slots that hold one number each.

The register bank

RegisterPurpose
r0 … r15free for your values
sp (= r16)stack pointer, see the stack lesson
ra (= r17)return address for subroutines

When the chip is inserted, every register is 0. A register keeps its value until you write something new into it.

Writing numbers

All IC10 values are decimal numbers. There is no separate true and false – those are simply 1 and 0.

NotationExampleValue
Decimal42, -7, 293.15as written
Hexadecimal$1F31
Binary%101010
Constantpi3.14159…
Warning

The decimal separator is the dot: 293.15. A comma is read as a thousands separator – 1,5 becomes 15.

Warning

The chip does not understand exponent notation like 1e5. Write 100000.

An example

move r0 101.325   # standard pressure in kPa
move r1 $FF       # 255
move r2 %1111     # 15
move r3 -12.5

Underscores are allowed in hex and binary numbers and make long numbers easier to read: %1010_0101.

Diagram

The register bank of the chip r0 42 r1 31 r2 10 r3 -2.5 r4 0 r5 0 r6 0 r7 0 r8 0 r9 0 r10 0 r11 0 r12 0 r13 0 r14 0 r15 0 sp = r16 ra = r17 16 free registers, one number each sp: stack pointer · ra: return address
The register bank: r0 to r15 are free to use, sp and ra have special jobs. Each register holds exactly one decimal number.

Exercise

Task

Fill four registers:

  • r0 = 15
  • r1 = 31, but written in hexadecimal
  • r2 = 10, but written in binary
  • r3 = −2.5

Hints

Hint 1

Hex numbers start with $, binary numbers with %.

Hint 2

31 is 1F in hex, 10 is 1010 in binary.

Hint 3

For −2.5 use the dot: -2.5.

Esc
↑ ↓ selectEnter open/ opens search anywhere