Last active
December 16, 2025 03:35
-
-
Save dbidwell94/ffae9c1380bf1440e4b69c8edf058264 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| j 36 | |
| pop r8 | |
| push ra | |
| slt r1 r8 0.25 | |
| slt r2 r8 0.5 | |
| slt r3 r8 0.75 | |
| select r4 r3 2 0 | |
| select r5 r2 5 r4 | |
| select r6 r1 4 r5 | |
| move r9 r6 | |
| move r15 r9 | |
| j 12 | |
| sub r0 sp 1 | |
| get ra db r0 | |
| sub sp sp 1 | |
| j ra | |
| pop r8 | |
| push ra | |
| lbn r15 -1388288459 r8 Ratio Sum | |
| move r9 r15 | |
| sbn -1013553731 r8 Setting r9 | |
| push r8 | |
| push r9 | |
| push r9 | |
| jal 1 | |
| sub r0 sp 2 | |
| get r8 db r0 | |
| sub r0 sp 1 | |
| get r9 db r0 | |
| sub sp sp 2 | |
| move r1 r15 | |
| sbn 1829854055 r8 Color r1 | |
| sub r0 sp 1 | |
| get ra db r0 | |
| sub sp sp 1 | |
| j ra | |
| sb -1013553731 Color 6 | |
| yield | |
| sb 1829854055 On 1 | |
| push 203543632 | |
| jal 16 | |
| move r1 r15 | |
| push -1792506390 | |
| jal 16 | |
| move r2 r15 | |
| push -500189828 | |
| jal 16 | |
| move r3 r15 | |
| push 2085298399 | |
| jal 16 | |
| move r4 r15 | |
| push 189534281 | |
| jal 16 | |
| move r5 r15 | |
| push -1840954893 | |
| jal 16 | |
| move r6 r15 | |
| push -448630427 | |
| jal 16 | |
| move r7 r15 | |
| lbn r8 1036015121 -515763321 PowerActual Sum | |
| lb r15 -2082355173 PowerGeneration Sum | |
| move r9 r15 | |
| sub r1 r9 r8 | |
| move r10 r1 | |
| s db Setting -448630427 | |
| slt r2 r10 0 | |
| sb -1535893860 On r2 | |
| j 37 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| j main | |
| getColor: | |
| pop r8 | |
| push ra | |
| slt r1 r8 0.25 | |
| slt r2 r8 0.5 | |
| slt r3 r8 0.75 | |
| select r4 r3 2 0 | |
| select r5 r2 5 r4 | |
| select r6 r1 4 r5 | |
| move r9 r6 | |
| move r15 r9 | |
| j __internal_L1 | |
| __internal_L1: | |
| sub r0 sp 1 | |
| get ra db r0 | |
| sub sp sp 1 | |
| j ra | |
| setDevice: | |
| pop r8 | |
| push ra | |
| lbn r15 -1388288459 r8 Ratio Sum | |
| move r9 r15 | |
| sbn -1013553731 r8 Setting r9 | |
| push r8 | |
| push r9 | |
| push r9 | |
| jal getColor | |
| sub r0 sp 2 | |
| get r8 db r0 | |
| sub r0 sp 1 | |
| get r9 db r0 | |
| sub sp sp 2 | |
| move r1 r15 | |
| sbn 1829854055 r8 Color r1 | |
| __internal_L2: | |
| sub r0 sp 1 | |
| get ra db r0 | |
| sub sp sp 1 | |
| j ra | |
| main: | |
| sb -1013553731 Color 6 | |
| __internal_L3: | |
| yield | |
| sb 1829854055 On 1 | |
| push 203543632 | |
| jal setDevice | |
| move r1 r15 | |
| push -1792506390 | |
| jal setDevice | |
| move r2 r15 | |
| push -500189828 | |
| jal setDevice | |
| move r3 r15 | |
| push 2085298399 | |
| jal setDevice | |
| move r4 r15 | |
| push 189534281 | |
| jal setDevice | |
| move r5 r15 | |
| push -1840954893 | |
| jal setDevice | |
| move r6 r15 | |
| push -448630427 | |
| jal setDevice | |
| move r7 r15 | |
| lbn r15 1036015121 -515763321 PowerActual Sum | |
| move r8 r15 | |
| lb r15 -2082355173 PowerGeneration Sum | |
| move r9 r15 | |
| sub r1 r9 r8 | |
| move r10 r1 | |
| s db Setting -448630427 | |
| slt r2 r10 0 | |
| sb -1535893860 On r2 | |
| j __internal_L3 | |
| __internal_L4: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| device self = "db"; | |
| const bank1 = hash("Bank 1"); | |
| const bank2 = hash("Bank 2"); | |
| const bank3 = hash("Bank 3"); | |
| const bank4 = hash("Bank 4"); | |
| const bank5 = hash("Bank 5"); | |
| const bank6 = hash("Bank 6"); | |
| const bank7 = hash("Bank 7"); | |
| const energyOutput = hash("EnergyOutput"); | |
| const gauge = hash("ModularDeviceGauge2x2"); | |
| const light = hash("ModularDeviceLight"); | |
| const battery = hash("StructureBatteryLarge"); | |
| const cableAnalyzer = hash("StructureCableAnalysizer"); | |
| const turbine = hash("StructureWindTurbine"); | |
| const flashingLight = hash("StructureFlashingLight"); | |
| fn getColor(forRatio) { | |
| let toReturn = forRatio < 0.25 ? 4 : (forRatio < 0.5 ? 5 : (forRatio < 0.75 ? 2 : 0)); | |
| return toReturn; | |
| } | |
| fn setDevice(bankNum) { | |
| let ratio = lbn(battery, bankNum, "Ratio", "Sum"); | |
| sbn(gauge, bankNum, "Setting", ratio); | |
| sbn(light, bankNum, "Color", getColor(ratio)); | |
| } | |
| sb(gauge, "Color", 6); | |
| loop { | |
| yield(); | |
| sb(light, "On", true); | |
| setDevice(bank1); | |
| setDevice(bank2); | |
| setDevice(bank3); | |
| setDevice(bank4); | |
| setDevice(bank5); | |
| setDevice(bank6); | |
| setDevice(bank7); | |
| let powerActual = lbn(cableAnalyzer, energyOutput, "PowerActual", "Sum"); | |
| let generated = lb(turbine, "PowerGeneration", "Sum"); | |
| let generatedRatio = generated - powerActual; | |
| self.Setting = bank7; | |
| sb(flashingLight, "On", generatedRatio < 0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment