From e68953854260b2af5e8eadda64ef033b75f463a0 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 24 Aug 2023 03:13:54 +0300 Subject: [PATCH] Show available LPT and COM ports --- Kernel.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Kernel.cpp b/Kernel.cpp index 2816828..3192a32 100644 --- a/Kernel.cpp +++ b/Kernel.cpp @@ -290,6 +290,38 @@ EXTERNC NIF void Main() if (DebuggerIsAttached) KPrint("\eFFA500Kernel debugger detected."); +#if defined(a86) && defined(DEBUG) + uint8_t lpt1 = inb(0x378); + uint8_t lpt2 = inb(0x278); + uint8_t lpt3 = inb(0x3BC); + + uint8_t com1 = inb(0x3F8); + uint8_t com2 = inb(0x2F8); + uint8_t com3 = inb(0x3E8); + uint8_t com4 = inb(0x2E8); + + if (lpt1 != 0xFF) + KPrint("LPT1 is present."); + + if (lpt2 != 0xFF) + KPrint("LPT2 is present."); + + if (lpt3 != 0xFF) + KPrint("LPT3 is present."); + + if (com1 != 0xFF) + KPrint("COM1 is present."); + + if (com2 != 0xFF) + KPrint("COM2 is present."); + + if (com3 != 0xFF) + KPrint("COM3 is present."); + + if (com4 != 0xFF) + KPrint("COM4 is present."); +#endif + /**************************************************************************************/ KPrint("Initializing GDT and IDT");