This preview shows page 1. Sign up to view the full content.
Unformatted text preview: or initialised storage. .text
Switch the destination of following statements into the text section of the final
executable. This is the section into which assembly language instructions should be
placed. See the .data directive for a somewhat longer explanation. .word expression …
.4byte expression …
Insert the (32-bit) word value of the expression into the object file. More than one
expression may appear, if separated by commas. The directive .4byte can be used as
a synonym. As an example, the following lines insert 8 bytes into the object file
-42 ; inserts the bytes 0xEF 0xBE 0xAD 0xDE
; inserts the bytes 0xD6 0xFF 0xFF 0xFF
; Least Significant Byte (LSB) ordering assumed Remember that the ARM microcontroller must access all word quantities on 32-bit
boundaries. In other words, it cannot access a word memory location if the lowest
two bits of that address are non-zero. See the .align directive for a solution.
See also the .byte and .hword assembler directives. Those coming from a background in other processors need to remember that, in ARM nomenclature, a word is
a 32-bit quantity, not a 16-bit one. Expressions
Many ARM assembly language statements, as well as assembler directives, require an
integer number of some sort as an operand. For example, “mov r0,#1” requires the
number “1”. An expression may appear any place a number is expected.
At the most basic level, an expression can be a simple integer number. This number
can be expressed in decimal (with the usual notation), in hexadecimal (with a 0x or
0X prefix), in octal (with a leading zero) or in binary (with a 0b or 0B prefix). It can
also be expressed as a character constant, surrounded or preceded by single quotes.
Thus, the following six lines all load register R0 with the same value, 74:
; decimal number 74
hexadecimal number 0x4A (0X4A and 0x4a are also OK)
octal number 0112
binary number 0b1001010 (0B1001010 is also OK)
character constant "J" (preferred syntax)
View Full Document
This test prep was uploaded on 03/30/2014 for the course CGS 1000 at Hillsborough.
- Assembly Language