CS 2011, A Term 1999
Prof. Sergio A. Alvarez
Lab 3
Objective
The goal of this lab is for you to practice basic console input/output
using DOS function calls; this is useful in HW 3 and in many other
contexts. In particular, you will write a procedure that reads a string
from the console using DOS function 0Ah, and you will use this procedure
together with an output procedure using DOS function 09h to perform a
simple console dialog with the user who is running your program. You
will also generate a script file of this dialog as required in HW 3.
Instructions
- Insert a floppy disk. Open a DOS window on your PC.
At the DOS prompt, type "cd A:\" (no quotes) to change the
directory to the floppy drive.
- Download the 8086 assembly language source file outline
ioprocs.asm onto your floppy disk,
to a file named A:\ioprocs.asm.
Using a text editor (for example the DOS edit command),
edit ioprocs.asm, completing the outline of a standard assembly
language source file.
- Read the specification of the procedure named getstring.
Add appropriate global data allocation directives for two string
variables string1 and string2, and for an input record inrecord
as described in the specification.
- Implement the procedure named getstring. Most of the work
is done for you by DOS function 0Ah. See the description that I
gave in class on Tuesday, or refer to section 5.5 of the textbook.
- Insert assembly code for the main procedure that prompts
the user to input a string, reads it using getstring, and writes
the string to the console using the writemessage procedure
that's been provided for you in ioprocs.asm.
- Assemble the file ioprocs.asm using the command tasm/la/zi
ioprocs.asm and link using tlink/m/v ioprocs.obj. Run the resulting
executable file ioprocs.exe by typing ioprocs at the DOS prompt.
Test your program with several input strings.
Debug it as necessary using td.
- Generate a script file of the DOS window view of several runs
of your program. Refer to the instructions
for using the prn2file utility on the CS2011 homepage.
- If you'd like, use any remaining time to continue working on
HW 3.
- When you're done, remove your floppy disk from the drive
and return the computer to a state in which other students will
be able to make full use of it (in case of doubt, ask your TA).
- Make sure you've signed the TA's sign-in sheet.