First page Back Continue Last page Overview Text
We can use the assembler storage directive dc.b to create program variables. The variable name is placed in a label in the assembler label field. This label is then assigned by the assembler and linker to a location in memory at which the value of the variable is stored. Since only one byte per value is allocated by the directive dc.b, unsigned values are limited to a range from 0-255.
Although it is possible to write assembly code and manually assign fixed values to storage locations (e.g. ldaa 15) using variables allows us to ignore the details of address assignments. Variables are automatically assigned to memory locations using the next sequential memory location available. The addresses assigned to variables are offset addresses since the linker assigns absolute addresses to the variables when it links all of the program modules together.
The following code loads the value located in location gain into register A.
What would happen if the following were attempted?