in CO and Architecture
641 views
0 votes
0 votes
Zero address instructions are stack instructions

let the instructions be

PUSH #3

PUSH #5

ADD  ------------ Add's top 2 elements of stack and stores the result in top of stack

what if initially stack is empty and

PUSH #3

ADD ---------Then what elements are added ???

If I'm wrong Please correct me
in CO and Architecture
641 views

1 Answer

0 votes
0 votes
ADD IS A BINARY OPERATOR ..MUST NEED TWO INPUT TO ADD....HOW CAN WE ADD WITH ONE ELEMENT
by

3 Comments

Thats what I'm asking what would be the result
0
0
will it add with 0 ??
0
0
What "ADD" does is as specified by the architecture.
@shivani no- it won't do that. It will just take wrong value from stack - say stack is assigned to be read from memory location 4000 and is growing up, then this will read from location 3996 (assuming 4 byte operand).
1
1

Related questions