三盏灯流水
.text
.global _start
_start:
@1.
LDR R0,=0X50000A28
LDR R1,[R0]
ORR R1,R1,#(0X1<<4)
STR R1,[R0]
@1.
LDR R0,=0X50000A28
LDR R1,[R0]
ORR R1,R1,#(0X1<<5)
STR R1,[R0]
@2.
LDR R0,=0X50006000
LDR R1,[R0]
BIC R1,R1,#(0X3<<20)
ORR R1,R1,#(0X1<<20)
STR R1,[R0]
@3.
LDR R0,=0X50006004
LDR R1,[R0]
BIC R1,R1,#(0X1<<10)
STR R1,[R0]
@4.
LDR R0,=0X50006008
LDR R1,[R0]
BIC R1,R1,#(0X3<<20)
STR R1,[R0]
@5.
LDR R0,=0X5000600C
LDR R1,[R0]
BIC R1,R1,#(0X3<<20)
STR R1,[R0]
@2.
LDR R0,=0X50007000
LDR R1,[R0]
BIC R1,R1,#(0X3<<20)
ORR R1,R1,#(0X1<<20)
STR R1,[R0]
@3.
LDR R0,=0X50007004
LDR R1,[R0]
BIC R1,R1,#(0X1<<10)
STR R1,[R0]
@4.
LDR R0,=0X50007008
LDR R1,[R0]
BIC R1,R1,#(0X3<<20)
STR R1,[R0]
@5.
LDR R0,=0X5000700C
LDR R1,[R0]
BIC R1,R1,#(0X3<<20)
STR R1,[R0]
@2.
LDR R0,=0X50006000
LDR R1,[R0]
BIC R1,R1,#(0X3<<16)
ORR R1,R1,#(0X1<<16)
STR R1,[R0]
@3.
LDR R0,=0X50006004
LDR R1,[R0]
BIC R1,R1,#(0X1<<8)
STR R1,[R0]
@4.
LDR R0,=0X50006008
LDR R1,[R0]
BIC R1,R1,#(0X3<<16)
STR R1,[R0]
@5.
LDR R0,=0X5000600C
LDR R1,[R0]
BIC R1,R1,#(0X3<<16)
STR R1,[R0]
@6.
LOOP:
@亮
LDR R0,=0X50006014
LDR R1,[R0]
ORR R1,R1,#(0X1<<10)
STR R1,[R0]
BL delay
@灭
LDR R0,=0X50006014
LDR R1,[R0]
BIC R1,R1,#(0X1<<10)
STR R1,[R0]
BL delay
@亮
LDR R0,=0X50007014
LDR R1,[R0]
ORR R1,R1,#(0X1<<10)
STR R1,[R0]
BL delay
@灭
LDR R0,=0X50007014
LDR R1,[R0]
BIC R1,R1,#(0X1<<10)
STR R1,[R0]
BL delay
@亮
LDR R0,=0X50006014
LDR R1,[R0]
ORR R1,R1,#(0X1<<8)
STR R1,[R0]
BL delay
@灭
LDR R0,=0X50006014
LDR R1,[R0]
BIC R1,R1,#(0X1<<8)
STR R1,[R0]
BL delay
b LOOP
@封装函数
delay:
LDR R4,=0X10000000
mm:
cmp R4,#0
subne R4,R4,#1
bne mm
mov pc,lr
.end
测试结果