Atlas - VGA.md
Home / systems / IBM-PC / PhotonX Rendered HTML view | Size: 4464 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]VGA Subsystem
PhotonX Graphics SDK — VGA driver interface for 8086/8088 systems.
Overview
The VGA subsystem exposes two distinct APIs depending on the active video mode: a text-mode API for 80x25 character output, and a graphics-mode API for direct pixel rendering in mode 13h (320x200, 256 colors).
Setting mode outputs
To switch between text and graphics modes, use the
vga_set_modefunction with the appropriate mode constant:
c vga_set_mode(VGA_MODE_TEXT_80x25); // Switch to text mode vga_set_mode(VGA_MODE_320x200x256); // Switch to graphics modeWARNING: It is always important to reset the screen mode back to text mode before returning the user to the MS-DOS environment, otherwise they will be left almost like a broken state and could lead to unexpected behavior - It is also noted that on MS-DOS the
clscommand does not reset the screen mode. For simple way to reset the screen mode you should call these functions:
c vga_set_mode(VGA_MODE_TEXT_80x25); // Reset to text mode vga_text_setcolor(7, 0); // Set default white on black text color vga_text_cls(); // Clear the screenText Mode
In text mode, you get a character grid of 80 columns and 25 rows and 16 colors.
Color palette
The VGA text mode supports a fixed palette of 16 colors, indexed from 0 to 15:
Index Color name Color HTML 0 Black #000000 1 Blue #0000AA 2 Green #00AA00 3 Cyan #00AAAA 4 Red #AA0000 5 Magenta #AA00AA 6 Brown #AA5500 7 Light Gray #AAAAAA 8 Dark Gray #555555 9 Light Blue #5555FF 10 Light Green #55FF55 11 Light Cyan #55FFFF 12 Light Red #FF5555 13 Light Magenta #FF55FF 14 Yellow #FFFF55 15 White #FFFFFF [FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.