Question

3) (5) What value will the carry flag contain after these instructions: a) MOV R1,#3 MOVS R2, R1, LSR #1 b) MOV R1,#2 MOVS R2
0 0
Add a comment Improve this question Transcribed image text
Answer #1

3a)
MOV R1, #3        ;will move 3 into R1 i.e. R1 = 0x00000003
MOVS R2, R1, LSR #1   ;LSR #1 will logical shift R1 contents to Right. Carry flag is replaced by shifted out bit
           ;Hence Carry Flag = 1 after LSR instruction.
           ;MOVS R2, R1 will cause data move with Carry = 1 ("S" is used to affect flags)

b)
MOV R1, #2       ; Move R1 = 0x00000002
MOVS R2, R1, LSR #1   ; Logical shifting R1 right will shift out "0" in carry flag
           ; Carry flag remains = 0

4)

To affect the condition flags in CPSR, we need ADDS instruction instead of ADD

Add a comment
Know the answer?
Add Answer to:
3) (5) What value will the carry flag contain after these instructions: a) MOV R1,#3 MOVS...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 4. What will r0 and r1 contain after each of the following instructions? Consider the instructions...

    4. What will r0 and r1 contain after each of the following instructions? Consider the instructions in sequence. Give your answers in decimal format. mov r0,#1 @ r0 =_____________ mov r1,#0x30 @ r0= _____________ r1= _____________ orr r1,r1,r0 @ r0= _____________ r1= _____________ lsl r1,#0x2 @ r0= _____________ r1= _____________ orr r1,r1,r0 @ r0= _____________ r1= _____________ eor r0,r0,r1 @ r0= _____________ r1= _____________ lsr r1,r0,#3 @ r0= _____________ r1= ______________

  • Assume SP = 0x20001010 before the following instructions are executed: MOV R0, #0 MOV R1, #1 MOV ...

    Assume SP = 0x20001010 before the following instructions are executed: MOV R0, #0 MOV R1, #1 MOV R2, #2 PUSH {R0, R1, R2} After these instructions execute: What is the value of the SP? _________________ What is the value of the following memory locations (place X in the blank if it cannot be calculated): Address 32-bit Data 0x2000101C ____________ 0x20001018 ____________ 0x20001014 ____________ 0x20001010 ____________ 0x2000100C ____________ 0x20001008 ____________ 0x20001004 ____________ 0x20001000 ____________

  • ASSEMBLY CODE NEED ASAP WILL RATE RIGHT AWAY all Verizon 6:48 PM What will r2 contain...

    ASSEMBLY CODE NEED ASAP WILL RATE RIGHT AWAY all Verizon 6:48 PM What will r2 contain after the execution of the following instructions assuming that the instructions are executed independently? given that initially r2=0XFFFFFFFF r1=0xFF00FF00 and r0= 0xF7 1) MVN r2, 0x7E000000 2) EOR r2,rO,r1; 3) ROR r2,ro,#2; 4)MLA r2,r2,r2,rO 5) RRX, r2,r& initial carry flag =1 6) MOV r2,(14<<3) 7)ASR r2,r1,#1 8)LSL r2,r1,#3 9) LAR r2,r1,#3

  • Exercise 1 (9 pts) We have seen that ARM has 16*32 bits registers (plus floating point...

    Exercise 1 (9 pts) We have seen that ARM has 16*32 bits registers (plus floating point registers) There is also a status register: CPSR. It contains, among other things, the following important status bits N Negative, set when the result of an arithmetic operation is negative (according to the two's complement encoding of the natural numbers . Z- Zero, set when the result of an operation is zero . C Carry, set when an operation results in a carry bit...

  • What will be the value of the parity flag after the following lines execute? Mov al,...

    What will be the value of the parity flag after the following lines execute? Mov al, 3 Add al, 5 What will be the value of the destination operand after each of the following instructions execute?            .data var1 SBYTE     -1, -2, -3, -4 var2 WORD A000h, B000h, C000h, D000h var3 SWORD     -16, -42 var4 DWORD     11, 22, 33, 44 .code mov ax, var2 mov ax, [var2+4] mov ax, var3 mov ax, [var3-2]

  • Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at...

    Section B - ARM Assembly Language (25 marks) An ARM instruction set summary is provided at the end of this paper 1. (5 marks) Consider the following assembly instruction STMFD r13!, (r5-6} Before executing this instruction, registers hold the following values: Register Value Register r9 Value r4 0x00400040 0x00000000 r5 r10 0x11223344 0x00800080 r6 0x55667788 r11 0x10001000 r7 0x99aabbcc r12 0x20002000 r8 exddeeff00 r13 ex40004000 What memory locations are affected after executing the above instruction? In a table, with a...

  • 1. What will be the contents of BX after the following instructions execute? mov bx,5 stc...

    1. What will be the contents of BX after the following instructions execute? mov bx,5 stc mov ax,60h adc bx,ax 2. Describe the output when the following code executes in 64-bit mode: .data dividend_hi QWORD 00000108h dividend_lo QWORD 33300020h divisor QWORD 00000100h .code mov rdx,dividend_hi mov rax,dividend_lo div divisor 3. The following program is supposed to subtract val2 from val1. Find and correct all logic errors (CLC clears the Carry flag): .data val1 QWORD 20403004362047A1h val2 QWORD 055210304A2630B2h result QWORD...

  • 37. What is the binary value of AL after the following instructions have mov al,01101011b stc...

    37. What is the binary value of AL after the following instructions have mov al,01101011b stc rcl al,2 38. What is the binary value of AX after the following instructions have executed? mov ax, 0000000010011101b mov bx, 1010101010000000b shld ax, bx,1 39. What is the binary value of AX after the following instructions have executed? mov ax, 0000000010011101b mov bx, 1010101010001011b shrd ax, bx, 2 will be the hexadecimal values of DX and AX after the following instructions have executed?...

  • 3.13 If rl - OXEAD 11FD and r2 - 16, what is the value of 0...

    3.13 If rl - OXEAD 11FD and r2 - 16, what is the value of 0 after each of the following instructions has been executed (assume that each instruction uses the same data)? (a) ADD r0, rl, rl, LSL #2 (b) ADD YO, rl, rl, ASR #4 (c) ADD r0, ri, r1, ROR A?

  • 4. (5 marks) Suppose that r1=0xffffffff and r2=0x2. After an "add ri, r2" instruction in Thumb-2...

    4. (5 marks) Suppose that r1=0xffffffff and r2=0x2. After an "add ri, r2" instruction in Thumb-2 mode, what will be the values of r2, the negative (N) flag and the overflow (V) flag?

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT