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

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

Stopping on purpose: hcf

hcf stops the chip with error 16, sets it on fire and makes a spark. The devices keep running. A lock state is almost always the better choice.

Lesson 14 min Week 21

What you learn today

  • Understand hcf
  • Stop the chip deliberately
  • Better: a lock state

A pump fills the methane tank in the storage area. If the pressure rises above the limit, it has to stop – immediately and for good. The obvious idea: the chip simply halts. There is even an instruction of its own for that.

hcf: halt and catch fire

hcf has no operands. The name is an old computing joke. In Stationeers it is meant literally:

  • The chip reports error 16 (ChipCatchingFire) and executes no further instruction.
  • The chip itself burns.
  • The housing creates a spark in the surrounding air and a small explosion right where it sits.
bgt press MAXPRESS emergency   # limit exceeded?
j start
emergency:
hcf                            # error 16, chip burns

What happens after the halt

The crucial part is written nowhere in the code: a halted chip switches nothing off. Every device keeps the value it received last. If the pump was running at the hcf, it keeps running – into the tank that is already too full.

The same goes for the quieter ways of stopping a chip:

WayChip afterwardsDevicesSide effect
hcfstopped, error 16keep the last valuespark, small explosion
End of programstopped permanently, no messagekeep the last valuenobody notices
Halt looprunning, does nothingkeep the last value–
Lock statekeeps runningset safe every tick–

A halt loop looks like this:

halt:
yield
j halt       # chip is alive but does nothing any more
Warning

The spark from hcf ends up in the air around the housing. If the chip sits in a room where methane or hydrogen has mixed with oxygen, exactly this spark can ignite the mix. With a gas problem of all things, hcf is the most dangerous reaction.

Better: the lock state

A lock state keeps the chip alive. It remembers the fault in a register, sets all devices safe every tick and only releases them once someone acknowledges and the cause is gone:

sgt tmp press MAXPRESS
select lock tmp OVERPRESS lock   # remember the fault
sle tmp press MAXPRESS           # cause gone?
and tmp tmp button               # ... and acknowledged?
select lock tmp 0 lock           # then release
seqz tmp lock
and pump pump tmp                # locked: pump off

That way the pump stays off, the display names the cause, and the chip keeps watching – even if the sensor disappears in between.

Note

So what is hcf good for? On a test bench as a marker for “the code must never get here”: the chip stops with the error and the line. In an inhabited base the instruction has no business. By the way, the game awards an achievement of its own for hcf.

Exercise

Task

A volume pump “Fuellung” fills a tank, a pipe analyzer “Tank” measures the pressure. The starter code halts with hcf on overpressure – try it in the simulator. The pump would stay on.

Build a lock state instead:

  • Normal operation: pump on while the pressure is below TARGET (4000 kPa)
  • Above MAXPRESS (5000 kPa): lock with cause 1; analyzer gone (NaN): lock with cause 2
  • Locked: pump off, flashing light “Alarm” on, LED “Status” shows the cause (otherwise 0)
  • The lock stays until the button “Quittieren” is pressed and the pressure is valid again and at most MAXPRESS

hcf is not allowed in this exercise.

Hints

Hint 1

Remember the fault: sgt tmp press MAXPRESS and select lock tmp OVERPRESS lock, the same for NaN with snan and SENSORGONE.

Hint 2

Acknowledge: sle tmp press MAXPRESS is 0 for NaN. Combine it with the button via and, then select lock tmp 0 lock.

Hint 3

Pump: first slt pump press TARGET, then “and” it with seqz tmp lock. Light: snez tmp lock.

Quiz

5 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