Features of the GCC ARM assembler
We will begin this section by looking at how memory space can be reserved for constants and variables. We have already seen that literals in the ARM assembly language are prefixed by a #
symbol. Numbers are regarded as decimal unless prefixed by 0x
, which indicates hexadecimal – for example, mov r0,#0x2C
. ASCII characters are indicated by using single quotes, as in this example:
cmp r0,#'A' @ Was it a letter 'A'?
Two important assembler directives are .equ
, which binds a name to a value, and .word
, which allows you to preload memory with data before a program runs. The .equ
directive is very easy to understand; it binds a numeric value to a name. Consider the following:
.equ Tuesday, 2
This assembly directive binds the name Tuesday
to the value...