Fill This Form To Receive Instant Help
Homework answers / question archive / Ques 1
Ques 1. SUB1 CMP r0,#0 ;test for x>0
MOVGT r0,r0, LSL #4 ;if x>0 x-16x
ADDGT r0,r0,#1 ; if x>0 then x=16x+1
MOVLE r0,r0, LSL #5 ; ELSE if x <= THEN x =32x
MOV pc,lr ;return by restoring saved PC
write an ARM assembly code to call SUB1,under the condition of r9<r4.Fully explain the code and also include comments.
Ques2. variable X is stored in memory location A. Variable Y is stored in memory location B.A is stored in register r5 and B is stored in register r6. Write an ARM assembly code to do Z=X+Y.You may decide the location of Z. X and Y are 31 bit integers (no need to consider overflow) . Explain your code by adding comments.
Ques3. If r0 contains 0000007816, r1 contains 000000EF16 , and r2 contains 1122334416,what is the value of r1 after each of the following ARM instructions? Treat each instruction separately and be sure to explain what it does (i.e. what does LSL do ,what does ROR do and etc).
a. ADD r1,r2,r2, LSL #16
b. ADD r2,r2,r0, LSL #8
c. MOV r2,r2.ROR #16