Technical information
Serial Solutions Using NewBIOS
The reader may wish to read the earlier section of this
chapter, ’accessing asynchronous services’ which discusses the
machine interrupts.
Example 1, Initialising A Port.__________________________
This example uses service 0H to initialise COM1. A later
chapter, "NewBIOS Reference", contains details of this and all
asynchronous services. The values that the service requires are
loaded into Ioregs, and Intr is performed.
USES
DOS; {Contains Registers type and Intr Procedure}
VAR
Ioregs: Registers;
BEGIN
{Pascal code fragment to set COM1 to 1200 Baud,
even parity, seven data bits and one stop bit.}
WITH Ioregs DO BEGIN
AH := $0; {Service 0, initialise}
AL := $9A; {Parameters as above}
DX := $0; {COM1}
Intr($14, Ioregs); {Asynchronous services}
END;
END.
Example 2, Sending Data Out.__________________________
This example uses service 1H to send Char nextchar to
COM2. It examines the status returned by the service to check
whether the character was sent correctly.
USES
DOS; {Contains Registers type and Intr Procedure}
VAR
Ioregs: Registers;
NextChar: Char;
BEGIN
{Pascal code fragment to send a char to COM2.}
WITH Ioregs DO BEGIN
NextChar := ’a’;
AH := $1; {Service 1, send char}
AL := Byte(NextChar); {Character to send}
Page 54 Chapter 4