Technical information

Using NewBIOS Serial Solutions
’Async services
END
GW-BASIC/BASICA.___________________
BASICA or GW-BASIC is a straightforward language
which offers simple convenient program development and which
carries a good number of powerful features. Although it is
supplied with all IBM machines and clones BASIC does not
include among those features a method of accessing the
machine’s BIOS. The GW-BASIC/BASICA programmer must
therefore resort to a small machine code interface which can be
CALLed with the relevant parameters.
The method shown here is one such solution. The
subroutine below loads a small machine code routine into an
integer array. The routine is CALLed with four integer
parameters (there must be exactly four, and they must be
integers) which contain the values for the AX, BX, CX and DX
registers. These values are copied over, INT 14H is performed,
and the returned register values are copied back into the
parameters. BASIC relocates arrays as variables are created, so it
is important the the parameter variables are first used before the
call statement, otherwise the machine code routine will be
relocated in memory as the call is executed. The call must be
told the location of the routine, and if it is told an incorrect
location the system will crash.
The reader may wish to refer to the section earlier in the
chapter called ’accessing asynchronous services’, which discusses
the machine interrupts.
BIOS Interface Setup Routine.___________________________
5000 ’BIOS interface setup
5010 :
5020 DIM ASM%(23) ’Array to hold data
5030 :
5040 :
5050 TOT# = 0 ’Data check
5060 RESTORE 5230
5070 :
5080 FOR I = 0 TO 21
5090 READ S$, T$ ’read in data
Chapter 4 Page 59