ARM7 Assembly Language assignments (1)

Problem 1 

 

I. What value will be in register r2 after execution of the following instructions? Show your work. (10 points)

 

MOV      r2, #0x0              

LDR       r1, =0xCF                           

MOVS   r1, r1, LSR #1                   

ADC       r2, r2, #0                            

MOVS   r1, r1, LSR #1                   

ADC       r2, r2, #0                            

 

 

 

 

 

 

 

 

 

 

II. What value will be in register r12 after execution of the following instructions? Show your work. (15 points)  

 

LDR     r0, =0xA4000000     

LDR     r1, =string                 

 

start                LDRB r2, [r1], #1                

CMP    r2, #0                         

BEQ     finish                          

STR     r2, [r0, #-4]!             

B          start

 

Finish              LDR     r12, [r0, #8]

 

string              DCB     "4mce6Qdkhk",0

 

 

 

 

 

 

 

 

 

III. Translate the following C code fragment to ARM assembly instruction. Assume a, b, c, d, x, and y are memory addresses. (15 points)

           

if (a < b)

{ x = 5;

  y = c + d; }

else

  x = c - d;

 

 

 

 

 

 

 

 

 

--------------------------------------------------------

 

IF you can solve  each problem clear step by step let me know

Field of study: 
No answers yet