Indirect Data Register Operations
You can use indirect addressing with any data register operation.
Indirect Storing
The key sequence [ STO ] [ 2nd ] [ IND ] nnn or X stores the value in the numeric display register in the data register specified by the contents of register nnn or X.For example, if data register D contains 12, the key sequence 25 [ STO ] [ 2nd ] [ IND ] D stores 25 in data register 012.
Indirect Recalling
The key sequence [ RCL ] [ 2nd ] [ IND ] nnn or X recalls the data register whose address is stored in register nnn or X.For example, if data register D contains 12 and data register 012 contains 25, the key sequence [ RCL ] [ 2nd ] [ IND ] D displays the value 25.
Indirect Data Register Restrictions
Although you can use alpha addressing to specify the pointer register, the contents of the pointer register must be a numeric address, not an alpha address. For example, if you want to address register C indirectly, the pointer register must contain 2, not C.Example
Using indirect addressing, store 10 in register E. Then recall E indirectly and directly. Use register A as the pointer register.Procedure | Press | Display |
---|---|---|
Store IND pointer | 4 [ STO ] A | |
Indirectly store 10 in register 4 (E) | 10 [ STO ] [ 2nd ] [ IND ] A | |
Clear display | [ CLEAR ] | |
Recall E indirectly | [ RCL ] [ 2nd ] [ IND ] A | |
Recall E directly | [ CLEAR ] [ RCL ] E |
Why Use Indirect Addressing?
The power of indirect addressing may not be readily apparent when illustrated by a keyboard example, but it can be seen in programming applications. Indirect addressing enables a program to control which data register is referred to by a memory function. This is an enormous advantage when a series of similar operations must be performed on different registers.For example, you may have a programming problem that requires the entry and storage of a series of numbers. Without indirect addressing, you would solve this problem by including a separate STO instruction for each number you want to store, as illustrated below.
As you can see, this method for solving the problem makes a program long and cumbersome. By using indirect addressing, you can design a loop to solve this problem, as illustrated by the example below.
Example
Write a program that will store six data in registers 1 through 6. Use data register A as the pointer register.PC = | Program Mnemonics | Comments |
---|---|---|
0000 | 1 STO A | Initializes IND pointer register |
0003 | LBL ZZ | Labels segment |
0006 | `ENTER NUMBER` | Creates message |
0018 | BRK | Stops program for enter |
0019 | STO IND A | Stores entry indirectly |
0022 | INC A | Increments IND pointer register |
0024 | 7 IF= A | Is IND pointer = 7? |
0027 | HLT | Yes-stop program |
0028 | GTL ZZ | No-repeat loop |
Running the Example
Use the program to store the following values: 101, 102, 103, 104, 105, 106. Check the program by listing data registers 1 through 6 (with RPD-95, you can also use the register view to see contents of all registers on one screen).Procedure | Press | Display |
---|---|---|
Run program | 4 [ RUN ] { PGM } | |
Enter data | 101 { GO } | |
102 { GO } | ||
103 { GO } | ||
104 { GO } | ||
105 { GO } | ||
106 { GO } | ||
Register List View |
The register contents can also be viewed by pressing [ LIST ] 1 { REG }, and copied to the print listing by enabling the printer prior to listing the register values.
Indirect Memory Arithmetic
Indirect memory arithmetic lets you perform an arithmetic operation on a series of stored values or a computed register address.The indirect memory arithmetic functions are listed below.
Key Sequence | Operation |
---|---|
[ STO ] [ + ] [ 2nd ] [ IND ] nnn or X | Indirect Addition |
[ STO ] [ - ] [ 2nd ] [ IND ] nnn or X | Indirect Subtraction |
[ STO ] [ × ] [ 2nd ] [ IND ] nnn or X | Indirect Multiplication |
[ STO ] [ ÷ ] [ 2nd ] [ IND ] nnn or X | Indirect Division |
[ INCR ] [ 2nd ] [ IND ] nnn or X | Indirect Increment |
[ INV ] [ INCR ] [ 2nd ] [ IND ] nnn or X | Indirect Decrement |
Example
The following subroutine uses indirect multiplication (ST* IND) to multiply by 3 the contents of data registers 070 through 073.PC = | Program Mnemonics | Comments |
---|---|---|
0000 | LBL XX | Initializes IND pointer register |
0003 | 70 STO A | Labels segment |
0007 | LBL YY | Creates message |
0010 | 3 ST* IND A | Stops program for enter |
0014 | INC A | Stores entry indirectly |
0016 | 73 IF< A | Increments IND pointer register |
0020 | RTN | Is IND pointer = 7? |
0021 | GTL YY | Yes-stop program |
Running the Example
To test the subroutine, first store known values in data registers 070 through 073. Then run the program. When the program stops, use [ LIST ] 70 { REG } ( or switch to the RPD-95 Registers Value view ) to verify that the stored values have been multiplied by 3.☚ Back