Overview of differences between armasm and GNU syntax assembly code
armasm (for assembling legacy assembly code) uses armasm syntax assembly code.
armclang aims to be compatible with GNU syntax assembly code (that is, the assembly code syntax supported by the GNU assembler,
If you have legacy assembly code that you want to assemble with
armclang, you must convert that assembly code from
armasm syntax to GNU syntax.
The specific instructions and order of operands in your UAL syntax assembly code do not change during this migration process.
However, you need to make changes to the syntax of your assembly code. These changes include:
- The directives in your code.
- The format of labels, comments, and some types of literals.
- Some symbol names.
- The operators in your code.
The following examples show simple, equivalent, assembly code in both armasm and GNU syntax.
; Simple armasm syntax example ; ; Iterate round a loop 10 times, adding 1 to a register each time. AREA ||.text||, CODE, READONLY, ALIGN=2 main PROC MOV w5,#0x64 ; W5 = 100 MOV w4,#0 ; W4 = 0 B test_loop ; branch to test_loop loop ADD w5,w5,#1 ; Add 1 to W5 ADD w4,w4,#1 ; Add 1 to W4 test_loop CMP w4,#0xa ; if W4 < 10, branch back to loop BLT loop ENDP END
// Simple GNU syntax example Comments // // Iterate round a loop 10 times, adding 1 to a register each time. .section .text,"ax" // Sections .balign 4 main: // Labels MOV w5,#0x64 // W5 = 100 Numeric literals MOV w4,#0 // W4 = 0 B test_loop // branch to test_loop loop: ADD w5,w5,#1 // Add 1 to W5 ADD w4,w4,#1 // Add 1 to W4 test_loop: CMP w4,#0xa // if W4 < 10, branch back to loop BLT loop .end // Miscellaneous directives