-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.txt
More file actions
20 lines (17 loc) · 747 Bytes
/
code.txt
File metadata and controls
20 lines (17 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
START:
SET R0, 1 ; Set the R0 to 1
SET R1, 1 ; Set the R1 to 1
JMP LOOP ; Jump to loop
LOOP:
FWD R0 ; Move forward by R0 value
ADD R1, 1 ; Add 1 to R1
BATT R2 ; Store the battery level in R2
LTE CHARGE, R2, 60 ; If R2 <= 60, jump to CHARGE else continue
EQU END, R1, 10 ; If R2 == 10, jump to END else continue
JMP LOOP ; Jump to LOOP
CHARGE:
BATT R2 ; Check battery level and store in R2
GTE LOOP, R2, 10 ; If R2 >= 100, jump back to LOOP
JMP CHARGE ; Continue charging until battery is full
END:
STOP ; End of program