IUP Computer Science
COSC 300    Fall 2000

Assignment #6
Due on 11 December 2000

You are to write four macros that are required to make the attached program work. The program is meant to make a directory listing of the root directory of the disk in the A: drive, in an unusual format. Your macros will need to work properly in order to make the display appear as it should. The program is provided to you in the file I:\jlwolfe\cosc300\altdir.asm In addition, a partial macro library file is provided to you in the file I:\jlwolfe\cosc300\6macros.inc This macro library contains other macros that are needed to make the directory listing and macro stubs for each of the four macros you are to write. Below are descriptions of your four macros.

GetLength STR

STR is a memory reference to a null-terminated string. GetLength must determine the number of characters in the string at STR and leave this number in the BX register. This macro is intended for use in the Place macro where it can help with determining the placement of strings on the screen.

Place STR, JUST

STR is a memory reference to a null-terminated string. JUST is a flag value to indicate where the string at STR should be displayed on the line. Place must display the string somewhere on the line that the cursor is on at the moment. The value of JUST determines where on the line. There are four possibilities: L display the string left justified (starting in column 0), R display the string right justified (ending in column 78, to allow the cursor to remain on the same line), C display the string centered on the line, and blank (JUST omitted) display the string starting at the current cursor position. If JUST is not one of these values, Place should generate an assembly error message. This macro is used in main, ShowSize, ReadDisk, and PauseCheck.

ExtractDate DATEPACK, YR, MO, DAY

DATEPACK is a memory reference to a word containing a file creation date in the standard directory format (see page 400 in the book). YR is a memory reference to a 2-byte area that is to hold the last two digits of the year (as ASCII characters). MO is a memory reference to a 2-byte area that is to hold the month number as two digits (ASCII characters). DAY is a memory reference to a 2-byte area that is to hold the day number as two digits (ASCII characters). ExtractDate converts the date components stored at DATEPACK to day, month and year and puts them into displayable form at DAY, MO, and YR. You should find the MakeTwo macro (provided to you) useful in helping to do this.

ExtractTime TIMEPACK, HRS, MINS, SECS

TIMEPACK is a memory reference to a word containing a file creation time in the standard directory format (see page 400 in the book). HRS is a memory reference to a 2-byte area that is to hold the hour as two digits (ASCII characters, 24-hour clock). MINS is a memory reference to a 2-byte area that is to hold the minute as two digits (ASCII characters). SECS is a memory reference to a 2-byte area that is to hold the second as two digits (ASCII characters). ExtractTime converts the time components stored at TIMEPACK to seconds, minutes and hours and puts them into displayable form at SECS, MINS, and HRS. You should find the MakeTwo macro (provided to you) useful in helping to do this.

Below is a sample of what the output of ALTDIR might look like if you create your macros properly. This is based on a floppy disk of mine; it is for illustration purposes only.
File Name               Size in bytes         Creation date/time
YAN.EXE                        7704           00/11/01  13:47:02
ASSIGNME.NTS             Disk label           00/11/14  16:15:52
WIEST2.EXE                     10052          00/11/06  15:03:52
WIEST2.ASM                     13900          00/10/31  16:30:34
GADI.ASM                       4291           00/11/06  15:59:26
CANTY.EXE                      5500           00/11/01  13:59:54
NEWFOL~1.               Subdirectory          00/11/14  16:18:48
PROJECT.6               Subdirectory          00/11/14  16:14:20
*IRDS.DAT                  Deleted            00/04/18  14:36:54
ANSWERS.TXT                    1509           00/04/17  15:36:06
*LB.DOC                    Deleted            00/04/28  13:37:44
Hand in a printout of your four macros. This printout may be produced with any software: NotePad, Word, MS-DOS print, whatever. Be sure to include comments in your macros about how they work; make sure the printout has a comment with your name in it. You do not need to printout the other macros in 6MACROS.INC. Also, hand in a disk with and executable file that does the ALTDIR program. However, you should rename this executable file after yourself (your last name). I would call my file WOLFE.EXE I do NOT want to receive 25-30 ALTDIR.EXE files.