Difference between revisions of "Index register"

From Computer History Wiki
Jump to: navigation, search
m (+cat)
m (typo)
Line 1: Line 1:
 
An '''index register''' is a [[register]] in a [[Central Processing Unit|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]].
 
An '''index register''' is a [[register]] in a [[Central Processing Unit|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.
+
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 register]]s can be used as an index register.
 
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 register]]s can be used as an index register.
  
 
[[Category: Hardware Basics‎‎]]
 
[[Category: Hardware Basics‎‎]]

Revision as of 04:15, 13 December 2018

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.