Technical information

NewBIOS Reference Serial Solutions
Meaning._________
Service B3H is used to read the status of the buffers
associated with a port, and to control those buffers. NewBIOS
itself does not use these values but the NewCOM.SYS device
driver does.
The buffer status of a port which has been opened by
NewCOM but for polled rather than buffered i/o is reported by
subservices 00H and 01H as a port with 1-byte input and output
buffers, the chip registers. This is to allow software to be able to
make the same tests of the ’buffers’, whether or not they are
real. There are however some differences. Because the output
register is beyond the control of NewCOM, the contents of this
’output buffer’ will still be sent if the output handshake goes
false. Then, even though there appears to be a byte free in the
output buffer, writes to it will be blocked. These ’buffers’ cannot
be flushed or halted.
Port which have not been opened are reported as having
halted buffers which are zero bytes long.
The disable buffer functions simply prevent data from
moving between the buffer and the serial chip by disabling the
interrupt responsible for that. Reads and writes to the port can
still be performed. Bytes coming in to the port will be lost if the
input buffer is disabled. By default both buffers are enabled.
Manipulating buffer contents using subservices 08h & 09h.
mov ah,0B3h
mov al,08h ;get input buffer addresses
int 14h
mov es,ax ;buffer is in this segment
mov di,ds:[bx]
;save the contents of the tail ptr here for later
;
;calculate amount of data in the buffer
mov ax,ds:[cx] ;get the contents of the head ptr
mov bx,ds:[bx] ;get the contents of the tail ptr
sub ax,bx ;take tail away from head
Chapter 5 Page 105