home *** CD-ROM | disk | FTP | other *** search
- December 01, 1987
-
- QWIK SCREEN UTILITIES
- Version 4.0
-
- PURPOSE:
-
- QWIK screen utilities permit fast screen writing on IBM
- | compatibles on any IBM or Hercules adapter including the new PS/2
- systems without "snow" or flicker effects and is compatible with
- | ANY column format (e.g. 40/80 or variable). Written in MASM and
- | implemented in a unit for Turbo Pascal 4.0, these procedures are
- lightning fast. The code has also been condensed as much as
- possible without sacrificing speed - only 1.6k bytes of compiled
- | code for all 18 procedures! QWIK utilities allow you to write to
- | the screen in absolute coordinates on any video page and are not
- | confined to a Turbo window or to just page 0.
-
-
- TEST DRIVE:
-
- Compile and run QWIKDEMO.PAS to get a feel for features and speed.
-
-
- IMPROVEMENTS:
-
- | Most obviously, this version was overhauled to work with TP 4.0.
- | In addition, Hercules and 3270 PC detection was added. (For those
- | not familiar with the 3270 PC, it is a stand alone PC that doubles
- | as a main-frame terminal.) WhereR and WhereC were added. CRTcols
- | and CRTrows variables were added. TP 4.0 improved string handling
- | procedures so that Qwrite- no longer requires VAR parameters, so,
- | QwriteV and QwriteCV were deleted. Read UPGRADING below on how to
- | change your source code. Also, char-type variables can now be
- | passed to Qwrite- procedures.
-
-
-
- FILES:
-
- In this version, QWIK40.ARC contains:
-
- Qwik40 .tpu: Compiled QWIK40 unit of 1200 lines of assembler.
- Qwik40 .pas: Source code for QWIK40.TPU. (MASM source code
- and object files are not included.)
- Qwik40 .doc: This document.
- QwikDemo.pas: A demonstration program showing the features and
- speed of all procedures and is written primarily
- for color cards, but also works on mono cards.
- Qinit .doc: Document for Qinit procedure.
- Qinitest.pas: A program that verifies the equipment detected
- by the Qinit procedure.
- Qbench .pas: A timing program that shows "screens/second" for
- the Q- procedures.
- Cursor .doc: Document for cursor procedures and functions.
- TimerD12.inc: Include file to measure elapsed time.
- License .arc: ARC file containing license agreements
-
-
- PROCEDURES AND FUNCTIONS:
-
- In this version, QWIK40.TPU has the following procedures and
- functions. To see the parameters needed, see QWIK40.PAS.
-
- One initializing procedure:
- Qinit - Initializing procedure executed by QWIK40.TPU
- which sets the global variables for the Q-
- procedures. It should be executed again after
- a change from one text mode to another.
- Three quick direct screen writing procedures, all work with or
- without attribute change:
- Qwrite - for any type string or char.
- QwriteC - for any type string or char; self-centering.
- QwriteA - for any type variable; specified length and
- index. (Array-like)
- Four quick direct screen filling procedures in Rows-by-Cols
- block parameters:
- Qfill - repetitive filling with the same character;
- self-centering, with or without attribute
- change.
- QfillC - Same as Qfill, but self-centering.
- Qattr - repetitive filling with the same attribute
- only.
- QattrC - Same as Qattr, but self-centering.
- Two quick screen storing procedures:
- QstoreToMem - Saves a Rows-by-Cols block to memory.
- QstoreToScr - Restores a Rows-by-Cols block to any screen
- page.
- Two quick video page changing procedures:
- QviewPage - Changes the page to be displayed - up to 8!
- QwritePage - Sets the page on which the Q- procedures are
- writing. You don't have to write just on the
- displayed page!
- Six quick cursor procedures and functions:
- GotoRC - inverse of Turbo's GotoXY but in absolute
- coordinates rather than relative to a window.
- It also works on any video page.
- ChangeCursor - changes shape and visibility of the cursor;
- saves old shape, too!
- CursorOff - Hides cursor.
- CursorOn - Reveals cursor, again.
- WhereR - Returns absolute row coordinate for the viewed
- video page.
- WhereC - Returns absolute column coordinate for the
- viewed video page.
-
-
- PROGRAMMING:
-
- | To use QWIK40.TPU in your programs add the following line:
- |
- | USES {$U Qwik40.tpu} Qwik;
- |
- | Or, if you would like, it is recommended that you copy QWIK40.TPU
- | to QWIK.TPU and just do this line:
- |
- | USES Qwik;
- |
- | TP 4.0 Startup - Borland improved the startup of any EXE file. It
- | checks for the video mode to see if it is a valid text mode
- | (0..3,7). If so, it remains in that mode. If not, it is in a
- | graphics mode and it is forced back into the computer's default
- | text mode, whatever that may be.
- |
- | QWIK40 Startup - QWIK40.TPU automatically runs Qinit the first
- | time. (Turbo's smart compiler does it just once no matter how
- | many times it appears in USES statments throughout your program.)
- | If you change from one text mode to another in a running program,
- | you still need to run Qinit again.
-
-
- 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. 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.
-
- ColL/ColR - In QwriteC, QfillC, and QattrC, 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. Or,
- | to center on any display, set ColL:=1 and ColR:=CRTcols.
-
- Rows/Cols - They can be any byte to define the block: Rows-by-
- Columns starting at Row, Col. Please keep Cols limited to one
- row.
-
- 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. You can also use Turbo's
- | TextColor and TextBackground procedures, and then use TextAttr as
- | a parameter. Be aware that the 3270 PC ignores the foreground
- | intensity bit, so there are only 8 colors. In addition, 4 colors
- | have different tints:
-
- | PC Color 3270 PC Color
- | ------------ -------------
- | Cyan Turquoise
- | Magenta Pink
- | Brown Yellow
- | Light Gray White
-
- | ArrayLength - In QwriteA, you can write arrays or partial strings
- | by specifying the ArrayLength and the starting index (aStr[i]).
- | (Qwrite and QwriteC assume the length is the value at aStr[0] and
- | the starting index is aStr[1].) ArrayLength can be any word. For
- | example:
- |
- | MyString:='Step B: Testin out this line.';
- | QwriteA (1,1,-1,21,MyString[9]);
- |
- | will print out "Testing out this line." Of course, MyString
- | doesn't have to be a string - it can be any type variable or
- | address in memory.
-
- | aStr - One of the nice improvements of TP 4.0 is that the address
- | of a string is always passed onto to the stack no matter if it's a
- | string value or a variable. So, there is no need to copy strings
- | to the stack and thereby increasing speed. The Qwrite- procedures
- | only use the address. "aStr" is of type "string", now, and not
- | Str80 and there is no need to be concerned about incompatible
- | string types
-
- Source/Dest - For Qstores.inc, this can be a pointer for the heap
- or an array variable. Be sure there is sufficient room. Storage
- requirements are: (Rows * Cols shl 1) which is two bytes for
- every column. For pointers use a format such as:
-
- Var MemPtr: ^byte;
- GetMem (MemPtr,Rows*Cols shl 1);
- QstoreToMem (Row,Col,Rows,Cols,MemPtr^);
-
- Page - The page range depends upon your adapter. See QINIT.DOC
- for the possible ranges.
-
-
- PAGING:
-
- If you have a CGA or better, you already have memory on your card
- for more than the 80x25 display you normally see. The two page
- procedures allow you to use QWIK utilities on these other pages
- and display which ever you choose. However, Turbo's procedures
- such as Write, Window, and GotoXY are dedicated to page 0 only.
- Be sure to end your programs with "QviewPage (0);".
-
-
- | UPGRADING:
-
- Here's a list of steps to help you upgrade to QWIK40 from earlier
- versions on your new programs:
-
- 1. Add "Uses Qwik;" or "Uses {$U Qwik40.tpu} Qwik;".
- 2. Delete the first Qinit.
- 3. Do a search and replace for the following names.
- Search Replace with
- --------- ---------------------
- CardWait CardSnow
- Qwait Qsnow
- QwriteLV QwriteA
- QwriteCV QwriteC
- QwriteV Qwrite
- ActiveDD ActiveDispDev
- AltDD AltDispDev
- PCCAltDD AltDispDevPCC
- Vmode VideoMode
- 4. Add "CheckSnow:=Qsnow" early in the program and after each
- Qinit.
- 5. See REVISIONS for changes of type.
-
-
- | TIPS:
-
- CheckSnow - If you plan on using the standard CRT unit, place the
- following line early in your programs and after each Qinit.
-
- CheckSnow:=Qsnow;
-
- Qinit appears to be more extensive in it's testing for wait-for-
- retrace. Then, Write and WriteLn will work at the same speed as
- QWIK if DirectVideo is true.
-
- Multi-Tasking - Currently, QWIK does not attempt to modify
- Page0seg for multi-tasking software, but the variables have been
- set up so you can do this. Take DESQview for example; rather than
- writing direct to screen memory, DESQview allocates a presentation
- buffer in RAM. All direct screen write procedures can treat the
- presentation buffer just like the video buffer, except that Qsnow
- can always be false. Then, DESQview copies the correct portions
- to the video buffer. Here's an example procedure that would
- modify Page0seg:
-
- uses DOS;
- GetVideoBuffer (VAR Page0seg: word);
- begin
- Regs.es:=Page0seg;
- Regs.di:=0;
- Regs.ah:=$FE;
- Intr ($10,Regs);
- Page0seg:=Regs.es;
- end;
-
- This procedure also works for 3270 PC. If neither DESQview nor
- the 3270 PC are present, then Page0seg will still have the same
- value.
-
- To update the display on the 3270 PC when using multi-tasking, use
- the following procedure:
-
- UpdateVideoDisplay (Row, Col: byte; NumOfChars: word);
- begin
- Regs.es:=Page0seg;
- Regs.di:=pred(Row)*CRTcols + pred(Col);
- Regs.cx:=NumOfChars;
- Intr ($10,Regs);
- Qseg:=Page0seg;
- end;
-
- where Row and Col is the position in the presentation buffer to be
- updated and only for NumOfChars. CardSeg will still have the
- original segment of the video card.
-
- EgaMono - You should be aware that another constant also named
- EGAMono is used by the DetectGraph procedure in the Graph unit,
- but fortunately, they have the same value!
-
- Longer names - If you wish to be more explicit with procedure,
- function, and variable names, you can always add the unit name as
- a prefix:
-
- Qwik.GotoRC (1,1);
- MyCols:=Qwik.CRTcols;
-
- Q- Convention - The "Q" in front of a procedure means that it
- depends on the data initialized by Qinit. Others do not.
-
-
- 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 procedure is repeated with a FOR loop to fill several 80x25
- pages and timed. Qwrite- use 80 character strings, and Qattr
- and Qfill use Rows:=25 and Cols:=80. Here are some samples from
- the systems that have been tested. My own computer is the
- AT&T 6300+ which uses Intel 80286. Monochrome (MDA) speeds are
- close to EGA speeds.
-
-
- ------------------ S C R E E N S / S E C O N D ------------------
- Chng XT(4.77 MHz) M50 M30 PCC ATT 6300+
- Procedure Attr EGA CGA MCGA VGA LCD EGA CGA
- --------- ---- ------------ ----- ----- ----- -----------
- | Qwrite Yes 32.8 9.5 75.4 88.4 40.0 112.1 16.7
- | No 42.4 9.5 90.0 138.1 48.6 119.5 16.8
- | QwriteC Yes 32.6 9.5 74.9 89.0 39.5 111.0 16.8
- | No 41.6 9.5 89.3 138.1 47.8 119.0 16.8
- QwriteA Yes 32.6 9.5 74.9 88.4 39.7 111.3 16.8
- No 42.0 9.5 89.3 138.1 47.8 119.5 16.8
- QfillC Yes 81.2 11.9 166.6 147.3 122.5 244.3 21.5
- No 72.6 7.4 141.3 174.4 90.5 176.9 14.0
- Qfill Yes 81.2 11.8 164.1 147.3 122.5 246.1 21.5
- No 73.7 7.4 141.3 174.4 90.5 177.9 14.0
- Qattr Yes 72.6 7.4 141.3 174.4 90.5 177.9 14.0
- QattrC Yes 72.6 7.4 141.3 174.4 90.5 177.9 14.0
- QstoreToMem n/a 59.1 7.2 111.6 127.4 78.4 181.9 13.8
- QstoreToScr n/a 59.1 7.0 111.6 126.2 78.4 183.9 13.7
-
-
- APPLICATIONS:
-
- Multi-level Windows - An application of QWIK40.INC is multi-level
- windows. The code is available in a file called WINDOW40.ARC. It
- creates protected windows with serial or random access that can be
- moved or removed and has Macintosh-like special special effects.
- Scheduled release is 12-12-87.
-
- Multi-level Pull-down Menus - An application of windows is multi-
- level pull-down menus. I have already created some very thorough
- code in a file called PULL20.ARC. It is fully featured and fully
- configurable. Includes execute, single, and multiple choice
- menus, unlimited nested submenus, data entry windows, help
- windows, directory windows, message system, and fully completed
- interfaces. Scheduled release is 01-02-88.
-
- On-line source - All updated files can be found on the CompuServe
- Borland Forum (GO BPROGA) in the MSDOS TP 4.0 Data Library or the
- IBM software forum (GO IBMSW) data library.
-
-
- CREDITS:
-
- Without the assistance and original ideas from Brian Foley
- [76317,3247], these routines would not have been written.
-
- Copyright (c) 1986,1987 by Jim LeMay
-
- If there are any problems, please let me know.
- Jim LeMay [76011,217] (1-817-735-4833 after 1800 CST)
- 6341 Klamath Rd., Ft. Worth, TX, 76116.
-
-
- PRICE:
-
- After much thought, I have decided to make these procedures into
- ShareWare. The cost may range from $6 to $16 depending on your
- application. I do enjoy assisting others in their programming,
- but lack of reimbursement is expensive for me! Please help out.
- See the license statement, STATMENT.LIC, in LICENSE.ARC for
- details. If the response will let me break even, I will continue
- | support. Those who have already registered can receive a disk
- | complete with source code for $2.50, or free if you supply the
- | disc, mailer and postage.
-
-
- REVISIONS:
-
- Version 4.0 (12-01-87):
- Converted QWIK30 to QWIK40 to work on Turbo Pascal 4.0.
- Deleted QwriteV and QwriteCV.
- Added WhereR and WhereC.
- Added Hercules and IBM 3270 PC detection.
- Renamed the following variables:
- From To
- ---------- ------------
- CardWait CardSnow
- Qwait Qsnow
- QwriteLV QwriteA
- QwriteCV QwriteC
- QwriteV Qwrite
- ActiveDD ActiveDispDev
- AltDD AltDispDev
- PCCAltDD AltDispDevPCC
- Vmode VideoMode
- Added the following variables:
- VideoPage, CRTcols, CRTrows, CardSeg, Have3270,
- ActiveDispDev3270
- Added the following constants:
- NoHerc, HgcMono, HgcPlus, HercInColor
- Types were changed on the following items:
- - Strings passed to Qwrite- are of type String rather
- than Str80. (Should not be of any consequence.)
- - The CursorChange parameters are now word.
- - EgaFontSize, CRTcolumns, CardSeg, Page0seg, Qseg,
- AltDispDevPCC and ArrayLength are now word.