$24
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 6. Do not change the data types (double-words) as defined below.
Declare the values:
lst
dd
4224, -1116,
1542,
1240,
1677
, -1635,
2420, 1820, 1246, -333
dd
2315,
-215,
2726,
1140,
2565
,
2871,
1614,
2418,
2513,
1422
dd
-119,
1215,
-1525,
-712,
1441
, -3622,
-731, -1729, 1615, 2724
dd
1217,
-224,
1580,
1147,
2324
,
1425,
1816, 1262, -2718, 1192
dd
-1435,
235,
2764, -1615,
1310
,
1765,
1954, -967, 1515, 1556
dd
1342,
7321,
1556,
2727,
1227
, -1927,
1382,
1465,
3955,
1435
dd
-225, -2419,
-2534, -1345,
2467
,
1615,
1959,
1335,
2856,
2553
dd
-1035, 1833,
1464,
1915, -1810
,
1465,
1554, -267, 1615, 1656
dd
2192, -825,
1925,
2312, 1725
, -2517,
1498, -677, 1475, 2034
length
dd
1223,
1883,
-1173,
1350,
2415
,
-335,
1125,
1118,
1713,
3025
dd
100
lstMin
dd
0
estMed
dd
0
lstMax
dd
0
lstSum
dd
0
lstAve
dd
0
negCnt
dd
0
negSum
dd
0
negAve
dd
0
sixCnt
dd
0
sixSum
dd
0
sixAve
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).
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.
Note 1, no template is provided. Create the program source file based on the previous assignments. Note 2, no debugger input file is provided. Create the debugger input file based on the previous assignments. This is useful for testing and debugging, but will not be submitted.
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.
• Late submissions will be accepted for a period of 24 hours after the due date/time for any given lab. 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: <your name>
• NSHE ID: <your id>
• Section: <section>
• Assignment: <assignment number>
• Description: <short description of program goes here>
Failure to include your name in this format will result in a loss of up to 10%.
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
10%
Must include header block in the
required format (see above).
General Comments
20%
Must include an appropriate level of
program documentation.
Program Functionality
70%
Program must meet the functional
(and on-time)
requirements as outlined in the
assignment. Must be submitted on time
for full score.
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/dw &length
x/dw &lstMin
x/dw &estMed
x/dw &lstMax
x/dw &lstSum
x/dw &lstAve
x/dw &negCnt
x/dw &negSum
x/dw &negAve
x/dw &sixCnt
x/dw &sixSum
x/dw &sixAve
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 <filename>''. 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.