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