alias autolathe d0 alias hydraulics d1 alias electronics d2 alias counterIC d4 alias ringmaster d5 # the IC containing the coordinating RAM alias qty r14 alias hash r13 alias latheptr r12 alias busy r11 define MODULUS 55 move sp MODULUS add sp sp 5 start: s db Setting -1 get r0 ringmaster 120 bne r0 1 -2 # wait for our turn to control LArRE s db Setting -2 schedule1: jal checkBusy bnez busy waitWhileFabbing jal maybeFlush # tell the autolathe to make anything missing move latheptr 0 alias fabber d0 move hash HASH("ItemKitWallIron") move qty 10 jal queueProduction move hash HASH("ItemKitWall") move qty 20 jal queueProduction move hash HASH("ItemSteelSheets") move qty 20 jal queueProduction move hash HASH("ItemPlasticSheets") move qty 20 jal queueProduction move hash HASH("ItemGlassSheets") move qty 20 jal queueProduction move hash HASH("ItemSteelFrames") move qty 15 jal queueProduction bdns hydraulics overHydraulics move latheptr 0 alias fabber d1 # hydraulics move hash HASH("ItemKitPipe") move qty 15 jal queueProduction move hash HASH("ItemKitInsulatedLiquidPipe") move qty 15 jal queueProduction move hash HASH("ItemKitInsulatedPipe") move qty 15 jal queueProduction overHydraulics: move latheptr 0 alias fabber d2 # electronics move hash HASH("ItemIntegratedCircuit10") move qty 1 jal queueProduction move hash HASH("ItemKitLogicCircuit") move qty 1 jal queueProduction move hash HASH("ItemCableCoilHeavy") move qty 20 jal queueProduction move hash HASH("ItemCableCoil") move qty 20 jal queueProduction # wait until fabbers are finished waitWhileFabbing: yield jal checkBusy bnez busy waitWhileFabbing # lathe has no instructions sleep 2 move ra handOff j maybeFlush maybeFlush: lbs r0 HASH("StructureStacker") 2 Occupied Sum lbs r1 HASH("StructureStackerReverse") 2 Occupied Sum or r0 r0 r1 blez r0 ra # some stacker had contents sleep 2 sb HASH("StructureStacker") Activate r0 # clear the stacker sb HASH("StructureStackerReverse") Activate r0 # clear the stacker j handOff queueProduction: # inputs = hash, qty mod r0 hash MODULUS get r0 counterIC r0 sub r0 qty r0 min r0 r0 10 blez r0 ra move r1 hash sll r1 r1 8 or r1 r1 r0 sll r1 r1 8 or r1 r1 PrinterInstruction.ExecuteRecipe put fabber latheptr r1 add latheptr 1 latheptr put fabber latheptr PrinterInstruction.WaitUntilNextValid add latheptr 1 latheptr j ra checkBusy: get busy autolathe 0 get r1 hydraulics 0 or busy busy r1 get r1 electronics 0 or busy busy r1 j ra handOff: s db Setting 79 put ringmaster 120 0 j start |
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.