{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

370ARMExamples

# Arm comparison instructions most arithmeticlogic

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: - Fill bits with zeroes. - 0b1001 logical shift right by 2 - > 0b0010 - mov r0, r1, lsr r2 // r0 = r1 >> (r2 & 0xFF); // r1 declared as unsigned; - mov r0, r1, lsr #2 // r0 = r1 >> 2; // r1 declared as unsigned; - Arithmetic Shift Right - Constant shift value will be in the range 1- 32. - Fill bits with sign bits. - 0b1001 arithmetic shift right by 2 - > 0b1110 - mov r0, r1, asr r2 // r0 = r1 >> (r2 & 0xFF); // r1 declared as signed; - mov r0, r1, asr #2 // r0 = r1 >> 2; // r1 declared as signed; - Rotate Right - Constant shift value will be in the range 1- 31. - mov r0, r1, ror #4 // If r1 == 0xABCD EF01, // then r0 = 0x1ABC DEF0; 7. ARM Comparison Instructions - Most arithmetic/logic instructions with a S suffix and compare instructions can set PSR(Program Status Register). - Four flags can be set: - N set if the result is negative. - Z set if the result is zero. - C set if last addition/subtraction had a carry/borrow out of bit 31 - V set if last addition/subtracti...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online