End mark the end of this source code file everything

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: nforced by the GNU Assembler. Chapter 4 of the GNU Assembler Reference deals with this topic in greater depth. .end Mark the end of this source code file; everything after this directive is ignored by the assembler. Quite optional but highly recommended. You might find the following analogy helpful… Imagine that the executable file is a factory containing at least two output bins. Bytes (the goods being produced) come down a single conveyer belt and are dropped into a particular bin (a section). The .text and .data directives, then, are like workers that move the end of the conveyer belt back and forth between the two bins labelled .text and .data. 2 –3– .equ symbol, expression Set the value of symbol to expression. This assembler directive can also be specified as .set or as “=”. The following three lines are exactly identical, and set the value of adams to 42: adams .equ .set = adams, (5 * 8) + 2 adams, 0x2A 0b00101010 .extern symbol Specify that symbol is defined in some other source code file (ie, module). This directive is optional as the assembler treats any symbols that are undefined as external. It is, nevertheless, recommended as part of documenting a source code file. .global symbol Specify that symbol is to be made globally visible to all other modules (source code files) that are part of the executable, and visible to the GNU Linker. The symbol _start, which is required by the GNU Linker to specify the first instruction to be executed in a program, must always be a global one (and only present in one module, of course). .hword expression … .2byte expression … Insert the (16-bit) half-word value of the expression into the object file. More than one expression may appear, if separated by commas. The directive .2byte can be used as a synonym. As an example, the following lines insert 8 bytes into the object file output: .hword .2byte 0xAA55, 12345 0x55AA, -1 ; inserts the bytes 0x55 0xAA 0x39 0x30 ; inserts the bytes 0xAA 0x55 0xFF 0xFF ; Least Significant Byte (LSB)...
View Full Document

This test prep was uploaded on 03/30/2014 for the course CGS 1000 at Hillsborough.

Ask a homework question - tutors are online