SPRING 2002

CSCI 2370

3/12/2002

DISK EDITOR





Assignment 2 due: 3/19

20 points

Write the macros GOTOLC and PUTS; subprograms SPAGEUP, and SPAGEDN; and a main program that will test these subprograms and macros for correct operation. You will need to write a temporary SDPLSEC with a few statements that display the page you are on. Run the program as many times as necessary to insure the correctness of the macros and subprograms.



For documentation include a short, one sentence description of each subprogram and macro plus pre & post conditions. They should be typed as comments with leading semi-colons. For each of the subprograms you should also have the C'ish comments done.



The grade for each lab in the project includes a portion (15%) on programming style and a portion (20%) on how well the program, macros and subprograms were tested.



Assignments are due at the beginning of class on the date given. Late assignments are penalized at a rate of 10% per day up to a maximum of 50%.







THE DISK EDITOR



The disk editor will allow the user to edit a sector from any disk. The user will indicate the desired disk and sector. That sector will be read into a sector array and displayed on the screen. The cursor may be moved within the display and any byte changed. The sector may then be written to that or another disk.





SUBPROGRAM AND MACRO DESCRIPTIONS



MAIN the main program.



SPAGEUP the subprograms to move the display back and forth

SPAGEDN between the two pages of 256 bytes of the sector (512 bytes). The screen will only hold 256 bytes from the sector so each sector takes two pages(screens) to display.



SDPLSEC for now this subprogram should display on the screen a message that indicates which page is current. The page is kept in the global, byte variable PAGENO which has a value of 0 or 1.



GOTOLC the macro that moves the cursor to the line and column specified in the parameters. The first parameter is the line (0-24) and the second gives the column (0-79).





PUTS the macro that displays the string given by the parameter at the current cursor position. The string must be in the data segment. All characters before the terminating '$' are displayed. See the documentation below.



SCREEN AND KEYBOARD HANDLING



To clear the screen:

MOV AX,0600H

MOV BH,07

MOV CX,0

MOV DX,184FH

INT 10H



To display the cursor at position line n, column m:

MOV AH,02

MOV BH,00

MOV DX,nm n in DH and m in DL

INT 10H



To put a series of characters on the screen starting at the cursor position, the series of characters must be in the data segment at location 'STRING' and the series must end with a $. The following statements will display the characters on the screen:

MOV AH,09

LEA DX,string

INT 21H



To read a character from the keyboard that is not echoed to the screen (the character is placed in AL):

MOV AH,08

INT 21H



To write a character in DL onto the screen at the cursor location:

MOV AH,02

INT 21H