home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
BBS
/
X00V124.ZIP
/
QBHLLAPI.ZIP
/
QBHLLAPI.DOC
next >
Wrap
Text File
|
1990-07-14
|
7KB
|
160 lines
Why use the Quick Basic HLLAPI
Every multitasker that I have examined insists on managing INT
14h. The FOSSIL specification is basically an extension of the
normal BIOS INT 14h functions. However, in implementing a FOSSIL
with features that are not supported by BIOS's INT 14h, additional
registers were used to pass additional parameters. Some
multitaskers will intercept the INT 14h calls and will alter
registers that are not normally used by BIOS. Quarterdeck's tech
support confirmed to me that they may change the DS register when
DESQview intercepts an INT 14h (when released, version 2.26 of
DESQview is supposed to correct this). What this means is that
some FOSSIL functions will work correctly with a multitasker and
others will not. Additionally, it means that if one application
program uses a FOSSIL function that another application does not
use, then one of the programs may work fine with a multitasker
and the other may not.
My first task in solving problems with multitaskers was to
eliminate the need for X00 to be called using an INT 14h. Starting
with version 1.20 of X00, I have included quick and dirty HLLAPI
routines for some high level languages. More are yet to come.
Applications programmers should replace references to library
routines in their existing source with the replacement routine(s)
included in the X00 distribution file. Then include the appropriate
object module in the linking process. At this writing, HLLAPIs are
included for:
Microsoft C, all models
Borland's Turbo C
Borland's Turbo Pascal
Microsoft Quick Basic
The first time the HLLAPI is called, it will determine if X00 is
the active FOSSIL. If X00 is the active FOSSIL, then it will be
directly called instead of using INT 14h. If X00 is not the
active FOSSIL, or if there is no FOSSIL, the HLLAPI will issue an
INT 14h. After the first call to the HLLAPI, a maximum of only 4
assembly instructions are added to the execution thread no matter
what FOSSIL is installed. The addition of 4 instructions to the
execution thread should have no effect on execution speed of the
application program.
Using the HLLAPIs to access X00 with a multitasking system can
result in significantly faster execution because the multitasker's
management of INT 14h is avoided. Thus, the multitasker has no
opportunity to change the registers and all X00 functions should
work correctly.
Those using assembly language to access X00 should replace INT 14h
instructions with a CALL BYPASS and include BYPASS.OBJ in the linked
program. BYPASS should be declared as a FAR external,
i.e. EXTRN BYPASS:FAR
QBHLLAPI
I am not a Basic programmer, so please forgive any documentation
blunders and/or syntax errors in the example Basic code fragments.
Now included in the X00 distribution is an object module that allows
access to all X00 functions from Quick Basic. That module is:
QBX00.OBJ
Two routines are defined in this module, QBX00 and QBX00X.
These routines are intended to be direct replacements for X00
calls when using the Quick Basic statements CALL INTERRUPT,
CALL INTERRUPTX, CALL INT86OLD and CALL INT86XOLD. The only
difference in the calling sequence(s) is that the interrupt number
is not passed as a parameter.
To use these interfacing routines, the programmer basically sets
variables is a structure that corresponds to the processor's
registers and passes the structure's address to QBX00 or QBX00X.
When QBX00 or QBX00X is invoked, it copies the variables in the
structure to the processor's registers and then calls X00. Upon
return from X00, all of the processor's registers are copied into
the output structure. The input structure and output structure
may be the same.
In order to provide convenient access to the QBX00 routines from
the Quick Basic 4 environment, QBX00.OBJ should be converted
into regular library (.LIB) and Quick Library (.QLB) formats.
This can be accomplished by issuing the following DOS commands:
LIB QBX00 +QBX00;
LINK /Q QBX00,,,BQLB45
For a more complete description of the structures and their uses,
read the documentation about the library functions INTERRUPT,
INTERRUPTX, INT86OLD and INT86XOLD in the appropriate Microsoft
Quick Basic reference manual. Also see the include file QB.BI
which comes on your Quick Basic disks.
The code fragments below are intended to provide examples of
replacing INTERRUPT, INTERRUPTX, INT86OLD and INT86XOLD calls with
QBX00 and QBX00X calls.
My thanks to Scott Barnes for helping with documentation and testing
the Quick Basic HLLAPI.
'** Sample QuickBasic 4.xx calls to X00.
'$INCLUDE: 'QB.BI'
DECLARE SUB QBX00 (inreg AS RegType,outreg AS RegType)
DECLARE SUB QBX00X (inreg AS RegTypeX, outreg AS RegTypeX)
COMMON SHARED INREG AS REGTYPE, OUTREG AS REGTYPE
COMMON SHARED INREGX AS REGTYPEX, OUTREGX AS REGTYPEX
PORTNUM = 0 'For COM1: operations
'** EXAMPLE 1: Initialize X00 driver and check initialization
INREG.AX = &H400 'FOSSIL function 04h
INREG.DX = PORTNUM 'Port number (0=COM1)
INREG.FLAGS = 512 'Keeps interrupts enabled
CALL QBX00(INREG, OUTREG) 'Call X00
IF OUTREG.AX <> &H1954 THEN 'If installed X00 returns &H1954
PRINT "FOSSIL driver not found!"
STOP
ELSEIF (OUTREG.BX \ 256) < 5 THEN 'Is FOSSIL level 5 supported
PRINT "FOSSIL driver does not support Level 5 commands."
GOTO SHUTDOWN
END IF
'** EXAMPLE 2: Transmit a string TXIT$ using FOSSIL's write block function
'** Note: The INREGX/OUTREGX structures and CALL INTERRUPTX statement must be
' used since FOSSIL requires the ES register to be passed in the call.
TXIT$ = "Sample data to be transmitted"
TXSTART = 1 'Try to xmit entire string
MAXTX = LEN(TXIT$) 'Total # of characters to xmit
INREGX.AX = &H1900 'Write block function code
INREGX.DX = PORTNUM 'Port number (0=COM1)
INREGX.FLAGS = 512 'Keeps interrupts enabled
DO UNTIL TXSTART > MAXTX 'Loop until entire string is sent
TXNOW$ = MID$(TXIT$, TXSTART) '
INREGX.CX = LEN(TXNOW$) 'Length of to xmit
INREGX.ES = VARSEG(TXNOW$) 'Segment of string
INREGX.DI = SADD(TXNOW$) 'Offset of string
CALL QBX00X(INREGX, OUTREGX) 'Call X00
TXSTART = TXSTART + OUTREGX.AX 'Add chars actually sent
LOOP