assembler-intro

For more information please see sections 34 and 53 of

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: hat you cannot start a symbol with a digit. (For more information, please see sections 3.4 and 5.3 of the GNU Assembler Reference). A comment is anything that follows a semicolon “;”.1 Everything after a semicolon— except when it appears in a string—is ignored to the end of that line. C-style comments (using “/*” and “*/”) are also allowed. You can also use “@” instead of “;”. The instruction field is the real meat of your program: it is any valid ARM assembly language instruction that you care to use. It also includes the so-called pseudo-operations or assembler directives: “instructions” that tell the assembler itself to do something. These directives are discussed in greater detail below. Assembler Directives All assembler directives have names that begin with a full-stop “.”. These are discussed in detail in Chapter 7 of the GNU Assembler Reference; the list of directives presented here (in alphabetical order) are the more useful ones that you may need to use in your assembly language programs. .align Insert from zero to three bytes of 0x00’s so that the next location will be on a 4-byte (word) boundary. Remember, in particularly, that the ARM microcontroller must always access words (32-bit quantities) on a word boundary. As an example, the following three lines will insert eight bytes into the object file output, assuming that the first line is already on a word boundary: .byte .align .word 0x55 0xAA55EE11 ; inserts the byte 0x55 ; inserts three alignment bytes: 0x00 0x00 0x00 ; inserts the bytes 0x11 0xEE 0x55 0xAA (LSB order) At least when targeting the ARM microcontroller, although this so-called comment character may be different for other architectures. 1 –2– By the way, please note that the 0x prefix indicates the number is in hexadecimal. See the section on Expressions, later in this document, for more details. This assembler directive has optional arguments that are not documented here; if you need to use them, you are encouraged to use the .balign directive i...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online