home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / c / quikc21.zip / QWIKC21.DOC < prev    next >
Text File  |  1989-07-06  |  79KB  |  2,118 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.                              QWIKC SCREEN UTILITIES
  21.                                   USER'S GUIDE
  22.  
  23.                                    Version 2.1
  24.                                   June 1, 1989
  25.  
  26.  
  27.                          Conversion to Turbo C / MS C by
  28.                        Jordan Gallagher / Wisdom Research
  29.  
  30.  
  31.                Copyright (C) 1988,1989 Eagle Performance Software
  32.                               All Rights Reserved.
  33.  
  34.  
  35.  
  36.                                _______
  37.                           ____|__     |               (tm)
  38.                        --|       |    |-------------------
  39.                          |   ____|__  |  Association of
  40.                          |  |       |_|  Shareware
  41.                          |__|   o   |    Professionals
  42.                        -----|   |   |---------------------
  43.                             |___|___|    MEMBER
  44.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  45.  
  46.  
  47.  
  48.                        T A B L E   O F   C O N T E N T S
  49.  
  50.         1. INTRODUCTION  . . . . . . . . . . . . . . . . . . . . . 3
  51.              Features  . . . . . . . . . . . . . . . . . . . . . . 3
  52.              Using the Manuals . . . . . . . . . . . . . . . . . . 3
  53.              Licensing . . . . . . . . . . . . . . . . . . . . . . 4
  54.              Customer Service  . . . . . . . . . . . . . . . . . . 4
  55.              ASP . . . . . . . . . . . . . . . . . . . . . . . . . 5
  56.  
  57.         2. GETTING STARTED . . . . . . . . . . . . . . . . . . . . 6
  58.              Distribution Files  . . . . . . . . . . . . . . . . . 6
  59.              Demonstration . . . . . . . . . . . . . . . . . . . . 6
  60.              Simple Programming  . . . . . . . . . . . . . . . . . 7
  61.              Functions . . . . . . . . . . . . . . . . . . . . . . 9
  62.  
  63.         3. BASIC TECHNIQUES  . . . . . . . . . . . . . . . . . . . 12
  64.              Cursor Mode Routines  . . . . . . . . . . . . . . . . 12
  65.              Cursor Location Routines  . . . . . . . . . . . . . . 13
  66.              EOS Marker  . . . . . . . . . . . . . . . . . . . . . 13
  67.              Scrolling . . . . . . . . . . . . . . . . . . . . . . 15
  68.              Pop-Up Windows  . . . . . . . . . . . . . . . . . . . 15
  69.              Memory Models and Libraries . . . . . . . . . . . . . 16
  70.  
  71.         4. ADVANCED TECHNIQUES . . . . . . . . . . . . . . . . . . 18
  72.              Virtual Screens . . . . . . . . . . . . . . . . . . . 18
  73.              Video Pages . . . . . . . . . . . . . . . . . . . . . 19
  74.              Video Modes . . . . . . . . . . . . . . . . . . . . . 20
  75.              Multi-tasking Environments  . . . . . . . . . . . . . 21
  76.              Interrupts  . . . . . . . . . . . . . . . . . . . . . 21
  77.  
  78.         5. HARDWARE DETECTION  . . . . . . . . . . . . . . . . . . 22
  79.              Display Combination Code  . . . . . . . . . . . . . . 22
  80.              Snow Checking . . . . . . . . . . . . . . . . . . . . 23
  81.              System Hardware . . . . . . . . . . . . . . . . . . . 24
  82.  
  83.         APPENDIX A: Video Mode Table . . . . . . . . . . . . . . . 25
  84.  
  85.         APPENDIX B: Cursor Mode Data . . . . . . . . . . . . . . . 27
  86.              Cursor Mode Tables  . . . . . . . . . . . . . . . . . 27
  87.              Cursor Emulation  . . . . . . . . . . . . . . . . . . 27
  88.  
  89.         APPENDIX C: Performance  . . . . . . . . . . . . . . . . . 30
  90.              Code Size . . . . . . . . . . . . . . . . . . . . . . 30
  91.              Speed . . . . . . . . . . . . . . . . . . . . . . . . 30
  92.  
  93.         APPENDIX D: Application Products . . . . . . . . . . . . . 32
  94.  
  95.         APPENDIX E: Revision History . . . . . . . . . . . . . . . 34
  96.  
  97.         APPENDIX F: References . . . . . . . . . . . . . . . . . . 35
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.                                        2
  105.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  106.  
  107.  
  108.    1.  I N T R O D U C T I O N
  109.  
  110.  
  111.    FEATURES
  112.  
  113.    Welcome to QWIKC Screen Utilities!
  114.  
  115.    You have just obtained a copy of the highest performance screen writing
  116.    tools available today for Turbo C 2.0 (TC2), MicroSoft C 5.x and QuickC
  117.    1.x.  Both novice and professional programmers will appreciate these simple
  118.    and very powerful utilities that give you absolute control over your CRT
  119.    displays in all text modes.
  120.  
  121.    Here are some of the features you will discover:
  122.  
  123.      . Writes on all IBM compatible computers, displays and adapters including
  124.        MDA, CGA, EGA, MCGA, VGA, 8514/A, Hercules and 3270 PC.
  125.      . Superior video detection routine.
  126.      . Eliminates snow and flicker.
  127.      . Writes directly to the screen in absolute rather than relative
  128.        coordinates.
  129.      . Writes in all text modes and column modes.
  130.      . Writes on all video pages.
  131.      . Writes on virtual screens in RAM.
  132.      . Writes text and attribute, text only, or attribute only.
  133.      . Reads strings, characters and attributes.
  134.      . Uses end-of-string (EOS) marker for quick string chaining.
  135.      . Provides standardized cursor control for all adapters.
  136.      . Enhanced cursor movement.
  137.      . Compatible with DESQview and similar multitasking environments.
  138.      . Up to 2300% faster than TC2 cprintf direct video writing.
  139.      . Only 2.7k bytes of code if all 41 utilities are used.
  140.      . Optimized by the linker and drops unused code.
  141.      . Used in all other Eagle products.
  142.  
  143.  
  144.    QWIKC is a library providing capabilities not offered in the standard
  145.    writing routines that come with most C compilers.  In contrast to TC2's
  146.    standard library functions which do window-relative writing, QWIKC knows
  147.    how to write directly to the screen in absolute screen coordinates for any
  148.    video configuration.
  149.  
  150.  
  151.    USING THE MANUALS
  152.  
  153.    Disk Based Guides - The manuals for QWIKC are on disk so that you can
  154.    conveniently scan for the topic you are seeking.  You can do this with any
  155.    list or search utility with a search function.  You can also make a printed
  156.    copy.  If you have not already printed this manual, refer to the READ.ME
  157.    file for instructions.  At the present time, no bound manuals are being
  158.    offered with registration.
  159.  
  160.    User's Guide - This manual, the one you are reading now, assumes that as a
  161.    programmer you are already familiar with your C compiler, and that you have
  162.    a working knowledge of your disk operating system (DOS).  It will provide
  163.  
  164.  
  165.                                        3
  166.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  167.  
  168.  
  169.    you the basic principles of direct screen writing and powerful tips on some
  170.    previously unavailable techniques.
  171.  
  172.    Reference Guide - This manual describes in detail all functions and
  173.    variables used in QWIKC.  It is alphabetically arranged for easy access in
  174.    a format similar to the TC2 manual.  Use this manual when you have become
  175.    familiar with the basic principles in the User's guide.
  176.  
  177.  
  178.    LICENSING
  179.  
  180.    Registration - These utilities and the documentation have been released for
  181.    distribution as Shareware.  You have been given the chance to sample the
  182.    full capability of QWIKC without risk!  If you find that QWIKC is a
  183.    valuable tool, then you are expected to register.  You will find a
  184.    reasonable licensing schedule found in LICENSE.ARC to meet private or
  185.    commercial needs.
  186.  
  187.    Source Code - All registered users will receive source code when the signed
  188.    license agreement is returned with the registration.
  189.  
  190.  
  191.    CUSTOMER SERVICE
  192.  
  193.    If you have questions, comments, or suggestions, the Eagle can be contacted
  194.    by four means - (1) CompuServe, (2) The Eagle BBS, (3) telephone, or
  195.    (4) mail.
  196.  
  197.    CompuServe - The most dependable way to contact the Eagle is through
  198.    CompuServe.  Jordan Gallagher has converted QWIKC from Turbo Pascal to C.
  199.    He can be contacted on the Borland Forum by typing GO BPROGB from the
  200.    CompuServe main menu.  You will enter the Forum for Turbo C.  You can
  201.    contact Jordan with his PPN number of 73557,2342.  Messages can also be
  202.    left through EasyPlex.
  203.  
  204.    The Eagle BBS - Our bulletin board system operates 24 hours a day, 7 days a
  205.    week at 1200 baud, using 8N1 at (214) 539-9878.  You can access our Pascal
  206.    and C products, and leave any questions or messages.
  207.  
  208.    Telephone - Jordan can also be reached by phone at (214) 539-7855 on
  209.    weekdays and Saturday from 10:00 a.m. to 9:00 p.m. CST.
  210.  
  211.    Mail - For registration or problems, please write:
  212.  
  213.        Eagle Performance Software
  214.        P.O. Box 292786
  215.        Lewisville, Texas 75029-2786
  216.  
  217.    In your written request for resolving problems, be sure to include:
  218.  
  219.      . A 5 1/4 inch diskette of compilable source code of the problem.
  220.      . The Eagle product and version number.
  221.      . The computer make and model.
  222.      . The type of video card, video monitor and keyboard.
  223.  
  224.  
  225.  
  226.                                        4
  227.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  228.  
  229.  
  230.  
  231.  
  232.    ASP
  233.  
  234.    QWIKC is a Shareware program conforming to the standards of the Association
  235.    of Shareware Professionals (ASP).  You can get more information about ASP
  236.    by writing to:
  237.  
  238.        Association of Shareware Professionals
  239.        P.O. Box 5786
  240.        Bellevue, WA 98006.
  241.  
  242.    This program is produced by a member of the Association of Shareware
  243.    Professionals (ASP).  ASP wants to make sure that the shareware principle
  244.    works for you.  If you are unable to resolve a shareware-related problem
  245.    with an ASP member by contacting the member directly, ASP may be able to
  246.    help.  The ASP Ombudsman can help you resolve a dispute or problem with an
  247.    ASP member, but does not provide technical support for member's products.
  248.    Please write to:
  249.  
  250.        ASP Ombudsman
  251.        P.O. Box 5786
  252.        Bellevue,WA 98006
  253.  
  254.    or send a CompuServe message via EasyPlex to ASP Ombudsman 70007,3536.
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.                                        5
  288.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  289.  
  290.  
  291.    2.  G E T T I N G   S T A R T E D
  292.  
  293.    This section will acquaint you with the files on disk and show you a brief
  294.    demonstration.  You will also run your first program with QWIKC and then
  295.    become familiar with all of the utilities.
  296.  
  297.  
  298.    DISTRIBUTION FILES
  299.  
  300.    In this version, QWIKC21.ARC contains:
  301.  
  302.      QWIKC21S.LIB:  Small model QWIKC21 library file containing the
  303.                     object files.  There are 2000 lines of assembler
  304.                     code for the Small model, and 12000 lines total
  305.                     for all models.  Only the small model is supplied
  306.                     with the distribution copy. All models will be
  307.                     supplied upon registration.
  308.      QWIKC21 .H  :  Header file for QWIKC21S.LIB.  Contains external
  309.                     declarations of QWIKC's variables, macro
  310.                     definitions, and function prototypes.
  311.      QWIKC21 .DOC:  This document - a user's guide to QWIKC.
  312.      QWIKDEMO.C  :  A demonstration program showing the features and
  313.                     speed of all functions and is written primarily
  314.                     for color cards, but also works on mono cards.
  315.      QWIKDEMO.PRJ:  Project file for compiling QWIKDEMO.C.
  316.      QWIKREF .DOC:  QWIKC Reference Guide document covering each
  317.                     function and variable in detail.
  318.      QINITEST.C  :  A program that verifies the equipment detected by
  319.                     the qinit() function.
  320.      QINITEST.PRJ:  Project file for compiling QINITEST.C.
  321.      QBENCH  .C  :  A timing program that shows "screens/second" for
  322.                     typical QWIKC functions.
  323.      QBENCH  .PRJ:  Project file for compiling QBENCH.C.
  324.      TIMERD12.C  :  Source file for routine to measure elapsed time.
  325.      TIMERD12.H  :  Header file for routine to measure elapsed time.
  326.      LICENSE .ARC:  ARC file containing license agreements.
  327.      *       .BAT:  Batch files for compiling demo programs using
  328.                     MicroSoft C or QuickC.
  329.  
  330.    Registered users who have the source code will also have the following
  331.    files:
  332.  
  333.      QWIKC21T.LIB:  Tiny model QWIKC21 library.
  334.      QWIKC21C.LIB:  Compact model QWIKC21 library.
  335.      QWIKC21M.LIB:  Medium model QWIKC21 library.
  336.      QWIKC21L.LIB:  Large model QWIKC21 library.
  337.      QWIKC21H.LIB:  Huge model QWIKC21 library.
  338.  
  339.    There will also be six subdirectories containing the .ARC files for the
  340.    source on the disk for registered users.
  341.  
  342.  
  343.    DEMONSTRATION
  344.  
  345.    To get an overview of the speed and features of QWIKC, let's run a
  346.  
  347.  
  348.                                        6
  349.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  350.  
  351.  
  352.    demonstration program that came with the utilities.  Do the following
  353.    steps:
  354.  
  355.      1. Using the small model, compile the QWIKDEMO program.  If you have
  356.         Turbo C, this is done using the project file QWIKDEMO.PRJ.  If you
  357.         have MicroSoft C or QuickC, use either CLQDEMO.BAT or QCLQDEMO.BAT,
  358.         respectively.  You must specify a parameter to these batch files
  359.         indicating the model size.
  360.      2. If you are running programs in a multi-tasking environment, instruct
  361.         the environment that you are NOT writing direct to the screen.  Also
  362.         set text pages to 2.
  363.      3. Run QWIKDEMO.
  364.      4. Press any key when the screen prompts you to continue with "... press
  365.         any key".
  366.  
  367.    Before doing the same thing with QINITEST.C, read the comments at the top
  368.    of the source file to see if you want to test for a computer submodel ID.
  369.    The batch files for QINITEST are CLQTEST.BAT and QCLQTEST.BAT.
  370.  
  371.  
  372.    SIMPLE PROGRAMMING
  373.  
  374.    Batch file or makefile (MSC/QC) - You should create either a batch file or
  375.    a makefile to compile your program.  A batch file should simply execute
  376.    your compiler and instruct it to link QWIKC21S.LIB.  Be sure to use the
  377.    small model.  For instructions on creating a makefile, see your compiler's
  378.    instructions.
  379.  
  380.    Project File (Turbo C) - All example programs in this manual assume that
  381.    QWIKC21S.LIB is being linked.  Your first project file may look like this:
  382.  
  383.        myqwik1
  384.        qwikc21s.lib
  385.  
  386.    First Program - Let's write a short program to see how simple it is to
  387.    write with QWIKC.  While in your editor, enter the following code:
  388.  
  389.      #include <stdio.h>
  390.      #include <conio.h>
  391.      #include "qwikc21.h"
  392.  
  393.      main() {
  394.          qinit();
  395.          qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY, ' ' );
  396.          qwrite( 5,  1, YELLOW+BLUE_BG, "QWIK writing" );
  397.          qwrite( 5, 13, YELLOW+BLUE_BG, " is easy!" );
  398.          getch();
  399.  
  400.          return;
  401.      }
  402.  
  403.    Save the file, then compile and run the program.  You can then see the text
  404.    "QWIK writing is easy!" starting on row 5, column 1.  On color monitors,
  405.    the text is a yellow foreground with a blue background while monochrome
  406.    monitors show high intensity on black.
  407.  
  408.  
  409.                                        7
  410.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  411.  
  412.  
  413.  
  414.    Row/Col vs. X/Y - You probably noticed that the row parameter is first and
  415.    the column parameter is second.  Since QWIKC is entirely for text modes, it
  416.    is more intuitive to specify the row first and the column second just like
  417.    any word processor.  The X/Y scheme is better suited for graphics.
  418.  
  419.    Attributes - Notice that our example uses the macro BLUE_BG.  QWIKC
  420.    provides eight convenient background color macros to use along with the 16
  421.    foreground color macros.  The same names are used, but the "_BG" suffix is
  422.    added:
  423.  
  424.       BLACK_BG      RED_BG
  425.       BLUE_BG       MAGENTA_BG
  426.       GREEN_BG      BROWN_BG
  427.       CYAN_BG       LIGHTGRAY_BG
  428.  
  429.    These allow QWIKC to make the most of C's macros.  By simply adding the
  430.    foreground and background macros together, the compiler saves the result as
  431.    a single word.  And, by simply reading the qwrite statement, what you see
  432.    is what you get (WYSIWYG).
  433.  
  434.    Readable Code - As an added benefit, QWIKC was designed with human factors
  435.    in mind and was made so that it is very easy to read the code you create.
  436.    With the row, column, and attribute parameters first and the string last,
  437.    you can see that the two qwrite statements were easily aligned.  WYSIWYG to
  438.    the rescue again!
  439.  
  440.    Chaining - Notice that we had to calculate the string length of "QWIK
  441.    writing" before we could locate the string " is easy".  Let's modify the
  442.    last statement to indeed make it easier to locate the last string:
  443.  
  444.      #include <stdio.h>
  445.      #include <conio.h>
  446.      #include "qwikc21.h"
  447.  
  448.      main() {
  449.          qinit();
  450.          qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY, ' ' );
  451.          qwrite( 5, 1, YELLOW+BLUE_BG, "QWIK writing" );
  452.          qwriteeos(    YELLOW+BLUE_BG, " is easy!" );
  453.          getch();
  454.          return;
  455.      }
  456.  
  457.    Now that was really easy!  How did qwriteeos() know where to write?  QWIKC
  458.    internally keeps track of an end-of-string (EOS) marker so that any
  459.    subsequent "eos" function like qwriteeos() will chain the next string right
  460.    there - no rows or columns to calculate!  And you can chain as many as you
  461.    want on to any other QWIKC function.
  462.  
  463.    Same Attribute - But suppose we did not want to change the attribute that
  464.    was already on the screen and don't even know what it is.  How is that
  465.    done?  Just modify the attributes to the following:
  466.  
  467.      #include <stdio.h>
  468.  
  469.  
  470.                                        8
  471.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  472.  
  473.  
  474.      #include <conio.h>
  475.      #include "qwikc21.h"
  476.  
  477.      main() {
  478.          qinit();
  479.          qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY, ' ' );
  480.          qwrite( 5, 1, SAMEATTR, "QWIK writing" );
  481.          qwriteeos(    SAMEATTR, " is easy!" );
  482.          getch();
  483.          return;
  484.      }
  485.  
  486.    The macro SAMEATTR (which is negative) tells QWIKC to simply enter the text
  487.    on the screen without changing the attribute.  The result of the program
  488.    shows the text with LIGHTGRAY on BLACK attributes.  This macro works on all
  489.    QWIKC utilities so that, when assigned to a variable, the attribute can
  490.    even be switched at runtime.
  491.  
  492.    Centering - Rather than having the text left-justified, let's center the
  493.    text on the screen by modifying a portion of the code:
  494.  
  495.      ...
  496.        qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY, ' ' );
  497.        qwritec( 5, 1, 80, SAMEATTR, "QWIK writing is easy!" );
  498.        return;
  499.      }
  500.  
  501.    This will place the text on row 5 centered between columns 1 and 80 which
  502.    is perfect for an 80 column text mode.  But what if other text or column
  503.    modes are used?  How can we ensure that it is always centered?  Only one
  504.    simple change is needed:
  505.  
  506.          ...
  507.          qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY, ' ' );
  508.          qwritec( 5, 1, crt_cols, SAMEATTR, "QWIK writing is easy!" );
  509.          return;
  510.      }
  511.  
  512.    The variable crt_cols always has the value of the column width that is
  513.    currently being used.  How does it know?  QWIKC is initialized at startup
  514.    by executing a function called qinit().  It detects a host of information
  515.    about your video configuration, everything from the type of video card you
  516.    are using to the shape of the cursor being used.  You can see a list of all
  517.    these variables available for your use in QWIKREF.DOC.
  518.  
  519.    qinit() - You probably have noticed that qinit() is the first function
  520.    called in every program.  This is essential before using any QWIKC
  521.    functions so that all CRT information can be correctly initialized.  If you
  522.    forget this, you can be certain your program will either crash or at least
  523.    misbehave!
  524.  
  525.  
  526.    FUNCTIONS
  527.  
  528.    Now that you have a basic idea of what QWIKC can do, let's make a brief
  529.  
  530.  
  531.                                        9
  532.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  533.  
  534.  
  535.    survey of all the functions in QWIKC21S.LIB to just know what is available:
  536.  
  537.      One initializing function:
  538.  
  539.         qinit()            - Initializing function which sets the global
  540.                               variables for the QWIKC functions.  It
  541.                               should be called at the top of your program
  542.                               before calling any QWIKC functions.
  543.         qreinit()          - Should be called after a change from one text
  544.                               mode to another.
  545.  
  546.      Three quick direct screen writing functions, all work with or without
  547.      attribute change:
  548.  
  549.         qwrite()           - For any string.
  550.         qwritec()          - For any string; self-centering.
  551.         qwrite_sub()       - For any substring or part of a byte array.
  552.  
  553.      Four quick direct screen filling functions in rows-by-cols block
  554.      parameters:
  555.  
  556.         qfill()            - Repetitive filling with the same character;
  557.                              with or without attribute change.
  558.         qfillc()           - Same as qfill(), but self-centering.
  559.         qattr()            - Repetitive filling with an attribute only.
  560.         qattrc()           - Same as qattr(), but self-centering.
  561.  
  562.      Two quick screen storing functions:
  563.  
  564.         qstoretomem()      - Saves a rows-by-cols block to memory.
  565.         qstoretoscr()      - Restores a rows-by-cols block to any screen
  566.                              page.
  567.  
  568.      Two quick screen storing functions for copying blocks between a
  569.      screen (scr) and a virtual screen (vscr - a screen in memory):
  570.  
  571.         qscrtovscr()       - Copies a rows-by-cols block from QWIKC screen
  572.                              to virtual screen.
  573.         qvscrtoscr()       - Restores a rows-by-cols block from a virtual
  574.                              screen to the QWIKC screen.
  575.  
  576.      Three quick screen reading functions for reading data from any
  577.      screen:
  578.  
  579.          qreadstr()        - Reads a string of text.
  580.          qreadchar()       - Reads a single character.
  581.          qreadattr()       - Reads an attribute.
  582.  
  583.      Two quick scrolling functions work on any video page and also
  584.      virtual screens without flicker or snow:
  585.  
  586.          qscrollup()       - Scroll affected rows-by-cols block up.
  587.          qscrolldown()     - Scroll affected rows-by-cols block down.
  588.  
  589.      Two quick video page changing functions:
  590.  
  591.  
  592.                                        10
  593.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  594.  
  595.  
  596.  
  597.          qviewpage()       - Changes the page to be displayed - up to 8!
  598.          qwritepage()      - Sets the page on which the QWIKC functions
  599.                              are writing.  You don't have to write just on
  600.                              the displayed page!
  601.  
  602.      Three quick cursor functions which work on any video page.  They now
  603.      work on the page being written rather than viewed:
  604.  
  605.          gotorc()          - Move cursor to absolute row and column
  606.                              coordinates rather than relative to a window.
  607.          wherer()          - Returns absolute cursor row.
  608.          wherec()          - Returns absolute cursor column.
  609.  
  610.      Eight quick EOS (end-of-string) marker functions that alter its
  611.      position and/or the cursor.  The marker can be moved on the CRT and
  612.      virtual screens, while the cursor movement is only on the page being
  613.      written:
  614.  
  615.          gotoeos()         - Moves cursor to EOS marker (like printf).
  616.          eosr()            - Returns absolute row of EOS marker.
  617.          eosc()            - Returns absolute col of EOS marker.
  618.          eostorc()         - Sets EOS to a given row and column.
  619.          eostorcrel()      - Relatively shifts EOS by a number of rows and
  620.                              columns, and can be negative or positive.
  621.          eostocursor()     - Matches EOS to the cursor position.
  622.          eosln()           - Moves EOS to column 1 of the next row.
  623.          qeosln()          - Like eosln(), but scrolls up if past last row.
  624.  
  625.      Three cursor routines alter the cursor mode:
  626.  
  627.          getcursor()       - Get current cursor mode from low memory.
  628.          setcursor()       - Sets new cursor mode.
  629.          modcursor         - Modifies cursor mode to on, off or erratic
  630.                              blink saving current scan lines.
  631.  
  632.      Four quick EOS writing function that chain write at the EOS marker:
  633.  
  634.          qwriteeos()       - like qwrite().
  635.          qwriteeos_sub()   - like qwrite_sub().
  636.          qfilleos()        - like qfill().
  637.          qattreos()        - like qattr().
  638.  
  639.      A submodel identification routine:
  640.  
  641.          get_submodel_id() - Optional function to find IBM submodel ID.
  642.  
  643.      A routine to set screen pointers to multi-tasking video buffers:
  644.  
  645.          setmultitask - Alters QWIKC to write to the multi-tasking buffer.
  646.    For a full description of each utility with its parameters, please refer to
  647.    QWIKREF.DOC for a summary of details and examples.
  648.  
  649.  
  650.  
  651.  
  652.  
  653.                                        11
  654.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  655.  
  656.  
  657.    3.  B A S I C   T E C H N I Q U E S
  658.  
  659.  
  660.    CURSOR MODE ROUTINES
  661.  
  662.    Three Routines - If you have ever struggled with controlling the shape of
  663.    the cursor, your life is about to be made easier.  With just three
  664.    routines, setcursor(), getcursor(), and modcursor(), you can consistently
  665.    and reliably control the cursor mode (shape and visibility) on any video
  666.    card!
  667.  
  668.    Four Standard Modes - To make it even easier, four standard cursor mode
  669.    variables are initialized at startup to fit the exact requirements of the
  670.    detected video card.  They are:
  671.  
  672.      cursor_underline  - The standard underline cursor.
  673.      cursor_half_block - The half block shape usually used for insert editing.
  674.      cursor_block      - An easy to find full cell cursor.
  675.      cursor_initial    - The mode detected at start up.
  676.  
  677.    So, if we wanted a full block cursor, only one line of code is needed:
  678.  
  679.      setcursor( cursor_block );
  680.  
  681.    And that's it!  There's nothing else to figure out - even if you are using
  682.    something like 43-row mode on an EGA card.  When ending your programs, you
  683.    can get back to the original cursor mode by using:
  684.  
  685.      setcursor( cursor_initial );
  686.  
  687.    Hidden Cursor - Many programs need to hide the cursor altogether.  This can
  688.    be done with modcursor():
  689.  
  690.      modcursor( cursor_off );
  691.  
  692.    Why use modcursor() instead of setcursor()?  modcursor() leaves the shape
  693.    of the cursor alone, and only alters bits 13 and 14 of the cursor mode to
  694.    turn it on or off.  In fact there are three macros that are useful with
  695.    modcursor():
  696.  
  697.      cursor_off   (0x2000) - To turn the cursor off.
  698.      cursor_on    (0x0000) - To turn the cursor back on with the same shape.
  699.      cursor_blink (0x6000) - To create erratic blinking on MDA/CGA.  (On
  700.                              EGA/VGA, it turns the cursor off.)
  701.  
  702.    Using your imagination, you can also mix and match the macros and variables
  703.    by logically summing them.  Let's say we want to change the shape of the
  704.    cursor to a block while it is still turned off:
  705.  
  706.      setcursor( cursor_block | cursor_off );
  707.  
  708.    So, the next time modcursor( cursor_on ) is used, the cursor will be a full
  709.    block.  As a suggestion for terminating your program, be sure to restore
  710.    the cursor when exiting your program with:
  711.  
  712.  
  713.  
  714.                                        12
  715.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  716.  
  717.  
  718.      setcursor( cursor_initial );
  719.  
  720.    getcursor() - This function simply returns the current cursor mode value
  721.    stored in low memory allowing you to save it for later use.
  722.  
  723.  
  724.    CURSOR LOCATION ROUTINES
  725.  
  726.    QWIKC has three routines that complement routines found in Turbo C -
  727.    gotorc(), wherer(), and wherec().  They correspond with Turbo C's gotoxy(),
  728.    wherex(), and wherex().  However, there are some important differences:
  729.  
  730.      . The QWIKC routines are absolute to the screen and are not
  731.        restricted by the Turbo C text window.
  732.      . The suffixes "r" and "c" mean row and column, so the parameters of
  733.        gotorc() are reversed from gotoxy().
  734.      . The QWIKC routines will also work on any video page. This is
  735.        explained in the Advanced Techniques section later.
  736.  
  737.    This is not the only way to move the cursor.  The EOS marker is also a very
  738.    powerful aid, as you will see in the next topic.
  739.  
  740.  
  741.    EOS MARKER
  742.  
  743.    Invisible Alternate Cursor - From the examples in the Simple Programming
  744.    topic, we found that we could easily chain two strings together using the
  745.    EOS marker.  In fact, this marker is so versatile, the EOS marker utilities
  746.    can be made interchangeable with the cursor, but much faster.  You could
  747.    think of it as an alternate cursor that is invisible.
  748.  
  749.    Keeping Track - Any time a QWIKC writing function is used, the EOS marker
  750.    is updated.  It is actually saved as the global variable qeosofs.
  751.    Technically, the value is the offset from the screen base and is a 0-based
  752.    byte count.  For example, if the following function was called:
  753.  
  754.      qwrite( 6, 5, YELLOW, "important data" );
  755.  
  756.    the EOS would be at row 6, column 19, right after the word "data".  The
  757.    value of qeosofs on an 80 column screen would be:
  758.  
  759.      qeosofs = ((row-1)*crt_cols + (col-1)) * 2 = 836
  760.  
  761.    QWIKC does not need to calculate this value, but simply saves it after
  762.    writing, so it is very efficient.  From the overview, you are already aware
  763.    of the four routines that will start writing at this marker - qwriteeos(),
  764.    qwriteeos_sub(), qfilleos(), and qattreos().  But what about changing the
  765.    location of the marker itself?  Keep reading.
  766.  
  767.    Moving the Marker - QWIKC has four routines that will manually move the EOS
  768.    marker:
  769.  
  770.      eostorc()    - Sets EOS to a given row and column.
  771.      eostorcrel() - Relatively shifts EOS by a number of rows and columns,
  772.                     and can be negative or positive.
  773.  
  774.  
  775.                                        13
  776.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  777.  
  778.  
  779.      eosln()      - Moves EOS to column 1 of the next row.
  780.      qeosln()     - Like eosln, but scrolls up if past last row.
  781.  
  782.    The basic function eostorc() moves the EOS marker exactly like gotorc does
  783.    for the cursor.  But there are also several ways to move the marker rela-
  784.    tively.  Let's test a short program:
  785.  
  786.      #include <stdio.h>
  787.      #include <conio.h>
  788.      #include "qwikc21.h"
  789.  
  790.      main() {
  791.          qinit();
  792.          textcolor( YELLOW );
  793.          qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY, ' ' );
  794.          qwrite( 1, 1, YELLOW+BLUE_BG, "first  row ");
  795.          eosln();                                     /* Jump to (2,1) */
  796.          qwriteeos( YELLOW+BLUE_BG, "second row ");
  797.          eostorc( 3, 1 );                             /* Jump to (3,1) */
  798.          qwriteeos( YELLOW+BLUE_BG, "third  row ");
  799.          eostorcrel( 1, -4 );                         /* Jump to (4,8) */
  800.          qwriteeos( YELLOW+BLUE_BG, "etc." );
  801.          eostorc( eosr()+1, 8 );                      /* Jump to (5,8) */
  802.          qwriteeos( YELLOW+BLUE_BG, "etc." );
  803.          getch();
  804.          return;
  805.      }
  806.  
  807.    Save the file, then compile and run the program.  You should see "row" and
  808.    "etc." all aligned in one column.  So, you can see that there are several
  809.    simple ways to move the marker!
  810.  
  811.    EOS and the Cursor - You can also interface the EOS marker and the cursor
  812.    with two functions:
  813.  
  814.      gotoeos()      - Moves cursor to match the EOS marker.
  815.      eostocursor()  - Sets the EOS marker to match the cursor position.
  816.  
  817.    It can't get any simpler than that!  Now you can see that:
  818.  
  819.      qwrite( 1, 1, YELLOW, "test line" );
  820.      gotoeos();
  821.  
  822.    and,
  823.  
  824.      textcolor( YELLOW );
  825.      gotoxy( 1, 1 );
  826.      cprintf( "test line" );
  827.  
  828.    produce identical results.  But QWIKC is much faster!
  829.  
  830.  
  831.    SCROLLING
  832.  
  833.    Improved Control - With your compiler's routines, you can only control the
  834.  
  835.  
  836.                                        14
  837.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  838.  
  839.  
  840.    full screen size with printf() or cprintf().  But with the two QWIKC
  841.    routines, qscrollup() and qscrolldown(), you can define any area to be
  842.    scrolled:
  843.  
  844.       qscrollup( 2, 2, crt_rows-2, crt_cols-2, myattr );
  845.  
  846.    This example scrolls a portion of the screen starting at (2,2) leaving a
  847.    one character border.  In a 25x80 text mode, it clears row 24 from column
  848.    2 to 79.  In addition, the cleared row attribute is myattr.
  849.  
  850.    Improved Performance - With qscrolldown() and qscrollup() (called qscroll*
  851.    for brevity), your programs can overcome the BIOS problems on many
  852.    machines.   Transparent to you, these functions work on all cards and
  853.    machines without flicker or snow and operate at three speeds:
  854.  
  855.      Maximum  - for video cards without snow
  856.      Fast CGA - for CGA cards on 80286 machines or better
  857.      Slow CGA - for CGA cards on 8086/8088 machines
  858.  
  859.    qinit() detects the CPU ID and video card to select the fastest algorithm.
  860.    All speeds use 16-bit transfers rather than 8-bit.  So, you can be assured
  861.    of the highest performance.
  862.  
  863.    Cursor Location - These routines do not move the cursor.  However, EOS is
  864.    pointing to the first column of the blank line and gotoeos() will move the
  865.    cursor there if needed.
  866.  
  867.    qeosln - This function is another alternative to full screen scrolling.  It
  868.    has the same function as eosln(), but will additionally scroll the screen
  869.    up if the EOS marker is past the last row.  Then it simply calls
  870.    qscrollup().  The attribute of the cleared row is the global variable
  871.    scroll_attr.  You must set this prior to using qeosln().
  872.  
  873.  
  874.    POP-UP WINDOWS
  875.  
  876.    QWIKC has the basic tools to create and remove pop-up windows.  Let's try
  877.    to create one.  While in your editor, enter the following code:
  878.  
  879.      #include <stdio.h>
  880.      #include <conio.h>
  881.      #include <dos.h>
  882.      #include "qwikc21.h"
  883.  
  884.      int mywindow[250],myunderlay[250];
  885.  
  886.      main() {
  887.          qinit();
  888.  
  889.          /* -- Fill the screen with a hatch character. -- */
  890.          qfill( 1, 1, crt_rows, crt_cols, LIGHTGRAY+BLACK_BG, 176 );
  891.  
  892.          /* -- Create a pop-up window. -- */
  893.          qstoretomem( 5, 12, 10, 25, myunderlay );        /* Save area to
  894.                                                              be covered    */
  895.  
  896.  
  897.                                        15
  898.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  899.  
  900.  
  901.          qfill( 5, 12, 10, 25, BLACK+LIGHTGRAY_BG, ' ' ); /* Clear area    */
  902.          qwritec( 9, 12, 36, SAMEATTR, "Pop-up window" ); /* Label window  */
  903.          suspend( 1000 );                                 /* Wait a sec    */
  904.          qstoretomem( 5, 12, 10, 25, mywindow );          /* Save a copy   */
  905.          qstoretoscr( 5, 12, 10, 25, myunderlay );      /* Restore screen  */
  906.  
  907.          /* -- Move window some where else. -- */
  908.          qstoretomem( 8, 25, 10, 25, myunderlay ); /* Save area underneath */
  909.          qstoretoscr( 8, 25, 10, 25, mywindow );   /* Move window          */
  910.          suspend( 1000 );                          /* Wait a sec           */
  911.  
  912.          /* -- Remove window. -- */
  913.          qstoretoscr( 8, 25, 10, 25, myunderlay );  /* Restore screen      */
  914.          getch();
  915.  
  916.          return;
  917.      }
  918.  
  919.    Save the file.  You will see a 10 row by 25 column window located at
  920.    (5,12) which is row 5, column 12.  After one second, it will be moved to
  921.    (8,25). Then after another second, it is removed from the screen.  We did
  922.    a lot of work with very little code!
  923.  
  924.    Rows-by-Cols - qstoretoscr() and qstoretomem() are screen saving and
  925.    restoring functions that conveniently work in row-by-column blocks.  They
  926.    accommodate any column mode, so there is no need to be concerned about
  927.    screen width.
  928.  
  929.    Memory Requirements - Notice that qstoretomem() wrote the data direct to
  930.    memory in mywindow.  It is important that the memory allocated to that
  931.    variable is correct to prevent it from overwriting any other variables.
  932.    The array size chosen was a 250 word array which is a perfect fit since
  933.    one word is needed for each character and attribute on the screen.  If you
  934.    prefer, the heap can also be used such as:
  935.  
  936.      int *myunderlay;
  937.  
  938.      main() {
  939.          myunderlay=malloc(500);
  940.          qstoretomem( 5, 12, 10, 25, myunderlay );
  941.          /* ... */
  942.          free( myunderlay );
  943.      }
  944.  
  945.  
  946.    MEMORY MODELS AND LIBRARIES
  947.  
  948.    Separate Library Files - QWIKC comes with several .LIB (library) files.
  949.    The correct .LIB file for your memory model must be linked with your
  950.    program.  Here is a list of the .LIB files and their corresponding models:
  951.  
  952.      QWIKC21T.LIB - Tiny model
  953.      QWIKC21S.LIB - Small model
  954.      QWIKC21M.LIB - Medium model
  955.      QWIKC21C.LIB - Compact model
  956.  
  957.  
  958.                                        16
  959.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  960.  
  961.  
  962.      QWIKC21L.LIB - Large model
  963.      QWIKC21H.LIB - Huge model
  964.  
  965.    Linking - If you have Turbo C, the library's name must be listed in your
  966.    project file.  For MicroSoft C or QuickC, instruct your compiler to link
  967.    the library when executing it.  You must also include QWIKC21.H in your
  968.    program so that the macros and function prototypes for QWIKC will be set
  969.    correctly.
  970.  
  971.    Libraries and Object Files - The library files that come with QWIKC
  972.    contain the object code for QWIKC's modules.  If it is necessary to
  973.    extract an object file, such as QWRITES from the Small model library,
  974.    enter the following at the DOS prompt:
  975.  
  976.        tlib qwikc21s *qwrites
  977.  
  978.    The file QWRITES.OBJ will be extracted and placed in the current
  979.    directory.  Since the linker optimizes the code anyway, this procedure
  980.    will probably not be necessary.
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.                                        17
  1020.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1021.  
  1022.  
  1023.    4.  A D V A N C E D   T E C H N I Q U E S
  1024.  
  1025.    This section will acquaint you with the powerful virtual screen writing
  1026.    features already built into QWIKC.  You will also find out how easy it is
  1027.    to work on multiple video pages and accommodate video mode changes.
  1028.  
  1029.  
  1030.    VIRTUAL SCREENS
  1031.  
  1032.    This topic will show you how to create and use powerful virtual screens.
  1033.  
  1034.    Virtual Screen - Just what is a virtual screen?  It is a screen maintained
  1035.    in RAM of any dimensions that can be reproduced on the CRT in full or in
  1036.    part.  The advantages are:
  1037.  
  1038.      . Variable row-by-column screen
  1039.      . Large video buffer up to 64k
  1040.      . High speed in RAM
  1041.      . Unlimited number of screens
  1042.  
  1043.    Screen Structure - QWIKC uses seven variables to define any screen.  When
  1044.    you call qinit() at the top of your program, QWIKC initializes them to the
  1045.    video system detected:
  1046.  
  1047.      crt_rows - Number of rows
  1048.      crt_cols - Number of columns
  1049.      crt_size - Byte allocation for screen
  1050.      qsnow    - True if snow checking needed
  1051.      qeosofs  - EOS offset
  1052.      qscrofs  - Screen offset
  1053.      qscrseg  - Screen segment
  1054.      qscrptr  - Far pointer to screen memory or virtual screen
  1055.  
  1056.    To make data access even easier, all these variables are contained in the
  1057.    structure qscr of type vscr_t.  In addition, qscrseg and qscrofs are
  1058.    actually macros pointing to the segment and offset of qscrptr.  This gives
  1059.    QWIKC a true far pointer, so screens can be anywhere in memory and not
  1060.    just paragraph aligned!
  1061.  
  1062.    Creating Virtual Screens - In three easy steps, you can easily create a
  1063.    virtual screen:
  1064.  
  1065.      1. Allocate memory for the screen.
  1066.      2. Save the current screen structure.
  1067.      3. Modify the screen structure for the virtual screen.
  1068.  
  1069.    Let's write some code that does just that:
  1070.  
  1071.      #include <stdio.h>
  1072.      #include <stdlib.h>
  1073.      #include <conio.h>
  1074.      #include "qwikc21.h"
  1075.  
  1076.      vscr_t crt,vscr;
  1077.  
  1078.  
  1079.  
  1080.                                        18
  1081.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1082.  
  1083.  
  1084.    main()
  1085.      {
  1086.          qinit();
  1087.  
  1088.          /* set up specs for virtual screen */
  1089.          vscr.vrows=80;                            /* let's choose 80 rows */
  1090.          vscr.vcols=100;                       /* let's choose 100 columns */
  1091.          vscr.vsize=vscr.vrows*vscr.vcols << 1;
  1092.          vscr.vsnow=0;                 /* flag can always be 0 on virtuals */
  1093.          vscr.veosofs=0;                  /* be safe and start at the base */
  1094.          vscr.vscrptr=malloc(vscr.vsize);  /* allocate heap space for vscr */
  1095.          crt=qscr;                                       /* save CRT specs */
  1096.          qscr=vscr;                    /* set current screen to our screen */
  1097.          /* ... */                          /* write to the virtual screen */
  1098.  
  1099.          qscr=crt;                         /* restore CRT specs when done! */
  1100.          return;
  1101.      }
  1102.  
  1103.    Now, when you use any QWIKC routine, they can be directed to the virtual
  1104.    screen - writing, reading, scrolling, wrapping, and everything you would
  1105.    expect.  qsnow can always be 0 when writing to virtual screens since RAM
  1106.    is used and not video card memory.
  1107.  
  1108.    Cursor Control - One thing not available to virtual screens is cursor
  1109.    movement, because the cursor location is reserved by DOS for just video
  1110.    pages.  That means there is no cursor available for virtual screens.  So,
  1111.    how can we get around this?  The EOS marker comes to the rescue as an
  1112.    indispensable cursor!  All EOS routines can still be used as before.
  1113.  
  1114.    Taking a Peek - At some time, we will need to take a look at all or a
  1115.    portion of the virtual screen by copying it to the CRT.  Two inter-screen
  1116.    functions do this by blocks at high speed - qscrtovscr() and qvscrtoscr().
  1117.    Here are the parameters of qvscrtoscr:
  1118.  
  1119.      qvscrtoscr( row, col, rows, cols, vrow, vcol, vwidth, vscrptr );
  1120.  
  1121.    Just like qstoretoscr(), row, col, rows, and cols describe the position
  1122.    and size on the screen (scr).  This screen is specified by qscr which is
  1123.    usually the CRT.  vscrptr points to the virtual screen (vscr).  Now, where
  1124.    is the same size block on vscr?  It's at vrow and vcol.  But the vscr may
  1125.    have a different column width than crt_cols.  So you specify that with
  1126.    vwidth.  Only the scr side checks for possible snow.  These functions are
  1127.    extremely fast, making virtual screens very practical.  See qscrtovscr()
  1128.    and qvscrtoscr() in QWIKREF.DOC for more examples.
  1129.  
  1130.    Multiple Virtual Screens - By changing qscr, you can even copy blocks from
  1131.    one virtual screen to another!  These routines do not affect qeosofs.
  1132.  
  1133.  
  1134.    VIDEO PAGES
  1135.  
  1136.    Multi-page Cards - Turbo C functions such as window and gotoxy, and C's
  1137.    printf are dedicated to just page 0, but many video cards have more than
  1138.    one page.  If you have a CGA or better, you already have memory on your
  1139.  
  1140.  
  1141.                                        19
  1142.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1143.  
  1144.  
  1145.    card for 4 to 8 pages.  Since the BIOS recognizes them as well, QWIKC
  1146.    gives you access to these extra pages.
  1147.  
  1148.    Page Control - qwritepage() and qviewpage() give you the power to use
  1149.    QWIKC on all video pages and display which ever you choose.  On a
  1150.    multiple-video page card like the CGA, you can simply code:
  1151.  
  1152.      qwritepage( mypage );
  1153.  
  1154.    to make all QWIKC routines be directed to your selected video page even
  1155.    though you could be viewing another page.  To view a page, you can in turn
  1156.    simply code:
  1157.  
  1158.      qviewpage( mypage );
  1159.  
  1160.    Tips About Pages - Here are some tips to keep in mind when using several
  1161.    video pages:
  1162.  
  1163.      . The highest valid video page is detected by qinit() and saved in
  1164.        the variable maxpage.
  1165.      . Invalid page parameters are just ignored.
  1166.      . The BIOS reserves a separate cursor location for each of up to 8
  1167.        video pages.
  1168.      . There is only one possible cursor mode, which is always displayed
  1169.        on the CRT.
  1170.      . The cursor location routines operate on the page being written
  1171.        rather than viewed.
  1172.      . The current video page viewed is in the variable videopage.
  1173.      . The current video page set by qwritepage() is saved in qvideo_page.
  1174.      . Be sure to end your programs with "qviewpage(0);".
  1175.  
  1176.  
  1177.    VIDEO MODES
  1178.  
  1179.    Changing Text Modes - Your application may require a change in video modes
  1180.    for different row or column modes.  If so, after the mode is changed, run
  1181.    qreinit() so the video variables will be correct.
  1182.  
  1183.    Text color - Be advised that a change of text modes with the textmode()
  1184.    function will also change your text color setting.  It is reset to normal,
  1185.    corresponding to a call to normvideo().
  1186.  
  1187.    Graphic Modes - If you need to alternate with a graphics mode, qreinit()
  1188.    does not need to be called provided you return back to the same text mode.
  1189.    Of course you may want to save the screen with qstoretomem() before
  1190.    switching to graphics.
  1191.  
  1192.    Changing Monitors - The technique to change monitors is to simply change
  1193.    the text mode.  This means qreinit() should be called.  Be sure to toggle
  1194.    the video mode bits in the equipment list byte at 0040h:0010h so other
  1195.    applications can behave properly.
  1196.  
  1197.    cursor_initial - When you call qinit() at the top of your program,
  1198.    cursor_initial saves what it detects for the current video mode.  When you
  1199.    call qrenit() after a text mode change, cursor_initial is also changed.
  1200.  
  1201.  
  1202.                                        20
  1203.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1204.  
  1205.  
  1206.    This may affect how you restore the cursor when terminating.  If needed,
  1207.    the value should be saved before using qreinit().
  1208.  
  1209.  
  1210.    MULTI-TASKING ENVIRONMENTS
  1211.  
  1212.    Multi-Tasking - QWIKC works very well with multi-tasking environments such
  1213.    as DESQview.  For examples on how to let QWIKC work in DESQview
  1214.    specifically, see a file called DESQC20.ARC (CIS: DSQC20.ARC) or a later
  1215.    version.
  1216.  
  1217.    setmultitask - A simple procedure has been included that generically
  1218.    detects the presence of DESQview, TopView, TaskView, OmniView, MS Windows
  1219.    or IBM 3270 PC multi-tasking video buffers (MTVB).  If they are being used,
  1220.    setmultitask will alter qscrptr, page0seg, and qsnow correctly.  This is a
  1221.    very simple task.  All of the *.C files included with the code show where
  1222.    the setmultitask declaration is to be placed early in the program.  If you
  1223.    are unsuccessful in getting it to work as you would expect, give us a call.
  1224.  
  1225.    inmultask - If setmultitask did indeed alter qscrptr for the MTVB, then
  1226.    inmultitask is set to 1.
  1227.  
  1228.    Multiple Video Pages - Be sure to instruct the multi-tasking environment
  1229.    of the number of video pages that are being used for your program.  Since
  1230.    some environments cannot correctly use multiple pages with the MTVB such as
  1231.    DESQview 2.01, it has been disabled in the demos with the use of
  1232.    inmultask.
  1233.  
  1234.    Cursor Routines and the BIOS - All cursor routines that change the mode and
  1235.    location use the BIOS.  This way multi-tasking environments can handle
  1236.    redirection properly.
  1237.  
  1238.  
  1239.    INTERRUPTS
  1240.  
  1241.    Within QWIKC - QWIKC only uses video interrupt 10h for qinit(), qreinit()
  1242.    and the cursor routines, so there no problem with DOS reentry.  Please read
  1243.    about "System Hardware" in Chapter 5 for more information on
  1244.    get_submodel_id() which uses INT 15h.
  1245.  
  1246.    Creating Handlers - If you use interrupt calls (like a clock display)
  1247.    within your program that use QWIKC routines, be sure to save and restore
  1248.    the value of qscr in the call so it won't return to the main program with
  1249.    unexpected results.  You should also be aware that main program may be
  1250.    writing to a virtual screen during the interrupt, so it is best that you
  1251.    initialize a copy of qscr solely for the interrupt.
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.                                        21
  1264.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1265.  
  1266.  
  1267.     5.  H A R D W A R E   D E T E C T I O N
  1268.  
  1269.  
  1270.    DISPLAY COMBINATION CODE
  1271.  
  1272.    qinit() function - qinit() initializes all the variables needed for the
  1273.    QWIKC functions, and specifically checks for ALL IBM video equipment
  1274.    including dual monitors.  qinit() MUST BE CALLED by your program before
  1275.    calling any QWIKC functions!  If you do not, you will get unexpected
  1276.    results.
  1277.  
  1278.    Display Combination Code (DCC) - The PS/2 video BIOS has a new function
  1279.    that simplifies equipment detection called the Read/Write Display
  1280.    Combination Code.  Using interrupt 10h with AH = 1A00h, the call will
  1281.    return the Active Display Device in BL and the Alternate Display Device in
  1282.    BH.  If the function is supported, it also returns 1Ah to AL.  For the
  1283.    possible Display Device codes which have been assigned by IBM, see
  1284.    QWIKREF.DOC.
  1285.  
  1286.    Conforming to DCC - No results are obtained for the DCC on anything other
  1287.    than PS/2 equipment.  However, to be consistent, qinit() was reprogrammed
  1288.    to conform to the DCC for ALL equipment.  To see if a CGA is in use, simply
  1289.    check to see if active_disp_dev=cga_color.  qinit() only sets the
  1290.    parameters for the active display.
  1291.  
  1292.    Dual Monitors - qinit() detects dual monitors and saves both the active and
  1293.    alternate display device codes.  The alternate display device code is for
  1294.    testing purposes only.  If you change monitors in a running program,
  1295.    qreinit() should be called.
  1296.  
  1297.    Testing for Dual Monitors - qinit() makes an attempt to detect for a second
  1298.    monitor by several means.  If no alternate cards like EGA or VGA are found,
  1299.    an alternate 6845 video chip (CGA, MDA, or Hercules) is checked.  If the
  1300.    chip is found, then further tests are made to find which card it could be.
  1301.    The chip existence test is highly reliable.  If no alternate display device
  1302.    is found, then alt_disp_dev=no_display.
  1303.  
  1304.    have_ps2 - qinit() sets have_ps2 to 1 if the DCC is supported.  This means
  1305.    that the program has detected a PS/2 video card whether it is integrated in
  1306.    a Model 30, a PS/2 Display Adapter installed on an IBM XT, or the like.  It
  1307.    also means that either MCGA or VGA is present, but not necessarily active.
  1308.    To know which, just check the DCC.
  1309.  
  1310.    have_3270 - If qinit() detects 3270 PC equipment/software, this variable is
  1311.    set to true.  In addition, the active_disp_dev is either mda_mono or
  1312.    cga_color.  Note: There may or may not be graphics capability in either
  1313.    case; qinit() is not meant to detect graphics.  If have_3270 is 1, then
  1314.    active_disp_dev_3270 will be set to the proper code.  On the 3270 PC, dual
  1315.    monitors are not possible as they use the same physical buffer space.  In
  1316.    addition, even though a color monitor may be used, there is only one video
  1317.    page unless there is a special adapter.  However, qinit() will determine if
  1318.    more than just one page is available.  The 3270 PC also does not support 40
  1319.    column modes.
  1320.  
  1321.    EGA Switches - By checking the value of this byte, you can determine the
  1322.  
  1323.  
  1324.                                        22
  1325.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1326.  
  1327.  
  1328.    monitor connected to the EGA, the alternate video system, and the start up
  1329.    default.  The byte is a copy of how the dip switches are set on the card
  1330.    where on=0 and off=1.  The primary is the default.  When the ECD is set for
  1331.    640x200, it is emulating the CD including the cursor mode.  qinit()
  1332.    directly tests for the alternate device rather than assuming it.
  1333.  
  1334.    EGA Information - The byte located at 0040h:0087h has hardware status
  1335.    information when the EGA (or VGA) is present.
  1336.  
  1337.    PC Convertible (PCC) - Since the PCC also does not support the DCC, a
  1338.    separate code is used.  If the 5140 LCD is used in mode 7, the Active
  1339.    Display Device is set to mda_mono which is close enough.  This set up can
  1340.    be verified by testing if maxpage=3.  The alternate display is found by
  1341.    using interrupt 10h with AH=15h.  The result is saved in alt_disp_dev_pcc.
  1342.    Of course the variable is undefined if a PCC is not used.
  1343.  
  1344.    Hercules - Hercules cards are also detected.  If either the active or
  1345.    alternate DCC is mda_mono, which is found by verifying a responsive 6845
  1346.    video chip at the mono register port, then an attempt is made to find if
  1347.    any Hercules card is attached.  If no Hercules card is found, then
  1348.    herc_model is no_herc; it is then assumed that just an MDA card is
  1349.    attached.  Because the test can take up to 1/3 of a second on slower
  1350.    computers, this test is only run once, even if you call qreinit().  The
  1351.    tests for the Hercules cards are the ones recommended by Hercules Computer
  1352.    Technology, which also admits that sometimes the tests will fail during
  1353.    multi-tasking activity. Hercules clones may not be detected by these tests,
  1354.    but the DCC will be correct.
  1355.  
  1356.  
  1357.    SNOW CHECKING
  1358.  
  1359.    CGA Snow - QWIKC is conservative with CGA cards and uses snow checking when
  1360.    the card is detected.  However, it is not needed in 40 column modes 0 and
  1361.    1.  qinit() was programmed to accommodate this.  For other hardware, you
  1362.    can change qsnow to suit your needs, but cardsnow should be left unchanged
  1363.    to save what qinit() detected.
  1364.  
  1365.    Zenith CGA - Zenith CGAs do not need wait-for-retrace.  If you would like
  1366.    to accommodate this, you can execute the following function after calling
  1367.    qinit() and after each qreinit():
  1368.  
  1369. void check_zenith(void)
  1370. {
  1371.     char tmp[10];
  1372.  
  1373.     movedata( 0xF000u, 0x800Cu, (unsigned)(((char far *)tmp)+1),
  1374.                                 (unsigned)((char far *)tmp),     8 );
  1375.     if(qsnow && (strncmp( tmp, "ZDS CORP", 8 )) == 0) {
  1376.         qsnow=0;
  1377.         cardsnow=0;
  1378.     }
  1379. }
  1380.  
  1381.    Critical Timing - The timing on the IBM PC (Intel 8088 at 4.77MHz) with a
  1382.    CGA is critical for storing characters and attributes with 16-bit transfers
  1383.  
  1384.  
  1385.                                        23
  1386.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1387.  
  1388.  
  1389.    because of the CPU architecture and slow speed.  Although previous versions
  1390.    kept the timing as tight as possible, there still remained a hint of snow
  1391.    in column 1.  This is due to the problem that RAM runs a little slower than
  1392.    BIOS ROM.  This problem has now been solved with a minor code change.  So
  1393.    the routines still run at the same speed, but there is absolutely no snow!
  1394.    I am not aware of any other routines that have done this as closely.
  1395.    (Computers with slower access RAM chips may still show up some variations
  1396.    from time to time.  Feedback is requested.)
  1397.  
  1398.  
  1399.    SYSTEM HARDWARE
  1400.  
  1401.    System ID - The basic computer system identification (or model) for IBM
  1402.    computers can be found by directly accessing the byte in memory at
  1403.    F000h:FFFEh.
  1404.  
  1405.    SubModel ID - After production of the AT, models were also given Submodel
  1406.    IDs.  To get both the model and submodel ID, you must use interrupt 15h
  1407.    with AH=C0h which only works on some computers.  A few PC and XT clones
  1408.    like the AT&T 6300 will actually crash when this interrupt is executed due
  1409.    to BIOS bugs.  So to prevent this from happening, the function only lets
  1410.    system IDs of FCh or less get the submodel_id.  In addition, it is a
  1411.    separate function called get_submodel_id() and is not a part of qinit().
  1412.    So you will have to execute it yourself to get a result.  The routine is
  1413.    entirely optional and is not required by QWIKC.
  1414.  
  1415.    CPU Identification - A CPU detection routine has been included for Intel
  1416.    processors.  It is useful for clones that do not recognize IBM's system ID
  1417.    scheme.  The idea came from Juan Jimenez as it appeared in Jan/Feb '88
  1418.    Turbo Technix magazine.  The routine has been simplified for reduced code
  1419.    (only 42 bytes) and enables use of simple macros.  This routine is required
  1420.    for qscrollup/down().
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.                                        24
  1447.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1448.  
  1449.  
  1450.    A P P E N D I X   A :   V I D E O   M O D E   T A B L E
  1451.  
  1452.  
  1453.    Video Modes - To help you figure out how all the IBM video systems are
  1454.    configured, it is helpful to have a table of all the possible Alphanumeric
  1455.    (A/N or text) modes.  QWIKC was not designed for the All Points Addressable
  1456.    (APA or graphics) modes.
  1457.  
  1458.              TABLE 1: Hardware Specific Video Mode Characteristics
  1459. -------------------------------------------------------------------------------
  1460. Mode Format Segment Display Box  MDA CGA EGA MCGA VGA PCjr PCC 3270 HGC maxpage
  1461. ---- ------ ------- ------- ---- --- --- --- ---- --- ---- --- ---- --- -------
  1462. 0,1  40x25  B800:0  320x200 8x8       x   x   x    x   x    x              7
  1463.                     320x350 8x14          x        x                       7
  1464.                     320x400 8x16              x                            7
  1465.                     360x400 9x16                   x                       7
  1466. 2,3  80x25  B800:0  640x200 8x8       x                x    x              3
  1467.                     640x200 8x8           x        x                       7 *
  1468.                     640x350 8x14          x        x                       7 *
  1469.                     640x400 8x16              x                            7
  1470.                     720x350 9x14                                x          0+
  1471.                     720x400 9x16                   x                       7
  1472. 7    80x25  B000:0  720x350 9x14  x                         x   x    x     0
  1473.                     720x350 9x14          x        x                       7 *
  1474.                     720x400 9x16                   x                       7
  1475.                     640x200 8x8                             x              3
  1476. -------------------------------------------------------------------------------
  1477.  
  1478.      Legend:
  1479.      Format  - Characters per row by the number of rows in the data area.
  1480.      Segment - Address of the first character on page 0 of the display
  1481.                buffer.
  1482.      Display - The pixel resolution for the data area excluding the
  1483.                border, horizontal by vertical.
  1484.      Box     - The pixel resolution for each character, horizontal by
  1485.                vertical.
  1486.      MDA     - Monochrome Display and Printer Adapter
  1487.      CGA     - Color Graphics Adapter
  1488.      EGA     - Enhanced Graphics Adapter
  1489.      PGC     - Professional Graphics Controller
  1490.      MCGA    - Multi-Color Graphics Array
  1491.      VGA     - Video Graphics Array
  1492.      PCjr    - PC Junior
  1493.      PCC     - PC Convertible
  1494.      HGC     - Hercules Graphics Cards - HGC, HGC Plus, and InColor Card
  1495.      3270    - All IBM 3270 PC adapters
  1496.      maxpage - 0-based highest page number; e.g. 7 means there are 8
  1497.                pages.
  1498.      MD      - 5151 Monochrome Display
  1499.      CD      - 5153 Color Display
  1500.      ECD     - 5154 Enhanced Color Display
  1501.  
  1502.      Notes:
  1503.      1. The 0 and 2 modes suppress color burst only on composite displays
  1504.         (not RGB) only for CGA and EGA.
  1505.  
  1506.  
  1507.                                        25
  1508.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1509.  
  1510.  
  1511.      2. The PS/2 model 25 and 30 have an integrated MCGA.  The model
  1512.         30/286, model 50 and above have an integrated VGA.
  1513.      3. The 8514 High Content Color Display along with the 8514/A adapter
  1514.         produces a superset of the VGA for APA, but there are no
  1515.         differences in the A/N modes to the VGA when the adapter is in
  1516.         "VGA" mode.  See IBM documentation for Advanced Function Mode.
  1517.      4. maxpage is reduced to 3 if EGA only has 64K graphics memory
  1518.         installed for modes marked "*".  maxpage of 7 is for 128K or more.
  1519.      5. The PCC can have either an alternate MDA or CGA.  The LCD (model
  1520.         5140) can emulate either the MDA or CGA modes, but the MDA mode is
  1521.         640x200.
  1522.      6. No information is provided on the PGC.
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.                                        26
  1569.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1570.  
  1571.  
  1572.    A P P E N D I X   B :   C U R S O R   M O D E   D A T A
  1573.  
  1574.    Each video card differs in character cell size and cursor emulation in
  1575.    different video modes.  The following data will show you the specific
  1576.    differences between modes and cards, and how QWIKC handles them.
  1577.  
  1578.  
  1579.    CURSOR MODE TABLES
  1580.  
  1581.    Cursor Mode Word - The cursor mode is saved in low memory at 0040h:0060h
  1582.    after each mode change.  Using hex is the easiest way to analyze the word.
  1583.    The shape of the cursor is defined by horizontal scan lines in the
  1584.    character cell where the top row of any cell is 0.
  1585.  
  1586.                           TABLE 2: Cursor Mode Word
  1587.               -------------------------------------------------
  1588.                       Hi byte                  Lo byte
  1589.               -----------------------   -----------------------
  1590.      Bit #:   15 14 13 12 11 10 09 08   07 06 05 04 03 02 01 00
  1591.      Bit #:   07 06 05 04 03 02 01 00   07 06 05 04 03 02 01 00
  1592.      Symbol:      $  $  *  *  *  *  *       @  @  +  +  +  +  +
  1593.  
  1594.      Key:     $ - controls cursor on/off and erratic blinking
  1595.               * - controls top scan line (0-based)
  1596.               @ - controls skew to the right
  1597.               + - controls bottom scan line (0-based)
  1598.  
  1599.  
  1600.    Skew - Bits 5 and 6 control the skew or shift to the right of the cursor on
  1601.    EGA/VGA cards.  Consistent results between video cards are not possible so
  1602.    it is best to leave these bits at zero.
  1603.  
  1604.    Cell Sizes - Because of different cells sized with different video cards,
  1605.    the top and bottom scan lines are also different for each card.  See TABLE
  1606.    1 in Appendix A for specific cell sizes.
  1607.  
  1608.                     TABLE 2: Cursor Mode Defaults
  1609.      ----------------------------------------------------------
  1610.      Adapter   Default  Comments
  1611.      --------  -------  ---------------------------------------
  1612.      MDA       0B0Ch
  1613.      CGA,MCGA  0607h
  1614.      EGA       0B0Ch    MD, ECD (640x350 25-line) Emulation off
  1615.      EGA       0607h    CD, ECD (640x200)
  1616.      VGA       0D0Eh    Emulation off
  1617.      3270 PC   0D0Dh    And converts MDA and CGA
  1618.  
  1619.  
  1620.    CURSOR EMULATION
  1621.  
  1622.    Cursor Emulation - qinit() sets the four standard cursor mode variables at
  1623.    startup to be either MDA or CGA defaults.  Almost all emulation modes can
  1624.    be handled by either of these two cell sizes.  qinit() handles certain
  1625.    exceptions.  If you want to handle your own exceptions, the following notes
  1626.    will help you.
  1627.  
  1628.  
  1629.                                        27
  1630.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1631.  
  1632.  
  1633.  
  1634.    cursor_blink - This mode is hardware specific.  It works on MDA and CGA
  1635.    while it turns the cursor off on EGA and VGA.
  1636.  
  1637.    MCGA/VGA Cursor Mode - On these two cards, you can both read and write the
  1638.    cursor mode direct from the CRTC.  To be compatible with all video cards,
  1639.    QWIKC does not attempt to do this, but instead depends on the Video Display
  1640.    Data Area at 0040h:0060h.  qinit() turns on the cursor emulation mode if
  1641.    PS/2 video equipment is detected.
  1642.  
  1643.    EGA Cursor Emulation - In 25-line mode on the EGA, cursor emulation works
  1644.    fairly well.  In other line modes, the emulation falters.  So qinit()
  1645.    forces emulation to be turned on in 25-line mode and off in other modes.
  1646.    On the EGA, emulation is turned off by setting bit 0 of egainfo to 1.  The
  1647.    standard QWIKC cursor modes are still set appropriately.
  1648.  
  1649.    MCGA Cursor Emulation - Use the CGA cursor cell size even though the
  1650.    character cell is 8x16.  The BIOS multiplies the start and end rows by 2
  1651.    and then adds one to the end row before writing to the hardware video port
  1652.    to emulate the CGA.
  1653.  
  1654.    VGA Cursor Emulation - qinit() turns the cursor emulation mode on so you
  1655.    don't have to worry about special fonts and cell sizes as it emulates the
  1656.    MDA and CGA.  The video BIOS will adjust your cursor shape to fit in the
  1657.    current cell size.  For the algorithms specific to the VGA, refer to the
  1658.    "IBM Personal System/2 and Personal Computer BIOS Interface Technical
  1659.    Reference Manual".
  1660.  
  1661.    3270 PC Peculiarities - The 3270 PC cursor types are limited to only three.
  1662.    In addition, the underline cursor is not visible on a white background on
  1663.    the 5272 color display and it is advisable to use a block cursor together
  1664.    with that attribute.  Notice that half-block cursors are converted to full
  1665.    block:
  1666.  
  1667.                      TABLE 3: 3270 PC Cursor Modes
  1668.      --------------------------------------------------------------
  1669.      Cursor Type   Comments
  1670.      ------------  ------------------------------------------------
  1671.      Underline     0D0Dh only.  CGA and MDA are emulated.
  1672.      Hidden (off)  cursor start > cursor end.  2000h is preferred.
  1673.      Block         anything other than the above
  1674.  
  1675.  
  1676.    Start Up Cursor Modes - Once QWIKC determines the cell size and the cursor
  1677.    emulation mode, the four standard cursor modes, cursor_initial,
  1678.    cursor_underline, cursor_halfblock and cursor_block are calculated:
  1679.  
  1680.        cursor_initial - This is the cursor mode detected at startup.  An
  1681.        improper default for MDA is automatically overridden to an
  1682.        underline.  Some early PCs have a BIOS bug that sets the MDA
  1683.        default incorrectly.
  1684.  
  1685.        cursor_underline - The lower scan line is set to: (bottom of
  1686.        cell-1).  The upper scan line is set to: (lower scan-1).
  1687.  
  1688.  
  1689.  
  1690.                                        28
  1691.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1692.  
  1693.  
  1694.        cursor_half_block - The top scan line is set to: (bottom of
  1695.        cell+1)/2.  This may appear a little fat for EGAs in 25-line mode,
  1696.        but is just right for all other cards and modes.
  1697.  
  1698.        cursor_block - Produces a block cursor by setting the top scan line
  1699.        to zero of cursor_underline.
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.                                        29
  1752.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1753.  
  1754.  
  1755.    A P P E N D I X   C :   P E R F O R M A N C E
  1756.  
  1757.  
  1758.    CODE SIZE
  1759.  
  1760.    If you use a QWIKC function, only the corresponding object file containing
  1761.    that function will be linked, thus optimizing the code.  Even if all func-
  1762.    tions are used, QWIKC is still quite small at a total of approx. 2681
  1763.    bytes.  Here's the linked code size for the small model (size varies
  1764.    slightly between models):
  1765.  
  1766.      FILE NAME    BYTES  FUNCTIONS
  1767.      ------------ -----  -------------------------------------------------
  1768.      qinit   .obj  608   qinit, qreinit
  1769.      qwrites .obj  282   qwrite, qwritec, qwriteeos
  1770.      qfills  .obj  451   qfill, qattr, qfillc, qattrc, qfilleos, qattreos
  1771.      qstores .obj  321   qstoretoscr, qstoretomem, qscrtovscr, qvscrtoscr
  1772.      qreads  .obj  131   qreadstr, qreadchar, qreadattr
  1773.      qscrolls.obj  271   qscrollup, qscrolldown
  1774.      qpages  .obj   59   qwritepage, qviewpage
  1775.      cursor  .obj   92   gotorc, wherer/c, setcursor, getcursor, modcursor
  1776.      eos     .obj  124   gotoeos, eosr/c, eostorc/rel, eostocursor, eosln
  1777.      qeosln  .obj   38   qeosln
  1778.      cpuident.obj   42   getcpuid
  1779.      getsubid.obj   27   get_submodel_id
  1780.      setmulti.obj   29   setmultitask
  1781.      qwrsub  .obj  206   qwrite_sub, qwriteeos_sub
  1782.  
  1783.    SPEED
  1784.  
  1785.    How fast is fast?  To have a basis for comparison, a unit of
  1786.    "screens/second" is used to get a feeling for speed.  To make one screen, a
  1787.    function is repeated with a FOR loop to fill several 80x25 pages and timed.
  1788.    The qwrite*() functions use 80 character strings, and qattr() and qfill()
  1789.    use 25 rows and 80 cols.  Here are some samples from the systems that have
  1790.    been tested.  16-bit video cards such as the one in the Compaq 386/20 will
  1791.    be much faster than 8-bit cards.
  1792.  
  1793.      --------------------- S C R E E N S / S E C O N D ---------------------
  1794.                 Chng  XT(4.77 MHz)  M30    M50    M70    ATT+  Compaq
  1795.      Function   Attr  MDA     CGA   MCGA   VGA    VGA    CGA   386/20
  1796.      ---------  ----  ------------  -----  -----  -----  ----  ------
  1797.      qwrite-     Yes   29.1   9.5    64.4   83.7  103.7  16.8   383.1
  1798.                  No    34.1   9.6    77.4  128.5  157.7  16.8   403.8
  1799.      qfill-      Yes  100.5  12.0   164.5  146.7  151.4  21.5   585.3
  1800.  
  1801.                  No    78.2   7.5   143.9  230.9  256.7  13.9   587.5
  1802.      qattr-      Yes   78.2   7.5   143.9  230.9  256.7  14.0   576.0
  1803.      qstore-     n/a   67.0   7.3   124.4  137.0  140.2  13.8   355.3
  1804.      qscroll-    n/a   55.6   3.8    90.3   76.5   77.7  16.8   322.1
  1805.  
  1806.    Be sure to test QBENCH.C for virtual screens and find another significant
  1807.    increase in speed.  All routines will be at least 100 Scr/Sec, and 500
  1808.    Scr/Sec is typical.
  1809.  
  1810.  
  1811.  
  1812.                                        30
  1813.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1814.  
  1815.  
  1816.    For those interested in comparisons, QWIKC's qwrite function is much faster
  1817.    than TC2 direct video writing routines by the following percentage:
  1818.  
  1819.      Function   CGA cards  All other cards
  1820.      ---------  ---------  ----------------
  1821.      cprintf     225%       900% to 2300%
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.                                        31
  1874.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1875.  
  1876.  
  1877.    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
  1878.  
  1879.  
  1880.    Eagle Performance Software has developed identical products for both Turbo
  1881.    C and Turbo Pascal.  Our pledge is to provide you quality products with
  1882.    unparalleled performance and ease of use.
  1883.  
  1884.  
  1885.    QWIK
  1886.  
  1887.    QWIK - For direct screen video, QWIK is the highest performance screen
  1888.    writing tool available today for all text modes in any video configuration.
  1889.    QWIK provides capabilities far beyond those in the unit/library that comes
  1890.    with your compiler.
  1891.  
  1892.    Here are the product versions:
  1893.  
  1894.       File name     CIS filename  Compiler  Release date
  1895.       ------------  ------------  --------  ------------
  1896.       QWIK42B.ARC   QWIK42.ARC    TP4/5      10-01-88
  1897.       QWIK5XA.ARC   QWIK5X.ARC    TP5        01-03-89
  1898.       QWIKC21.ARC   QWKC21.ARC    TC2/MSC    06-01-89
  1899.  
  1900.  
  1901.    WNDW
  1902.  
  1903.    WNDW - For multi-level virtual windows, WNDW is the highest performance
  1904.    window utilities package available today.  It offers very powerful
  1905.    utilities for full window control and management you probably never thought
  1906.    possible.   They are simple and yet very powerful with high speed and tight
  1907.    code.  With WNDW, you can choose the absolute writing routines of QWIK, the
  1908.    window- relative writing routines of WNDW, and even customize your own.
  1909.    Here are some of the features you will discover:
  1910.  
  1911.    . Uses the powerful direct screen writing routines of QWIK.
  1912.    . Up to 254 fixed or virtual windows can be on the screen at one time.
  1913.    . Extremely high-speed virtual screens in RAM (up to 40 times faster).
  1914.    . Virtual windows are fully updated on screen, even if covered!
  1915.    . Virtual windows have virtual titles.
  1916.    . Fully supported hidden windows saved in RAM.
  1917.    . Fully supports all video pages.
  1918.    . Adjustable-rate moving, resizing, and scrolling.
  1919.    . All windows can be randomly accessed, not just stacked or tiled.
  1920.    . 28 window-relative writing routines.
  1921.    . 15 different border styles with shadow and zoom effects.
  1922.    . Full line drawing procedures.
  1923.    . Full cursor mode control for each window.
  1924.    . Writes in all text modes and column modes.
  1925.    . Only 13k bytes of code if all 69 utilities are used.
  1926.    . Used in all other Eagle products.
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.                                        32
  1935.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1936.  
  1937.  
  1938.    Here are the product versions:
  1939.  
  1940.       File name    CIS filename  Compiler  Release date
  1941.       -----------  ------------  --------  ------------
  1942.       WNDW42.ARC   WNDW42.ARC    TP4/5      10-15-88
  1943.       WNDW5XB.ARC  WNDW5X.ARC    TP5        01-15-88
  1944.       WNDWC21.ARC  WNDC21.ARC    TC2/MSC    TBA
  1945.  
  1946.  
  1947.    PULL
  1948.  
  1949.    PULL - For multi-level pull-down menus, PULL is fully featured and fully
  1950.    configurable.  Includes execute, single, and multiple choice menus,
  1951.    unlimited nested submenus, data entry windows, help windows, directory
  1952.    windows, message system, and fully completed interfaces.  Some of the
  1953.    features are:
  1954.  
  1955.      . Uses QWIK and WNDW.
  1956.      . Work window(s) and complete interface for menus
  1957.      . Pull-down menus with 5 menu modes and 7 line modes
  1958.      . Pull-down file directory
  1959.      . Highlighted command letters
  1960.      . Unlimited levels of submenus
  1961.      . Unlimited data entry windows for 9 types of data
  1962.      . Data entry for the work window(s)
  1963.         Full editing capability including insert cursor mode
  1964.         Full field selection with cursor keys
  1965.         Automatic NumLock for numerical data entry
  1966.         Right or left justification for data entry output
  1967.         Error messages for invalid data entries
  1968.         Error messages for data entries out of range
  1969.      . Automatic sizes and locations for menus.
  1970.      . Operation by cursor keys or command keys
  1971.      . Pull/Pop between work window and nested submenu(s)
  1972.      . Programmable control of pull and pop sequences
  1973.      . Context-sensitive help
  1974.      . Message lines for prompts and processing
  1975.      . Full working shell for user development
  1976.  
  1977.    Here are the product versions:
  1978.  
  1979.       File name    CIS filename  Compiler  Release date
  1980.       -----------  ------------  --------  ------------
  1981.       PULL42.ARC   PULL42.ARC    TP4/5      12-06-88
  1982.       PULL5XB.ARC  PULL5X.ARC    TP5        02-15-89
  1983.       PULLC21.ARC  PULC21.ARC    TC2        TBA
  1984.  
  1985.  
  1986.    ON-LINE SOURCE
  1987.  
  1988.    CompuServe - All updated files and later versions can be found on
  1989.    the CompuServe Borland Forums (GO BPROGA for TP and GO BPROGB for
  1990.    TC) or the IBM Programming Forum (GO IBMPRO).
  1991.  
  1992.  
  1993.  
  1994.  
  1995.                                        33
  1996.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  1997.  
  1998.  
  1999.    A P P E N D I X   E :  R E V I S I O N   H I S T O R Y
  2000.  
  2001.  
  2002.    Version 2.0a (01-02-89):
  2003.      Fixed an oversight which caused videomode, videopage and
  2004.        crtcolumns to be inaccessible in all models except compact and
  2005.        huge.  This occurred because they were not declared as PUBLIC
  2006.        in the QINIT modules.
  2007.  
  2008.    Version 2.0b (02-03-89):
  2009.      Row and Column sizes greater than 127 were not supported unless
  2010.        default char type was set to unsigned.  All row/col parameters
  2011.        and variables are now specified as "unsigned char".
  2012.  
  2013.    Version 2.0c (03-06-89):
  2014.      Remedied qreadattr/char bug which trashed a function's local
  2015.        variables, due to the BP register not being restored correctly.
  2016.      Sped up qvscrtoscr and qstoretoscr by eliminating snow check.
  2017.        A wait-for-retrace was always done in these functions (for the
  2018.        Medium and Compact models only), due to an incorrect
  2019.        addressing method on the qsnow variable.
  2020.      Add setmultitask function to set variables for multitasking
  2021.        video buffers (MTVB).
  2022.      Forced null strings written to virtual buffers to leave qeosofs
  2023.        unchanged.
  2024.  
  2025.    Version 2.0d (03-22-89):
  2026.      Fixed another bug in qreadattr/char which popped SI/DI in the
  2027.        wrong order, thus losing local variables if optimization was
  2028.        turned on.
  2029.      Incorporated SETMULTI.C into the makefiles.
  2030.      Added macros for pointer variables to QWIKSCR.INC and changed
  2031.        QINIT.ASM so as to treat them as macros rather than
  2032.        variables.
  2033.  
  2034. |  Version 2.1 (06-01-89):
  2035. |    Converted to MicroSoft C / QuickC.  SUSPEND routine added,
  2036. |    courtesy of Borland International.  All programs now compile
  2037. |    under TC, MSC, or QC.
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.  
  2055.  
  2056.                                        34
  2057.    QWIKC Screen Utilities                           User's Guide, Version 2.1
  2058.  
  2059.  
  2060.    A P P E N D I X   F :   R E F E R E N C E S
  2061.  
  2062.  
  2063.    REFERENCES
  2064.  
  2065.    PS/2 Systems - For more information on the new IBM PS/2 system, you can get
  2066.    the "Personal System/2 and Personal Computer BIOS Interface Technical
  2067.    Reference" manual.  Other references include:
  2068.  
  2069.  
  2070.      IBM Personal System/2 Seminar Proceedings:
  2071.        Volume 5, Number 2, Displays and Adapters, publication
  2072.          # G360-2678.
  2073.        Volume 5, Number 4, Models 50, 60, 80, VGA, BIOS and
  2074.          Programming Considerations, publication # G360-2747.
  2075.  
  2076.    3270 PC - For more information on the IBM 3270 PC, you can get the
  2077.    following publications:
  2078.  
  2079.      "3270 PC Application Development Considerations"
  2080.      "IBM 3270 Personal Computer Programming Guide", Pub # SA23-0221
  2081.      "IBM 3270 Personal Computer Control Program Reference", Pub # GA23-0232
  2082.  
  2083.    As always, the above information is subject to change without notice per
  2084.    IBM.
  2085.  
  2086.    Video Guide - An excellent guide for IBM and Hercules video card
  2087.    programming in text and graphics is:
  2088.  
  2089.      "Programmer's Guide to PC & PS/2 Video Systems" by Richard Wilton
  2090.    and published by Microsoft Press
  2091.  
  2092.    Trademarks - IBM is the trademark for International Business
  2093.    Machines Corp.  Turbo C and Turbo Pascal are trademarks of Borland
  2094.    International.  The SUSPEND routine called in the demonstration and
  2095.    example programs is used by permission of Borland International.
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.                                        35
  2118.