label1 ADR r4,c
LDR r0,[r4] ; a comment
ADR r4,d
LDR r1,[r4]
SUB r0,r0,r1 ; another comment
組合語言通常有以下的特徵
- 一個指令一行
- Labels, 通常在first column給memory loacation名字
- 指令必須從second column或second column之後開始,才能區分跟Label的不同
上圖是ARM data processing instruction ,這個例子是ADD
這個指令 ADDGT r0,r3,#5
- cond 會依照f GT condition (1100) 來設定[註1]
- GT的意思是Greater than (signed). (Z==0) && (N==V)
- opcode 會顯示二進制 ADD 指令 (0100
- 第一個operand register Rn 會被設為 3 來代表 r3 ,
- destination register Rd 會被設為0 for r0
- the operand 2 field 會被設為 immediate value of 5.[註2]
[註1]cond 就是 Condition codes透過查表(請搜尋關鍵字ARM CortexA Series Programmer’s Guide for ARMv8A Version: 1.0)
Operand2 in the descriptions of the syntax of each instruction.Operand2 can be a:constantregister with optional shift.Reference:
[1]Computers as Components - Principles of Embedded Computing Sy
stem Design Ch.2
沒有留言:
張貼留言