4/25/2001 NOTE: The latest change indicates that the floating-point numbers in the input data file are given in standard scientific notation. If you assumed decimal representation, e.g., 123.456 and have coded your converter to handle these, you don't have to redo your code to handle scientific notation -- just let me know what you have done at the beginning of your documentation on the project. If you haven't worked on this yet, then do it assuming standard scientific notation -- it'll be easier for you to convert these types of numbers anyway. Feel free to write a perl script to convert the sample data file(s) to the other format.
* (4/8/2001) CORRECTION 1: You can use MASM, not TASM, as indicated in the original project description. Of course, the preferred assembler is still NASM, since it will give you exposure to the Linux OS.
* (4/9/2001) CORRECTION 2: Typo in CC equations: denominator += num_areas... should by denominator *= num_areas...
(4/9/2001) C lib help !
Okay... No sense kidding ourselves. It would be handy to use C functions, at least for a while, in this project. Here is an article that I grabbed from the Assembly Journal (http://asmjournal.freeservers.com, the actual article given by http://fivedots.coe.psu.ac.th/~cj/240-321/resources/apj/apj_1.txt) on the subject. Remember, when you are finished, no C function calls are allowed -- obviously ! Also note that I read this journal (in my spare time of course) so don't plagiarise the code/macros given there !
* (4/10/2001) Temporary documentation on system calls
The URL given above just recently broke but I managed to grab the list before my cache expired. Unfortunately, the links within my copy do not work. However, the links point to standard man page descriptions of the c calls, so you can still get to this missing information easily.
* (4/16/2001) CORRECTION 2: Several small changes to the project description have been posted, e.g. you can use FSQRT instruction (since it's available -- I didn't realize this on the first revision).
* (4/19/2001) Floating point printf example
Some of you have been having trouble with printing floating point numbers with printf. printf wants a double precision number. The example shows one way of converting the number generated by nasm to double precision. I discovered this by writing a simple c program and using gcc -S file.c and looking at the assembly code generated.
Also, this example shows how do use scaled index addressing mode. If you are getting error messages like "ELF format does not support non-32-bit relocations", you may want to take a look.
* (4/22/2001): Sample data file.
CORRECTION 3: (4/20/2001) NOTE: There was an error in the original file. The first line of every waveform was 0.0 instead of 0.0E+00.
CORRECTION 4: (4/23/2001) NOTE: The original file had only 50 data points per waveform. Simpson's Rule requires an odd number of data points so I added the -4.000000E+03 0.000000E+00 data point to this file to make 51 points. This preserves the original values of area under the Rectangular and Trapezoidal Rules.
* (4/22/2001): Sample data file.
CORRECTION 3: (4/20/2001) NOTE: There was an error in the original file. The first line of every waveform was 0.0 instead of 0.0E+00.
CORRECTION 4: (4/23/2001) NOTE: The original file had only 50 data points per waveform. Simpson's Rule requires an odd number of data points so I added the -4.000000E+06 0.000000E+00 data point to this file to make 51 points. This preserves the original values of area under the Rectangular and Trapezoidal Rules.
(4/20/2001): Sample data file (extra credit - positive and negative areas and unequal time sub-intervals).
Note: you will need to increase the size of your storage area from 2000 floating point numbers to 5000 in order to read this file!
CORRECTION 4: (4/23/2001) NOTE: This file has waveforms with different numbers of data points. I have not yet fixed this file so that it will work with Simpson's Rule, which requires an odd number of data points. The plan is to add 0.000000E+00 0.000000E+00 as the first value of each waveform that is has an even number of points. You can to do add this point automatically in the code, if you prefer to handle this in a generic way :)
* (4/25/2001) My macros for your use (courtesy of me)
You may use my macros if you like (this is what I have so far, which you should find useful). If you've written your own, you should still take a look at these since it gives some indication of the type of documentation I expect. For example, CLEARLY marking the beginning of your functions and including a header describing it is a VERY important piece of information. I guess I can say the following with respect to grading at this point. If the code doesn't assemble, you will get a 0. If it assembles but doesn't run, you'll get 20 points total. If it runs and generates output, you can use the following as a breakdown of the points: 25% documentation and comments, 20% modularity, 40% correctness, 10% neatness of output, 5% robustness. NOTE: I did not have the if-then-else macros in the original file. These are necessary in order to use the gcc_getcmdline.asm code I've given below.
* Given that the conversion from a character representation to a floating point number is a bit challenging (took me a couple hours), you can use printf to go in the opposite direction if you like, e.g., to generate the output table. Those of you who have already written the routine to take a floating point number to an ascii string as given in the project specification will get extra credit. If you haven't written the forward conversion code (string to floating point), use sscanf and work on the integration methods first. Using sscanf will cost you many fewer points than not implementing the integration methods.
* The code to get the command line if you are using GCC.
I know many of you have been struggling with this. This took me about 30 minutes to figure it out -- it is completely consistent with the argc and **argv definitions you've known for years in C. I suspect that many of you are still having trouble with pointers! Take a very close look at this code -- if you understand EVERYTHING that I'm doing, you should breeze through coding the rest of the project.
* (4/25/2001) CORRECTION: Typo in CC equations: You should multiply by num_areas/2 -- which is the number of data points (area pairs) instead. If you've coded it with num_areas, the answers are still very close to the correct answers and are acceptable.
numerator = (num_areas/2)*xy_sum - x_sum*y_sum
denominator = (num_areas/2)* x_sqr_sum - x_sum*x_sum
denominator *= (num_areas/2)*y_sqr_sum - y_sum*y_sum
CC = numerator/sqrt(denominator)
* The code to get the command line if you are using GCC.
IMPORTANT NOTE: (4/25/2001) A lot of you have tried using this code and have complained that it core dumps. I assumed that you would add the input_filename_ptr to your section .data and add 'section .text' before the main: label. Instead, many of you are just compiling it directly - which wont work. I've updated the file with 'section .data' and 'section .text' so that it runs as a stand-alone program.