home *** CD-ROM | disk | FTP | other *** search
- November 10, 1986
-
- Q SCREEN UTILITES
- Version 1.3
-
- PURPOSE:
-
- Q screen utilities permit fast screen writes on IBM compatibles
- with MDA, CGA, and/or EGA adapters without "snow" or flicker
- effects. Written in Turbo Pascal inline assembler, these
- procedures are lightning fast. This version has reduced the
- assembly code by 60% without sacrificing speed - only 759 bytes
- of compiled code for all eight utilities!
-
-
- TEST DRIVE:
-
- Compile and run QDEMO.PAS to get a feel for features and speed.
-
-
- UTILITIES:
-
- In this version, QWIK13.ARC contains:
-
- EGAchk .inc: Initializing function required to be compiled
- before Qwrites.inc or Qfills.inc.
- Qwrites.inc: Four Quick direct screen writing procedures:
- QwriteV - referenced (VAR) strings
- Qwrite - value strings
- QwriteC - value strings, self-centering
- QwriteCV - referenced (VAR) strings, self-
- centering
- Qfills .inc: Two Quick direct screen filling procedures:
- Qfills - repetitive filling with the same
- character
- Qattr - repetitive filling with the same
- attribute only
- Cursor .inc: Two Quick cursor procedures:
- GotoRC - inverse of Turbo's GotoXY
- ChangeCursor - changes shape and visibility
- of the cursor; saves old, too!
- Qwik13 .inc: Has all of the above routines but compiles much
- faster because there are few comments.
- Qwik13 .doc: This document.
- Qdemo .pas: A demonstration program showing the features and
- speed of all utilities and written for color
- terminals.
-
- All Q utilities work with or without attributes changes. (Do not
- run QwritesDisp and QfillsDisp alone as they are just dummy
- names.)
-
-
- PROGRAMMING:
-
- To use the procedures, just simply pick out the ones you need and
- include them in your programs. Be sure to read the MODIFICATIONS
- section below before editing the modules. Only one initializing
- statement is necessary (not required for cursor.inc):
-
- ToEGA:=EGAcheck;
-
- Until I can find a means of direct memory access, this statement
- is needed to find out if you have an EGA. The procedures auto-
- matically configure to your machine and also make them portable
- to others.
-
-
- MODULES:
-
- The coding has been reduced by making the display loops into a
- subroutine and programming the procedures to access it. These
- were combined to make modules - two in this package. It is
- important that the procedures within the module remain in their
- present order because the CALL address was compiled in assembler
- and not with Turbo. But you can easily delete the procedures you
- don't need. Refer to MODIFICATIONS below.
-
-
- PARAMETERS:
-
- Row/Col - The procedures do not check for bounds on the screen,
- so be sure to stay in range. The procedures were designed for
- the upper left column on the screen to be 1,1. If you want 0,0,
- refer to MODIFICATIONS below. They also wrap to the next line;
- they do not truncate at EOL. You of course can have something
- like Row:=1 and Col:=255 which is equivalent to Row:=3 and
- Col:=15 on a screen with 80 columns.
-
- Attr - The attributes range from 0 to 255. Values greater than
- 255 will be operated by modulo 256 to stay useful. Negative
- values suppress any changes to the screen attributes and use
- what's currently on the screen. For help with attribute values,
- use Brian Foley's FWATTR.INC on Borland's SIG on CompuServe in
- Turbo Pascal Data Library for MSDOS.
-
- Cols - In Qfill.inc and Qattr.inc, Cols can be any positive
- integer up to a full screen - 2000 on 80x25 displays and more on
- EGA displays. Negative values will simply abort the procedure.
-
- ColL/ColR - In QwriteC.inc and QwriteCV.inc, the left and right
- columns are simply averaged. To center on the full width of an
- 80 column display, set ColL:=1 and ColR:=80. To center on a
- certain column number, set both values equal to that column
- number.
-
- St - The original type was set for string length of 80 characters
- which my be changed to any value between 1 and 255. Be sure to
- change the type statment to reflect it though!
-
- Order - You may rearrange the parameters in any order you prefer.
- The arrangement was made to facilitate readability and keeping
- the coordinates on the left side of the display.
-
-
- SPEED:
-
- How fast is fast? Well, I thought it would be good idea to have
- some criteria to get a feeling for speed. The units I decided
- to use for comparison are "screens/second". To make one screen,
- a utility is repeated with a FOR loop to fill an entire 80x25
- display and timed. QwriteXX use 80 character strings, and Qattr
- and Qfill use Cols:=2000. At the moment, all I have are ratings
- on my own computer (AT&T 6300+) which uses Intel 80286. Other
- processors will be proportional. EGA speeds are essentially the
- same as Mono speeds.
-
- ------------------ S C R E E N S / S E C O N D ------------------
- Chng -- 80286 -- -- 8086 --- -- 8088 ---
- Procedure Attr Mono CGA Mono CGA Mono CGA
- --------- ---- ----------- ----------- ------------
- QwriteV Yes 112 16.8
- No 120 16.8
- Qwrite Yes 87.3 14.4
- No 92.0 14.4
- QwriteCV Yes 111 16.8
- No 119 16.8
- QwriteC Yes 86.9 14.4
- No 91.2 14.4
- Qfill Yes 252 15.0
- No 186 14.1
- Qattr Yes 186 14.1
-
-
- ASSEMBLING:
-
- Turbo compiles some code before and after procedures:
-
- 1. 7 bytes before.
- 2. 7 bytes after without parameters.
- 3. 9 bytes after with parameters.
-
- So, when the modules were assembled, some dummy bytes were placed
- between the procedures to represent Turbo's compiled code which
- allowed Dave Baldwin's Inline to correctly address the calls.
- The dummy bytes were:
-
- Qwrites Module:
- QwriteV
- { 16 dummy bytes }
- Qwrite
- { 16 dummy bytes }
- QwritesDisp
- { 14 dummy bytes }
- QwriteC
- { 16 dummy bytes }
- QwriteCV
-
- Qfills Module:
- Qfill
- { 16 dummy bytes }
- QfillsDisp
- { 14 dummy bytes }
- Qfill
-
-
- MODIFICATIONS:
-
- Deleting Procedures - If you want to delete some procedures
- within a module, just follow this simple rule:
-
- Delete from the outside in.
-
- You can delete the procedures surrounding QwriteDisp and
- QfillsDisp, but you cannot for example delete QwriteC without
- also deleting QwriteCV. You of course can delete a whole module.
- Do not attempt to rearrange the procedures within a module unless
- you feel confident with modifying the CALL addresses.
-
- Base Coordinates - If you want to change the upper left corner to
- be 0,0 instead of 1,1, you need to do the following:
-
- 1. In QwriteV, Qwrite, Qfill, and Qattr replace DEC DI with
- NOP which has an inline code of $90.
- 2. In QwritesDisp and QfillsDisp, change the screen addresses
- from $AFF6 and $B7F6 to $B000 and $B800 respectively.
- 3. In QwriteC and QwriteCV, change DEC DI to INC DI which has
- a inline code of $40.
-
-
- EGAchk.inc - This include file has one function, EGAcheck, that
- is needed only for Qwrites.inc and Qfills.inc and should be
- included first so the the Q utilities can recognize the variable
- ToEGA. It is not required for the cursor procedures.
-
- Retrace - If snow is not objectionable for your application as is
- sometimes the case when Qfill with attribute is used, then you can
- set ToEGA:=true.
-
-
- CREDITS:
-
- Without the assistance and original ideas from Brian Foley
- [76317,3247], these routines would not have been written. In
- addition, Dave Baldwin's InLine Assembler was essential in its
- development.
-
- Copyright (c) 1986 by Jim LeMay
- These procedures may be used and distributed without profit in
- private contexts. I must be contacted for any other use.
-
- If there are any problems such as snow, please let me know.
- Jim LeMay [76011,217] (1-817-735-4833 after 1800 CST )
-
-
- REVISIONS:
-
- Version 1.1 (10-31-86):
- Improved speed about 15%.
- Corrected segment error for Mono mode.
-
- Version 1.2 (11-04-86):
- Added self-centering routines.
- Added document and complete demo.
-
- Version 1.3 (11-10-86):
- Reduced assembly code 60% by using modules.
- Added CursorChange utility.
- Improved speed on Qfill and Qattr about 5%.
- Corrected Qfill bug. Extra character was added when
- attr<0 and Cols=even.
- Changed EGA detection to use Mono rather than CGA loops.
- Added page capability to GotoRC.