ECE4500_Project3

ECE4500_Project3 -...

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

View Full Document Right Arrow Icon
1 ! ,-, ./00 ! 12#"%$ 3040 5#67)*8 9 Due at 11:59 p.m. (EDT) on April 11 Name: ___________________________________ ID Number: ______________________ :%8#6;<*8"6% As for the previous project, the objectives of this assignment are to reinforce your understanding of low-level computation and to gain experience with programming in assembly language. Your goal is to write another program for the MARIE processor. You must assemble and test your program using the MARIE simulation package, MarieSim. Write an assembly language program for the MARIE processor that will f i nd the average (mean) value of an array of integers. The general structure of the assembly language source code is illustrated in Figure 1. / ECE 4500 Project 3 / Find the average value for an array of integers / <Your name, and other useful comments> ORG 100 /Your “main” program goes here Halt /Subroutine to perform division Div, Hex 0 /Your subroutine’s instructions go here JumpI Div /Variables and constants Size, DEC 8 /Size of array Ptr, HEX 116 /Pointer to start of array X X, DEC 3 /First value of data array DEC -2 /Second value DEC 17 /Third value DEC 0 DEC 8 DEC -23 DEC 5 DEC 14 /Last value of data array Var, . . . /Other variables and constants / can be placed here Figure 1. Code template with separate areas for instructions and data.
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 In order to do its job, your program will need to 1) compute the sum of the values in the array, and then 2) divide the sum by the number of elements. Unfortunately, the MARIE instruction set does not contain an instruction that performs division. You will therefore need to write code to perform the division; this can be accomplished by repeated subtraction or addition. To simplify the assignment, your code can ignore any fractional part that could result from the division operation. (For example, the average value for the example shown in the figure is 22 / 8 = 2.75, but your program could simply report the integer 2 as the result. Rounding is not needed.) For full credit, your program should satisfy these additional requirements:
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

ECE4500_Project3 -...

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

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