90 likes | 177 Views
Addressing. Sample Question. Three addressing modes. Immediate Not an address. Use this number as it is. Direct Treat this number as an address, use the value that is at that address. Indirect
E N D
Three addressing modes • Immediate • Not an address. Use this number as it is. • Direct • Treat this number as an address, use the value that is at that address. • Indirect • Treat this number as an index. Go to that address, find the address in that location, then use the number pointed by that.
Immediate addressing Accumulator LDA #99 99 MemoryOMatic
Immediate addressing Accumulator LDA #99 99 MemoryOMatic
Direct addressing LDA 99 Accumulator 145 MemoryOMatic
Indirect addressing LDA (99) Accumulator 145 MemoryOMatic Indirect addressing may be used for code or data. It can make implementation of pointers or references or handlesmuch easier, and can also make it easier to call subroutines which are not otherwise addressable. Some early minicomputers (e.g. DEC PDP-8, Data General Nova) had only a few registers and only a limited addressing range (8 bits). Hence the use of memory indirect addressing was almost the only way of referring to any significant amount of memory.
Indexed addressing X LDA 99 (X) Accumulator 10 333 MemoryOMatic
Example use of Indexed Addressing LDA #0 ;load 0 to acc LDX #0 ;load 0 to x LOOP STA TABLE(X) ;store acc in table+x INX ;increment x CPX #99 ;compare x with 99 BNE LOOP ;branch if not equal What does this do?