Difference between revisions of "Indirect Mode"
m (Protected "Indirect Mode" ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite)))
Latest revision as of 08:38, 4 December 2010
Indirect Mode instructions read (or write) one of their arguments from memory, at an address pointed to by one of the pointer registers: R1, R2, R3, R4, R5, and R6. Immediate Mode is closely related to Indirect Mode. Indeed, it appears that Immediate Mode is actually Indirect Mode through R7 (the program counter). Thus, R0 is the only register which may not hold a pointer value for Indirect Mode accesses.
Indirect Mode instructions ordinarily access one word at the specified location. The Double Byte Data Flag modifies instructions that read memory, causing them to make two reads via the selected pointer register.
When used for indirection, registers R1 through R3 are "non-incrementing" registers, whereas R4, R5 and R7 are "auto-incrementing." That is, indirect accesses through R1, R2 or R3 leave the indirect register's value unchanged. Indirect accesses through R4, R5 or R7 increment the indirect register's contents once for each access. This makes stepping through an array convenient.
Register R6 is special. GI documentation refers to Indirect reads via R6 as Stack Mode accesses. Indirect reads through R6 pre-decrement the value of R6. That is, the machine decrements the value in R6, and then accesses the location pointed to by the new value. This process adds three (3) cycles to a Stack Mode read. Indirect writes through R6 auto-increment in the same manner as R4, R5 and R7. This behavior makes R6 very convenient as a stack pointer.
The following instructions are Indirect Mode instructions: