alias larre d0 alias import d1 alias stacker d2 alias fabberOut d3 alias ringmaster d5 alias hashToStack r15 alias hash r14 alias lockerIndex r13 alias qty r12 alias stackSize r11 define fabberStation 1 define importStation 3 define exportStation 2 define lockerStation 4 define MODULUS 55 start: s db Setting -1 yield get r0 ringmaster 120 bne r0 2 -2 # some other IC has larre s db Setting -2 ls hashToStack larre 0 OccupantHash beqz hashToStack handoff # nothing in my claw, hand off to another IC mod r2 hashToStack MODULUS add r2 r2 MODULUS get stackSize ringmaster r2 coalesce: s larre Setting importStation s larre TargetSlotIndex 0 jal waitLarreIdle s larre Activate 1 # deposit stack in import chute jal waitLarreIdle s import Open 0 ls hash fabberOut 0 OccupantHash s db Setting hash bne hash hashToStack fabberIsEmpty #the output of the fabbers matches what we are stacking s larre Setting fabberStation jal waitLarreIdle s larre Activate 1 jal waitLarreIdle j coalesce fabberIsEmpty: s larre Setting lockerStation s db Setting -5 jal waitLarreIdle move lockerIndex 0 grabAnother: #find another slot with matching item s larre TargetSlotIndex lockerIndex ls hash larre 255 OccupantHash bne hash hashToStack nextSlot # slot does not match ls qty larre 255 Quantity bge qty stackSize nextSlot s larre Activate 1 jal waitLarreIdle j coalesce nextSlot: add lockerIndex 1 lockerIndex blt lockerIndex 30 grabAnother #reached the end of the locker s stacker Activate 1 s larre Setting exportStation jal waitLarreIdle handoff: put ringmaster 120 0 j start waitLarreIdle: yield l r0 larre Idle blez r0 waitLarreIdle 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.