Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .text
- .global _start
- _start:
- LDR R8, =0xFF200050 //Store address of KEYS into R8
- LDR R9, =0xFF200000 //Store address of LEDS into R9
- LDR R10, =0xFFFEC600//Store address of timer into R10
- LDR R11, =200000000 //Count value
- MOV R12, #0b011 //Instruction codes for timer
- MOV R1, #0x1 //LED VALUES
- STR R11, [R10] //Feed in count value of timer
- STR R12, [R10, #8] //Init timer to start
- LEFT:
- BL KEYPOLL
- STR R1, [R9] //Load value into LEDS
- BL DELAY //Delay until next
- CMP R1, #0b1000000000 //Check if at edge
- BEQ RIGHT //Go to RIGHT if at edge
- LSL R1, R1, #1 //Shift LEDS value to left by 1
- B LEFT
- RIGHT:
- BL KEYPOLL
- STR R1, [R9] //Load value into LEDS
- BL DELAY //Delay until next
- CMP R1, #0b1 //See if at edge
- BEQ LEFT //Go to LEFT if at edge
- LSR R1, R1, #1 //Shift LEDS value to right by 1
- B RIGHT
- KEYPOLL:
- LDR R0, [R8] //Load KEYS state into R0
- CMP R0, #0b1000 //See if KEY3 is activated
- BEQ KEY3_LOOP //If it isn't go to pause
- MOV PC, LR
- KEY3_LOOP:
- MOV R0, #0b010
- STR R0, [R10, #8] // Sets Auto = 1, Enable = 0
- LDR R0, [R8]
- CMP R0, #0b1000
- BEQ KEY3_LOOP
- KEY3_LOOP_CONT:
- LDR R0, [R8]
- CMP R0, #0b0000
- BEQ KEY3_LOOP_CONT
- KEY3_LOOP_CONT2:
- LDR R0, [R8]
- CMP R0, #0b1000
- BEQ KEY3_LOOP_CONT2
- MOV R0, #0b011
- STR R0, [R10, #8] // Sets Auto = 1, Enable = 1
- MOV PC, LR
- DELAY:
- LDR R0, [R10, #12] //Load value of timer's F bit
- CMP R0, #0 //See if F bit is 0
- BEQ DELAY //Continue delaying if it is
- STR R0, [R10, #12] //Restart timer
- MOV PC, LR //Return to sweeping loop
- .end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement