CSc 343, Computer Organization and Programming
Fall 1998
Programming Assignment #5 (Due: 11 December 1998, Friday)

Assignment Objectives: To learn how to manipulate disk files using DOS services, process command line parameters, read lines of text from ascii files, write directly to video display area, and to become more proficient at writing assembly programs.

Problem Description: Write an assembly program, called BROWSE, which takes the name of a file as command line input. The following is an example of how the program will be invoked:

   a:> browse t.asm
It then displays the first 24 lines of text from the file on the screen. The following keyboard functions should be implemented:
   PgUp      Scroll up 24 lines
   PgDn      Scroll down 24 lines
   UpArrow   Scroll up 1 line
   DnArrow   Scroll down 1 line
   Esc       Exit to DOS
You should write directly to video memory for best performance. The program should run in the default text mode (03h).

Submission Instructions: Electronically submit browse.asm and browse.exe by the deadline and submit program listing of browse.asm.

Hints:

  1. The command line is stored in the program segment prefix (PSP) at offset 81H. The program name itself (browse) is not stored there, however. The byte at offset 80H indicates the length of the string that begins at 81H. The segment address of the PSP is stored in DS and ES when the program begins to execute. See pages 447-452 of the text for more details.
  2. Your program may read the entire file into a buffer (assume that the maximum file size would be 60,000 bytes so that the buffer may fit into your default data segment).
  3. Use the following DOS services (in addition to any others you have used in the past assignments):
      
      INT  21H, Function 3DH  ; Open file
      INT  21H, Function 3EH  ; Close file
      INT  21H, Function 3FH  ; Read record from file
      INT  21H, Function 42H  ; Move File Pointer (can be used to 
                              ; find the size of the file)
    

Raj Sunderraman
Thu November 26 1998