addressing modes Flashcards
opcode consists of
binary digits representing basic operation eg ADD/LOAD and 2 digit code/bit pattern representing addressing mode
immediate addressing
operand is the actual value to be operated on (eg LDA #5)
direct addressing
operand holds the memory address of the value to be operated on, data hardcoded into instruction (only addressing mode used in LMC assembly language) (eg LDA 5)
indirect addressing
operand is the location (typically register) which holds address of data we want. (eg LDA (5)) starting address stored in block of memory ie index table
uses of indirect addressing
Enables a larger range of addressable locations and allows calling routine whose starting point may move eg if x = 1009. store 1009 at 4000 and go via BRA 4000. if routine moves from 1009, only change contents of 4000
indexed addressing
address of the operand is obtained by adding a constant value/address to the contents of a general register aka INDEX REGISTER. constant val and the number of the index register are in the instruction code
index addressing use
to access an array whose elements in successive memory locations
useful for a table of routine start addresses
immediate addressing adv and uses
- uses no memory, so fastest
- used when using a constant rather than variable
direct addressing adv, disadv and uses
-fast (not as fast as immediate)
BUT -code depends on correct data always being present
uses: computers only running single program eg engine management computer so good for quick access too
indirect addressing uses
if loader loads software libraries in different memory location each time when program is loaded