Section 8.5
Review Questions

How Indirect Addressing Works

  1. Which types of data would use LOD and STD instructions? Circle all that apply.
          scalar               array                  struct              object
answer...
scalar
  1. Which types of data would use LDS and STS instructions? Circle all that apply.
          scalar               array                  struct              object
answer...
array, struct, object
  1. Which register holds the address of the data as the LDS or STS instruction is executing?
answer...
S
  1. Which register must be used for address arithmetic?
answer...
A
  1. Look at the following picture and then execute the 3 machine instructions beginning at 500. Show the values in the registers at the end.
answer...
A=  1000
S=  2500
IR= LDS
PC= 503
MBR=1000
MAR=2500
  1. Look at the following picture and then execute the 3 machine instructions beginning at 500. Show the values in the registers at the end.
answer...
A=  1000
S=  1000
IR= STS
PC= 503
MBR=1000
MAR=1000
  1. Suppose you are working on a computer that does not have LDS and STS so it must actually rewrite instructions like "LOD 2500" in order to access successive elements of an array. What do we call such programs? And are they used nowadays?
answer...
self-modifying programs; they are almost never used anymore
  1. Why are arrays dangerous in most computers?
answer...
because a buggy program can go outside the bounds of the array and "clobber" other sections of memory by mistaking those regions for words in the array