home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / PAGWRITE.ZIP / README < prev    next >
Encoding:
Text File  |  1985-10-07  |  4.9 KB  |  71 lines

  1.  
  2.        The two files PageDisp.Pas and Speedchk.pas were written as demo
  3.  programs to demonstrate the use of User provided I/O routines from Turbo
  4.  Pascal. This capability basically provides you with the ability to make
  5.  Tubo use the procedure you have written instead of its own internal
  6.  routine in the Write and Writeln statements.
  7.        What the programmer has to do is to write a procedure/Function to
  8.  do the I/O ensuring that the parameters are compatible.(Check the T.P
  9.  reference manual for the parameters expected of the I/O procedures and
  10.  functions). Turbo has pre-declared integer variables called ConOutPtr,
  11.  ConInPtr,LstOutPtr etc which are supposed to point to the offset of the
  12.  corresponding I/O routines. So assigning these pointers to the offsets
  13.  of your I/O routines will essentially cause T.P to use them for the
  14.  corresponding function. If an output pointer has been reassigned, then
  15.  all the Write and Writeln statements will call the new procedures and
  16.  If it is an input pointer, the Read/Readln statements will use the new
  17.  procedure/function.
  18.        The programs PageDisp and SpeedChk reassign the ConOutPtr to a
  19.  routine "WriteChar". What the procedure WriteChar does is to write a
  20.  character to screen writing the character and its attribute directly to
  21.  the display memory instead of using the BIOS interrupt 10H. The additional
  22.  capability of this routine is that it can write to any page of the display
  23.  of a Color Graphics adapter. The Color Graphics adapter in an IBM PC has
  24.  16K of memory and hence can hold 4 pages of 80 X 25 characters in the text
  25.  mode. Any one of these pages can be selected on the screen by using the
  26.  BIOS interrupt 5. However, most high level languages do not use this
  27.  capability and do not provide access to pages other than page 0.( May be to
  28.  maintain compatibility with the monochrome adapter also.) Using the multipage
  29.  capability enables you to change displays almost instantaneously by writing
  30.  to a non-displayed page and switching to that page after finishing writing.
  31.  The procedure Writechar enables one to write to any page specified by the
  32.  variable Out_Page irrespective of what is displayed on the screen.The
  33.  procedure Disp_Page is used to bring onto display any of thes pages.
  34.        These programs bring out another feature in Turbo Pascal which is
  35.  the capability to replace any standad internal procedure by a user-provided
  36.  procedure. If a procedure/function provided by the user has the same name as
  37.  an internal Turbo procedure/function, then the internal function gets
  38.  disabled and the user-provided function is used in all calls to that
  39.  procedure. The procedures TextColor and TextBackground have been redefined
  40.  this way in the two programs to make those functions work when using the
  41.  WiteChar procedure for output. There is a disadvantage in this though..
  42.  If at all you want to go back to the internal display driver routine at some
  43.  other place in the same program (Which you can do by restoring the original
  44.  value of ConOutPtr) the procedures TextColor and TextBackground will not work.
  45.  So if that capability is needed, you'd have to rename them to something else
  46.  and use those nonstandard names to change background and foreground text
  47.  colors when using WriteChar as the Display diver.
  48.        The writechar procedure as given here does not support the Window
  49.  function of Turbo. However it is possible to do that also by incorporating
  50.  some more code.The Assembler source for that procedure is provided as a
  51.  separate file for anyone who would like to make changes.
  52.        While writing and testing the program DispPage, I wanted to test the
  53.  improvement in speed achieved by using writing directly to screen and hence
  54.  the program SpeedChk. This measures the speed of 4 cases of writing to screen
  55.  20 lines of 79 characters each. The first 2 use the Turbo internal procedure
  56.  while the next two use WriteChar for screen output. The second and fourth
  57.  runs write these lines on the 25th line of the display, forcing the screen
  58.  to scroll which slows down the output quite a lot. On my AT&T 6300, I
  59.  observed speed increases of the order of 5 to 6 : 1 for unscrolled output
  60.  and about 3.5 : 1 for scrolled outputs. This was using Tubo Pascal 2.0 which
  61.  I am using presently. Turbo 3.0 apparently uses direct screen memory writes
  62.  in its standard output routine, so the speed increases may be much less. Also
  63.  an IBM PC may give different ratio than my AT&T machine, due to differences
  64.  in hardware (8 bit vs 16 bit bus mainly) and the BIOS software.
  65.         I hope these routines are of some value to other Turbo Pascal
  66.  enthusiasts. Any comments and suggestions would be appreciated.
  67.                                          Babu Kalakrishnan
  68.                                        Voice # (415)-965-8859
  69.                           Or leave message on LogOn BBS (408)-735-7390
  70.                                            or P.D.S.E   (408)-735-7190
  71.