Assembly Stack machine: Exercise with Push/Pop

355 Views Asked by At

Assume address 100 holds the value 7 and address 200 holds the value 3, explain the instruction cycle for the arithmetic instruction sub using Von Neumann Machine definition.

push[100]
push[200]
sub
pop[500]

I know the answer is

  • push[100] so Top of the stack is 7 , as the value in address 100 is 7
  • push[200] so Top of the stack is 3, as the value in address 200 is 3.
  • sub so you subtract 7 minus 3 i.e do (7-3) and 4 will be stored in stack address 500.
  • pop[500] so you pop the value contained in address 500. so 4 will be popped and returned."

I wanted to ask why the 4 would be stored in address 500?

0

There are 0 best solutions below