Sale!

CS 218 Assignment 4 Solved

Original price was: $40.00.Current price is: $35.00.

Category:

Description

5/5 - (1 vote)

Purpose:

Learn to use arithmetic instructions, control instructions, compare instructions, and conditional jump instructions. Points: 75

Assignment:

Write a simple assembly language program to find the minimum, estimated median value, maximum, sum, and integer average of a list of numbers. Additionally, the program should also find the sum, count, and integer average for the negative numbers. The program should also find the sum, count, and integer average for the numbers that are evenly divisible by twelve (12).

Do not change the data types (double-words) as defined below. Since the list is not sorted, we will estimate the median value. Since the list length is even, the estimated median will be computed by summing the first, last, and two middle values and then dividing by 4.

Be sure to divide the length by 2 (and not hard-code the indexes). There will be a 10% penalty for hard-coding indexes. Declare the values: list dd 2140, -2376, 2540, -2240, 2677, -2635, 2426, 2000 dd -2614, 2418, -2513, 2420, -2119, 2215, -2556, 2712 dd 2436, -2622, 2731, -2729, 2615, -2724, 2208, 2220 dd -2580, 2146, -2324, 2425, -2816, 2256, -2718, 2192 dd 2004, -2235, 2764,

-2615, 2312, -2765, 2954, 2960 dd -2515, 2556, -2342, 2321, -2556, 2727, -2227, 2844 dd 2382, -2465, 2955, -2435, 2225, -2419, 2534, 2348 dd -2467, 2316, -2961, 2335, -2856, 2553, -2032, 2832 dd 2246, -2330, 2317, -2115, 2726, -2140, 2565, 2868 dd -2464, 2915, -2810, 2465, -2544, 2264, -2612, 2656 dd 2192, -2825, 2916, -2312, 2725, -2517, 2498, 3672 dd -2475, 2034, -2223, 2883,

-2172, 2350, -2415, 2335 dd 2124, -2118, 2713, 2025 length dd 100 listMin dd 0 listEstMed dd 0 listMax dd 0 listSum dd 0 listAve dd 0 negCnt dd 0 negSum dd 0 negAve dd 0 twelveCnt dd 0 twelveSum dd 0 twelveAve dd 0 You may declare additional variables if needed. All data is signed.

As such, the IDIV/IMUL would be used (not DIV/MUL). The JG/JGE/JL/JLE must be used (as they are for signed data). Note, no template is provided. Create the program source file, ast04.asm, based on the previous assignments.

CS 218 Assignment 4

Submission:

• All source files must assemble and execute on Ubuntu with yasm. • Submit source files ◦ Submit a copy of the program source file via the on-line submission • Once you submit, the system will score the project and provide feedback. ◦ If you do not get full score, you can (and should) correct and resubmit. ◦ You can re-submit an unlimited number of times before the due date/time (at a maximum rate of 5 submissions per hour).

• Late submissions will be accepted for a period of 24 hours after the due date/time for any given assignment. Late submissions will be subject to a ~2% reduction in points per an hour late. If you submit 1 minute – 1 hour late -2%, 1-2 hours late -4%, … , 23-24 hours late -50%. This means after 24 hours late submissions will receive an automatic 0.

Program Header Block

All source files must include your name, section number, assignment, NSHE number, and program description. The required format is as follows: ; Name: ; NSHE_ID: ; Section: <4-digit-section> ; Assignment: ; Description: Failure to include your name in this format will result in a loss of up to 5%.

Scoring Rubric

Scoring will include functionality, code quality, and documentation. Below is a summary of the scoring rubric for this assignment. Criteria Weight Summary Assemble – Failure to assemble will result in a score of 0. Program Header 5% Must include header block in the required format (see above). General Comments 10% Must include an appropriate level of program documentation.

Program Functionality (and on-time) 85% Program must meet the functional requirements as outlined in the assignment. Must be submitted on time for full score. Includes 10% penalty for hard-coding the indexes of the middle values.

Debugger Commands:

Due to the looping, when debugging assignment #4, you should learn to set breakpoints within the program. Create an input file for the debugger. Some useful commands might include: x/100dw &list x/uw &length x/uw &lstMin x/uw &estMed x/uw &lstMax x/uw &lstSum x/uw &lstAve x/uw &evenCnt x/uw &evenSum x/uw &evenAve x/uw &tenCnt x/uw &tenSum x/uw &tenAve

The commands should be placed in a file (such as ‘a4in.txt’) so they can be read from within the debugger. The debugger command to read a file is ”source ”. For example, if the command file is named ‘a4in.txt’, (gbd) source a4in.txt Refer to the debugger input files from the previous assignments for examples. This will include outputting the results to a file.

CS 218 Assignment 4