Chapter 8 Writing Source Statements

8.6Location Counter

The assembler contains an variable for counting addresses of instructions. This variable is called the location counter. Each time the assembler converts an instruction to machine language, it increments the location counter by the number of words in that instruction.

Location counter values are first set during linking for each section defined by the section directive, so location counter values during assembly will not necessarily match the addresses assigned to instructions during execution. Location counter values during execution will be offset values from the start of each section.

The address of the current instruction can be coded as an asterisk (*). This asterisk is called the self- reference address symbol. By using a self-reference address symbol in the operand field of a source statement, you can reference the address assigned to that statement during execution.

136 Location Counter

Page 148
Image 148
Panasonic MN1030 user manual Location Counter