1) An instruction is stored at location 300 with its address field at location 301.
The address field has the value 400. A processor register R 1 contains the
number 200. Evaluate the effective address if the addressing mode of the
instruction is (a) direct; (b) immediate; (c) relative; (d) register indirect;
(e) index with R1 as the index register.
The description given in the assignment can be represented like this:
Location _ Contents
300 _ opcode ;the instruction operation code
301 _ 400 ;address field of the above instruction
(a) direct addressing
Direct addressing means that the address field contains the address of memory location the instruction is supposed to work with (where an operand "resides").
Effective address would therefore be 400.
(b) immediate addressing
Immediate addressing means that the address field contains the operand itself.
Effective address would therefore be 301.
(c) relative addressing
Relative addressing means that the address field contains offset to be added to the program counter to address a memory location of the operand.
Effective address would therefore be 301 + 400 = 701.
(d) register indirect addressing
Register indirect addressing means that the address of an operand is in the register. The address field in this case contains just another operand.
Effective address would therefore be in R1 = 200.
(e) indexed addressing with R1 as index register
There are several possible indexed addressing modes but in this case (tehre is an address field) it is co called "indexed absolute" addressing.
In indexed absolute addressing the effective address is calculated by taking the contnts of the address field and adding the contents of the index register.
Effective address would therefore be 400 + R1 = 400 + 200 = 600
Comments
Leave a comment