2 pages
Problem 3- Addressing Modes and Stack
What value will be in register r4 after execution of the following instructions? Fill up the
given table at points 1, 2, 3, and 4. Show all your work to receive full credit. (15 points)
LDR sp, =0x10000000
LDR r0, =0x78
LDR r1, =0xAB
LDR r2, =0x49
STR r0, [sp, #-4]!
STR r1, [sp, #-4]!
STR r2, [sp, #-4]!
BL func
ADD sp, #12
SUB r4, r4, r0
stop B stop
func STMDB sp!, {r0-r2, lr}
LDR r2, [sp]
LDR r1, [sp, #8]
LDR r0, [sp, #4]
ADD r3, r1, r2
RSB r4, r1, r3
Address Value Check Point
0x1000 0000
Problem 4 - ARM Assembly Programming
Write an ARM assembly program to isolate the bits between lower (m) and upper (n)
indices and returns only those bits (from m to n-1). For instance if input data is
0x12345678 and the lower and upper indices are 3 and 12, the output data must include
bits 3 to 11 which is 0xCF. (15 points)
Note: Assume input data, m and n are in registers r0, r1, and r2 respectively and result
must be stored in register r3. Present your flowchart and comment your code.