Indirect Mode

From Intellivision Wiki
Revision as of 22:23, 14 January 2005 by Mr z (talk | contribs)
Jump to: navigation, search

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. 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. 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: