Assembly of pseudo commands |
Description |
Example |
. ASCII "<string>" |
Inserts a string to the target file, but does not end with null. |
. ASCII "jnz" @ insert byte 0x4a 0x4e 0x5a |
. Asciz "<string>" |
Similar to. ASCII, but ended with null |
. Asciz "jnz" @ insert byte 0x4a 0x4e 0x5a 0x00 |
. Balign <power_of_2> {, <Fill_value> {, <Max_padding> }} |
Align the following position <power_of_2> |
. Byte 0x55 @ insert byte: 0x55 . Balign 4, 0 @ insert 3 alignment Bytes: 0x00 0x00 0x00 . Word 0xaa55ee11 @ insert byte: 0x11 0xEE 0x55 0xaa (LSB order) |
. Byte <byte1 >{, <byte2> }... |
Insert byte to target file |
. Byte 64, 'A' @ inserts the bytes 0x40 0x41 . Byte 0x42 @ inserts the byte 0x42 . Byte 0b000011, 0104 @ inserts the bytes 0x43 0x44 |
. Code <number_of_bits> |
Set the number of commands, 16-bit thumb or 32-bit arm |
. Code 16 @ set the following assembly as the thumb command |
. Else |
Use with. If and. endif |
|
. End |
Indicates the end of the Assembly file. The assembler no longer reads the following content. |
|
. Endif |
Huai. If used in combination |
|
. Endm |
The macro definition is over and used with. Macro. |
|
. Endr |
End a loop and use it with. Rept and. IRP. |
|
. Equ <symbol name >,< value> |
Set the value of a symbol |
. Equ Adams, (5*8) + 2 @ set Adams to 42 . Set Adams, 0x2a @ set Adams to 42 Adams = 0b001010 @ set Adams to 42 |
. Err |
Stops compilation if. Err is encountered during assembly. |
|
. Exitm |
Exit macro definition halfway |
|
. Global <symbol> |
Identifies the symbol to be accessed by other modules (assembly or C) of the program, It is equivalent to export_symbol in the kernel. |
. Global _ my_test_count @ It Can Be r/W by other modules |
. Hword <short1 >{, <short2>} ... |
Insert a 16-bit (half-word) value to the target file |
. Hword 0xaa55, 12345 @ insert byte 0x55 0xaa 0x39 0x30 . 2 byte 0x55aa,-1 @ insert byte 0xaa 0x55 0xff 0xff @ Least significant byte (LSB) Ordering assumed |
. If <logical_expression> |
Use with. endif |
|
. Ifdef <symbol> |
Use with. endif |
|
. Ifndef <symbol> |
Use with. endif |
|
. Include "<FILENAME>" |
Similar to # include of C |
|
. IRP <Param >{,< val_1>} {, <Val_2> }... |
Repeats a block of code, once for each value In the Value List. mark the end of the block Using a. endr directive. In the repeated code block, Use \ <param> to substitute the associated Value in the Value List. |
|
. Macro <name >{< arg_1} {, <Arg_2> }... {, <Arg_n>} |
Defines an assembly macro named name, which has N parameters, It must end with. endm. |
. Macro shiftleft a, B . If \ B <0 Mov \ A, \ A, ASR #-\ B . Exitm . Endif Mov \ A, \ A, LSL # \ B . Endm |
. Section <section_name> {, "<Flags> "} |
Start a new section. section_name can be: . Text: code segment . Data: initialized Data Segment . BSS: uninitialized data segment Flags can be: A allowable Section W writable Section X executable Section |
. Section. Text, "X" |
. Set <variable_name>, <Variable_value> |
Set the changed value, which is the same as. equ. |
. Set Adams, 0x2a @ set Adams to 42 |
. Space <number_of_bytes> {, <Fill_byte>} |
Reserve the given byte space and set it to 0 or fill_byte. |
. Space 0x400,0 |
. Word <word1 >{,< word2> }... |
Insert a 32-bit word list to the target file |
Head_ptr:. Word 0 @ head pointer to within buffer (initially zero) Tail_ptr:. Word 0 @ tail pointer to within buffer (initially zero) . Word 0 xdeadbeef @ inserts the bytes 0xef 0xbe 0xad 0xde . 4 byte-42 @ inserts the bytes 0xd6 0xff 0xff 0xff @ Least significant byte (LSB) Ordering assumed |
. Rept <number_of_times> |
The code block number_of_times is repeatedly executed. Similarly, end with endr |
|
<Register_name>. req <Register_name> |
Register renaming |
ACC. req R0 |