aboutsummaryrefslogtreecommitdiff
path: root/mubios/include/vbe.h
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-11-10 02:29:20 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-11-10 02:29:20 +0800
commit7ecf4901b486693e525d3daafc7d6e9c3a4abcd0 (patch)
tree722ed5d7919170cedef44bdb22bc87ab98a47682 /mubios/include/vbe.h
parent03c2c766aad0746ca3e71b44756b443ae8742e95 (diff)
downloadrcc-project-7ecf4901b486693e525d3daafc7d6e9c3a4abcd0.tar.gz
rcc-project-7ecf4901b486693e525d3daafc7d6e9c3a4abcd0.tar.xz
[mubios] Complete VGA text initialization and add VBE graphics services
Load the 8x16 font and VGA palette, restore text memory mapping, and synchronize BIOS cursor and page state with the hardware. Allocate QEMU standard VGA PCI memory resources and expose VBE controller information, mode queries and switching, logical scanline lengths, and display start control. Signed-off-by: Richard Qin <richard.qin.x@gmail.com>
Diffstat (limited to 'mubios/include/vbe.h')
-rw-r--r--mubios/include/vbe.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/mubios/include/vbe.h b/mubios/include/vbe.h
new file mode 100644
index 0000000..eea2bd2
--- /dev/null
+++ b/mubios/include/vbe.h
@@ -0,0 +1,75 @@
+/*
+ RCC-Project
+
+ Copyright (C) 2026 Richard Qin
+
+ This file is part of RCC-Project.
+
+ RCC-Project is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your option) any
+ later version.
+
+ RCC-Project is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ RCC-Project; see the file COPYING. If not see
+ <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MUBIOS_VBE_H
+#define MUBIOS_VBE_H
+
+#include "bios.h"
+
+#define VBE_MODE_COUNT 15u
+#define VBE_MODE_LINEAR 0x4000u
+#define VBE_MODE_PRESERVE 0x8000u
+#define VBE_OK 0x004Fu
+#define VBE_FAILED 0x014Fu
+#define VBE_UNSUPPORTED 0x024Fu
+
+#define DISPI_XRES 1u
+#define DISPI_YRES 2u
+#define DISPI_BPP 3u
+#define DISPI_ENABLE 4u
+#define DISPI_BANK 5u
+#define DISPI_VIRT_WIDTH 6u
+#define DISPI_VIRT_HEIGHT 7u
+#define DISPI_X_OFFSET 8u
+#define DISPI_Y_OFFSET 9u
+
+struct vbe_mode
+{
+ u16 number;
+ u16 width;
+ u16 height;
+ u16 bpp;
+};
+
+struct vbe_state
+{
+ u32 framebuffer;
+ u32 memory_size;
+ u16 max_width;
+ u16 max_height;
+ u16 max_bpp;
+ u16 current_mode;
+ u16 mode_list[VBE_MODE_COUNT + 1u];
+ u8 present;
+};
+
+extern struct vbe_state vbe;
+
+void vbe_init (void);
+void vbe_leave_graphics (void);
+u16 vbe_read (u16 index);
+void vbe_write (u16 index, u16 value);
+const struct vbe_mode *vbe_find_mode (u16 number);
+u16 vbe_set_mode (u16 request);
+u16 vbe_get_mode (u16 *number);
+void vbe_service (struct bios_regs *regs);
+
+#endif