furnace
advanced-furnace.mips
arc-furnace-room-control.mips
furnace-calc-pre.mips
furnace-ingot-recipe.mips
furnace-operate.mips
furnace-room-vacuum-pump.mips
hot-cold-waste-tank-manager.mips
hot-tank-filler.mips
pressurize-furnace.mips
waste-tank-to-cold-tank-with-chiller.mips
furnace-waste-chiller.mips

manufacturing
vend-ingots-to-printer.mips
vending-ore-counter-omni-fast.mips
vending-ore-counter-omni-slow.mips
vending-ore-counter-single.mipsr
vending-ore-counter-triple.mips

greenhouse
larre-config-1.mips
larre-config-2.mips
larre-config-mars-a.mips
larre-config-mars-bdef.mips
larre-config-mars-c.mips
larre-farming-hardcoded.mips
larre-farming-stack.mips
larre-farming.mips
hydrolarre-farming.mips
greenhouse-ac.mips
greenhouse-o2-pressure-display.mips
greenhouse-oxygen-harvest.mips
greenhouse-temperature.mips
harvie-triple.mips
seed-distributer.mips
seed-sorter-old.mips
seed-sorter.mips
stacker-vending-button.mips

atmospherics
base-atmosphere-control.mips
battery-room-atmosphere.mips
battery-room-vent-setter.mips
harvest-cold-atmosphere.mips
harvest-liquid-from-atmosphere.mips
refrigeration-room.mips

mining rocket
rocket-driving.mips
rocket-miner-readout.mips

ore warehousing
ore-sorter-multi.mips
ore-sorter2-multi.mips
gas-rock-sorter.mips
centrifuge-ore.mips

gas handling
gas-filter-chain.mips
co2-tank-pressure-management.mips
fuel-mixer.mips
gas-harvester.mips
gas-mixer-nitrous.mips
n2o-heater.mips
pump-feed-nitrolyzer.mips
show-gas-pressure-triple.mips
manage-coolant-from-atmosphere.mips

doors
weather-gate.mips
door-switch-logic.mips

solar
solar-old.mips
1-axis-solar-panel-control.mips
2-axis-solar-panel-control.mips
batch-solar-control-dumb.mips
batch-solar-control.mips

biomass fuel
biomass-generator-pipeline.mips
biomass-generator-silo.mips
biomass-recycler.mips
charcoal-stockpile-display.mips

gas liquification
condenser-pollutant-limiter.mips
condenser-volatiles-limiter.mips
measure-condensation-rate.mips
cybernetic-regulator-clumsy-batch.mips
cybernetic-regulator-clumsy.mips
cybernetic-regulator-pid.mips
liquid-delta-volume-graph.mips
liquification-power-mgmt.mips
mars-nighttime-liquid-harvest.mips

H2 combuster / water
h2-combuster-condense.mips
h2-combuster-mixer.mips
h2-combuster-operate.mips

stockboy
stockboy-coalesce.mips
stockboy-config.mips
stockboy-fabricator.mips
stockboy-pre-fabricator.mips
stockboy-stacker.mips
stockboy-trucker.mips

AIMeE
aimee-old.mips
aimee-position-display.mips
aimee.mips


airlock-speed-vent.mips
airlock-tank-accelerator-mgmt.mips
battery-leveling.mips
centrifuge-miner-manager.mips
chamber-liquification-mgr.mips
chiller-purge-pump-controll.mips
cooling-gas-buffer-room.mips
cooling-gas-buffer.mips
display-avionics.mips
exhaust-gas-cooler-control.mips
flashing-light-mirror.mips
fuel-mixer-n2o.mips
fuel-mixer-o2.mips
gas-pressure-display.mips
greenhouse-parasite-battery-manager.mips
ice-logic-sorter.mips
ingot-divider.mips
light-console.manager.mips
light-manager.mips
loulan-airlock.mips
loulan-arc-furnace-room.mips
loulan-greenhouse.mips
low-gas-cutoff.mips
mars-atmosphere-harvest-n2-o2.mips
memorize-sunrise-sunset.mips
nitrolyzer-battery-threshold.mips
nitrous-warmer.mips
ore-sorter-1.mips
ore-sorter-2.mips
ore-sorter-logic.mips
power-charge-average.mips
power-consumption-triple.mips
radiator-control.mips
rocket-landing.mips
rocket-umbilical-safety.mips
seed-logic-sorter.mips
simpler-gate.mips
sorter-feeding-autooven.mips
trader-scanner.mips
vacuum-enforcer.mips
vend-ingots-to-printer-2.mips
vending-ore-counter-omni-hash.mips
workshop-off-button.mips

alias larre d0
alias depositchute d1
alias sensor d2

alias stationidx r15
alias seedstation r10
alias index r9
alias depositstation r8
define tooCold 280
define tooHot 320

start:

get r0 db 0
mul r0 r0 3
add sp r0 2 # reset the stack pointer, because we might have not popped everything
s db Setting 42
move index 0
loop1:

jal clearchute

mul r0 index 3
add r0 r0 1
get stationidx db r0
add r0 r0 1
get seedstation db r0
add r0 r0 1
get depositstation db r0
jal doplant
#s db Setting index

add index index 1
get r0 db 0 # number of hydroponics
blt index r0 loop1
s db Setting index

yield
j start

#
doplant:

ls r0 larre 0 Occupied
blez r0 regular
push ra
s larre Setting depositstation
jal waittillidle
s larre Activate 1
jal waittillidle
jal clearchute
pop ra
j doplant

regular:

s larre Setting stationidx
push ra
jal waittillidle
pop ra

ls r0 larre 255 Occupied
blez r0 plantseed
# something is growing
ls r0 larre 255 Seeding
bltz r0 ra # hasn't grown a seed yet

push ra
jal waittillidle
harvest:
s larre Activate 1
jal waittillidle
ls r0 larre 255 Occupied
bgtz r0 harvest
pop ra
j doplant

plantseed:

l r0 sensor RatioPollutant
bgtz r0 ra
l r0 sensor RatioWater
l r1 sensor RatioSteam
add r0 r1 r0
blt r0 0.9 ra
l r0 sensor Temperature
blt r0 tooCold ra
bgt r0 tooHot ra
l r0 sensor Pressure
blt r0 10 ra

push ra
s larre Setting seedstation
jal waittillidle
s larre Activate 1
jal waittillidle
yield # give the game time to detect the arm has an item.
ls r0 larre 0 Occupied
peek ra
blez r0 ra #no seed available
s larre Setting stationidx
jal waittillidle
s larre Activate 1
jal waittillidle
pop ra

j ra

waittillidle:
yield
l r0 larre Idle
beqz r0 waittillidle
l r0 larre Setting
l r1 larre PositionX
bne r0 r1 waittillidle
j ra

clearchute:
bdns depositchute nochute
ls r0 depositchute 0 Occupied
seqz r0 r0
s depositchute Open r0
j ra
nochute:
lbs r0 HASH("StructureChuteBin") 0 Occupied Maximum
seqz r0 r0
sb HASH("StructureChuteBin") Open r0
j ra

MIPS is the programming language used by IC (integrated circuits) in the game Stationeers. Stationeering web site has a MIPS emulator with syntax highlighting and error detection.