MIM3122 PC Architecture and System Programming Winter 2000 -- Dr. Perry
Write assembly language code for a menu-driven set of utilities to accomplish the following tasks. The menu should contain the tasks listed below. Menu selections may be made by typing the number of the desired selection or by highlighting the desired selection using the arrow keys and hitting the "Enter" key. The menu screen should indicate the selection method to be used. The menu may be enhanced by enclosing it in a box or shadowed box.
MAIN MENU
1 CALCULATOR
2 KEYBOARD SCAN AND ASCII CODES
3 KEYBOARD STATUS INDICATOR
4 COMPARE TWO TEXT FILES
5 CHECK FOR A SPECIFIC STRING OF INPUT
6 QUIT
All results should be displayed on a clean screen; if numerical, they should be displayed as base-10 numbers with appropriate surrounding text to make the meaning clear. Provision should be made to return to the Main Menu from any result. The menu items should function as follows.
Item 1 This four-function
(+, -, x, / ) calculator accepts signed
integers from the keyboard and
performs signed integer arithmetic. For addition, the calculator accepts
any number of values
to be added, the sum being continuously accumulated and displayed after
each value is
entered. For the other functions, the operation is performed after the
second value is entered
and immediately displayed. The results should be labeled "sum", "difference",
"product",
"quotient" and "remainder", as appropriate. You may use any of the library
routines in
IRVINE.LIB..
Item 2 The
program displays the keyboard scan code and ASCII code for any key pressed
by
the user. The program is terminated by pressing the Esc key. Do not use
any library code
from IRVINE.LIB for this item except for the "writeint"
library routine.
Item 3 The program displays the
status of the Shift, CapsLock and Alt keys in the lower right corner
of the screen. All other keys pressed are ignored. The user specifies the
color of the
characters to be used to display all output information. The user may also
specify the
background color for the characters, or a default of black may be used.
The program is
terminated by pressing the Esc key. Do not use any library code from IRVINE.LIB
for this
item except for the "writeint" library routine.
Item 4 The user
should be asked for the full file specification (directory path and filename)
of the
files to be compared. Words not common to both files should be displayed.
A word is defined
to be a string that ends with a space. Test with an ASCII text file of
at least 2000 bytes. See
below for a suggested algorithm for finding uncommon words. You
may use any of the
routines in IRVINE.LIB.
Item 5 A string of up to 40 ASCII
characters is specified from the keyboard by the user. This target
string is compared with a test string of 100 ASCII characters to be provided
by the
programmer and specified in the code comments. The results of the comparison
are displayed
as, "Match" or "No Match", in blinking text. For a match to occur, there
must be an exact
(case sensitive) match of the 40 characters entered from the keyboard to
some set of 40
characters within the test string of 100 characters. You
may use any of the library routines in
IRVINE.LIB..
Item 6 Selecting this item will return the user to the DOS prompt.
RESOURCES AND APPROACH
The examples discussed in the lectures and the text should suggest how to proceed in developing this menu system. Important pieces of the puzzle will be found in the material from the textbook and the handout dealing with disk organization and file handling, video basics and DOS/BIOS interrupts. In particular, Chapter 10, Strings and Arrays, and Appendix G, BIOS and DOS Interrupts, are relevant. Library routines found in the CDROM accompanying the text will also be useful (IRVINE.LIB). Given the timing of presentation for these topics, you may have to read ahead somewhat to facilitate progress on the term project. You should develop the overall system in a modular fashion using procedures. You may want to debug each procedure as separate code before putting the whole thing together. The Codeview debugger should be useful in this process.
REPORT GUIDELINES AND GRADING CRITERIA
The final report should include the following components:
DUE DATE: MARCH 6, 2000
--------------------------------------------------------------------------------------------------------------------------------------
Suggested Algorithm for Item 4
1. Define file1 as the source and file2 as the destination.
2. Compare a source word to each destination word.
3. If the word from the source matches a word from the destination,
index to next source word and
repeat step 2.
4. If the word from the source does not match any of the words from
the destination, write it to the
unmatched list and index to next source word.
5. Return to step 1. until all words in the source file have been compared.
6. Define file1 as the destination and file2 as the source. Return to step 2
EXAMPLE:
file1: a b
c d e f f1 f2 g h i
j k l
file2: a b
c c1 c2 d e f g g1 g2
Unmatched words list after "file1 is source" pass: f1
f2 h i j k l
Unmatched words added after "file2 is source" pass:
c1 c2 g1 g2