Technical information
Serial Solutions BASterm
The BASIC CLOSE statement does not access the device
driver, but merely informs DOS and BASIC that the program no
longer wishes to use the file. CLOSE is performed just before
the program ends and during a change of port on the ’C’
command in BASterm.
Serial Port Parameters._____________________
The serial port settings, the Baud rate, parity etc., must be
set to the values that the remote device requires. In BASterm
this is all done by one subroutine, at line 28000, Figure 10-5.
Figure 10-5. BIOS Access Subroutines.__________________________________
28000 ’**************************************************************
28010 ’Set mode of com port-.
28020 ’In QuickBASIC 4.5 uses ’call interrupt’ to access BIOS
28030 ’In GW-BASIC uses small machine code routine
28040 INITOK = 0
28050 ’Check parameters are ok first
28060 IF COMNO < 0 OR COMNO > 15 THEN RETURN
28070 INREGS.DX = COMNO
28080 IF BRK < 0 OR BRK > 1 THEN RETURN
28090 INREGS.AX = &H400 OR BRK ’&H04 ==> service 4, extended init
28100 IF PARITY < 0 OR PARITY > 4 THEN RETURN
28110 IF STOPBITS < 0 OR STOPBITS > 1 THEN RETURN
28120 INREGS.BX = PARITY * 256 + STOPBITS
28130 IF DATABITS < 0 OR DATABITS > 3 THEN RETURN
28140 IF BAUD < 0 OR BAUD > 11 THEN RETURN
28150 INREGS.CX = DATABITS * 256 + BAUD
28160 :
28170 INITOK = -1 ’All parameters are ok
28180 IF ISBASICA THEN GOSUB 28410 ELSE GOSUB 28610
28190 :
28200 RETURN
28210 :
28220 :
28400 ’**************************************************************
28410 ’Call BIOS via machine code interface. GWBASIC
28420 :
28430 DEF SEG
28440 ADDR = VARPTR(ASM%(0))
28450 ’Use the following here line in GWBASIC. It is commented out as
28460 ’QuickBASIC refuses to compile it.
28470 ’CALL ADDR(INREGS.AX, INREGS.BX, INREGS.CX, INREGS.DX): RETURN
28480 :
28490 PRINT "This is GW-BASIC, remember to uncomment line 28470"
Page 158 Chapter 10