Question: Q10: Consider the following problem: writing an assembly code to check the value of a signed variable x, if x>20 && x <25 then y=5
Q10: Consider the following problem: writing an assembly code to check the value of a signed variable x, if x>20 && x<25 then y=5 otherwise>
Do you think that the following code can be used to solve this problem? Explain?
AREA mycode, CODE, READONLY EXPORT asm_main
asm_main
LDR r0,=x;
LDR r1,=y;
LDR r2,[r0]
CMP r2,#20
CMPGT r2,#25
MOVLT r3,#5
MOVGE r3,#-5
STR r3,[r1]
AREA mydata, DATA, READWRITE
x DCD 12
y DCD 0
END
Q11: The assembly codes shown in parts a and b below perform the same task. Briefly explain the task, and highlight the approach used to perform the task by each part. a) TST r0, 0x01 ADDNE r1, r1, #1 b) LSRS r0, r0, #1 ADDHS r1, r1,#1
Q12: Do the assembly codes shown in parts (a) and (b) below perform the same task? Explain. a) TST r0, (1<<13) ADDNE r1, r1, #1 b) TEQ r0, (1<<13) ADDEQ r1, r1, #1
Q13: Write an assembly code to check the number stored in register r1, if it is even then store 0x12 in register r2, if it is odd then store 0x10 in register r2.
Q14: Suppose that registers r0 and r1 contain values as shown below r0 0b1010 1101 0001 0000 0000 0000 0000 0010 r1 0b0011 1111 1111 1000 0000 0000 0000 0000 What would be the content of register r2 after the execution of the following instructions? MOV r2, #0 CMP r0,r1 BGE else B done else MOV r2, #2 done
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
