Question: .thumb .text .align 2 .global main ; ------------------------------ main: ; while(1) ; { mov r0, #045h ; r0 = 0x45; // value to test mov

.thumb .text .align 2 .global main

; ------------------------------

main: ; while(1) ; {

mov r0, #045h ; r0 = 0x45; // value to test mov r1, #01234h ; r1 = 0x1234; // where the answer goes nop

mov r2, #041h ; if( r0 >= 0x41 && r0 <= 0x5a ) cmps r0, r2 ; { blt linus ; mov r2, #05ah cmps r0, r2 bgt linus

mov r1, #0ffffh ; r1 = 0xffff;

B lucy ; } ; else linus: ; {

mov r1, #0 ; r1 = 0;

; } lucy:

nop

B main ; } // end while(1)

; ------------------------------------------------------------ ; Final catch-all at the end of our code, just in case

hang_forever: nop B hang_forever

; ------------------------------

.end

; ------------------------------------------------------------ ; Lab Questions: (put your answers here in comments) ; ; 1. What is the purpose of a loop such as the "hang_forever" loop ; at the end of this program. In this particular program, it is ; redundant and never should execute. But in an embedded application, ; why is it important to never let the program execution leave your ; source code? ; ; ; 2. What is the meaning of the numerical values 0x41 and 0x5a? ; ; ; 3. Given the meaning of these values, what would be a clearer way ; write the if() statement in the comments? ; ; ; 4. Given the meaning of these values, what is the meaning of the ; results placed in register r1? ; ; ; 5. Is the variable in r0 treated as a signed or unsigned value? ; Which one should it be treated as? Does it matter? ; ; ; ------------------------------------------------------------ ; ------------------------------------------------------------

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!