diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-11-09 03:22:35 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-11-09 03:22:35 +0800 |
| commit | 06cb46aa0236352554f23697e17bed378083be1a (patch) | |
| tree | 099e92dce130d8f3b2bdbe9c88ddc3949babe94c /mubios/services | |
| parent | a54a4236a27e8319da421010fe0c3c5d80edca45 (diff) | |
| download | rcc-project-06cb46aa0236352554f23697e17bed378083be1a.tar.gz rcc-project-06cb46aa0236352554f23697e17bed378083be1a.tar.xz | |
[mubios] Initialize VGA mode and serial BIOS services
Diffstat (limited to 'mubios/services')
| -rw-r--r-- | mubios/services/int10.c | 14 | ||||
| -rw-r--r-- | mubios/services/int14.c | 61 |
2 files changed, 75 insertions, 0 deletions
diff --git a/mubios/services/int10.c b/mubios/services/int10.c index 6793c40..4f6aef1 100644 --- a/mubios/services/int10.c +++ b/mubios/services/int10.c @@ -63,6 +63,20 @@ int10_service (struct bios_regs *regs) function = (u8)(regs->eax >> 8); page = (u8)(regs->ebx >> 8); + if (function == 0x00u) + { + if ((u8)regs->eax == 0x03u) + vga_text_mode_init (); + return; + } + + if (function == 0x0Fu) + { + regs->eax = (regs->eax & 0xFFFF0000u) | 0x5003u; + regs->ebx &= 0xFFFF00FFu; + return; + } + if (function == 0x02u) { cursor = int10_cursor_for_page (page); diff --git a/mubios/services/int14.c b/mubios/services/int14.c new file mode 100644 index 0000000..86019b7 --- /dev/null +++ b/mubios/services/int14.c @@ -0,0 +1,61 @@ +/* + RCC-Project + + Copyright (C) 2026 Richard Qin + + This file is part of RCC-Project. + */ + +#include "bios.h" +#include "io.h" +#include "regs.h" + +#define COM1_BASE 0x03F8u +#define COM_DATA 0x00u +#define COM_LSR 0x05u +#define COM_LSR_THRE 0x20u +#define COM_LSR_IDLE 0x40u + +static void +int14_putc (u8 value) +{ + while ((io_in8 ((u16)(COM1_BASE + COM_LSR)) & COM_LSR_THRE) == 0u) + { + } + + io_out8 ((u16)(COM1_BASE + COM_DATA), value); +} + +void +int14_service (struct bios_regs *regs) +{ + u8 function; + u8 status; + + function = (u8)(regs->eax >> 8); + + if (function == 0x00u) + { + serial_init (); + regs->eax &= 0xFFFF0000u; + return; + } + + if (function == 0x01u) + { + int14_putc ((u8)regs->eax); + status = (u8)(io_in8 ((u16)(COM1_BASE + COM_LSR)) + | COM_LSR_THRE | COM_LSR_IDLE); + regs->eax = (regs->eax & 0xFFFF00FFu) | ((u32)status << 8); + return; + } + + if (function == 0x03u) + { + status = io_in8 ((u16)(COM1_BASE + COM_LSR)); + regs->eax = (regs->eax & 0xFFFF00FFu) | ((u32)status << 8); + return; + } + + regs->eax = 0x0100u; +} |
