Technical information

Using NewBIOS Serial Solutions
union REGS inregs, outregs; /* Declare variables. */
unsigned com3addr, com4addr;
inregs.h.ah = 0xAD; /* Service ADH, set address. */
inregs.x.dx = 0x2; /* COM3. */
inregs.x.bx = com3addr; /* address of com3. */
int86(0x14, &inregs, &outregs); /* Async services. */
if( outregs.h.ah != 0x52AD ) /* Check that send successful. */
{
printf("NewBIOS not installed!\n");
exit(1);
};
inregs.x.dx = 0x3; /* COM 4. */
inregs.x.bx = com4addr; /* address of COM4. */
int86(0x14, &inregs, &outregs);
Borland Turbo Pascal.____________________
This powerful and well-structured language has facilities to
access the machine’s BIOS in a quite straightforward way.
Turbo Pascal provides a procedure called Intr which access
the machine interrupt routines. This is defined as:
PROCEDURE Intr(IntNo: Byte; VAR Regs: Registers);
where ’Registers’ are
TYPE
Registers =
RECORD
CASE Integer OF
0: (AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags: Word);
1: (AL,AH,BL,BH,CL,CH,DL,DH: Byte);
END;
Note how the record reflects reflects the actual organisation of
the 8086, with its byte and word registers. The Procedure is part
of the Dos unit.
Intr places the values in ’Regs’ in the registers of the 8086
and performs an INT IntNo. On return the values in the 8086
registers are copied back into ’Regs’. This means that the
assembly language examples above are very easy to translate
into Turbo Pascal.
Chapter 4 Page 53