{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

This is the section into which assembly language

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

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 output: .word .4byte 0xDEADBEEF -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: mov mov mov mov mov mov r0,#74 r0,#0x4A r0,#0112 r0,#0b1001010 r0,#'J' r0,#'J ; ; ; ; ; ; 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) character...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online