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_mode function 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 mode

WARNING: 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 cls command 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 screen

Text 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:

IndexColor nameColor HTML
0Black#000000
1Blue#0000AA
2Green#00AA00
3Cyan#00AAAA
4Red#AA0000
5Magenta#AA00AA
6Brown#AA5500
7Light Gray#AAAAAA
8Dark Gray#555555
9Light Blue#5555FF
10Light Green#55FF55
11Light Cyan#55FFFF
12Light Red#FF5555
13Light Magenta#FF55FF
14Yellow#FFFF55
15White#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.