home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
msdos
/
turbopas
/
qwik41a.arc
/
QINIT.DOC
< prev
next >
Wrap
Text File
|
1988-05-01
|
17KB
|
321 lines
{ Qinit.doc - documentation for QWIK Qinit ver 4.1, 05-01-88 }
{ }
{ Qinit initializes all the variables needed for the Q- procedures. And }
{ specifically checks for ALL IBM video equipment including dual monitors. }
This file will help you figure out how the new IBM PS/2 systems are config-
ured as well as original equipment. First, it is helpful to have a list of
all the possible Alphanumeric (A/N or text) modes. QWIK was not designed
for the All Points Addressable (APA or graphics) modes. Qinit detects dual
monitors and saves both the active and alternate display device codes.
TABLE 1: Hardware Specific Video Mode Characteristics
Mode Format Segment Display Box MDA CGA EGA MCGA VGA PCjr PCC 3270 HGC MaxPage
---- ------ ------- ------- ---- --- --- --- ---- --- ---- --- ---- --- -------
0,1 40x25 B800:0 320x200 8x8 x x x x x x 7
320x350 8x14 x x 7
320x400 8x16 x 7
360x400 9x16 x 7
2,3 80x25 B800:0 640x200 8x8 x x x 3
640x200 8x8 x x 7 *
640x350 8x14 x x 7 *
640x400 8x16 x 7
720x350 9x14 x 0+
720x400 9x16 x 7
7 80x25 B000:0 720x350 9x14 x x x x 0
720x350 9x14 x x 7 *
720x400 9x16 x 7
640x200 8x8 x 3
Legend:
Format - Characters per row by the number of rows in the data area.
Segment - Address of the first character on page 0 of the display buffer.
Display - The pixel resolution for the data area excluding the border,
horizontal by vertical.
Box - The pixel resolution for each character, horizontal by vertical.
MDA - Monochrome Display and Printer Adapter
CGA - Color Graphics Adapter
EGA - Enhanced Graphics Adapter
PGC - Professional Graphics Controller
MCGA - Multi-Color Graphics Array
VGA - Video Graphics Array
PCjr - PC Junior
PCC - PC Convertible
HGC - Hercules Graphics Cards - HGC, HGC Plus, and InColor Card
3270 - All IBM 3270 PC adapters
MaxPage - 0-based highest page number; e.g. 7 means there are 8 pages.
MD - 5151 Monochrome Display
CD - 5153 Color Display
ECD - 5154 Enhanced Color Display
Notes:
1. The 0 and 2 modes suppress color burst only on composite displays (not
RGB) only for CGA and EGA.
2. The PS/2 model 25 and 30 have an integrated MCGA. The model 50 and
above have an integrated VGA.
3. The 8514 High Content Color Display along with the 8514/A adapter
produces a superset of the VGA for APA, but there is no differences in
the A/N modes to the VGA when the adapter is in "VGA" mode. See IBM
documentation for Advanced Function Mode.
4. Reduced MaxPage to 3 if EGA only has 64K graphics memory installed for
modes marked "*". MaxPage of 7 is for 128K or more.
5. The PCC can have either an alternate MDA or CGA. The LCD (model 5140)
can emulate either the MDA or CGA modes, but the MDA mode is 640x200.
6. I currently have no information on the PGC.
7. To relieve cursor routine programming due to the multiple character box
sizes, the VGA has a cursor emulation mode. Qinit turns on the mode
if PS/2 equipment is detected. See CURSOR.DOC for emulation notes.
8. On the 3270 PC, dual monitors are not possible as they use the same
physical buffer space. Qinit will determine if more than just page 0
is available for color displays. Unless there is a special adapter,
there is only page 0.
Display Combination Code (DCC) - The PS/2 video BIOS has a new function
that simplifies equipment detection called the Read/Write Display
Combination Code. Using interrupt $10 with AH = $1A00, the call will
return the Active Display Device in BL and the Alternate Display Device in
BH. If the function is supported, it also returns $1A to AL. The possible
Display Device codes (as assigned by IBM) are:
TABLE 2: Display Combination Code
CODE DESCRIPTION QWIK41 Constant
---- -------------------------------- ---------------
$00 No display NoDisplay
$01 MDA with 5151 monochrome display MdaMono
$02 CGA with 5153/4 color display CgaColor
$03 reserved DCC3
$04 EGA with 5153/4 color EgaColor
$05 EGA with 5151 monochrome EgaMono
$06 PGC with 5175 color PgcColor
$07 VGA with analog monochrome VgaMono
$08 VGA with analog color VgaColor
$09 to $0A - reserved DCC9,DCC10
$0B MCGA with analog monochrome McgaMono
$0C MCGA with analog color McgaColor
$0D to $FE - reserved n/a
$FF unknown Unknown
Conforming to DCC - No results are obtained for the DCC on anything other
than PS/2 equipment. However, to be consistent, Qinit was reprogrammed
to conform to the DCC for ALL equipment. To see if a CGA is in use,
simply check to see if ActiveDispDev=CgaColor. Qinit only sets the
parameters for the active display. Although the alternate display device
code is saved, it is only for testing purposes. If you change text modes
in a running program, Qinit should be executed again.
HavePS2 - Qinit sets HavePS2 to true if the DCC is supported. This means
| that the program has detected a PS/2 video card whether it is a standard
Model 30, a PS/2 Display Adapter on an IBM XT, or the like. It also
means that either MCGA or VGA is present, but not necessarily active. To
know which, just check the DCC.
Have3270 - If Qinit detects 3270 PC equipment/software, this variable is
set to true. In addition, the ActiveDispDev is either MdaMono or
CgaColor. Note: There may or may not be graphics capability in either
case; Qinit is not meant to detect graphics. ActiveDispDev3270 may be
one of the following:
TABLE 3: 3270 PC Display Combination Code
CODE MONITOR ADAPTER QWIK41 Constant
---- -------------- ------------------------- ---------------
$00 5151 or 5272 for 5151 or 5272
$01 3295 for 3295
$02 5151 or 5272 for 5151 or 5272 plus
XGA graphics
$03 5279 3270 PC G
$04 5379 C01 3270 PC GX
$05 5379 M01 3270 PC GX
$06 Reserved
$07 Reserved
$FF Unknown, not a 3270 PC Unknown
EGA Switches - By checking the value of this byte, you can determine the
monitor connected to the EGA, the alternate video system, and the start
up default. The byte is a copy of how the dip switches are set on the
card where on=0 and off=1. The primary is the default. When the ECD is
| set for 640x200, it is emulating the CD including the cursor mode. Qinit
| now directly tests for the alternate device rather than assuming it.
TABLE 4: EGA dip switch configuration
SWITCH VALUE PRIMARY SECONDARY
------ ----- -------------------- -------------------
0000 0 MDA + MD EGA + CD - 40x25
0001 1 MDA + MD EGA + CD - 80x25
0010 2 MDA + MD EGA + ECD (640x200)
0011 3 MDA + MD EGA + ECD (640x350)
0100 4 CGA + CD - 40x25 EGA + MD
0101 5 CGA + CD - 80x25 EGA + MD
0110 6 EGA + CD - 40x25 MDA + MD
0111 7 EGA + CD - 80x25 MDA + MD
1000 8 EGA + ECD (640x200) MDA + MD
1001 9 EGA + ECD (640x350) MDA + MD
1010 10 EGA + MD CGA + CD - 40x25
1011 11 EGA + MD CGA + CD - 80x25
EGA Information - The byte located at $0040:$0087 has the following
information when the EGA (or VGA) is present:
TABLE 5: EGA information
BITS DESCRIPTION
---- -------------------------------------------------
7 (0) Clear, (1) Keep video data after mode set
6,5 (00) 64k, (01) 128k, (10) 192k, (11) 256k, memory
4 Reserved
3 (0) EGA active, (1) EGA not active
2 (0) Disable, (1) Enable wait-for-display
1 (0) CD/ECD, (1) MD attached
0 (0) Active, (1) Inactive CD emulation
PCC Exceptions - Since the PCC also does not support the DCC, a separate
code is used. If the 5140 LCD is used in mode 7, the Active Display
Device is set to MdaMono which is close enough. This set up can be
verified by testing if MaxPage=3. The alternate display is found by using
interrupt $10 with AH=$15. The result is saved in AltDispDevPCC. Of
course the variable is undefined if a PCC is not used. The possible types
are:
TABLE 6: PC Convertible Alternate Display Adapters
VARIABLE MODEL DESCRIPTION
------------- ----- --------------------
AltDispDevPCC = $ 0 No alternate adapter
= $5140 LCD
= $5153 CGA type
= $5151 Monochrome type
Dual Monitors - Qinit makes an attempt to detect for a second monitor by
| several means. If no alternate cards like EGA or VGA are found, an
| alternate 6845 video chip (CGA, MDA, or Hercules) is checked. If the
| chip is found, then further tests are made to find which card it could
| be. The chip existence test is highly reliable. If no alternate display
| device is found, then AltDispDev=NoDisplay.
| Hercules - Hercules cards are also detected. If either the active or
| alternate DCC is MdaMono, which is found by verifying a responsive 6845
| video chip at the mono register port, then an attempt is made to find if
| any Hercules card is attached. If no Hercules card is found, then
| HercModel=NoHerc; it is then assumed that just an MDA card is attached.
| This test is only run once, even if Qinit is executed again, because the
| test can take up to 1/3 of a second on slower computers. The tests for
the Hercules cards are the ones recommended by Hercules Computer
Technology, which also admits that sometimes the tests will fail during
multi-tasking activity. Hercules clones may not be detected by these
test, but the DCC will be correct.
TABLE 7: HercModel - Hercules Model Code
CODE DESCRIPTION QWIK41 Constant
---- -------------------------------- ---------------
0 No Hercules card NoHerc
1 HGC HgcMono
2 HGC Plus HgcPlus
3 Hercules InColor Card HercInColor
System Identification - To get both the model and submodel, you must use
| interrupt $15 with AH=$C0 which only works on some computers. The code
| was modified to properly exit on AT&T, Leading Edge, and other clones
| which have BIOS inconsistencies. If the carry flag is set on exit, then
that interrupt is not supported, because there's no submodel number. The
alternative is to get the basic computer model by directly accessing the
byte in memory at $F000:$FFFE. The possible values are:
TABLE 8: System Identification Codes
SysID Sub-Model SYSTEM
----- --------- ---------------------------
$FF n/a IBM PC
$FE n/a IBM PC XT
$FD n/a IBM PCjr
$FC n/a IBM PC AT (6 MHz, 01/10/84)
$00 IBM PC AT (6 MHz, 06/10/85)
$01 IBM PC AT (8 MHz, 11/15/85)
$02 IBM PC XT (286)
$04 IBM PS/2 model 50
$05 IBM PS/2 model 60
$FB $00 IBM PC XT (256/640)
$FA $00 IBM PS/2 model 30
$01 IBM PS/2 model 25
$F9 $00 IBM PC Convertible
$F8 $00 IBM PS/2 model 80 (16 MHz)
$01 IBM PS/2 model 80 (20 MHz)
| CPU Identification - A CPU detection routine has been included for Intel
| processors. This routine is independent of QWIK and is useful for clones
| that do not recognize IBM's system ID scheme. The idea came from Juan
| Jimenez as it appeared in Jan/Feb '88 Turbo Technix magazine. The
| routine has been simplified for reduced code (only 42 bytes) and allows
| use of simple constant identifiers. Therefore, this routine is optional
| to QWIK and may be deleted from the initialization in QWIKxx.PAS if
| desired.
| TABLE 9: Intel CPU Identification
| INTEL CPU MODEL NUMBERS QWIK41 Constant
| ----------------------- ---------------
| Intel 8086/8088 Cpu8086
| Intel 80186/80188 Cpu80186
| Intel 80286 Cpu80286
| Intel 80386 Cpu80386
The essential variables set by Qinit are:
VARIABLE DESCRIPTION
------------ ---------------------------------------------------------
Page0seg Segment for the base page, page 0. This value may be
changed for multi-tasking environments.
Qseg Segment for Q writing which is altered when changing
pages.
Qsnow Wait-for-retrace (snow) while Q writing.
MaxPage Maximum possible 0-based page number.
The other variables set or located by Qinit are for your reference to
help make decisions in your programs:
VARIABLE DESCRIPTION
------------ ---------------------------------------------------------
VideoMode Directly accesses the video mode code.
VideoPage Directly accesses the video page number.
EgaRows 0-based number of rows on the screen for EGA or VGA.
EgaFontSize 1-based number of horizontal scan lines per character for
EGA or VGA.
EgaInfo (Described above)
EgaSwithces (Described above)
CRTcolumns 1-based number of CRT columns for any card or video mode.
CRTcols Global variable equal to CRTcolumns.
CRTrows 1-based number of CRT rows for any card or video mode.
| QnextOfs 0-based offset where next Q*More procedure will write.
HavePS2 Detects the presence of IBM PS/2 video equipment.
Have3270 Detects the presence IBM 3270 PC equipment/software.
CardSeg Video buffer address the video "card".
CardSnow Requirement for wait-for-retrace for the video "card".
SystemID Code for the IBM computer in use.
SubModelID Code for the sub-model of the IBM computer in use.
| CpuID Intel CPU identification code.
ActiveDispDev Code for the Active Display Device.
AltDispDev Code for the Alternate Display Device.
AltDispDevPCC Code for the Alternate Display adapter on the PC
Convertible.
ActiveDispDev3270 Code for the Active Display Device on the 3270 PC.
CGA Snow - A recent discovery has shown that CGA cards do not need wait-
for-retrace in 40 column modes 0 and 1. Qinit was programmed to
accommodate this. For other hardware, you can change Qsnow to suit your
needs, but CardSnow should be left unchanged to save what Qinit detected.
References - For more information on the new IBM PS/2 system, you can get
the "IBM BIOS Interface Technical Reference Manual". Other references
include:
IBM Personal System/2 Seminar Proceedings:
Volume 5, Number 2, Displays and Adapters, publication # G360-2678.
Volume 5, Number 4, Models 50, 60, 80, VGA, BIOS and Programming
Considerations, publication # G360-2747.
For more information on the IBM 3270 PC, you can get the the following
publications:
"3270 PC Application Development Considerations"
"IBM 3270 Personal Computer Programming Guide", Pub # SA23-0221
"IBM 3270 Personal Computer Control Program Reference", Pub # GA23-0232
As always, the above information is subject to change without notice per
IBM. IBM is the trademark for International Business Machines Corp. (but
you already know that!)