diff --git a/kernel/main.c b/kernel/main.c index f71d97a..05d6fd8 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -53,6 +53,7 @@ STATIC VOID signon(VOID); STATIC VOID kernel(VOID); STATIC VOID FsConfig(VOID); STATIC VOID InitPrinters(VOID); +STATIC VOID InitSerialPorts(VOID); STATIC void CheckContinueBootFromHarddisk(void); #ifdef _MSC_VER @@ -202,6 +203,7 @@ STATIC void init_kernel(void) /* Initialize IO subsystem */ InitIO(); InitPrinters(); + InitSerialPorts(); /* set interrupt vectors */ setvec(0x1b, got_cbreak); @@ -616,6 +618,23 @@ STATIC VOID InitPrinters(VOID) } } +STATIC VOID InitSerialPorts(VOID) +{ + iregs r; + int serial_ports, i; + + init_call_intr(0x11, &r); /* get equipment list */ + + serial_ports = (r.a.x >> 9) & 7; /* bits 11-9 */ + + for (i = 0; i < serial_ports; i++) + { + r.a.x = 0xA3; /* initialize serial port to 2400,n,8,1 */ + r.d.x = i; + init_call_intr(0x14, &r); + } +} + /***************************************************************** if kernel.config.BootHarddiskSeconds is set, the default is to boot from harddisk, because diff --git a/kernel/serial.asm b/kernel/serial.asm index 5ae68ac..914bf5f 100644 --- a/kernel/serial.asm +++ b/kernel/serial.asm @@ -61,6 +61,8 @@ ComRead: jnz ComRd2 ComRd1: call BiosRdCom + or ah,ah ; timeout? + js ComRd1 ; yes, try again ComRd2: stosb loop ComRd1