在汇编komodo中循环减法10次。我想循环至少4次,但我可以设法循环无限次。如何循环x次。
B main
bottles DEFW 4
text DEFB " bottles sitting on a wall",0
ALIGN
main
LDR R0,text
SWI 3
LDR R0,bottles
loop SUB R0,R0,#1
SWI 4
B loop
SWI 2
答案 0 :(得分:0)
Just for safety, move 'SUB R0,R0,#1' after the 'SWI 4', and instead of 'B loop' (unconditional branch) use 'BNE loop' (branch if not equal/zero). Oh, and change 'SUB' to 'SUBS' (= SUB + sets the fags).