|
which is then copied into the A register to complete the instruction:
It is very important to realize that what has just occurred, the three instructions shown above, is equivalent to a single "LOD 2500." However, the "LOD 2500" instruction is fixed and cannot load from 2501, or 2502, as would be needed if this program were working through an array. The 3 instruction program that uses LDS could work through an array by changing the value at location 1000, to be 2501, then 2502, and so forth. We say that location 1000 is a pointer variable. Some very old computers actually did change their load instructions. In this example, it would be as if the program went back and rewrote the lower 12 bits of the "LOD 2500" instruction so that it said "LOD 2501", then "LOD 2502," and so forth. In this way they were able to process an array. However, the program was altered permanently and could not be reused without changing the LOD instruction back to its original value, something that was too easy to forget to do! Hence, self-modifying programs quickly fell out of favor. |