home *** CD-ROM | disk | FTP | other *** search
-
- IBM PASCAL UTILITY I/O SUBROUTINES
- ----------------------------------
- by Brian Irvine
-
- This is a short description of the Pascal routines provided in the
- Unit IOSTUFF.PAS and its accompanying files IOSTUFF.INC and INTRPT.ASM.
- These files together, when assembled, compiled and linked with a host
- program written in Pascal, provide a set of utility procedures for screen
- manipulation which are not available as built-in procedures or functions
- in the IBM Pascal compiler. They also provide low-level access to the
- diskettes installed by allowing the programmer to read any sector into
- memory for examination.
-
- The pivotal mechanism in all this is the small assembly language
- routine INTRPT.ASM. This routine allows the programmer to access all the
- machine language code in the PC's ROM BIOS. These functions and their
- access mechanisms are detailed in the Technical Reference Manual,
- Appendix A.
-
- There are no built-in screen and cursor manipulation functions in the
- IBM Pascal compiler. The programmer is obliged to write his own routines
- to service the display in the way he wishes. However, there are many
- functions already available in the ROM, the only question is how to
- access them. This is where INTRPT.ASM comes into play. INTRPT.ASM is an
- interfacing routine which accepts five parameters passed to it in a stack
- frame by a calling Pascal procedure or function. These variables are the
- number of the interrupt to be generated, and values to place in the four
- 8088 registers AX, BX, CX and DX. The variables passed to INTRPT are
- word length and can therefore be used to pass two byte values for use in
- the high and low bytes of the registers. INTRPT then places the values
- passed into their proper locations and executes an interrupt. This
- passes control to the desired routine which then does its thing. When
- the ROM routine is done, it returns control to INTRPT, which places the
- returned values in the AX, BX, CX and DX registers back in the stack
- frame to be returned to Pascal. INTRPT then passes control back to the
- Pascal calling routine and we are back in our application program.
-
- The file IOSTUFF.INC is the include file which must be included in
- your Pascal source file before any of the routines or variables are used.
- This file contains a list of all the procedure names, variable names and
- variable type definitions. It also contains all the Procedure calls and
- the variables passed to and from them.
-
- The file IOSTUFF.PAS is the source code for all the procedures which
- access the INTRPT procedure. It is the Implementation of the Unit
- IOSTUFF. This file is not to be included in your source program, but
- rather the compiled version IOSTUFF.OBJ must be linked in with the object
- code from the application program and with the object code INTRPT.OBJ.
- This is done with a Linker command of the form:
-
- LINK MYPROG IOSTUFF INTRPT;
-
- This will cause the IBM Link facility to generate an EXE file with all
- the proper code in the right place, etc. For further information on
- using Units in Pascal, see the compiler manual, pages 13-11 to 13-17.
-
- All the routines in the IOSTUFF Unit are fairly well documented and
- most of them are simple routines. The parameters used and the functions
- or procedures performed are self-explanatory. There is not much checking
- for valid data performed in the procedures themselves. This is left up
- to the programmer to control as he wishes. There are also many functions
- in the ROM which are not implemented in this Unit. If you come up with
- some terrific new application, let me know. I think this system could be
- used effectively to create some good graphics routines for Pascal, since
- it lets you get to the bit level on the screen. Also, the access to the
- printer port through ROM has not been implemented nor has the access to
- the COM port. These are things which I would like to do in the future.
- All I need is about 2 months off work with pay.
-
- The program DISKREAD is a demonstration of some of the procedures in
- IOSTUFF, especially the ability to read any sector on the disk. It also
- demonstrates setting the cursor size and positioning the cursor on the
- screen. The program is not complete by any means, and the functions it
- performs are not very complicated. There are three commands not shown on
- the bottom line, they are:
-
- F1 - Input new Drive/Side/Track/Sector
- F2 - Toggle the radix for Drive/Side/Track/Sector from decimal to hex
- and back
- T - Fills the sector buffer with a test pattern of all characters in
- the PC's character generator ROM.
-
- Since this program prints ALL codes in the ROM, you may not be able to
- do a PrtSc since it may send your printer into the Thulies. Now there's
- a good application for writing a procedure using this method!
-
- Brian Irvine
- 3379 St Marys Place
- Santa Clara, CA 95051
- (408) 984-8692
- 2/24/83