Question: Question 1 ( 2 0 points ) The following program implements a stack that grows down toward high memory addresses as items are pushed, and
Question points
The following program implements a stack that grows down toward high memory addresses as items are pushed, and the stack pointer points to the top item on the stack.
ENTRY
LDR SPSTACK
MOV r #x
MOV r #x
PUSHR instruction
PUSHR instruction
POPR instruction
POPR instruction
Loop B Loop
space
STACK DCD x
space
END
AREA prog, CODE, READWRITE
Using ONLY LDRSTR instructions:
Write one instruction instruction to push the value of RO onto the stack.
Write one instruction instruction to push the value of R onto the stack.
Write one instruction instruction to pop from the stack a value and to save it in RO
Write one instruction instruction to pop from the stack a value and to save it in R Make sure that the values of R and R are swapped after these operations.
What are the instructions you used?
Write your answer ie the instructions in TWO parts, the mnemonic in a box and ALL operands in another box.
To facilitate automatic marking,
Use CAPITAL letters ONLYexcept x make it a small letter.
Do NOT leave ANY spaces between operands.
The mnemonic of the st instruction is:
The operands of the st instruction are:
The mnemonic of the nd instruction is:
The operands of the nd instruction are:
The mnemonic of the rd instruction is:
The operands of the rd instruction are:
The mnemonic of the th instruction is:
The operands of the th instruction are: How many elements can be pushed onto this stack?
Encode the st instruction to ARM machine language code. Write your answer as eight hexadecimal digits, each digit in a box. x
A A A A A A A A A A A A A A
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
