1.練習一
.text @文本段
.global _start @ 聲明一個_start函數入口
_start: @ _start標簽,相當于C語言中函數mov r0,#0x2mov r1,#0x3cmp r0,r1beq stopsubhi r0,r0,r1subcc r1,r1,r0stop: @ stop標簽,相當于C語言中函數b stop @ 跳轉到stop標簽下的第一條指令執行,相當于C語言中while(1).end @結束標志
?
2.練習二 用for循環實現1~100之間和5050
.text @文本段
.global _start @ 聲明一個_start函數入口
_start: @ _start標簽,相當于C語言中函數mov r0,#1 @ 一條匯編指令mov r1,#0bl loop_sumloop_sum:cmp r0,#100bhi stopadd r1,r1,r0add r0,r0,#1bl loop_summov pc,lrstop: @ stop標簽,相當于C語言中函數b stop @ 跳轉到stop標簽下的第一條指令執行,相當于C語言中while(1)
.end @結束標志
?思維導圖
?