retagged by
2,898 views

3 Answers

Best answer
5 votes
5 votes
The question asks for the effective address of the memory operand and so it must be the main memory address (in case virtual memory is used; the virtual address from where the operand is to be fetched)

1. LOAD 20(R1), R5

Here the first operand is using indexed addressing and EA = 20 + R1 = 20 + 1200 = 1220. From the instruction it is clear that the second operand is the destination, but that is not important in answering here.

2. MOVE #3000, R5

Immediate addressing for #3000. So, the EA is the address of the given instruction plus the opcode part size.

3. STORE R5, 30(R1,R2)

Base indexed addressing mode for second (destination) operand. EA = 30 + R1 + R2 = 30 + 1200 + 4600 = 5830.

4. ADD -(R2), R5

Decrement addressing mode. EA = R2 - 1 = 4599.

5. Subtract (R1)+, R5

Increment addressing mode. EA = R1 = 1200. (R1 changes to 1201 after this instruction).
selected by
2 votes
2 votes

Registers R1 and R2 of a computer contain the decimal values 1200 and 4600, we have to find effective adress of associated memory operand in each instruction:

 Load 20(R1),R5 : This means load 20+R1 into R5 .   R1= 1200 , R1 + 20 = 1220 , so R5 have 1220 , Effective address of R5 is 1220.


 Move #3000,R5 : This means move value 3000 into R5 , so effective address is part of the instruction whose value is 3000.

Now R5 = 3000


 Store R5,30(R1,R2) : This means 30+R1+R2 and store the result into R5 . so R5 = 30+1200+4600 =  5830 , so now R5 value is 5830 , the effective address is 5830.


 Add -(R2),R5 : This means -1 from  R2 value and store the result into R5 . So R5= 4600 - 1 = 4599 , effective address of R5 is 4599 .


 Subtract (R1)+,R5 : This means effective address is contents of R1 so EA = 1200 .

Effective addresses are 

  1. 1220
  2. 3000   [ it is not EA,  it is the address of the instruction part where 3000 is stored ] 
  3. 5830
  4. 4599
  5. 1200
edited by
0 votes
0 votes

R1=1200                            R2=4600

1. LOAD 20R1,R5 (copy the data from memory into a register.)

R5=1220      (20+1200)

2.MOVE #3000,R5 (COPY 3000 INTO R5)

Now,R5=3000

3.STORE R5,30(R1,R2)

it will add the contents of R1 and R2 ,also add offset 30(1200+4600+30)

Now R5=5830

ADD -(R2),R5

it will first decrement R2 content by 1 then add with R5 content 

R5=4599+5830=10429

SUBTRACT (R1)+,R5

it will first increment the content of R1 then subtract will perform

R5=9228

FINAL VALUE OF REGISTERS WILL BE 

R5=9228                       R1=1200                            R2=4600

Related questions

0 votes
0 votes
0 answers
2
0 votes
0 votes
1 answer
3
0 votes
0 votes
0 answers
4
aditi19 asked Nov 20, 2018
330 views
what is the approach to this problem? also, what will be the solution for little endian notation?