Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PROGRAMMING ASSIGNMENT: Write a fully-commented program for the Dragon 12 board, called Lab5.asm, including appropriate directives and labels for memory operands and constants. Use only
PROGRAMMING ASSIGNMENT: Write a fully-commented program for the Dragon 12 board, called Lab5.asm, including appropriate directives and labels for memory operands and constants. Use only one program loop. Comments should mostly describe WHAT you are accomplishing toward solving the problem, not HOW each instruction works alone. Every instruction may not have a comment, but small groups of instructions must have explanatory comments. The program should do the following: 1- An array, called Data, can hold up to 255 signed byte elements. Each element can store a number in the range 127 to -127. The last element in the array is -128 (a delimiter). The program should be able to handle any size of the array (up to 255 elements) with any set of legal values by changing ONLY the directives that create the array values without modifying any instruction. Do not do the computations on the delimiter. It is not a number in the array. Use directives to define the array and initialize it with 100, 127, - 127. 22. 0.-8.-1.0.1, 120, 77. -45, 0.-99, 2.-5. 110, 0,-1, 87. -128. You do not need to convert the array elements to hexadecimal. You can write them in decimal format and the assembler will convert them. Define any more variable as needed. 2- In this requirement and the next ones, choose appropriate data sizes for all the variables and results. Calculate the sum of all the elements of the array. Store the result in a memory variable called total_sum. To reduce the chance of overflow, store the running and final) summation in a word. You should extend each element to a signed word, and then add it to the running sum (total_sum). 3- Calculate the sum of all the negative numbers in the array. Store the result in a memory variable called negative_sum. To reduce the chance of overflow, store the running (and final) summation in a word. 4. Count the number of zeros in the array. Store the result in a memory variable called zeros_cnt. 5- Count the number of positive numbers in the array. Store the result in a memory variable called positive_cnt. 6- Count the number of array elements that are even. Store the result in a memory variable called even_cnt. Hint: when dividing these numbers by 2, the remainder is zero. An easier way is, if bit 0 is zero, the number is even. 7- Store the minimum value in the array in a memory variable called Min. 8- Multiply each element by 10 and store the result in a word array. You should define this array as Array_10. You should use signed multiplication. 9. Store the average of the array elements in a memory variable called average. You need to count the number of elements of the array. Notes 1. Use only one program loop to do all the tasks from 2 to 9. 2. Use While loop. The program should loop until the delimiter is found
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started