#include #define BASE 0x3f8 #define DATA_FMT_REGISTER BASE+3 /* 9600 baud, 8N1 format */ void init() { unsigned char val; unsigned char divisor_low, divisor_high; val = inb(DATA_FMT_REGISTER); val = val|0x80; /* set DLAB */ outb(val, DATA_FMT_REGISTER); divisor_low = 12; divisor_high = 0; outb(divisor_low, BASE); /* LSB */ outb(divisor_high, BASE+1); /* MSB */ outb(3, DATA_FMT_REGISTER); } main() { int i; iopl(3); init(); while(1) { while((inb(BASE+0x5)&0x1) != 1); printf("%d\n", inb(BASE)); } }