Technical information
Serial Solutions Using NewBIOS
2115 CX = 0
2120 DEF SEG
2130 ADDR = VARPTR(ASM%(0))
2140 CALL ADDR(AX,BX,CX,DX) ’Call interrupt
2150 :
2160 AL = AX AND 255 ’Get at byte registers
2170 AH = ASC(RIGHT$(MKI$(AX),1))
2180 :
2190 IF AH AND &H80 THEN PRINT "COM2 timed out on output":END
2200 :
2210 END
Note the use of the functions CVI and MKI$ to build byte
values into words and decompose word values into bytes. The
competent BASIC programmer may wish to use faster arithmetic
functions to do this conversion, but care should be taken when
trying to build an unsigned value in a signed word.
Example 3, Setting Port Addresses.______________________________
This example uses service ADH to set the i/o addresses for
COM3 and COM4, it also checks for the presence of NewBIOS.
The service is only available through NewBIOS.
3000 ’GW-BASIC code fragment to set addresses for COM3 and COM4
3020 :
3030 DEFINT A-Z ’Parameters are integers
3040 :
3050 GOSUB 5000 ’Set up machine code
3060 :
3070 COM3ADDR = &H3220
3080 COM4ADDR = &H3228
3090 :
3100 AX = &HAD00 ’Service ADH, set address
3110 BX = COM3ADDR ’New address
3120 CX = 0 ’Must create
3130 DX = &H2 ’COM3
3140 :
3150 DEF SEG
3160 ADDR = VARPTR(ASM%(0))
3170 CALL ADDR(AX,BX,CX,DX) ’Call interrupt
3180 :
3190 IF AX <> &H52AD THEN PRINT "NewBIOS not installed!" :END
3200 :
3300 AX = &HAD00
3400 BX = COM4ADDR
3410 DX = &H3 ’COM4
Page 62 Chapter 4