home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_10_12
/
1012022a
< prev
next >
Wrap
Text File
|
1992-10-13
|
597b
|
25 lines
struct port_data {
int uart_address;
int head_pointer;
int tail_pointer;
char buffer[ 1024 ];
};
void far interrupt isr()
{
unsigned char c;
int space_used;
c = ( unsigned char ) inp( port.uart_address );
space_used = port.head_pointer - port.tail_pointer;
if ( space_used < 0 )
space_used += 1024;
if ( space_used < 1023 ) {
port.buffer[ port.head_pointer++ ] = c;
port.head_pointer &= 1023;
}
outp( 0x20, 0x20 );
}