IUP Computer Science
COSC 300    Fall 03

Project #3
(Due 17 Nov 03)

You are to write a16-bit assembly language program that makes the keyboard and screen behave like a simple electronic typewriter.  Your program is not allowed to use any of Irvine's library procedures.  Your program is to do all input and output using BIOS functions.  Your program is to operate in three phases.

Phase 1 (Setup)

The program must begin by clearing the screen to LIght Gray.  Then, on line 1 (second line of the screen), it should display double bars (ASCII code CDh) across the entire width of the screen.  Finally, it should place the cursor in the upper left corner (position 0, 0).

Phase 2 (Input)

As the person at the keyboard types characters, they should appear twice on the screen.  On the single line above the bars, characters are to be displayed in Green on a Light Gray background.  Each time the person presses the Enter key, the line above the bars should be erased and the cursor put back to position 0.0.  If the person at the keyboard does not press Enter but continues to type beyond the right edge of the screen (i.e., past position 79), the program should erase the top line anyway, move the cursor back to position 0,0, and continue dealing with the person's input characters.  If the person presses the BackSpace key, the last character entered should be erased and the cursor moved back one position (unless the cursor is already at the left edge of the screen, in which case no action should be taken).  If the person presses '`' (a backquote character), the program should clear the screen and start over.  If the person presses '~' (a tilde), the program should enter phase 3.  For all other characters, the program should display the symbol shown in the book for the ASCII codes.

As each character is typed, the program must also display it in the bottom portion of the screen in Red on a Light Gray background.  Each time Enter is pressed or the top line is forced to be erased, the program should move its display in red down one line.  In this way, the line above the bar shows what is currently being typed and the lines below the bar show all lines previously typed and the current line being typed.  Naturally, if BackSpace is entered, the red character, as well as the green one, should be erased.

Phase 3 (Output)

When the person at the keyboard presses a tilde, your program should call a procedure named WriteFile which scrapes the characters from the bottom portion of the screen and writes them to a file named SCRAPED.TXT  The WriteFile procedure will be provided to you; all you have to do is call it.  WriteFile requires no setup.

Name the .ASM file after yourself.  Hand in a commented printout of your program from the .LST file (only the program part is needed).  Copy the .ASM file and the ,EXE file to the hand-in folder for COSC 300 on the P: drive.  I will execute your program to see if it works; if it does something terrible, please tell me about this by writing a note on the printout which you hand in.