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 pointer4
[ STO ] A
D_t8f1BQ
Indirectly store 10 in register 4 (E)10 [ STO ]
[ 2nd ] [ IND ]
A
D_AxhAHB
Clear display[ CLEAR ]D_dAstlh
Recall E indirectly[ RCL ]
[ 2nd ] [ IND ]
A
D_AxhAHB
Recall E directly[ CLEAR ]
[ RCL ] E
D_AxhAHB



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.

whyindirect

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 AInitializes IND pointer register
0003LBL ZZLabels segment
0006 `ENTER NUMBER`Creates message
0018 BRKStops program for enter
0019 STO IND AStores entry indirectly
0022 INC AIncrements IND pointer register
0024 7 IF= AIs IND pointer = 7?
0027 HLTYes-stop program
0028 GTL ZZNo-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 program4
[ RUN ]
{ PGM }
D_zPswMe
Enter data101 { GO }D_zPswMe
102 { GO }D_zPswMe
103 { GO }D_zPswMe
104 { GO }D_zPswMe
105 { GO }D_zPswMe
106 { GO }D_tvPW3D

Register List Viewregviewlist

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 XIndirect Addition
[ STO ] [ - ] [ 2nd ] [ IND ] nnn or XIndirect Subtraction
[ STO ] [ × ] [ 2nd ] [ IND ] nnn or XIndirect Multiplication
[ STO ] [ ÷ ] [ 2nd ] [ IND ] nnn or XIndirect Division
[ INCR ] [ 2nd ] [ IND ] nnn or XIndirect Increment
[ INV ] [ INCR ] [ 2nd ] [ IND ] nnn or XIndirect 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

0000LBL XXInitializes IND pointer register
0003 70 STO ALabels segment
0007LBL YYCreates message
0010 3 ST* IND AStops program for enter
0014 INC AStores entry indirectly
0016 73 IF< AIncrements IND pointer register
0020 RTNIs IND pointer = 7?
0021 GTL YYYes-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