Fall 1999 CSCI 2370 11/12/99

Compare Files

Assignment 4 due:11/19 20 points

Write the subprograms GETFN1, GETFN2, INITFIL1, and INITFIL2; and a main program to test these subprograms. In the folder under the Departmental Programs, Math & CSC, CSCI2370, Fall 99 is a file named ASSIGN4.ASM which contains the code for the macros DIV8, DIV16, and PUTSMLZ, and the subprogram DTOA. You will need those modules for your subprograms



The grade for each lab in the project includes a portion (15%) on programming style and a portion (20%) on how well the program and subprograms are tested. Turn in a listing of the ASM file and a copy of your ASM and EXE files on a 3.5" diskette (or you may email it to me). You will want to include a few PrintScreens with your ASM listing to show that you believe your tests worked.



Subprogram and Macro Descriptions

GETFN1 and GETFN2 are the subprograms that prompt the user for a filename, read the filename, calculate the length of the name and store it in a variable so you can make it a string terminated by a dollar sign or by a zero byte, open the file, and save the file handle. To open a file, the file name must be zero byte terminated and pointed to by DX. The interrupt 21 function number is 3D. A value in AL of 00 makes it read-only. Upon return from the interrupt AX holds the handle number.

INITFIL1 and INITFIL2 are subprograms that output the file name, retrieves the file information, and output the file size. To retrieve the file information, the file name must be zero byte terminated. First using interrupt 21 function number 1A, you establish a connection between the operating system and a disk transfer area (DTA) of 44 bytes. The address of the DTA must be in DX when the interrupt is called. Then using interrupt 21 function number 4E, get the file information. CX should contain 00 and DX should contain the address of the zero byte terminated file name. The file size will then be at the double word beginning at location 1A of the DTA.

Note: interrupt 21 function number 3E with the handle in BX, closes the file.



The screen when entering the file names should look like the first screen on the next page. The screen built by INITFIL1 and INITFIL2 should look like the second.



























































Given Subprogram and Macro Descriptions

DIV8 and DIV16 are the macros that divide 16 or 32 bit direct binary numbers by a power of 10 to yield a decimal digit character result. They are used by DTOA.

DTOA is the subprogram that converts a double word, direct binary number (pointed to by SI) into a string of 10 decimal digits held in DBLSTR.

PUTSMLZ is the macro that outputs a $ terminated string of decimal digits while replacing the leading zeros by spaces. The string is sent to the macro a parameter. So it can be used following a call to DTOA to output the decimal value of a double word, direct binary number