{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

C85Quiz2Prob-29FSol

# C85Quiz2Prob-29FSol - CSC C85 2008F Problems for Quiz2 Nov...

This preview shows pages 1–2. Sign up to view the full content.

CSC C85 2008F Problems for Quiz2 Nov. 26 in LECTURE. Chap. 8 8.4, 8.9, 8.10 Chap. 10 10.2, 10.3, 10.4, 10.9 8.4 .text .global _start _start: LDR r2,= Values LDR r4, [r2] @load 1 st value for comparison MOV r0, #50 Loop: LDR r3, [r2] CMP r3, r4 @ current > previous max ? MOVGT r4, r3 @ if so, new max SUBS r0, r0, #1 @ decrement counter, set flags ADD r2, r2, #4 @ increment pointer BNE Loop LDR r2,= Max STR r4, [r2] Done: B Done .data .align Values: .word 1, 2, 4, 5, 6, 7, -8, 11, 23, 100 .word 4, 5, 6, 2, 3, 4, 5, 13, 45, 200 .word 5, -4, 888, 2, 1, 2, 7, 88, 45, 444 .word 3, 4, -5, 1, 0, 2, 0, 23, -23, 111 .word 3, 4, 5, 6, 7, -8, 9, 33, 22, 666 Max: .skip 4 .end 8.9. Translate the following conditions into a single ARM instruction: a. Add registers r3 and r6 only if N is clear. Store the result in register r7. ADDPL r7, r3, r6 b. Multiply registers r7 and r12, putting the results in register r3 only if C is set and Z is clear. MULHI r3, r7, r12 c. Compare registers r6 and r8 only if Z is clear. CMPNE r8, r8 8.10 foo: ADDS r0, r0, r1 @ r1 = x + y, setting CCs MOVPL r0, #1 @ return 1 if n bit = 0 MOVMI r0, #0 @ return 0 if n bit = 1 MOV

This preview has intentionally blurred sections. Sign up to view the full version.

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

{[ snackBarMessage ]}

### Page1 / 3

C85Quiz2Prob-29FSol - CSC C85 2008F Problems for Quiz2 Nov...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online