The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
44 views

Assume that $EA = (X)+$ is the effective address equal to the contents of location $X$, with $X$ incremented by one word length after the effective address is calculated; $EA = +(X)$ is the effective address equal to the contents of location $X$, with $X$ incremented by one word length before the effective address is calculated; $EA = -(X)$ is the effective address equal to the contents of location $X$, with $X$ decremented by one word length before the effective address is calculated; ${EA = (X)-}$ is the effective address equal to the contents of location $X$, with $X$ decremented by one word length after the effective address is calculated. The format of the instruction is $(\text{opcode, } \text{destination, } \text{source})$, which means $(\text{destination } \leftarrow \text{ source } \: \text{ op } \text{destination})$ with address of source operand being evaluated before the address of destination operand. Using $X$ as a stack pointer, which of the following instructions can pop the top two elements from the stack, perform the addition operation and push the result back to the stack.

  1. $ADD \: (X)-, (X)$
  2. $ADD \: (X), (X)-$
  3. $ADD \: -(X), (X)+$
  4. $ADD \: -(X), (X)+$
asked in CO & Architecture by Boss (17.2k points)
edited by | 44 views

1 Answer

0 votes
$ADD \: (X), (X)-$
First sources operand is evaluated as $(X)-$ which takes the element at TOS and decrements the pointer by 1 element. Now $X$ points to second operand which is the destination operand itself. So just adding these two will do the job.
answered by Boss (17.2k points)
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,049 questions
53,194 answers
184,531 comments
70,402 users