stationeers.de Mod workshop · Dominik1199
DE Sign in
  1. Home
  2. IC10 academy
  3. Day 123

Day 123 of 365 · Advanced · Month 5: Memory and structure

Memory of other devices: get, put, clr, clrd

get and put also read and write the stack of other devices, clr and clrd clear it. Which devices have memory at all is listed in the game data.

Lesson 15 min Week 18

What you learn today

  • Read and write another chip's stack
  • Clear memory
  • clrd with an ID

A chip has 512 slots in its stack. If it needs more, or if two chips should share a big table, it reads and writes the stack of another chip.

get and put with another device

Instead of db you put in the other device: a pin, a register with a ReferenceId or a define with the number.

get value d0 5         # read address 5 in the chip on d0
put d0 5 value         # write address 5 in the chip on d0
get value id 5         # the same via a ReferenceId

With an IC housing you end up in the stack of the chip sitting inside it. The order with put is always device, address, value.

Which devices have memory

According to the game data only certain devices have memory:

Deviceslotsreadwrite
IC housing (chip inside)512yesyes
Logic Sorter32yesyes
Autolathe and other fabricators64yesyes
Satellite dish (medium)32yesyes
Suit storage24yesno
Occupancy sensor18yesno

The logic memory has no stack, only its Setting. If you write into a memory that is read-only, the chip reports MemoryNotWriteable.

Clearing memory: clr and clrd

clr d0             # set the whole stack of the device on d0 to 0
clrd id            # the same via a ReferenceId

clr takes a pin, clrd a ReferenceId. Both set all slots to 0. They do not change the other chip's sp.

Warning

Someone else's memory belongs to the other chip. If you write into addresses it uses itself, you destroy its data. Agree on which addresses belong to whom, like with the mailboxes from day 115. And clr clears everything without asking.

Tip

Check the device with bdns beforehand. If it is missing, get stops with an error.

Diagram

The stack with its pointer slot 0 10 slot 1 20 slot 2 30 slot 3 slot 4 sp = 3 next free slot push 40 pop r0 r0 = 30 last in, first out
Instead of db there is a pin or a ReferenceId: then get and put access the memory of the other device.

Exercise

Task

A second IC housing sits on d0. Your chip keeps a counter in its stack.

  • Every tick: read address 0 of the neighbouring chip, add 1, write it back. The value sits in r0.
  • A press on the button “Loeschen” (edge) clears the whole memory of the neighbouring chip with clrd via its ReferenceId and sets r0 to 0.
  • If the neighbouring chip is missing, nothing happens – without an error.

Hints

Hint 1

First bdns store start – without the neighbouring chip back to the yield.

Hint 2

Counter: get, add, put store ADDRESS count.

Hint 3

Clearing: check the edge, then l id store ReferenceId and clrd id.

Quiz

4 questions. You pass from 60 % – the server does the grading.

Complete the day

  • Passed the simulator exercise
  • Passed the quiz with at least 60 %

Without an account progress is saved in this browser only.

Report a mistake in this lesson

Please sign in to report. Sign in

Esc
↑ ↓ selectEnter open/ opens search anywhere