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

Day 358 of 365 · Expert · Month 12: Masterpieces

Recap: bits and data

Recap bits and data: and, or, xor, not, shifts, rotations, ext and ins once more at a glance – and a status word that ends up as plain text on the display.

Lesson 20 min Week 52

What you learn today

  • Repeat bitwise operations
  • Combine packing and text
  • Spot gaps

The last week of the year looks back. Three recaps sum up the expert level, each with an exercise that combines two topics. Today: bits and data.

The tools

Instructiondoestrap
andtests and clears bitsworks on integers, decimals are dropped
orsets bits–
xortoggles bits–
notflips all bitsnot 0 is −1
sll/sla, srl, srashiftonly sra keeps the sign
rol, rorrotatewithin 54 bits, not 64
ext, instake a field, set a fieldat most 53 bits long
STR("…")text into a numberat most 6 ASCII characters
HASH("…")name into a numberCRC32 as a signed 32-bit number

Underneath there is always the same fact: a register is a decimal number with 53 bits of precision. Bit instructions turn it into an integer and back.

Combining packing and text

A status word like the ventilation's from day 345 is ideal for chips and unreadable for people. “35” tells you nothing. “SPUELN” does. The chip unpacks the word with ext and picks the matching text:

ext req wort 4 2                   # bits 4-5: request
move text T_AUS
seq tmp req 1
select text tmp T_NORMAL text
sbn ANZ HASH("Lueftung") Mode TEXTMODUS
sbn ANZ HASH("Lueftung") Setting text    # shows NORMAL instead of a number

The texts are defines with STR("…"). The preprocessor turns them into a number when loading, and a display in mode DisplayMode.String shows them as letters again.

Finding gaps

Go through the table and ask yourself for every line: can I work out an example in my head? and %1100 %1010, sra -32 3, ext %1011_0000 4 4 – if one of them sticks, read the day for it once more. The exam calculates exactly such examples.

Warning

No more than six characters fit into STR. “SPUELEN” has seven and does not load – that is why it says “SPUELN” here. Umlauts do not work at all.

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
One register, many fields: ext takes a field out, ins puts one in. Anything beyond 53 bits does not come back unchanged.

Exercise

Task

Show the status word “Lueft_Status” (format from day 345: bit 0 supply, bit 1 exhaust, bit 2 fault, bits 4–5 request) as plain text. The display “Lueftung” is in text mode and shows “AUS”, “NORMAL” or “SPUELN” – with the fault bit set, request 3 or a missing memory “FEHLER”. The display “Lueft_Pumpen” shows how many pumps are running, -1 without memory.

Hints

Hint 1

Missing memory: snan missing word, then select word missing 4 word – 4 is the fault bit.

Hint 2

Request with ext req word 4 2, the pumps with ext … 1 twice and add.

Hint 3

Text as a chain of seq and select, the fault bit last so it wins.

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