Indirect Addressing

Top  Previous  Next

 

You do not have to specify the operands finally while writing your program, but you can specify them while runtime. This will be useful if always returning operations with different operands are to be executed. If you have, for example, saved 14 recipes in the data blocks DB 1 -14 and the number of the current recipe is saved in MW 20, you will program:

 

       OPN DB[MW 20]

 

If there is a 5 in MW 20 the DB 5 will be opened by this instruction and the program works in the following with the recipe which is saved in it. You call this procedure ‘Memory Indirect Addressing’ because the index in the square brackets can be any memory place.

 

For indirect access to separate bits one word is not enough because of the big address area of inputs, outputs, markers and data bits of 65536 each, because one bit is already needed for the specification of the byte address. For the indirect addressing of these data areas a double word is needed. For reasons of unity this will also be valid if bytes, words or DWords are accessed. To code the bit number the three less significant bits of the DWord are used. Because of the fact that these bits are not available for the byte number this one is multiplicated with 8 and added to the bit number. In the result all bits of a data area are numbered all the way through

 

       Bit 0.2        gets the number       2    hex 0000 0002

       Bit 1.0        gets the number       8    hex 0000 0008

       Bit 8.3        gets the number      67    hex 0000 0043

 

In practise you will not have to care about these details if you use the POINTER-Format, then you just program:

 

      L      P#8.3

      T      MD 24

      A      Q[MD24]

 

to access the output Q 8.3.

 

See also:

Register-Indirect-Addressing