Add do_not_waste_structure_battery_charger.asm
This commit is contained in:
parent
cb1ef42f53
commit
144e2cbff5
30
do_not_waste_structure_battery_charger.asm
Normal file
30
do_not_waste_structure_battery_charger.asm
Normal file
@ -0,0 +1,30 @@
|
||||
define SBC HASH("StructureBatteryCharger")
|
||||
define SBC1 HASH("Charger 1")
|
||||
define SBC2 HASH("Charger 2")
|
||||
alias CHARGEID r15
|
||||
alias UNCHARGEDAmount r14
|
||||
|
||||
start:
|
||||
yield
|
||||
move CHARGEID SBC1
|
||||
jal donotwaste
|
||||
move CHARGEID SBC2
|
||||
jal donotwaste
|
||||
j start
|
||||
|
||||
donotwaste:
|
||||
move UNCHARGEDAmount 0
|
||||
move r0 4
|
||||
|
||||
donotwasteloop:
|
||||
lbns r1 SBC CHARGEID r0 Occupied Sum
|
||||
breqz r1 4
|
||||
lbns r1 SBC CHARGEID r0 ChargeRatio Sum
|
||||
brge r1 0.99 2
|
||||
add UNCHARGEDAmount UNCHARGEDAmount 1
|
||||
sub r0 r0 1
|
||||
bgez r0 donotwasteloop
|
||||
|
||||
sgtz r0 UNCHARGEDAmount
|
||||
sbn SBC CHARGEID On r0
|
||||
j ra
|
Loading…
Reference in New Issue
Block a user