First page Back Continue Last page Overview Text
The offset (IND in the above example) must be a constant and meaning that it cannot be changed during program execution. The assembler determines whether the constant needs to be a 5, a 9 or a 16-bit value. A 5-bit offset will generate the most compact instruction, but has a range of only –16 to +15. The 9-bit constant has a range of –256 to +255 and requires an extra byte. Any address value can be reached using the 16-bit constant.
A pointer can be moved through memory locations by incrementing an index register within the loop. In addition to working with index registers X and Y this addressing mode can be used with the stack pointer (SP) and the program counter (PC). When the SP or PC is the destination register with indexed addressing, the address value is loaded into the destination register.