Complete the code to declare an unsigned 8-bit integer in ARM assembly.
MOV [1], #255 ; Load maximum value for unsigned 8-bit integer
R1 is commonly used as a general-purpose register. Here, it holds the maximum unsigned 8-bit value 255.
Complete the code to sign-extend an 8-bit signed integer to 32 bits in ARM assembly.
SXTB [1], R2 ; Sign-extend byte in R2 to 32 bits
R0 is used here to store the sign-extended 32-bit value from the 8-bit value in R2.
Fix the error in the code to correctly compare a signed and unsigned integer in ARM assembly.
CMP R5, [1] ; Compare R5 with unsigned integer in R6
The comparison should be between R5 and R6 as R6 holds the unsigned integer.
Fill both blanks to create a mask for extracting the lower 8 bits of a 32-bit unsigned integer.
AND [1], R8, [2] ; Mask lower 8 bits
R9 is used as the destination register to store the masked result. The mask #0xFF extracts the lower 8 bits.
Fill all three blanks to correctly perform a signed right shift by 3 bits on a 32-bit signed integer.
ASR [1], [2], [3] ; Arithmetic shift right by 3 bits
R11 is the source register holding the signed integer. R12 is the destination register. The shift amount is #3 bits.
