CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

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 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 (opcode, source, destination), which means (destination source opdestination). 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.

A
ADD -(X), (X)+
No worries! We‘ve got your back. Try BYJU‘S free classes today!
B
ADD (X), (X)-
No worries! We‘ve got your back. Try BYJU‘S free classes today!
C
ADD -(X), (X)
No worries! We‘ve got your back. Try BYJU‘S free classes today!
D
ADD (X)-, (X)
Right on! Give the BNAT exam to get a 100% scholarship for BYJUS courses
Open in App
Solution

The correct option is D ADD (X)-, (X)
EA = (X) + works as post increment

EA = -(X) works as pre-decrement

EA = (X) - works as post decrement

To add top 2 elements:

1. Pop (Top) Pop (X) a


2. Then decrement X i.e., X = X - 1


3. Pop (Top) = Pop (X) b



Add a + b and push at address of X.

Which is implemented by ADD (X)-, X.

flag
Suggest Corrections
thumbs-up
0
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Contributions to Mathematics
HISTORY
Watch in App
Join BYJU'S Learning Program
CrossIcon