This page tracks the assignments given and the status
Status Tracker 
Assignment  Selfimposed Deadline 
Assignment 1 
20110216
20110223
20110302

Assignment 2 
20110216
20110223
20110302

Assignment 3

Become familiar with the DEBUG program under DOS and run 8086 assembly language programs
using DEBUG. Similarly, use the Motorola 68000 simulator (68asmsim) to run
assembly language programs.

Write assembly language programs for both 8086 and M68k for drawing a
straight line on the screen using the Bresenham's algorithm.
Compare the performance of the algorithm on both platforms.

Port the M68k simulator to run under Linux.

The fifth version of the Quadratic Equation Solver (v0.5) is uploaded.
Enhancements in this version:
This is still buggy and needs a lot of work. The source is available here

The third version of the HTML Entity Search program (v0.3) is uploaded.
Enhancements in this version:
 Fixed missing entity bugs. It was a very interesting problem. My test HTML file contained
a unicode character (ΓΏ), which C somehow identified as the EOF character and stopped processing
my file! In the process of trying to locate the issue, I even rewrote the program without
using regular expressions!
 Valid and invalid entities written to separate files. Reason for rejection is also
included along with the invalid entities.
I will be showing this in tomorrow's lab session.
The source is available here.

The third version of the HTML Entity Search program (v0.2) is uploaded.
Enhancements in this version:
 Reports valid and invalid entity matches by searching a hash table.
Some bugs still seem to be present which results in some entities being missed.
The source is available here.

The fourth revision of the Quadratic Equation Solver (v0.3) is uploaded.
Enhancements in this version:
 Accepts spaces between sign and number.
 Tells user the number of guaranteed digits of precision.
The issues listed on 20110201 are still present.
The source is available here.
The second version of the HTML Entity Search program (v0.1) is uploaded.
Enhancements in this version:
 Matches entities with a carriage return after the &.
 Added some logic to handle entities which occur at the 100character border
The code is still buggy and I have confirmed that it misses some entities. I'm debugging
it presently. Also, the program still matches any string that fits the pattern.
I've thought about the hash table design but not yet started coding.
The source is available here.

The first version of the HTML Entity Search program (v0.0) is uploaded here.

The third revision of the Quadratic Equation Solver (v0.2) is uploaded.
Enhancements in this version:
 Generates nonzero roots for equations with b*b much greater than 4*a*c.
 Better user input validation (Character by character input and immediate error reporting).
The following issues are still present:
 In case the user enters an invalid data, there is no provision for correcting the error alone. That is, user has to enter the whole number again.
 There are still minor issues with input handling (Do you want to continue? prompt is skipped). It is not repeatable and I think it's because of multiple keypresses rather than junk in stdin.
 Float number validation still has loop holes.
 The code is not very clean.
The source is available here.
Write a program which asks the user for an input file (text format) and find out the total number of HTML entities in the file and print each one.
I haven't started writing the program yet. The code will be uploaded as soon as it is completed.

The Quadratic Equation Solver that I wrote failed to handle the following inputs given by the professor:
 Value of b*b much greater than 4*a*c results in one root computed as 0.0.
 Input containing alphabets are rejected totally and user has to reenter the whole value again.
 Error message is reported only after entering all three coefficients, instead of immediately after entering.
I have started rewriting the program for handling such input conditions and values. It is not complete yet, but I hope to upload a new version by tomorrow morning.
Edit 1 (22:40): I'm having trouble dealing with getchar and leftover characters in stdin and can't seem to work around the issue. I don't think I'll be able to get a working piece of code by tomorrow morning.

Quadratic Equation Solver  Rewrite  Now the function for returns a single atomic value and not a pointer / structure
During the discussions in class on 20110118, we were told that we are not allowed to return a
pointer from the function which computes the roots. I have rewritten the program so that the
function returns a single atomic value. However, I couldn't think of any graceful way of passing
back two roots using a single variable. Since we were told not to use pointers, I assumed that
we are not allowed to pass the result variables by reference to the function, as parameters.
After ruling that out, there was only one option I could think about  Find out a data type
large enough to hold two float numbers and flag (Information which was originally in the
structure) and pack everything into that variable and return it. An unsigned integer of size
at least equal to 66 bits could have been ideal (2*32 bits for storing float values
b/2a and sqrt(determinant)/2a and two bits for indicating nature of the solution  real / imaginary /
linear / invalid equation).
However, I was not able to find any integer data type of size greater than 64 bytes (Largest
available was long long, which is 64 bits wide).
So, I took a long double variable (96 bits wide) and packed the required information
into it using a series of questionable pointer operations. So now, the function returns a
single long double value, which holds b/2a, sqrt (determinant)/2a and the flag denoting
nature of the solution. The function which prints the result now extracts the actual values
through another set of pointer operations.
I am sure this is not what the professor had in mind, but I can't think of anything else!
The updated source is available here.

Write a C program which asks the user for three variables a,b,c which are coefficients of a quadratic
equation and calculate the roots of the equation. Use a function to calculate the roots and the function
should return the roots.
I wrote the program so that it returns a pointer to a structure holding the roots of the equation. The
structure itself contains five variables  two floats for each root (real and imaginary) and one
unsigned char for denoting the type of solution (roots real, roots imaginary, equation is linear,
equation is invalid).
The inputs are considered valid if the value entered contains:
 Digits (and/or)
 Decimal point (and/or)
 + or  sign
This validation is by no means complete and it will not catch invalid inputs like 100.0.0.1. Also,
after the discussions on 20110107, I realized that valid entries like 10,00,000 will be rejected
by my program. Also, I have not yet handled inputs of length larger than the allocated space and
such inputs may crash the program. These issues are not yet addressed. The current source can be accessed
here.

Find out the maximum file size supported by the Notepad editor under Windows and vi editor under GNU/Linux.
I took a large text file (report generated by the dmesg utility) and copied it into itself till the editor
was not able to handle the file gracefully. I found that Notepad could not handle files larger than 64MB
whereas vi could open much larger files. As the file size became larger (around 550 MB), vi started slowing
down. It could still open the file, but it was slow and practically unusable.

