home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / PASCAL / IOSTUFF.ZIP / IOSTUFF.DOC < prev    next >
Encoding:
Text File  |  1985-12-28  |  5.1 KB  |  93 lines

  1.  
  2.             IBM PASCAL UTILITY I/O SUBROUTINES
  3.             ----------------------------------
  4.                  by Brian Irvine
  5.  
  6.       This is a short description of the Pascal routines provided in the
  7.    Unit IOSTUFF.PAS and its accompanying files IOSTUFF.INC and INTRPT.ASM.
  8.    These files together, when assembled, compiled and linked with a host
  9.    program written in Pascal, provide a set of utility procedures for screen
  10.    manipulation which are not available as built-in procedures or functions
  11.    in the IBM Pascal compiler.    They also provide low-level access to the
  12.    diskettes installed by allowing the programmer to read any sector into
  13.    memory for examination.
  14.  
  15.       The pivotal mechanism in all this is the small assembly language
  16.    routine INTRPT.ASM.    This routine allows the programmer to access all the
  17.    machine language code in the PC's ROM BIOS.  These functions and their
  18.    access mechanisms are detailed in the Technical Reference Manual,
  19.    Appendix A.
  20.  
  21.       There are no built-in screen and cursor manipulation functions in the
  22.    IBM Pascal compiler.  The programmer is obliged to write his own routines
  23.    to service the display in the way he wishes.  However, there are many
  24.    functions already available in the ROM, the only question is how to
  25.    access them.  This is where INTRPT.ASM comes into play.  INTRPT.ASM is an
  26.    interfacing routine which accepts five parameters passed to it in a stack
  27.    frame by a calling Pascal procedure or function.  These variables are the
  28.    number of the interrupt to be generated, and values to place in the four
  29.    8088 registers AX, BX, CX and DX.  The variables passed to INTRPT are
  30.    word length and can therefore be used to pass two byte values for use in
  31.    the high and low bytes of the registers.  INTRPT then places the values
  32.    passed into their proper locations and executes an interrupt.  This
  33.    passes control to the desired routine which then does its thing.  When
  34.    the ROM routine is done, it returns control to INTRPT, which places the
  35.    returned values in the AX, BX, CX and DX registers back in the stack
  36.    frame to be returned to Pascal.  INTRPT then passes control back to the
  37.    Pascal calling routine and we are back in our application program.
  38.  
  39.       The file IOSTUFF.INC is the include file which must be included in
  40.    your Pascal source file before any of the routines or variables are used.
  41.    This file contains a list of all the procedure names, variable names and
  42.    variable type definitions.  It also contains all the Procedure calls and
  43.    the variables passed to and from them.
  44.  
  45.       The file IOSTUFF.PAS is the source code for all the procedures which
  46.    access the INTRPT procedure.  It is the Implementation of the Unit
  47.    IOSTUFF.  This file is not to be included in your source program, but
  48.    rather the compiled version IOSTUFF.OBJ must be linked in with the object
  49.    code from the application program and with the object code INTRPT.OBJ.
  50.    This is done with a Linker command of the form:
  51.  
  52.         LINK MYPROG IOSTUFF INTRPT;
  53.  
  54.    This will cause the IBM Link facility to generate an EXE file with all
  55.    the proper code in the right place, etc.  For further information on
  56.    using Units in Pascal, see the compiler manual, pages 13-11 to 13-17.
  57.  
  58.       All the routines in the IOSTUFF Unit are fairly well documented and
  59.    most of them are simple routines.  The parameters used and the functions
  60.    or procedures performed are self-explanatory.  There is not much checking
  61.    for valid data performed in the procedures themselves.  This is left up
  62.    to the programmer to control as he wishes.  There are also many functions
  63.    in the ROM which are not implemented in this Unit.  If you come up with
  64.    some terrific new application, let me know.    I think this system could be
  65.    used effectively to create some good graphics routines for Pascal, since
  66.    it lets you get to the bit level on the screen.  Also, the access to the
  67.    printer port through ROM has not been implemented nor has the access to
  68.    the COM port.  These are things which I would like to do in the future.
  69.    All I need is about 2 months off work with pay.
  70.  
  71.       The program DISKREAD is a demonstration of some of the procedures in
  72.    IOSTUFF, especially the ability to read any sector on the disk.  It also
  73.    demonstrates setting the cursor size and positioning the cursor on the
  74.    screen.  The program is not complete by any means, and the functions it
  75.    performs are not very complicated.  There are three commands not shown on
  76.    the bottom line, they are:
  77.  
  78.       F1 - Input new Drive/Side/Track/Sector
  79.       F2 - Toggle the radix for Drive/Side/Track/Sector from decimal to hex
  80.        and back
  81.       T  - Fills the sector buffer with a test pattern of all characters in
  82.        the PC's character generator ROM.
  83.  
  84.    Since this program prints ALL codes in the ROM, you may not be able to
  85.    do a PrtSc since it may send your printer into the Thulies.    Now there's
  86.    a good application for writing a procedure using this method!
  87.  
  88.       Brian Irvine
  89.       3379 St Marys Place
  90.       Santa Clara, CA 95051
  91.       (408) 984-8692
  92.       2/24/83
  93.