Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .global main
- .arm
- .EQU PB_OER, 0xFFFFF410
- .EQU PB_PER, 0xFFFFF400
- .EQU PB_SODR, 0xFFFFF430
- .EQU PB_CODR, 0xFFFFF434
- .EQU PC_OER, 0xFFFFF610
- .EQU PC_PER, 0xFFFFF600
- .EQU PC_SODR, 0xFFFFF630
- .EQU PC_CODR, 0xFFFFF634
- .EQU PC_ODR, 0xFFFFF614
- .EQU PC_PPUER, 0xFFFFF664
- .EQU PC_IFER, 0xFFFFF620
- .EQU PC_PDSR, 0xFFFFF63C
- .EQU PMC_PCR, 0xFFFFFC10
- .EQU DS1, (1<<8)
- .EQU DS2, (1<<29)
- .EQU SW1, (1<<4)
- .EQU SW2, (1<<5)
- .EQU delay, 655000
- .section .text
- main:
- MOV R1, #DS1
- LDR R2, =PB_OER
- STR R1, [R2]
- LDR R2, =PB_PER
- STR R1, [R2]
- LDR R3, =PB_CODR
- LDR R4, =PB_SODR
- MOV R1, #DS2
- LDR R2, =PC_OER
- STR R1, [R2]
- LDR R2, =PC_PER
- STR R1, [R2]
- LDR R5, =PC_CODR
- LDR R6, =PC_SODR
- MOV R1, #4
- LDR R2, =PMC_PCR
- STR R1, [R2]
- MOV R1, #SW1
- LDR R2, =PC_ODR
- STR R1, [R2]
- LDR R2, =PC_PPUER
- STR R1, [R2]
- LDR R2, =PC_PER
- STR R1, [R2]
- LDR R2, =PC_IFER
- STR R1, [R2]
- MOV R1, #SW2
- LDR R2, =PC_ODR
- STR R1, [R2]
- LDR R2, =PC_PPUER
- STR R1, [R2]
- LDR R2, =PC_PER
- STR R1, [R2]
- LDR R2, =PC_IFER
- STR R1, [R2]
- LDR R7, =PC_PDSR
- MainLoop:
- LDR R0, =delay
- MOV r9, #DS1
- loopA:
- SUBS R0, R0, #1
- STR R9, [R3]
- BNE loopA
- LDR R0, =delay
- loopB:
- SUBS R0, R0, #1
- STR R9, [R4]
- BNE loopB
- LDR R8, [R7]
- TST R8, #SW1
- BEQ IF1
- TST R8, #SW2
- BEQ IF2
- B MainLoop
- IF1:
- MOV R9, #DS2
- STR R9,[R6]
- B MainLoop
- IF2:
- MOV R9, #DS2
- STR R9,[R5]
- B MainLoop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement