Page 55 - ARM 64 Bit Assembly Language
P. 55
GNU assembly syntax 39
and optionally initialize the memory. Some of these directives allow the memory to be initial-
ized using an expression. An expression can be a simple integer, or a C-style expression. The
directives for allocating storage are as follows:
.byte expressions
.byte expects zero or more expressions, separated by commas. Each expression pro-
duces one byte of data. The first byte is placed at the current address counter, and then
the counter is incremented so that the second expression is placed at the next byte, and
so on. If no expressions are given, then the address counter is not advanced and no bytes
are reserved.
.2byte expressions
.hword expressions
.short expressions
For the AArch64 processor, these directives all do exactly the same thing. They expect
zero or more expressions, separated by commas, and emit a 16-bit number for each ex-
pression. If no expressions are given, then the address counter is not advanced and no
bytes are reserved.
.4byte expressions
.word expressions
.long expressions
For the AArch64 processor, these three directives do exactly the same thing. They ex-
pect zero or more expressions, separated by commas, and will emit four bytes for each
expression given. If no expressions are given, then the address counter is not advanced
and no bytes are reserved.
.8byte expressions
.quad expressions
For the AArch64 processor, these two directives do exactly the same thing. They expect
zero or more expressions, separated by commas, and will eight bytes for each expres-
sion given. If no expressions are given, then the address counter is not advanced and no
bytes are reserved.
.ascii "string"
The .ascii directive expects zero or more string literals, each enclosed in quotation
marks and separated by commas. It assembles each string (with no trailing ASCII
NULL character) into consecutive addresses.
.asciz "string"
.string "string"
The .asciz directive is similar to the .ascii directive, but each string is followed by
an ASCII NULL character (zero). The “z”in .asciz stands for zero. .string is just
another name for .asciz.