我正在使用手臂模拟器编写一个程序,为了使这个问题变得简单,当按下其中一个蓝色键时,模拟器中的两个LED闪烁。我的问题是,当我从我的程序分支到闪烁函数时,它不会回到我分支的位置,而是当它完成等待循环时它只是执行在等待循环下面写的任何东西
主循环
swi SWI_CheckBlue
cmp r0, #0
blne BlinkBoth
BlinkBoth:
mov r0,#(LEFT_LED|RIGHT_LED)
swi SWI_SETLED
ldr r3,=500
BL Wait
mov r0,#0
swi SWI_SETLED
Wait:
stmfd sp!,{r0-r5,lr}
ldr r4,=0x00007FFF @mask for 15-bit timer
SWI SWI_GetTicks @Get start time
and r1,r0,r4 @adjusted time to 15-bit
Wloop:
SWI SWI_GetTicks @Get current time
and r2,r0,r4 @adjusted time to 15-bit
cmp r2,r1
blt Roll @rolled above 15 bits
sub r5,r2,r1 @compute easy elapsed time
bal CmpLoop
Roll:
sub r5,r4,r1 @compute rolled elapsed time
add r5,r5,r2
CmpLoop:cmp r5,r3 @is elapsed time < delay?
blt Wloop @Continue with delay
Xwait:
ldmfd sp!,{r0-r5,pc}