63 views

The memory locations $100, \: 200, \:300$ and $400$ have data values $200,\: 400,\: 100$ and $300$ respectively before the following program is executed.
Note that instructions with an $I$ in the end of an operation use immediate values of operands. The structure of instructions is as follows:
$OPCODE\:\: RESULT, \:\: OPERAND1,\:\:OPERAND2\:\:OPERAND3...$
where $RESULT$ is the register which stores the result of the operation $OPCODE$ performed on $OPERAND1$, $OPERAND2$, $OPERAND3$ and so on. Number of operands may vary based on type of instruction.

$\text{MOVI } R_1, \: 400$
$\text{MOV } R_2, \:300$
$\text{ADDI } R_2, \:R_2, \:200$
$\text{SUB }R_2, \:R_2, \:300$
$\text{SUB }R_1, \:R_1, \:R_2$
$\text{STORE } 100(R_1), \:R_2$

Which of the statements below is not TRUE after the program is executed ?

1. Memory location $100$ has value $200$
2. Memory location $200$ has value $200$
3. Memory location $300$ has value $200$
4. Memory location $400$ has value $300$
edited | 63 views

$R_1$ contains immediate value 400. $R_2$ contains value 100 stored at address 300.
Addition operation adds value 200 to content of $R_2$ which is :
$R_2 = 100+200=300$
Subtract operation subtracts value 100, stored in location 300, from $R_2$, so $R_2$ contains 200.
Next subtract operation sets $R_1=R_1-R_2= 400-200=200$
STORE operation stores value of $R_1=200$ in memory location $100+200=300$.
Thus Content of location 300 is changed to 200, rest all locations have their contents unchanged.
Thus address 100 and address 300 contain 200, address 200 contains value 400 and address 400 contains value 300.
answered by Boss (17.2k points)
0

For 100(R1), R2

EA= 100 + [R1] = 100 + [200] = 100 + 400 = 500. getting 500 . :(

@GATEBOOK @Manoja Rajalakshmi A where am I doing mistake?

+1

$STORE$ $100(R1),R2$

Here contents of $R2$ is stored in $100(R1)$.

Effective address of destination, $EA=100+$contents of register $R1$. Here contents of $R1$ is $200$. So effective address of dest. operand is $100+200=300$. Value in $R2$ , ie $200$ is stored in memory address $300$.

$[ R1]$ means contents of register $R1$.

$100[R1]$ is register indirect mode of addressing with an offset.

You have wrongly used register indirect mode- but the addressing mode you have used is called "Autoindexing Post-indexing Addressing Mode"

0
Thanks. :)

1
2