CS-220, Lab 9
Spring, 2006
Due: 5-16-06 (Will not be accepted if submitted after 12:00, noon)

In this lab you are to write a two module program that inputs a list of 
integers and computes and outputs their mean (average). The data input 
and the computation and display of the mean on the screen should be done 
in in C using the Visual Studio .NET development environment. This 
program should have, in addition to the main() function, one other 
function that computes and returns the mean. This function should be 
implemented as an external 80X86 (.386P, flat memory model) assembly 
language procedure. If, for example the function were called calc_avg, 
your C program module might have the following statements at the top:
#include <stdio.h>
extern calc_avg(int x[], int n, int* a);

Here x is the array of integers input by the user and n is the number of 
integers input. the parameter a represents the mean computed by the 
function calc_avg.

(Note here that the resulting mean will be an integer, since we have not 
covered floating point assembly language instructions.) 

In order to do this assignment, start with the templates given in the two 
example programs discussed in class: ADDCPTR.C and ADDAPTR.ASM (See the 
last two example programs on the CS-220 Sample Programs web page: 

You should also look very carefully at: 
"Using Visual Studio .NET to Create a C/ASM Mixed Module Program Project"
on the CS-220 Notes web page at: 

When you build the project, you should should do it in such a way that an 
assembly/machine language listing of the code generated from the C source 
module is created. You should submit the following printed listings: the 
C source file, the assembly language source file, the .LST file for the 
assembly language module generated when the project was built, the .COD 
file containing the assembly/machine language code generated from the 
compilation of the C language module, and most importantly, a diskette or 
CD-ROM containing all the files created in the directory containing the 
project. The easiest way to do this is to just copy the entire project 
directory from the hard drive to a floppy or CD-ROM.