alias daysensor d0 alias cable1 d1 alias cable2 d2 #alias cable2 d3 alias sampleCount r15 # how many valid values are on the stack alias sampleSum r14 alias counter r13 alias oldVert r12 alias vert r11 alias incomingPower r10 alias cursor r9 alias newSampleCount r8 alias avgPower r7 move cursor 0 move sampleCount 0 move sampleSum 0 move counter 0 move oldVert 0 s db Setting -7 get r0 db 211 start: sleep 4 l r0 cable1 PowerActual l r1 cable2 PowerActual add incomingPower r0 r1 get r0 db cursor sge r1 cursor sampleCount select r0 r1 0 r0 sub sampleSum sampleSum r0 add sampleSum sampleSum incomingPower poke cursor incomingPower add cursor cursor 1 max sampleCount sampleCount cursor l vert daysensor Vertical slt r0 vert 90 sge r1 oldVert 90 and r0 r0 r1 move oldVert vert beqz r0 over # dawn move newSampleCount cursor revise: bge cursor sampleCount doneRevising s db Setting cursor get r0 db cursor sub sampleSum sampleSum r0 add cursor cursor 1 j revise doneRevising: move sampleCount newSampleCount move cursor 0 over: div avgPower sampleSum sampleCount add avgPower 100 avgPower sbn HASH("StructureConsoleLED5") HASH("sample count") Setting sampleCount sbn HASH("StructureConsoleLED5") HASH("cursor") Setting cursor s db Setting avgPower 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.