分支标记但在ARM中保留旧的寄存器值

时间:2015-10-26 18:33:48

标签: assembly arm

我是ARM新手,我想分支到我创建的标签,但仍然可以使用我在程序前一部分设置的寄存器的值。

我的代码是

    B main

menmow  DEFB    "men went to mow\n",0
manmow  DEFB    "man went to mow\n",0
meadow  DEFB    "Went to mow a meadow\n",0
dog DEFB    "man and his dog, Spot\n",0
men DEFB    "men",0
man DEFB    "man",0

    ALIGN

main    MOV R1, #4
    MOV R2, #0
    MOV R2, #1
    CMP R1,R2
    BNE Verse1
    ;SWI    2
Verse1  
    ADR R0, R1  
    SWI 4
    CMP R1,R2
    BEQ Man
    ADR R0, menmow
    SWI 3
    ;B  Verse2      
Man ADR R0, manmow
    SWI 3
    SWI 2           ; stop
    B main      


;SWI 4 to print integers

0 个答案:

没有答案