home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / QWIK13.ZIP / QWIK13.DOC < prev    next >
Encoding:
Text File  |  1986-11-10  |  10.2 KB  |  243 lines

  1.                                                         November 10, 1986
  2.  
  3.                                 Q SCREEN UTILITES
  4.                                    Version 1.3
  5.  
  6.         PURPOSE:
  7.  
  8.         Q screen utilities permit fast screen writes on IBM compatibles
  9.         with MDA, CGA, and/or EGA adapters without "snow" or flicker
  10.         effects.  Written in Turbo Pascal inline assembler, these
  11.         procedures are lightning fast.  This version has reduced the
  12.         assembly code by 60% without sacrificing speed - only 759 bytes
  13.         of compiled code for all eight utilities!
  14.  
  15.  
  16.         TEST DRIVE:
  17.  
  18.         Compile and run QDEMO.PAS to get a feel for features and speed.
  19.  
  20.  
  21.         UTILITIES:
  22.  
  23.         In this version, QWIK13.ARC contains:
  24.  
  25.            EGAchk .inc:  Initializing function required to be compiled
  26.                          before Qwrites.inc or Qfills.inc.
  27.            Qwrites.inc:  Four Quick direct screen writing procedures:
  28.                          QwriteV  - referenced (VAR) strings
  29.                          Qwrite   - value strings
  30.                          QwriteC  - value strings, self-centering
  31.                          QwriteCV - referenced (VAR) strings, self-
  32.                                     centering
  33.            Qfills .inc:  Two Quick direct screen filling procedures:
  34.                          Qfills   - repetitive filling with the same
  35.                                     character
  36.                          Qattr    - repetitive filling with the same
  37.                                     attribute only
  38.            Cursor .inc:  Two Quick cursor procedures:
  39.                          GotoRC   - inverse of Turbo's GotoXY
  40.                          ChangeCursor - changes shape and visibility
  41.                                     of the cursor; saves old, too!
  42.            Qwik13 .inc:  Has all of the above routines but compiles much
  43.                          faster because there are few comments.
  44.            Qwik13 .doc:  This document.
  45.            Qdemo  .pas:  A demonstration program showing the features and
  46.                          speed of all utilities and written for color
  47.                          terminals.
  48.  
  49.         All Q utilities work with or without attributes changes. (Do not
  50.         run QwritesDisp and QfillsDisp alone as they are just dummy
  51.         names.)
  52.  
  53.  
  54.         PROGRAMMING:
  55.  
  56.         To use the procedures, just simply pick out the ones you need and
  57.         include them in your programs.  Be sure to read the MODIFICATIONS
  58.         section below before editing the modules.  Only one initializing
  59.         statement is necessary (not required for cursor.inc):
  60.  
  61.             ToEGA:=EGAcheck;
  62.  
  63.         Until I can find a means of direct memory access, this statement
  64.         is needed to find out if you have an EGA.  The procedures auto-
  65.         matically configure to your machine and also make them portable
  66.         to others.
  67.  
  68.  
  69.         MODULES:
  70.  
  71.         The coding has been reduced by making the display loops into a
  72.         subroutine and programming the procedures to access it.  These
  73.         were combined to make modules - two in this package.  It is
  74.         important that the procedures within the module remain in their
  75.         present order because the CALL address was compiled in assembler
  76.         and not with Turbo.  But you can easily delete the procedures you
  77.         don't need.  Refer to MODIFICATIONS below.
  78.  
  79.  
  80.         PARAMETERS:
  81.  
  82.         Row/Col - The procedures do not check for bounds on the screen,
  83.         so be sure to stay in range.  The procedures were designed for
  84.         the upper left column on the screen to be 1,1.  If you want 0,0,
  85.         refer to MODIFICATIONS below.  They also wrap to the next line;
  86.         they do not truncate at EOL.  You of course can have something
  87.         like Row:=1 and Col:=255 which is equivalent to Row:=3 and 
  88.         Col:=15 on a screen with 80 columns.
  89.  
  90.         Attr - The attributes range from 0 to 255.  Values greater than 
  91.         255 will be operated by modulo 256 to stay useful.  Negative 
  92.         values suppress any changes to the screen attributes and use
  93.         what's currently on the screen.  For help with attribute values,
  94.         use Brian Foley's FWATTR.INC on Borland's SIG on CompuServe in
  95.         Turbo Pascal Data Library for MSDOS.
  96.  
  97.         Cols - In Qfill.inc and Qattr.inc, Cols can be any positive
  98.         integer up to a full screen - 2000 on 80x25 displays and more on
  99.         EGA displays.  Negative values will simply abort the procedure.
  100.  
  101.         ColL/ColR - In QwriteC.inc and QwriteCV.inc, the left and right
  102.         columns are simply averaged.  To center on the full width of an
  103.         80 column display, set ColL:=1 and ColR:=80.  To center on a
  104.         certain column number, set both values equal to that column
  105.         number.
  106.  
  107.         St - The original type was set for string length of 80 characters
  108.         which my be changed to any value between 1 and 255.  Be sure to
  109.         change the type statment to reflect it though!
  110.  
  111.         Order - You may rearrange the parameters in any order you prefer.
  112.         The arrangement was made to facilitate readability and keeping
  113.         the coordinates on the left side of the display.
  114.  
  115.  
  116.         SPEED:
  117.  
  118.         How fast is fast?  Well, I thought it would be good idea to have
  119.         some criteria to get a feeling for speed.  The units I decided
  120.         to use for comparison are "screens/second".  To make one screen,
  121.         a utility is repeated with a FOR loop to fill an entire 80x25
  122.         display and timed.  QwriteXX use 80 character strings, and Qattr
  123.         and Qfill use Cols:=2000.  At the moment, all I have are ratings
  124.         on my own computer (AT&T 6300+) which uses Intel 80286.  Other
  125.         processors will be proportional.  EGA speeds are essentially the
  126.         same as Mono speeds.
  127.  
  128.         ------------------ S C R E E N S / S E C O N D ------------------
  129.                   Chng    -- 80286 --    -- 8086 ---    -- 8088 ---
  130.         Procedure Attr    Mono    CGA    Mono    CGA    Mono    CGA
  131.         --------- ----    -----------    -----------    ------------
  132.         QwriteV   Yes     112    16.8
  133.                   No      120    16.8
  134.         Qwrite    Yes      87.3  14.4
  135.                   No       92.0  14.4
  136.         QwriteCV  Yes     111    16.8
  137.                   No      119    16.8
  138.         QwriteC   Yes      86.9  14.4
  139.                   No       91.2  14.4
  140.         Qfill     Yes     252    15.0
  141.                   No      186    14.1
  142.         Qattr     Yes     186    14.1
  143.  
  144.         
  145.         ASSEMBLING:
  146.  
  147.         Turbo compiles some code before and after procedures:
  148.  
  149.           1. 7 bytes before.
  150.           2. 7 bytes after without parameters.
  151.           3. 9 bytes after with parameters.
  152.  
  153.         So, when the modules were assembled, some dummy bytes were placed 
  154.         between the procedures to represent Turbo's compiled code which 
  155.         allowed Dave Baldwin's Inline to correctly address the calls.  
  156.         The dummy bytes were:
  157.  
  158.           Qwrites Module:
  159.               QwriteV
  160.                 { 16 dummy bytes }
  161.               Qwrite
  162.                 { 16 dummy bytes }
  163.               QwritesDisp
  164.                 { 14 dummy bytes }
  165.               QwriteC
  166.                 { 16 dummy bytes }
  167.               QwriteCV
  168.  
  169.           Qfills Module:
  170.               Qfill  
  171.                 { 16 dummy bytes }
  172.               QfillsDisp
  173.                 { 14 dummy bytes }
  174.               Qfill  
  175.  
  176.  
  177.         MODIFICATIONS:
  178.  
  179.         Deleting Procedures - If you want to delete some procedures 
  180.         within a module, just follow this simple rule:
  181.  
  182.             Delete from the outside in.
  183.  
  184.         You can delete the procedures surrounding QwriteDisp and
  185.         QfillsDisp, but you cannot for example delete QwriteC without
  186.         also deleting QwriteCV. You of course can delete a whole module.
  187.         Do not attempt to rearrange the procedures within a module unless
  188.         you feel confident with modifying the CALL addresses.
  189.  
  190.         Base Coordinates - If you want to change the upper left corner to
  191.         be 0,0 instead of 1,1, you need to do the following:
  192.  
  193.            1. In QwriteV, Qwrite, Qfill, and Qattr replace DEC DI with
  194.               NOP which has an inline code of $90.
  195.            2. In QwritesDisp and QfillsDisp, change the screen addresses
  196.               from $AFF6 and $B7F6 to $B000 and $B800 respectively.
  197.            3. In QwriteC and QwriteCV, change DEC DI to INC DI which has
  198.               a inline code of $40.
  199.  
  200.  
  201.         EGAchk.inc - This include file has one function, EGAcheck, that
  202.         is needed only for Qwrites.inc and Qfills.inc and should be
  203.         included first so the the Q utilities can recognize the variable
  204.         ToEGA.  It is not required for the cursor procedures.
  205.  
  206.         Retrace - If snow is not objectionable for your application as is
  207.         sometimes the case when Qfill with attribute is used, then you can
  208.         set ToEGA:=true.
  209.  
  210.  
  211.         CREDITS:
  212.  
  213.         Without the assistance and original ideas from Brian Foley
  214.         [76317,3247], these routines would not have been written.  In
  215.         addition, Dave Baldwin's InLine Assembler was essential in its
  216.         development.
  217.  
  218.         Copyright (c) 1986 by Jim LeMay
  219.         These procedures may be used and distributed without profit in 
  220.         private contexts.  I must be contacted for any other use.
  221.         
  222.         If there are any problems such as snow, please let me know.  
  223.         Jim LeMay [76011,217]  (1-817-735-4833  after 1800 CST )         
  224.  
  225.  
  226.         REVISIONS:
  227.  
  228.         Version 1.1 (10-31-86):
  229.            Improved speed about 15%.
  230.            Corrected segment error for Mono mode.
  231.  
  232.         Version 1.2 (11-04-86):
  233.            Added self-centering routines.
  234.            Added document and complete demo.
  235.  
  236.         Version 1.3 (11-10-86):
  237.            Reduced assembly code 60% by using modules.
  238.            Added CursorChange utility.
  239.            Improved speed on Qfill and Qattr about 5%.
  240.            Corrected Qfill bug.  Extra character was added when
  241.               attr<0 and Cols=even.
  242.            Changed EGA detection to use Mono rather than CGA loops.
  243.            Added page capability to GotoRC.