


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Midterm of Doug's midterm exam 2023 for fall term.
Typology: Exams
1 / 4
This page cannot be seen from the preview
Don't miss anything!
8b. Using only the STANDARD PROGRAM STRUCTURES shown in text Figure 3-15, write the ALGORITHM/task list for a simple program that calculates the rounded average of the 8 values and puts the result in the memory location you have created for the average. As always, simply think of the initializations and the steps you would take, if you were doing it with pencil and paper.
. Initialize pointer to WTRF array R Initialize pointer to DayAv memory location R Initialize counter to 8 since 8 elements R Initialize Sum to zero to act as accumulator R Repeat Read half word from WTRF and INC pointer to next value in WTRF Add to value read from WTRF to sum Decrement counter Until all 8 elements of WTRF added Divide sum by 8 to get average (shift right 3 bit positions, 8 is power of 2?) Round average Write average to DayAv memory location 8c. Show the assembly language instructions you would use to initialize pointers to the WTRF array and the DayAv variable. LDR R0, = WTRF @ Initialize pointer to WTRF array LDR R1, = DayAv @Initialize pointer to DayAv location