Index register

From Computer History Wiki
Jump to: navigation, search

An index register is a register in a CPU which, duing the execution of an instruction, can be added to something else (perhaps a constant in the instruction, or sometimes another register) to produce the address of an operand in main memory. They are useful for walking along an array, applying some operation to all the elements in it.

In early computers, such addresses had to be computed 'manually'; in some very earliest computers, which could not use register contents as an address, it was necessary to use self-modifying code to process an array.

In early computers with index registers (such as the IBM 704 and descendants), they were special registers dedicated to this function; in modern computers, generally any of the machine's general registers can be used as an index register.