Category : Pascal Source Code
Archive   : QWIK5X.ZIP
Filename : QWIK5X.DOC

 
Output of file : QWIK5X.DOC contained in archive : QWIK5X.ZIP



















QWIK SCREEN UTILITIES
USER'S GUIDE

Version 5.x
December 20, 1988


Copyright (C) 1988 Eagle Performance Software
All Rights Reserved.



_______
____| _ | (tm)
--| | |-------------------
| ____|__ | Association of
| | |_| Shareware
|__| o | Professionals
-----| | |---------------------
|___|___| MEMBER


QWIK Screen Utilities User's Guide, Version 5.x



T A B L E O F C O N T E N T S

1. INTRODUCTION . . . . . . . . . . . . . . . . . . . . . 3
Features . . . . . . . . . . . . . . . . . . . . . . 3
Using the Manuals . . . . . . . . . . . . . . . . . . 3
Licensing . . . . . . . . . . . . . . . . . . . . . . 4
Customer Service . . . . . . . . . . . . . . . . . . 4
ASP . . . . . . . . . . . . . . . . . . . . . . . . . 5

2. GETTING STARTED . . . . . . . . . . . . . . . . . . . . 6
Distribution Files . . . . . . . . . . . . . . . . . 6
Demonstration . . . . . . . . . . . . . . . . . . . . 6
Simple Programming . . . . . . . . . . . . . . . . . 6
Procedures and Functions . . . . . . . . . . . . . . 8

3. BASIC TECHNIQUES . . . . . . . . . . . . . . . . . . . 11
Number to String Conversion . . . . . . . . . . . . . 11
Cursor Mode Routines . . . . . . . . . . . . . . . . 11
Cursor Location Routines . . . . . . . . . . . . . . 13
EOS Marker . . . . . . . . . . . . . . . . . . . . . 13
Scrolling . . . . . . . . . . . . . . . . . . . . . . 14
Pop-Up Windows . . . . . . . . . . . . . . . . . . . 15

4. ADVANCED TECHNIQUES . . . . . . . . . . . . . . . . . . 17
Virtual Screens . . . . . . . . . . . . . . . . . . . 17
Video Pages . . . . . . . . . . . . . . . . . . . . . 18
Video Modes . . . . . . . . . . . . . . . . . . . . . 19
Multi-tasking Environments . . . . . . . . . . . . . 20
Interrupts . . . . . . . . . . . . . . . . . . . . . 20

5. HARDWARE DETECTION . . . . . . . . . . . . . . . . . . 21
Display Combination Code . . . . . . . . . . . . . . 21
Snow Checking . . . . . . . . . . . . . . . . . . . . 22
System Hardware . . . . . . . . . . . . . . . . . . . 23
Tips . . . . . . . . . . . . . . . . . . . . . . . . 23

APPENDIX A: Video Mode Table . . . . . . . . . . . . . . . 24

APPENDIX B: Cursor Mode Data . . . . . . . . . . . . . . . 26
Cursor Mode Tables . . . . . . . . . . . . . . . . . 26
Cursor Emulation . . . . . . . . . . . . . . . . . . 26

APPENDIX C: Performance . . . . . . . . . . . . . . . . . 29
Code Size . . . . . . . . . . . . . . . . . . . . . . 29
Speed . . . . . . . . . . . . . . . . . . . . . . . . 29
TP4 Usage . . . . . . . . . . . . . . . . . . . . . . 30

APPENDIX D: Application Products . . . . . . . . . . . . . 31

APPENDIX E: Revision History . . . . . . . . . . . . . . . 34

APPENDIX F: References and Credits . . . . . . . . . . . . 37




2
QWIK Screen Utilities User's Guide, Version 5.x


1. I N T R O D U C T I O N


FEATURES

Welcome to QWIK Screen Utilities!

You have just obtained a copy of the highest performance screen writing
tools available today for Turbo Pascal 5.0 (TP5). Both novice and
professional programmers will appreciate these simple and very powerful
utilities that gives you absolute control over your CRT displays in all
text modes.

Here are some of the features you will discover:

. Writes on all IBM compatible computers, displays and
adapters including the new PS/2 systems and Hercules.
. Superior video detection routine.
. Eliminates snow and flicker.
. Writes directly to the screen in absolute coordinates.
. Writes in all text modes and column modes.
. Writes on all video pages.
. Writes on virtual screens in RAM.
. Writes text and attribute, text only, or attribute only.
. Reads strings, characters and attributes.
. Uses End-Of-String (EOS) marker for quick string chaining.
. Provides standardized cursor control for all adapters.
. Enhanced cursor movement.
. 650% faster than TP5 direct screen writing.
. Only 2.7k bytes of code if all 43 utilities are used.
. Optimized by the compiler and drops unused code.
. Used in all other Eagle products.

QWIK is an enhancement unit providing capabilities not offered in the CRT
unit that came with TP5. In contrast to the CRT unit which does window
relative writing, QWIK knows how to write directly to the screen in
absolute screen coordinates for any video configuration.

| Version 5X - This version is simply a TP5 compiled version of QWIK42B.
| QWIK50 will be out at a later date with other features specific to TP5.


USING THE MANUALS

Disk Based Guides - The manuals for QWIK are on disk so that you can
conveniently scan for the topic you are seeking. You can do this with any
list or search utility with a search function. You can also make a printed
copy. If you have not already printed this manual, refer to the READ.ME
file for instructions. At the present time, no bound manuals are being
offered with registration.

User's Guide - This manual, the one your are reading now, assumes that as a
programmer you are already familiar with Turbo Pascal 4.0. And that you
have a working knowledge of your disk operating system (DOS). It will
provide you the basic principles of direct screen writing and powerful tips


Chapter 1, Introduction Page 3
QWIK Screen Utilities User's Guide, Version 5.x


on some previously unavailable techniques.

Reference Guide - This manual describes in detail all procedures, functions
and variables used in QWIK. It is a alphabetically arranged for easy
access in a format similar to the TP5 manual. Use this manual when you
have become familiar with the basic principles in the User's guide.


LICENSING

Registration - These utilities and the documentation have been released for
distribution as Shareware. You have been given the chance to sample the
full capability of QWIK without risk! If you find that QWIK is a valuable
tool, then you are expected to register. You will find a reasonable
licensing schedule found in LICENSE.ARC to meet private or commercial
needs. When registering, be sure to specify the version for Turbo Pascal
(such as TP4 or TP5) you wish to receive.

Source Code - All registered users will receive source code when the signed
license agreement is returned with the registration.


CUSTOMER SERVICE

If you have questions, comments, or suggestions, the Eagle can be contacted
by three means - (1) CompuServe, (2) telephone, (3) The Eagle BBS, or
(4) mail.

CompuServe - The most dependable way to contact the Eagle is through
CompuServe. James (Jim) H. LeMay has written the TP5 version of QWIK. He
can be contacted on the Borland Forum by typing GO BPROGA from the
CompuServe main menu. You will enter the Forum for Turbo Pascal. You can
contact Jim with his PPN number of 76011,217. Messages can also be left
through EasyPlex.

Telephone - Jim can also be reached by phone at (817) 735-4833 on weekdays
and Saturday from 9:00 a.m. to 8:00 p.m CST.

The Eagle BBS - After 01-10-89, you can also contact us on our 24-hour BBS
at (214) 539-9878, 1200 N81.

Mail - For registration or problems, please write:

Eagle Performance Software
TP products
P.O. Box 122237
Ft. Worth, TX 76121-2237

In your written request for resolving problems, be sure to include:

. A 5 1/4 inch diskette of compilable source code of the problem.
. The Eagle product and version number.
. The computer make and model.
. The type of video card, video monitor and keyboard.



Chapter 1, Introduction Page 4
QWIK Screen Utilities User's Guide, Version 5.x


For identical Turbo C products, write:

Eagle Performance Software
TC products
P.O. Box 292786
Lewisville, TX 75029-2786

Or, contact Jim Gallagher at (214)-539-7855

ASP

QWIK is a Shareware program conforming to the standards of the Association
of Shareware Professionals (ASP). You can get more information about ASP
by writing to:

Association of Shareware Professionals
325 118th Ave. S.E., Suite 200
Bellevue, WA 98005.







































Chapter 1, Introduction Page 5
QWIK Screen Utilities User's Guide, Version 5.x


2. G E T T I N G S T A R T E D

This section will acquaint you with the files on disk and show you a
brief demonstration. You will also run your first program with QWIK and
then become familiar with all of the utilities.


DISTRIBUTION FILES

In this version, QWIK5X.ARC contains:

Qwik5x .tpu: Compiled unit of 2000 lines of assembly for TP5.
Qwik5x .pas: Source code for QWIK5X.TPU. (MASM source code
and object files are not included.)
Qwik5x .doc: This document - a user's guide to QWIK.
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.
QwikRef .doc: QWIK Reference Guide document covering each
procedure and variable in detail.
Qinitest.pas: A program that verifies the equipment detected by
the Qinit procedure.
Qbench .pas: A timing program that shows "screens/second" for
typical QWIK procedures.
Strs .pas: Supplementary unit for number to string
conversions.
TimerD12.inc: Include file to measure elapsed time.
License .arc: ARC file containing license agreements.


DEMONSTRATION

To get an overview of the speed and features of QWIK, let's run a
demonstration program that came with the utilities. Do the following
steps.

1. Copy QWIK5X.TPU to QWIK.TPU for TP5.
2. Make, compile and run QWIKDEMO.PAS to get a feel for
features and speed.
3. Press return when the screen prompts you to continue with
"... press any key".
4. Before running QINITEST.PAS, read the source code header
to see if you want to test for a computer submodel ID.


SIMPLE PROGRAMMING

First Program - Let's write a short program to see how simple it is to
write with QWIK. While in the TP editor, enter the following code:

uses Crt,Qwik;
begin
TextAttr := Yellow+BlackBG;
ClrScr;
Qwrite (5, 1,Yellow+BlueBG,'QWIK writing');


Chapter 2, Getting Started Page 6
QWIK Screen Utilities User's Guide, Version 5.x


Qwrite (5,13,Yellow+BlueBG,' is easy!');
end.

Assuming you have already copied QWIK5X.TPU to QWIK.TPU, compile and run
the code. You can then see the text "QWIK writing is easy!" starting on
row 5, column 1. On color monitors, the text is a yellow foreground with a
blue background while monochrome monitors show high intensity on black.

Row/Col vs. X/Y - You probably noticed that the row parameter is first and
the column parameter is second. Since QWIK is entirely for text modes, it
is more intuitive to specify the row first and the column second just like
any word processor. The X/Y scheme is better suited for graphics.

Attributes - Notice that our example uses the constant "BlueBG". QWIK
provides eight convenient background color constants to use along with
Turbo's 16 foreground colors. The same names are used, but the "BG" suffix
is added:

BlackBG RedBG
BlueBG MagentaBG
GreenBG BrownBG
CyanBG LightGrayBG

These allow QWIK to make the most of Turbo's constant folding. By simply
adding the foreground and background constants together, the compiler saves
the result as a single word. And, by simply reading the Qwrite statement,
what you see is what you get (WYSIWYG).

Readable Code - As an added benefit, QWIK was designed with human factors
in mind and was made so that it is very easy to read the code you create.
With the row, column, and attribute parameters first and the string last,
you can see that the two Qwrite statements were easily aligned. WYSIWYG to
the rescue again!

Chaining - Notice that we had to calculate the string length of "QWIK
writing" before we could locate the string " is easy". Let's modify the
last statement to indeed make it easier to locate the last string:

uses Crt,Qwik;
begin

TextAttr := Yellow+BlackBG;
ClrScr;
Qwrite (5, 1,Yellow+BlueBG,'QWIK writing');
QwriteEos (Yellow+BlueBG,' is easy!');
end.

Now that was really easy! How did QwriteEos know where to write? QWIK
internally keeps track of an End-Of-String (EOS) marker so that any
subsequent "Eos" procedure like QwriteEos will chain the next string right
there - no rows or columns to calculate! And you can chain as many as you
want on to any other QWIK procedure.

Same Attribute - But suppose we did not want to change the attribute that
was already on the screen and don't even know what it is. How is that
done? Just modify the attributes to the following:


Chapter 2, Getting Started Page 7
QWIK Screen Utilities User's Guide, Version 5.x



uses Crt,Qwik;
begin
TextAttr := LightGray+BlackBG;
ClrScr;
Qwrite (5, 1,SameAttr,'QWIK writing');
QwriteEos (SameAttr,' is easy!');
end.

The special constant SameAttr (which is negative) tells QWIK to simply
enter the text on the screen without changing the attribute. The result of
the program would show the text with LightGray on Black attributes. This
special constant works on all QWIK utilities. When assigned to a variable,
the attribute can even be switched at run time.

Centering - Rather than having the text left justified, let's center the
text on the screen by modifying a portion of the code:

...
ClrScr;
QwriteC (5, 1,80,SameAttr,'QWIK writing is easy!');
end.

This will place the text on row 5 centered between columns 1 and 80 which
is perfect for an 80 column text mode. But what if other text or column
modes are used? How can we ensure that it is always centered? Only one
simple change is needed:

...
ClrScr;
QwriteC (5, 1,CRTcols,SameAttr,'QWIK writing is easy!');
end.

The variable CRTcols always has the value of the column width that is
currently being used. How does it know? QWIK is initialized at startup by
executing a procedure called Qinit. It detects a host of information about
your video configuration, everything from the type of video card you are
using to the shape of the cursor being used. You can see a list of all
these variables available for your use in QWIKREF.DOC.


PROCEDURES AND FUNCTIONS

Now that you have a basic idea of what QWIK can do, let's make a brief
survey of all the utilities in QWIK.TPU to just know what is available:

One initializing procedure:

Qinit - Initializing procedure executed by QWIK5X.TPU which
sets the global variables for the QWIK 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:


Chapter 2, Getting Started Page 8
QWIK Screen Utilities User's Guide, Version 5.x



Qwrite - For any type string or character (char).
QwriteC - For any type string or char; self-centering.
QwriteA - For any type variable, arrays or substrings.

Four quick direct screen filling procedures in Rows-by-Cols block
parameters:

Qfill - Repetitive filling with the same character; with or
without attribute change.
QfillC - Same as Qfill, but self-centering.
Qattr - Repetitive filling with an 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 screen storing procedures for copying blocks between a
screen (Scr) and a virtual screen (Vscr - a screen in memory):

QScrToVscr - Copies a Rows-by-Cols block from QWIK screen to
virtual screen.
QVscrToScr - Restores a Rows-by-Cols block from a virtual screen
to the QWIK screen.

Three quick screen reading functions for reading data from any
screen:

QreadStr - Reads a string of text.
QreadChar - Reads a single character.
QreadAttr - Reads an attribute.

Two quick scrolling procedures work on any video page and also
virtual screens without flicker or snow:

QscrollUp - Scroll affected rows-by-cols block up.
QscrollDown - Scroll affected rows-by-cols block down.

Two quick video page changing procedures:

QviewPage - Changes the page to be displayed - up to 8!
QwritePage - Sets the page on which the QWIK procedures are
writing. You don't have to write just on the
displayed page!

Three quick cursor procedures and functions which work on any video
page. They now work on the page being written rather than viewed:

GotoRC - Move cursor to absolute row and column coordinates
rather than relative to a window.
WhereR - Returns absolute cursor row.
WhereC - Returns absolute cursor column.



Chapter 2, Getting Started Page 9
QWIK Screen Utilities User's Guide, Version 5.x


Eight quick EOS (End-Of-String) marker procedures and functions that
alter its position and/or the cursor. The marker can be moved on the
CRT and virtual screens, while the cursor movement is only on the
page being written:

GotoEos - Moves cursor to EOS marker (like TP write).
EosR - Returns absolute row of EOS marker.
EosC - Returns absolute col of EOS marker.
EosToRC - Sets EOS to a given row and column.
EosToRCrel - Relatively shifts EOS by a number of rows and
columns, and can be negative or positive.
EosToCursor - Matches EOS to the cursor position.
EosLn - Moves EOS to column 1 of the next row.
QEosLn - Like EosLn, but scrolls up if past last row.

Three cursor routines alter the cursor mode:

GetCursor - Get current cursor mode from low memory.
SetCursor - Sets new cursor mode.
ModCursor - Modifies cursor mode to on, off or erratic
blink saving current scan lines.

Four quick EOS writing procedures that chain write at the EOS marker:

QwriteEos - like Qwrite.
QwriteEosA - like QwriteA.
QfillEos - like Qfill.
QattrEos - like Qattr.

A Submodel identification routine:

GetSubModelID - Optional procedure to find IBM submodel ID.

Five string functions that convert integers and reals to strings by
using the supplementary STRS unit:

StrL - converts LongInt to string
StrLF - converts LongInt to string in a fixed Field
StrR - converts Real to string
StrRF - converts Real to string in a fixed Field
StrRFD - converts Real to string in a fixed Field with a
specified number of Decimals

For a full description of each utility with its parameters, please refer to
QWIKREF.DOC for a summary of details and examples.












Chapter 2, Getting Started Page 10
QWIK Screen Utilities User's Guide, Version 5.x


3. B A S I C T E C H N I Q U E S


NUMBER TO STRING CONVERSION

Str Procedure - TP5 handily converts numbers into strings with the Str
procedure. For example:

var MyNumber: integer;
MyString: string;
begin
Str (MyNumber:7,MyString);
Qwrite ( 1, 1,SameAttr,MyString);
end.

But this means that a data area must be reserved and the code isn't as
readable as it could be.

Str Functions - Instead, QWIK and the supplementary STRS unit let you use a
function form of Str:

uses Qwik, Strs;
var MyNumber: integer;
begin
Qwrite ( 1, 1,SameAttr,StrLF(MyNumber,7));
end.

Just like WriteLn, this lets the number remain in the Qwrite statement.
There are five functions in the STRS unit and they can be used just like
any other function:

StrL - converts LongInt to string
StrLF - converts LongInt to string in a fixed Field
StrR - converts Real to string
StrRF - converts Real to string in a fixed Field
StrRFD - converts Real to string in a fixed Field with a specified
number of Decimals

The suffixes mean:

L - LongInt, but any scalar will work
R - Real
F - Field width that is right justified format
D - Number of decimals in the format

The Str* functions actually use the Str procedure from TP5 to do the
conversion. But with an InLine code trick, functions were created that
don't recopy the string for the greatest speed. The code useage is
also reduced.


CURSOR MODE ROUTINES

Three Routines - If you have ever struggled with controlling the shape of
the cursor, your life is about to be made easier. With just three


Chapter 3, Basic Techniques Page 11
QWIK Screen Utilities User's Guide, Version 5.x


routines, SetCursor, GetCursor, and ModCursor, you can consistently and
reliably control the cursor mode (shape and visibility) on any video card!

Four Standard Modes - To make it even easier, four standard cursor mode
variables are initialized at startup to fit the exact requirements of the
detected video card. They are:

CursorUnderline - The standard underline cursor.
CursorHalfBlock - The half block shape usually used for insert
editing.
CursorBlock - An easy to find full cell cursor.
CursorInitial - The mode detected at start up.

So, if we wanted a full block cursor, only one line of code is needed:

SetCursor (CursorBlock);

And that's it! There's nothing else to figure out - even if you are using
something like 43-row mode on an EGA card. When ending your programs, you
can get back to the original cursor mode by using:

SetCursor (CursorInitial);

Hidden Cursor - Many programs need to hide the cursor altogether. This can
be done with ModCursor:

ModCursor (CursorOff);

Why use ModCursor instead of SetCursor? ModCursor leaves the shape of the
cursor alone, and only alters bits 13 and 14 of the cursor mode to turn it
on or off. In fact there are three constants that are useful with
ModCursor:

CursorOff ($2000) - To turn the cursor off.
CursorOn ($0000) - To turn the cursor back on with the same shape.
CursorBlink ($6000) - To create erratic blinking on MDA/CGA. (On
EGA/VGA, it turns the cursor off.)

Using your imagination, you can also mix and match the constants and
variables by logically summing them. Let's say we want to change the shape
of the cursor to a block while it is still turned off:

SetCursor (CursorBlock or CursorOff);

So, the next time ModCursor(CursorOn) is used, the cursor will be a full
block. As a suggestion for terminating your program, be sure to restore
the cursor in your exit procedure with:

SetCursor (CursorInitial);

GetCursor - This function simply returns the current cursor mode value
stored in low memory allowing you to save it for later use.





Chapter 3, Basic Techniques Page 12
QWIK Screen Utilities User's Guide, Version 5.x


CURSOR LOCATION ROUTINES

QWIK has three routines that complement the CRT unit - GotoRC, WhereR, and
WhereC. They correspond with the familiar GotoXY, WhereX, and WhereY.
However, there are some important differences:

. The QWIK routines are absolute to the screen and are not restricted
by the Turbo window.
. The suffixes "R" and "C" mean row and column, so the parameters of
GotoRC are reversed from GotoXY.
. The QWIK routines will also work on any video page. This is
explained in the Advanced Techniques section later.

This is not the only way to move the cursor. The EOS marker is also a very
powerful aid as you will see in the next topic.


EOS MARKER

Invisible Alternate Cursor - From the examples in the Simple Programming
topic, we found that we could easily chain two strings together using the
EOS marker. In fact, this marker is so versatile, the EOS marker utilities
can be made interchangeable with the cursor, but much faster. You could
think of it as an alternate cursor that is invisible.

Keeping Track - Any time a QWIK writing procedure is used, the EOS marker
is updated. It is actually saved as the global variable QEosOfs.
Technically, the value is the offset from the screen base and is a 0-based
byte count. For example, if the following procedure was executed:

Qwrite (6,5,Yellow,'Important Data');

the EOS would be at row 6, column 19, right after the word "Data". The
value of QEosOfs on an 80 column screen would be:

QEosOfs = ((Row-1)*CRTcols + (Col-1)) * 2 = 836

QWIK does not need to calculate this value, but simply saves it after
writing, so it is very efficient. From the overview, you are already aware
of the four routines that will start writing at this marker - QwriteEos,
QwriteEosA, QfillEos, and QattrEos. But what about changing the location
of the marker itself? Keep reading.

Moving the Marker - QWIK has four routines that will manually move the EOS
marker:

EosToRC - Sets EOS to a given row and column.
EosToRCrel - Relatively shifts EOS by a number of rows and
columns, and can be negative or positive.
EosLn - Moves EOS to column 1 of the next row.
QEosLn - Like EosLn, but scrolls up if past last row.

The basic procedure EosToRC moves the EOS marker exactly like GotoRC does
for the cursor. But there are also several ways to move the marker
relatively. Let's test a short program:


Chapter 3, Basic Techniques Page 13
QWIK Screen Utilities User's Guide, Version 5.x



uses Crt,Qwik;
begin
TextAttr := Yellow;
ClrScr;
Qwrite ( 1, 1,Yellow+BlueBG,'First Row ');
EosLn; { Jump to (2,1) }
QwriteEos (Yellow+BlueBG,'Second Row ');
EosToRC ( 3, 1); { Jump to (3,1) }
QwriteEos (Yellow+BlueBG,'Third Row ');
EosToRCrel ( 1,-4); { Jump to (4,8) }
QwriteEos (Yellow+BlueBG, 'etc.');
EosToRC (succ(EosR),8); { Jump to (5,8) }
QwriteEos (Yellow+BlueBG, 'etc.');
end.

Compile and run the program. You should see "Row" and "etc." all aligned
in one column. So, you can see that there are several simple ways to move
the marker!

EOS and the Cursor - You can also interface the EOS marker and the cursor
with two procedures:

GotoEos - Moves cursor to match the EOS marker.
EosToCursor - Sets the EOS marker to match the cursor position.

It can't get any simpler than that! Now you can see that:

Qwrite (1,1,Yellow,'Test Line');
GotoEos;

and,

TextAttr := Yellow;
GotoXY (1,1);
Write ('Test Line');

produce identical results. But QWIK is much faster!


SCROLLING

Improved Control - With the CRT unit, you can only control the full screen
size with WriteLn. But with the two QWIK routines, QscrollUp and
QscrollDown, you can define any area to be scrolled:

QscrollUp ( 2, 2,CRTrows-2,CRTcols-2,MyAttr);

This example scrolls a portion of the screen starting at (2,2) leaving a
one character border. In a 25x80 text mode, it clears row 24 from column 2
to 79. In addition, the cleared row attribute is MyAttr.

Improved Performance - With QscrollDown and QscrollUp (called Qscroll* for
brevity), your programs can overcome the BIOS problems on many machines.
Transparent to you, these procedures work on all cards and machines without



Chapter 3, Basic Techniques Page 14
QWIK Screen Utilities User's Guide, Version 5.x


flicker or snow and operate at three speeds:

Maximum - for video cards without snow
Fast CGA - for CGA cards on 80286 machines or better
Slow CGA - for CGA cards on 8086/8088 machines

Qinit detects the CPU ID and video card to select the fastest algorithm.
All speeds use 16-bit transfers rather than 8-bit. So, you can be assured
of the highest performance.

Cursor Location - These routines do not move the cursor. However, EOS is
pointing to the first column of the blank line and GotoEos will move the
cursor there if needed.

QEosLn - This procedure is another alternative to full screen scrolling.
It has the same function as EosLn, but will additionally scroll the screen
up if the EOS marker is past the last row. Then it simply calls QscrollUp.
The attribute of the cleared row is the global variable ScrollAttr. You
must set this prior to using QEosLn.


POP-UP WINDOWS

QWIK has the basic tools to create and remove pop-up windows. Let's try to
create one. While in the TP editor, enter the following code:

uses Crt,Qwik;
var
MyWindow,MyUnderlay: array[1..250] of word;
begin
{ -- Fill the screen with a hatch character. -- }
Qfill ( 1, 1,CRTrows,CRTcols,LightGray+BlackBG,#176);
{ -- Create a pop-up window.-- }
QstoreToMem ( 5,12,10,25,MyUnderlay); { Save area to be covered }
Qfill ( 5,12,10,25,Black+LightGray,' '); { Clear the area }
QwriteC (9,12,36,SameAttr,'Pop-Up Window'); { Label window }
delay (1000); { Wait a sec }
QstoreToMem ( 5,12,10,25,MyWindow); { Save a copy }
QstoreToScr ( 5,12,10,25,MyUnderlay); { Restore screen }
{ -- Move window some where else. -- }
QstoreToMem ( 8,25,10,25,MyUnderlay); { Save area to be covered }
QstoreToScr ( 8,25,10,25,MyWindow); { Move window }
delay (1000); { Wait a sec }
{ -- Remove window. -- }
QstoreToScr ( 8,25,10,25,MyUnderlay); { Restore screen }
end.

Compile and run the code. You will see a 10 row by 25 column window
located at (5,12) which is row 5, column 12 . After one second, it will be
moved to (8,25). Then after another second, it is removed from the screen.
We did a lot of work with very little code!

Rows-by-Cols - QstoreToScr and QstoreToMem are screen saving and restoring
procedures that conveniently work in row-by-column blocks. They
accommodate any column mode, so there is no need to be concerned about


Chapter 3, Basic Techniques Page 15
QWIK Screen Utilities User's Guide, Version 5.x


screen width.

Memory Requirements - Notice that QstoreToMem wrote the data direct to
memory in MyWindow. It is important that the memory allocated to that
variable is correct to prevent it from overwriting any other variables.
The array size chosen was a 250 word array which is a perfect fit since one
word is needed for each character and attribute on the screen. If you
prefer, the heap can also be used such as:

var MyUnderlay: pointer;
begin
GetMem (MyUnderlay,500);
QstoreToMem ( 5,12,10,25,MyUnderlay^);
{ ... }
FreeMem (MyUnderlay,500);
end.









































Chapter 3, Basic Techniques Page 16
QWIK Screen Utilities User's Guide, Version 5.x


4. A D V A N C E D T E C H N I Q U E S

This section will acquaint you with the powerful virtual screen writing
features already built into QWIK. You will also find out easy it is to
work on multiple video pages and how to accommodate video mode changes.


VIRTUAL SCREENS

This topic will show you how to create and use powerful virtual screens.

Virtual Screen - Just what is a virtual screen? It is a screen maintained
in RAM of any dimensions that can be reproduced on the CRT in full or in
part. The advantages are:

. Variable row-by-column screen
. Large video buffer up to 64k
. High speed in RAM
. Unlimited number of screens

Screen Record - QWIK uses seven variables to define any screen. At start
up, QWIK initializes them to the video system detected:

CRTrows - Number of rows
CRTcols - Number of columns
CRTsize - Byte allocation for screen
Qsnow - True if snow checking needed
QEosOfs - EOS offset
QScrOfs - Screen offset
QScrSeg - Screen segment

To make data access even easier, all these variables are contained in the
record QScrRec of VScrRecType. In addition, QScrPtr is absolute to QScrOfs
and QScrSeg. This gives QWIK a true far pointer, so screens can be
anywhere in memory and not just paragraph aligned!

Creating Virtual Screens - In three easy steps, you can easily create a
virtual screen:

1. Allocate memory for the screen.
2. Save the current screen record.
3. Modify the screen record for the virtual screen.

Let's write some code that does just that:

uses Qwik;
var CRTrec,VScrRec: VScrRecType;
begin
with VScrRec do { create specs for virtual screen }
begin
Vrows := 80; { Let's choose 80 rows }
Vcols := 100; { Let's choose 100 columns }
Vsize := Vrows * Vcols shl 1;
Vsnow := false; { Can always be false }
VEosOfs := 0; { Be safe and start at the base }


Chapter 4, Advanced Techniques Page 17
QWIK Screen Utilities User's Guide, Version 5.x


GetMem (VScrPtr,Vsize); { Allocate heap space }
end;
CRTrec := QScrRec; { Save CRT specs }
QScrRec := VScrRec; { Set virtual specs }
{ ... } { Write to the virtual screen }
QScrRec := CRTrec; { Restore CRT specs when done! }
end.

Now, when you use any QWIK routine, they can be directed to the virtual
screen - writing, reading, scrolling, wrapping, and everything you would
expect. Qsnow can always be false when writing to virtual screens since
RAM is used and not video card memory.

Cursor Control - One thing not available to virtual screens is cursor
movement, because the cursor location is reserved by DOS for just video
pages. That means there is no cursor available for virtual screens. So,
how can we get around this? The EOS marker comes to the rescue as an
indispensable cursor! All EOS routines can still be used as before.

Taking a Peek - At some time, we will need to take a look at all or a
portion of the virtual screen by copying it to the CRT. Two inter-screen
procedures do this by blocks at high speed - QScrToVscr and QVscrToScr.
Here are the parameters of QVscrToScr:

QVscrToScr (Row,Col,Rows,Cols,Vrow,Vcol,Vwidth,VScrPtr);

Just like QstoreToScr, Row, Col, Rows, and Cols describe the position and
size on the screen (Scr). This screen is specified by QScrRec which is
usually the CRT. VScrPtr points to the virtual screen (Vscr). Now, where
is the same size block on Vscr? It's at Vrow and Vcol. But the Vscr may
have a different column width than CRTcols. So you specify that with
Vwidth. Only the Scr side checks for possible snow. These procedures are
extremely fast making virtual screens very practical. See QScrToVscr and
QVscrToScr in QWIKREF.DOC for more examples.

Multiple Virtual Screens - By changing QScrRec, you can even copy blocks
from one virtual screen to another! These routines do not affect QEosOfs.


VIDEO PAGES

Multi-page Cards - TP5 procedures such as Write, Window, and GotoXY are
dedicated to just page 0, but many video cards have more than one page. If
you have a CGA or better, you already have memory on your card for 4 to 8
pages. Since the BIOS recognizes them as well, QWIK gives you access to
these extra pages.

Page Control - QwritePage and QviewPage give you the power to use QWIK on
all video pages and display which ever you choose. On a multiple-video
page card like CGA, you can simply code:

QwritePage (MyPage);

to make all QWIK routines be directed to your selected video page even
though you could be viewing another page. To view a page, you can in turn


Chapter 4, Advanced Techniques Page 18
QWIK Screen Utilities User's Guide, Version 5.x


simply code:

QviewPage (MyPage);

Tips About Pages - Here are some tips to keep in mind when using several
video pages:

. The highest valid video page is detected by Qinit and saved in the
variable MaxPage.
. Invalid page parameters are just ignored.
. The BIOS reserves a separate cursor location for each of up to 8
video pages.
. There is only one possible cursor mode which is always displayed on
the CRT.
. The cursor location routines operate on the page being written
rather than viewed.
. The current video page viewed is found with VideoPage.
. The current video page set by QwritePage is saved in QvideoPage.
. Be sure to end your programs with "QviewPage (0);".


VIDEO MODES

CRT Unit - If you intend to use the CRT unit with QWIK, it is best to place
the CRT unit first in the "USES" list. When the CRT runs its
initialization code, 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 or extended column mode and is forced back into the computer's
default text mode as set by the equipment flag at $40:$10. By having the
CRT unit first, you can be assured of a valid text mode when Qinit is run.

Changing Text Modes - Your application may require a change in video modes
for different row or column modes. If so, after the mode is changed, run
Qinit again so the video variables will be correct.

TextAttr - Be advised that a change of text modes with the CRT unit will
also change TextAttr. It is set to what ever attribute is at the cursor.

Graphic Modes - If you need to alternate with a graphics mode, Qinit does
not need to be run provided you return back to the same text mode. Of
course you may want to save the screen with QstoreToMem before switching to
graphics.

Changing Monitors - The technique to change monitors is to simply change
the text mode. This means Qinit should be run again. Be sure to toggle
the video mode bits in the equipment list byte at $40:$10 so other
applications can behave properly.

CursorInitial - When QWIK is initialized, CursorInitial saves what it
detects for the current video mode. Whenever Qinit is run again,
CursorInitial is also changed. This may affect how you restore the cursor
when terminating. If needed, the value should be saved before using Qinit.





Chapter 4, Advanced Techniques Page 19
QWIK Screen Utilities User's Guide, Version 5.x


MULTI-TASKING ENVIRONMENTS

Multi-Tasking - QWIK works very well with multi-tasking environments such
as DESQview. For examples on how to let QWIK work in DESQview, see a file
called DESQ5X.ARC or a later version. The key is to set Page0seg, QScrPtr
| and Qsnow correctly. This is a very simple task. If you are unsuccessful
| in getting it to work as you would expect, give us a call.

Cursor Routines and the BIOS - All cursor routines that change the mode and
location use the BIOS. This way multi-tasking environments can handle
redirection properly.


INTERRUPTS

Within QWIK - QWIK only uses video interrupt $10 for Qinit and the cursor
routines so there no problem with DOS re-entry. Please read about "System
Hardware" on page 22 for more information on procedure GetSubModelID which
uses INT $15.

Creating Handlers - If you use interrupt calls (like a clock display)
within your program that use QWIK routines, be sure to save and restore the
value of QScrRec in the call so it won't return to the main program with
unexpected results. You should also be aware that main program may be
writing to a virtual screen during the interrupt, so it is best that you
initialize a copy of a QScrRec solely for the interrupt.































Chapter 4, Advanced Techniques Page 20
QWIK Screen Utilities User's Guide, Version 5.x


5. H A R D W A R E D E T E C T I O N


DISPLAY COMBINATION CODE

Qinit Procedure - Qinit initializes all the variables needed for the QWIK
procedures. And specifically checks for ALL IBM video equipment including
dual monitors. Qinit is initialized by the unit at start up.

Display Combination Code (DCC) - The PS/2 video BIOS has a new function
that simplifies equipment detection called the Read/Write Display
Combination Code. Using interrupt $10 with AH = $1A00, the call will
return the Active Display Device in BL and the Alternate Display Device in
BH. If the function is supported, it also returns $1A to AL. For the
possible Display Device codes which have been assigned by IBM, see
QWIKREF.DOC.

Conforming to DCC - No results are obtained for the DCC on anything other
than PS/2 equipment. However, to be consistent, Qinit was reprogrammed to
conform to the DCC for ALL equipment. To see if a CGA is in use, simply
check to see if ActiveDispDev=CgaColor. Qinit only sets the parameters for
the active display.

Dual Monitors - Qinit detects dual monitors and saves both the active and
alternate display device codes. The alternate display device code is for
testing purposes only. If you change monitors in a running program, Qinit
should be executed again.

Testing for Dual Monitors - Qinit makes an attempt to detect for a second
monitor by several means. If no alternate cards like EGA or VGA are found,
an alternate 6845 video chip (CGA, MDA, or Hercules) is checked. If the
chip is found, then further tests are made to find which card it could be.
The chip existence test is highly reliable. If no alternate display device
is found, then AltDispDev=NoDisplay.

HavePS2 - Qinit sets HavePS2 to true if the DCC is supported. This means
that the program has detected a PS/2 video card whether it is integrated in
a Model 30, a PS/2 Display Adapter installed on an IBM XT, or the like. It
also means that either MCGA or VGA is present, but not necessarily active.
To know which, just check the DCC.

Have3270 - If Qinit detects 3270 PC equipment/software, this variable is
set to true. In addition, the ActiveDispDev is either MdaMono or CgaColor.
Note: There may or may not be graphics capability in either case; Qinit is
not meant to detect graphics. If Have3270 is true, then ActiveDispDev3270
will be set to the proper code. On the 3270 PC, dual monitors are not
possible as they use the same physical buffer space. In addition, even
though a color monitor maybe used, there is only one video page unless
there is a special adapter. However, Qinit will determine if more than
just one page is available. The 3270 PC also does not support 40 column
modes.

EGA Switches - By checking the value of this byte, you can determine the
monitor connected to the EGA, the alternate video system, and the start up
default. The byte is a copy of how the dip switches are set on the card


Chapter 1, Hardware Detection Page 21
QWIK Screen Utilities User's Guide, Version 5.x


where on=0 and off=1. The primary is the default. When the ECD is set for
640x200, it is emulating the CD including the cursor mode. Qinit now
directly tests for the alternate device rather than assuming it.

EGA Information - The byte located at $0040:$0087 has hardware status
information when the EGA (or VGA) is present.

PC Convertible (PCC) - Since the PCC also does not support the DCC, a
separate code is used. If the 5140 LCD is used in mode 7, the Active
Display Device is set to MdaMono which is close enough. This set up can be
verified by testing if MaxPage=3. The alternate display is found by using
interrupt $10 with AH=$15. The result is saved in AltDispDevPCC. Of
course the variable is undefined if a PCC is not used.

Hercules - Hercules cards are also detected. If either the active or
alternate DCC is MdaMono, which is found by verifying a responsive 6845
video chip at the mono register port, then an attempt is made to find if
any Hercules card is attached. If no Hercules card is found, then
HercModel=NoHerc; it is then assumed that just an MDA card is attached.
Because the test can take up to 1/3 of a second on slower computers, this
test is only run once, even if Qinit is executed again. The tests for the
Hercules cards are the ones recommended by Hercules Computer Technology,
which also admits that sometimes the tests will fail during multi-tasking
activity. Hercules clones may not be detected by these tests, but the DCC
will be correct.


SNOW CHECKING

CGA Snow - QWIK is conservative with CGA cards and uses snow checking when
the card is detected. However, it is not needed in 40 column modes 0 and
1. Qinit was programmed to accommodate this. For other hardware, you can
change Qsnow to suit your needs, but CardSnow should be left unchanged to
save what Qinit detected.

Zenith CGA - Zenith CGAs do not need wait-for-retrace. If you would like
to accommodate this, you can execute the following procedure early in your
programs and to be run after each Qinit:

procedure CheckZenith;
var ZdsRom: array[1..8] of char absolute $F000:$800C;
begin
if Qsnow and (ZdsRom='ZDS CORP') then
begin
Qsnow := false;
CardSnow := false;
end;
end;

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.


Chapter 1, Hardware Detection Page 22
QWIK Screen Utilities User's Guide, Version 5.x


Then, Write and WriteLn will work faster if DirectVideo is true.

Critical Timing - The timing on the IBM PC (Intel 8088 at 4.77MHz) with a
CGA is critical for storing characters and attributes with 16-bit transfers
because of the CPU architecture and slow speed. Although previous versions
kept the timing as tight as possible, there still remained a hint of snow
in column 1. This is due to the problem that RAM runs a little slower than
BIOS ROM. This problem has now been solved with a minor code change. So
the routines still run at the same speed, but there is absolutely no snow!
I am not aware of any other routines that have done this as closely.
(Computers with slower access RAM chips may still show up some variations
from time to time. Feedback is requested.)


SYSTEM HARDWARE

System ID - The basic computer system identification (or model) for IBM
computers can be found by directly accessing the byte in memory at
$F000:$FFFE.

SubModel ID - After production of the AT, models were also given Submodel
IDs. To get both the model and submodel ID, you must use interrupt $15
with AH=$C0 which only works on some computers. A few PC and XT clones
like the AT&T 6300 will actually crash when this interrupt is executed due
to BIOS bugs. So to prevent this from happening, the procedure only lets
SystemIDs of $FC or less get the SubModelID. In addition, it was made it
into a separate procedure called GetSubModelID and is no longer apart of
Qinit. So you will have to execute it yourself to get a result. The
routine is entirely optional and is not required by QWIK.

CPU Identification - A CPU detection routine has been included for Intel
processors. It is useful for clones that do not recognize IBM's system ID
scheme. The idea came from Juan Jimenez as it appeared in Jan/Feb '88
Turbo Technix magazine. The routine has been simplified for reduced code
(only 42 bytes) and enables use of simple constant identifiers. This
routine is required for Qscroll*.


TIPS

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;








Chapter 1, Hardware Detection Page 23
QWIK Screen Utilities User's Guide, Version 5.x


A P P E N D I X A : V I D E O M O D E T A B L E


Video Modes - To help you figure out how the all IBM video systems are
configured, it is helpful to have a table of all the possible Alphanumeric
(A/N or text) modes. QWIK was not designed for the All Points Addressable
(APA or graphics) modes.

TABLE 1: Hardware Specific Video Mode Characteristics
-------------------------------------------------------------------------------
Mode Format Segment Display Box MDA CGA EGA MCGA VGA PCjr PCC 3270 HGC MaxPage
---- ------ ------- ------- ---- --- --- --- ---- --- ---- --- ---- --- -------
0,1 40x25 B800:0 320x200 8x8 x x x x x x 7
320x350 8x14 x x 7
320x400 8x16 x 7
360x400 9x16 x 7
2,3 80x25 B800:0 640x200 8x8 x x x 3
640x200 8x8 x x 7 *
640x350 8x14 x x 7 *
640x400 8x16 x 7
720x350 9x14 x 0+
720x400 9x16 x 7
7 80x25 B000:0 720x350 9x14 x x x x 0
720x350 9x14 x x 7 *
720x400 9x16 x 7
640x200 8x8 x 3
-------------------------------------------------------------------------------

Legend:
Format - Characters per row by the number of rows in the data area.
Segment - Address of the first character on page 0 of the display
buffer.
Display - The pixel resolution for the data area excluding the
border, horizontal by vertical.
Box - The pixel resolution for each character, horizontal by
vertical.
MDA - Monochrome Display and Printer Adapter
CGA - Color Graphics Adapter
EGA - Enhanced Graphics Adapter
PGC - Professional Graphics Controller
MCGA - Multi-Color Graphics Array
VGA - Video Graphics Array
PCjr - PC Junior
PCC - PC Convertible
HGC - Hercules Graphics Cards - HGC, HGC Plus, and InColor Card
3270 - All IBM 3270 PC adapters
MaxPage - 0-based highest page number; e.g. 7 means there are 8
pages.
MD - 5151 Monochrome Display
CD - 5153 Color Display
ECD - 5154 Enhanced Color Display

Notes:
1. The 0 and 2 modes suppress color burst only on composite displays
(not RGB) only for CGA and EGA.


Appendix A: Video Mode Table Page 24
QWIK Screen Utilities User's Guide, Version 5.x


2. The PS/2 model 25 and 30 have an integrated MCGA. The model 50
and above have an integrated VGA.
3. The 8514 High Content Color Display along with the 8514/A adapter
produces a superset of the VGA for APA, but there is no
differences in the A/N modes to the VGA when the adapter is in
"VGA" mode. See IBM documentation for Advanced Function Mode.
4. MaxPage is reduced to 3 if EGA only has 64K graphics memory
installed for modes marked "*". MaxPage of 7 is for 128K or more.
5. The PCC can have either an alternate MDA or CGA. The LCD (model
5140) can emulate either the MDA or CGA modes, but the MDA mode is
640x200.
6. No information is provided on the PGC.













































Appendix A: Video Mode Table Page 25
QWIK Screen Utilities User's Guide, Version 5.x


A P P E N D I X B : C U R S O R M O D E D A T A

Each video card differs in character cell size and cursor emulation in
different video modes. The following data will show you the specific
differences between modes and cards, and how QWIK handles them.


CURSOR MODE TABLES

Cursor Mode Word - The cursor mode is saved in low memory at $40:$60 after
each mode change. Using hex is the easiest way to analyze the word. The
shape of the cursor is defined by horizontal scan lines in the character
cell where the top row is of any cell is 0.

TABLE 2: Cursor Mode Word
-------------------------------------------------
Hi byte Lo byte
----------------------- -----------------------
Bit #: 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
Bit #: 07 06 05 04 03 02 01 00 07 06 05 04 03 02 01 00
Symbol: $ $ * * * * * @ @ + + + + +

Key: $ - controls cursor on/off and erratic blinking
* - controls top scan line (0-based)
@ - controls skew to the right
+ - controls bottom scan line (0-based)


Skew - Bits 5 and 6 control the skew or shift to the right of the cursor on
EGA/VGA cards. Consistent results between video cards is not dependable so
it is best to leave these bits at zero.

Cell Sizes - Because of different cells sized with different video cards,
the top and bottom scan lines are also different for each card. See TABLE
1 in Appendix A for specific cell sizes.

TABLE 2: Cursor Mode Defaults
----------------------------------------------------------
Adapter Default Comments
-------- ------- ---------------------------------------
MDA $0B0C
CGA,MCGA $0607
EGA $0B0C MD, ECD (640x350 25-line) Emulation off
EGA $0607 CD, ECD (640x200)
VGA $0D0E Emulation off
3270 PC $0D0D And converts MDA and CGA


CURSOR EMULATION

Cursor Emulation - Qinit sets the four standard cursor mode variables at
startup to be either MDA or CGA defaults. Almost all emulation modes can
be handled by either of these two cell sizes. Qinit handles certain
exceptions. If you want to handle your own exceptions, the following notes
will help you.


Appendix B: Cursor Mode Data Page 26
QWIK Screen Utilities User's Guide, Version 5.x



CursorBlink - This mode is hardware specific. It works on MDA and CGA
while it turns the cursor off on EGA and VGA.

MCGA/VGA Cursor Mode - On these two cards, you can both read and write the
cursor mode direct from the CRTC. To be compatible with all video cards,
QWIK does not attempt to do this, but instead depends on the Video Display
Data Area at $40:$60. Qinit turns on the cursor emulation mode if PS/2
video equipment is detected.

EGA Cursor Emulation - In 25-line mode on the EGA, cursor emulation works
fairly well. In other line modes, the emulation falters. So just like CRT
unit, Qinit forces emulation to be turned on in 25-line mode and off in
other modes. On the EGA, emulation is turned off by setting bit 0 of
EgaInfo to 1. The standard QWIK cursor modes are still set appropriately.

MCGA Cursor Emulation - Use the CGA cursor cell size even though the
character cell is 8x16. The BIOS multiplies the start and end rows by 2
and then adds one to the end row before writing to the hardware video port
to emulate the CGA.

VGA Cursor Emulation - Qinit turns the cursor emulation mode on so you
don't have to worry about special fonts and cells sizes as it emulates the
MDA and CGA. The video BIOS will adjust your cursor shape to fit in the
current cell size. For the algorithms specific to the VGA, refer to the
"IBM BIOS Interface Technical Reference Manual".

3270 PC Peculiarities - The 3270 PC cursor types are limited to only three.
In addition, the underline cursor is not visible on a white background on
the 5272 color display and it is advisable to use a block cursor together
with that attribute. Notice that half-block cursors are converted to full
block:

TABLE 3: 3270 PC Cursor Modes
--------------------------------------------------------------
Cursor Type Comments
------------ ------------------------------------------------
Underline $0D0D only. CGA and MDA are emulated.
Hidden (off) cursor start > cursor end. $2000 is preferred.
Block anything other than the above


Start Up Cursor Modes - Once QWIK determines the cell size and the cursor
emulation mode, the four standard cursor modes, CursorInitial,
CursorUnderline, CursorHalfBlock and CursorBlock are calculated:

CursorInitial - This is the cursor mode detected at startup. An
improper default for MDA is automatically overridden to an
underline. Some early PCs have a BIOS bug that sets the MDA
default incorrectly.

CursorUnderline - The lower scan line is set to: (BottomOfCell-1).
The upper scan line is set to: (LowerScan-1).

CursorHalfBlock - The top scan line is set to: (BottomOfCell+1)/2.


Appendix B: Cursor Mode Data Page 27
QWIK Screen Utilities User's Guide, Version 5.x


This may appear a little fat for EGAs in 25-line mode, but is just
right for all other cards and modes.

CursorBlock - Produces a block cursor by setting the top scan line
to zero of CursorUnderline.




















































Appendix B: Cursor Mode Data Page 28
QWIK Screen Utilities User's Guide, Version 5.x


A P P E N D I X C : P E R F O R M A N C E


CODE SIZE

If you use a QWIK procedure, only the corresponding object file containing
that procedure will be linked and thereby optimizing the code. Even if all
procedures are used, QWIK is still quite small at a total of 2496 bytes
while the STRS unit is 240 bytes. Here's the linked code size:

FILE NAME BYTES PROCEDURES
------------ ----- -------------------------------------------------
Qinit .obj 592 Qinit - always linked when QWIK is USEd
Qwrites .obj 350 Qwrite, QwriteC, QwriteA, QwriteEos, QwriteEosA
Qfills .obj 439 Qfill, Qattr, QfillC, QattrC, QfillEos, QattrEos
Qstores .obj 293 QstoreToScr, QstoreToMem, QScrToVscr, QVscrToScr
Qreads .obj 127 QreadStr, QreadChar, QreadAttr
Qscrolls.obj 269 QscrollUp, QscrollDown
Qpages .obj 61 QwritePage, QviewPage
Cursor .obj 96 GotoRC, WhereR/C, SetCursor, GetCursor, ModCursor
Eos .obj 131 GotoEos, EosR/C, EosToRC/rel, EosToCursor, EosLn
QEosLn .obj 37 QEosLn
CpuIdent.obj 42 GetCpuID
GetSubID.obj 27 GetSubModelID
Qwik .tpu 32 Initialize and paragraph round up


SPEED

How fast is fast? To have a basis for comparision, a unit of
"screens/second" is used to get a feeling for speed. To make one screen, a
procedure is repeated with a FOR loop to fill several 80x25 pages and
timed. Qwrite- uses 80 character strings, and Qattr and Qfill use Rows:=25
and Cols:=80. Here are some samples from the systems that have been
tested. 16-bit video cards such as the one in the Compaq 386/20 will be
much faster than 8-bit cards.

------------------ S C R E E N S / S E C O N D -----------------
Chng XT(4.77 MHz) M30 M50 M70 ATT+ Compaq
Procedure Attr EGA CGA MCGA VGA VGA CGA 386/20
--------- ---- ------------ ----- ----- ----- ---- ------
Qwrite- Yes 32.8 9.5 75.4 88.4 113.3 16.8 418.4
No 42.4 9.5 90.0 138.1 191.9 16.8 450.4
Qfill- Yes 81.2 11.8 164.1 147.3 151.0 21.5 579.6
No 73.7 7.4 141.3 174.4 251.0 13.9 574.9
Qattr- Yes 72.6 7.4 141.3 174.4 254.9 14.0 570.3
Qstore- n/a 59.1 7.2 111.6 127.4 139.4 13.8 351.8
Qscroll- n/a 32.9 5.6 62.2 71.1 77.7 16.8 317.9

For those interested in comparisons, QWIK is much faster than the TP5
direct video routines by the following percentage:

Procedure CGA cards All Other cards
--------- --------- ---------------
Writeln 125% 650%


Appendix C: Performance Page 29
QWIK Screen Utilities User's Guide, Version 5.x




| TP4 USAGE
|
| QWIK5X.ARC is simply QWIK42B.PAS compiled under TP5. If you need to
| evaluate QWIK under TP4, obtain the TP4 version of QWIK. Here are the
| versions for each compiler:
|
| File Compiler
| ----------- ---------
| QWIK5X.TPU TP5
| QWIK42B.TPU TP4
|
| If you have the source code and want to recompile QWIK, be sure to use the
| correct directives at the top of the file by locating the "$" on the
| appropriate line. This a simple but important task. The important
| directive in TP5 is the alignment directive $A-. It must be turned off or
| QScrRec will not be addressed correctly.







































Appendix C: Performance Page 30
QWIK Screen Utilities User's Guide, Version 5.x


A P P E N D I X D : A P P L I C A T I O N P R O D U C T S


| Eagle Performance Software has developed identical products for both
| Turbo C and Turbo Pascal. Our pledge is to provide you quality products
| with unparalleled performance and ease of use. All registered users
| receive the complete source code when a signed license agreement is
| returned.


QWIK

QWIK - Here are the product versions and release dates for QWIK utilities:

File name CIS Name Compiler Release date
----------- ---------- -------- ------------
QWIK42B.ARC QWIK42.ARC TP4 10-01-88
QWIK5X.ARC QWIK5X.ARC TP5 12-20-88
QWIKC20.ARC QWKC20.ARC TC2 12-03-88


WNDW

WNDW - For multi-level virtual windows, WNDW is the highest performance
window utilities available today. It offers very powerful utilities for
full window control and management you probably never thought possible.
They are simple and yet very powerful with high speed and tight code. With
WNDW, you can choose the absolute writing routines of QWIK, the window-
relative writing routines of WNDW, and even customize your own. Here are
some of the features you will discover:

- Uses the powerful direct screen writing routines of QWIK.
- Up to 254 fixed or virtual windows can be on the screen at one
time.
- Extremely high-speed virtual screens in RAM (up to 40 times
faster).
- Virtual windows are fully updated on screen, even if covered.
Screens can scroll underneath one another right on the screen at
very high speeds!
- Virtual windows have virtual titles.
- Fully supported hidden windows saved in RAM.
- Fully supports all video pages.
- Adjustable-rate moving, resizing, and scrolling.
- All windows can be randomly accessed, not just stacked or tiled.
- 28 window-relative writing routines.
- 15 different border styles with shadow and zoom effects.
- Full line drawing procedures.
- Full cursor mode control for each window.
- Writes in all text modes and column modes.
- Only 13k bytes of code if all 69 utilities are used.
- Used in all other Eagle products.
- Excellent documentation like this document.





Appendix D: Application Products Page 31
QWIK Screen Utilities User's Guide, Version 5.x


Here are the product versions:

File name CIS Name Compiler Release date
----------- ---------- -------- ------------
WNDW42.ARC WNDW42.ARC TP4 10-15-88
WNDW5X.ARC WNDW5X.ARC TP5 10-15-88
WNDWC20.ARC WNDC20.ARC TC2 02-01-89


PULL

PULL - For multi-level pull-down menus, PULL 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. Some of the
features are:

- Uses QWIK and WNDW.
- Work window(s) and complete interface for menus
- Pull-down menus with 3 menu modes and 7 line modes
- Pull-down file directory
- Highlighted command letters
- Unlimited levels of submenus
- Unlimited data entry windows for 9 types of data
- Data entry for the work window(s)
Free field entry with either fixed column or flexible column
length.
Full editing capability including insert cursor mode
Full field selection with cursor keys
Automatic NumLock for numerical data entry
Right or left justification for data entry output
Error messages for invalid data entries
Error messages for data entries out of range
- Automatic sizes and locations for menus.
- Operation by cursor
keys or command keys
- Pull/Pop between work window and nested submenu(s)
- Programmable control of pull and pop sequences
- Context-sensitive help
- Message lines for prompts and processing
- Full working shell for user development
- Excellent documentation like this document.

Here are the product versions:

File name CIS Name Compiler Release date
----------- ---------- -------- ------------
PULL42.ARC PULL42.ARC TP4 01-03-89
PULL5X.ARC PULL5X.ARC TP5 TBA
PULLC20.ARC PULC20.ARC TC2 TBA







Appendix D: Application Products Page 32
QWIK Screen Utilities User's Guide, Version 5.x


ON-LINE SERVICES

CompuServe - All updated files and later versions can be found on the
CompuServe Borland Forums (GO BPROGA for TP and GO BPROGB for TC) or the
IBM Programming Forum (GO IBMPRO).

| The Eagle BBS - After 01-10-89, you can also get the latest files on our
| 24-hour BBS at (214) 539-9878, 300/1200 N81.

















































Appendix D: Application Products Page 33
QWIK Screen Utilities User's Guide, Version 5.x


A P P E N D I X E : R E V I S I O N H I S T O R Y


Pre-QWIK40 Versions - Here's a list of steps to help you upgrade to
QWIK42 from versions prior to QWIK40 on your programs:

1. Add "Uses 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
if you use the CRT unit.
5. See REVISIONS for changes of type.

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.





Appendix E: Revision History Page 34
QWIK Screen Utilities User's Guide, Version 5.x


Version 4.1a (05-01-88):
Added QwriteMore, QwriteMoreA, QfillMore, and QattrMore
procedures.
Added QnextOfs for the Q*More procedures.
Improved video detection in Qinit for dual monitors, Hercules
cards, and system hardware detection.
Included background color constants to use instead of an
attribute function.
Reduced code size about 10%.
Solved critical timing problem on IBM PC with CGA - at last!
QWIK now uses the global variable CRTcols and not the absolute
variable CRTcolumns for offset calculations.

Version 4.1b (06-18-88):
Separated GetSubModelID out of Qinit as an optional procedure
due to BIOS bugs in PC/XT clones which would cause a lock up
at initialization. New GetSubModelID now avoids those
machines and QWIK should now work on them.

Version 4.2 (10-1-88):
For clarity, the Q*More procedures were renamed to Q*Eos.
Added the type VScrRecType.
Added the following constants:
CursorOff, CursorOn, CursorBlink,
Added the following variables:
QvideoPage, QvideoMode, QScrPtr, QScrRec,
CursorInitial, CursorUnderline, CursorHalfBlock, CursorBlock
Renamed the following variables for clarity:
Qseg -> QScrSeg
Qofs -> QScrOfs
QnextOfs -> QEosOfs
Added the following procedures and functions:
QScrToVscr, QVscrToScr, QscrollUp, QscrollDown,
QreadStr, QreadChar, QreadAttr,
GotoEos, EosR, EosC, EosToRC, EosToRCrel, EosToCursor, EosLn,
QEosLn
Revamped the cursor procedures by deleting:
CursorChange, CursorOn, CursorOff
and replacing them with:
SetCursor, GetCursor, ModCursor
The screen base is now a FAR pointer using QScrOfs and QScrSeg pieced
together to make QScrPtr to do virtual screens in RAM.
GotoRC and WhereR/C now work on the "write" page instead of the viewed
page.
Made FirstQinit a variable instead of constant so that it would be
initialized at each startup when executing in TP environment. Hercules
cards are then tested at each startup.
Completely revised documentation.
Added supplementary STRS unit for string functions:
StrL, StrLF, StrR, StrRF, StrRFD

Version 4.2a (10-5-88):
QattrC fixed. (Did not exit properly when SameAttr used.)




Appendix E: Revision History Page 35
QWIK Screen Utilities User's Guide, Version 5.x


Version 4.2b (10-15-88):
Identifiers StrLF, StrRF, and StrRFD incorrectly labled in STRS unit as
StrLW, StrRW, and StrRWD. Document examples also corrected.
Added intstructions for TP5 useage (registered users only).

| Version 5.x (12-20-88):
| Compiled QWIK42B under TP5. No other changes.


















































Appendix E: Revision History Page 36
QWIK Screen Utilities User's Guide, Version 5.x


A P P E N D I X F : R E F E R E N C E S A N D C R E D I T S


REFERENCES

PS/2 Systems - For more information on the new IBM PS/2 system, you can
get the "Personal System/2 and Personal Computer BIOS Interface Technical
Reference" manual. Other references include:

IBM Personal System/2 Seminar Proceedings:
Volume 5, Number 2, Displays and Adapters, publication
# G360-2678.
Volume 5, Number 4, Models 50, 60, 80, VGA, BIOS and
Programming Considerations, publication # G360-2747.

3270 PC - For more information on the IBM 3270 PC, you can get the
following publications:

"3270 PC Application Development Considerations"
"IBM 3270 Personal Computer Programming Guide", Pub # SA23-0221
"IBM 3270 Personal Computer Control Program Reference", Pub
# GA23-0232

As always, the above information is subject to change without notice
per IBM.

Video Guide - An excellent guide for IBM and Hercules video card
programming in text and graphics is:

"Programmer's Guide to PC & PS/2 Video Systems" by Richard Wilton and
published by Microsoft Press

Trademarks - IBM is the trademark for International Business Machines
Corp. Turbo Pascal is a trademark of Borland International.


CREDITS

Without the assistance and original ideas from Brian Foley, these
routines would not have been written. And the helpful feedback from
users has inspired more powerful routines.
















Appendix F: References and Credits Page 37


  3 Responses to “Category : Pascal Source Code
Archive   : QWIK5X.ZIP
Filename : QWIK5X.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/