Question

Addressing modes example

When the instruction LOAD 800 is fed I understand how the other values are loaded into the accumulator but I don't know how you get the results for indexed and indirect addressing.

Était-ce utile?

La solution

Not sure which architecture you're discussing so I'll just explain generically as best I can (based on experience wtih more concrete architectures, and investigative analysis of the stuff shown in the graphic you posted).

  1. Immediate mode means use the immediate value, so something like load r2, #800 would put the immediate value 800 into register 2.

  2. Direct means direct memory access, so something like load r2, 800 loads the value from memory address 800, and that value is 900.

  3. Indirect means indirect memory access, so something like load r2, (800) loads the value from the memory address at memory address 800. The memory address at 800 is 900 and the value at 900 is 1000.

  4. This one is a register/base-address combination like load r2, (r1,#800). What that would do would be to add register 1 and the immediate value 800 (to get 1600) then grab the value from that memory location, giving 700.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top