Assembly Pseudo-Directives |
Describe |
Example |
. ASCII "<string>" |
Inserts a string into the destination file, but does not end with null |
. ASCII "JNZ" @ Insert byte 0x4a 0x4E 0x5A |
. Asciz "<string>" |
Similar to. ASCII, but ends with null |
. Asciz "JNZ" @ Insert byte 0x4a 0x4E 0x5A 0x00 |
. balign <power_of_2> {,<fill_value> {, <max_padding>}} |
Make the following position <power_of_2> align |
. Byte 0x55 @ Insert byte: 0x55 . balign 4,0 @ Insert 3 aligned bytes: 0x00 0x00 0x00 . Word 0xaa55ee11 @ Insert byte: 0x11 0xEE 0x55 0xAA (LSB order) |
. Byte <byte1> {, <byte2>} ... |
Insert byte to destination file |
. Byte, ' A ' @ Inserts the bytes 0x40 0x41 . Byte 0x42 @ Inserts the byte 0x42 . Byte 0b1000011, 0104 @ Inserts the bytes 0x43 0x44 |
. Code <number_of_bits> |
Set the number of instruction bits, 16-bit thumb or 32-bit arm |
. code 16 @ Set the following assembly as thumb instructions |
. else |
Use with. if and. endif |
|
. end |
End of symbol assembly file, assembler no longer reads back content |
|
. endif |
If used in conjunction with the. |
|
. endm |
Flag macro definition end, used in conjunction with. macro |
|
. Endr |
End a loop, using the. 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 = 0b00101010 @ set Adams to 42 |
. err |
Assembly when you encounter. Err, stop compiling |
|
. exitm |
Exit macro Definition Halfway |
|
. Global <symbol> |
Identity symbol is accessed by other modules of the program (assembly or C), Equivalent to Export_symbol in kernel |
. Global _my_test_count @ It can be r/w by other modules |
. Hword <short1> {, <short2>} ... |
Insert 16-bit (half-character) value to the destination file |
. Hword 0xaa55, 12345 @ Insert byte 0x55 0xAA 0x39 0x30 .2byte 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 C's # include |
|
. 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>} |
Define a compilation macro called Name, which has n parameters, and 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>"} |
To start a new section, the Section_name can be: . Text: Code snippet . Data: Initialized Segments . BSS: Uninitialized data segments The flags can be: A allowable section W writable section X executable section |
. section. Text, "X" |
. set <variable_name>, <variable_value> |
Sets the value of the change, as with the. equ |
. Set Adams, 0x2A @ set Adams to 42 |
. Space <number_of_bytes> {, <fill_byte>} |
Reserve a given byte space and set to 0 or fill_byte |
. Space 0x400,0 |
. Word <word1> {, <word2>} ... |
Insert a 32-bit word list to the destination file |
Head_ptr:. Word 0 @ Head pointer to within buffer (initially zero) Tail_ptr:. Word 0 @ tail pointer to within buffer (initially zero) . Word 0xDEADBEEF @inserts the bytes 0xEF 0xBE 0xAD 0xDE .4byte-42 @ Inserts the bytes 0xd6 0xFF 0xFF 0xFF @ Least significant Byte (LSB) ordering assumed |
. rept <number_of_times> |
Repeat code block number_of_times times, with C for Similar to the end of Endr |
|
<register_name>. req <register_name> |
Register Rename |
Acc. req R0 |