Technical information

Serial Solutions Using NewBIOS
al = outregs.ax AND 255 ’Get at AL
ah = ASC(RIGHT$(MKI$(outregs.ax), 1)) ’Get at AH
IF ah AND &H80 THEN
PRINT "COM2 timed out on output"
END
END IF
The function CVI is used to convert the individual byte
values into word values, and MKI$ is used to get at byte values
returned in words. The competent BASIC programmer may wish
to use the faster arithmetic functions to perform byte/word
conversions, although care must be taken building an unsigned
value in a signed 16-bit word.
Example 3, Setting Port Addresses.______________________________
In this example service ADH is used to set addresses for
COM3 and COM4. Service ADH is only available through
NewBIOS. The program also checks for the presence of
NewBIOS.
’QuickBASIC code fragment to set COM3 and COM4 addresses
DEFINT A-Z
REM $INCLUDE: ’QB.BI’
DIM inregs AS RegType, outregs AS RegType
com3addr = &H3220
com4addr = &H3228
inregs.ax = &HAD00 ’AH = ADH, ==>set address
inregs.dx = &H2 ’COM3
inregs.bx = com3addr ’Address
CALL INTERRUPT(&H14, inregs, outregs)
’Async services
IF outregs.ax <> &H52AD THEN
PRINT "NewBIOS not installed!"
END
END IF
inregs.dx = &H3 ’COM4
inregs.bx = com4addr ’Address
CALL INTERRUPT(&H14, inregs, outregs)
Page 58 Chapter 4