Bird
0
0

What will be the value of SP after executing these instructions if SP initially is 0x1000?

medium📝 Analysis Q5 of 15
ARM Architecture - Subroutines and Stack
What will be the value of SP after executing these instructions if SP initially is 0x1000?
PUSH {R4, LR}
SUB SP, SP, #16
A0x0FF0
B0x0FE8
C0x0FF8
D0x0FE0
Step-by-Step Solution
Solution:
  1. Step 1: Calculate SP after PUSH {R4, LR}

    PUSH of 2 registers decreases SP by 8 bytes (4 bytes each): 0x1000 - 0x8 = 0x0FF8.
  2. Step 2: Calculate SP after SUB SP, SP, #16

    Subtract 16 bytes: 0x0FF8 - 0x10 = 0x0FE8.
  3. Final Answer:

    0x0FE8 -> Option B
  4. Quick Check:

    SP final = 0x1000 - 8 - 16 = 0x0FE8 [OK]
Quick Trick: Each register PUSH subtracts 4 bytes from SP [OK]
Common Mistakes:
  • Adding instead of subtracting SP
  • Miscounting bytes per register
  • Ignoring order of instructions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More ARM Architecture Quizzes