Example Test Questions - SUB R1,R1, #1 CMP R1, #0 BNE LOOP...

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

View Full Document Right Arrow Icon
Example Test Questions 1. Write a program for the ARM processor to add a list of 5 32 bit unsigned words and store the sum in a word variable. Your program should zero a 32 bit variable in memory if the result is not valid or set it equal to 1 if valid. Explain what can happen to produce an incorrect sum, buy giving an example of such a list. Marks will be given for useful comments as well as for the code. 2. Explain in detail what the code below does. For full credit you must write a useful comment for each line of the program, and explain the overall operation of the program. .text .global _start _start: LDR R1,=SIZE LDR R1,[R1] LDR R2,=VEC MOV R0, #0 LOOP: LDR R3,[R2] ADD R0,R0,R3 ADD R2,R2 ,#4
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: SUB R1,R1, #1 CMP R1, #0 BNE LOOP LDR R1,=TOT STR R0, [R1] DONE: B DONE .data .align SIZE: .word 3 VEC: .word 3, -1, 2 TOT: .skip 4 .end 3. Assume the following register memory contents in an ARM computer: Register R0 contains 1000 Register R1 contains 2000 Register R2 contains 1016 Register R6 contains 20 Register R7 contains 30 The numbers 1, 2, 3, 4, 5, and 6 are stored in successive word locations starting at memory address 1000. What is the effect of executing each of the following two short instruction blocks starting each time from the given initial values? (A) LDR R8, [R0] LDR R9, [R0,#4] ADD R10,R8,R9 (B) STR R6,[R1,#-4]! STR R7,[R1,#-4]! LDR R8,[R1],#4 LDR R9,[R1],#4 SUB R10,R8,R9...
View Full Document

This note was uploaded on 12/20/2010 for the course CSC CSCC85 taught by Professor Lorincz during the Spring '10 term at University of Toronto- Toronto.

Page1 / 2

Example Test Questions - SUB R1,R1, #1 CMP R1, #0 BNE LOOP...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online