Atlas - TEXTT.C

Home / systems / IBM-PC / PhotonX / src / demos Lines: 7 | Size: 1962 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1#include "VGA.H" 2#include <conio.h> 3 4int main() 5{ 6 unsigned char i; 7 unsigned char j; 8 const char *color_names[16] = { 9 "Black", 10 "Blue", 11 "Green", 12 "Cyan", 13 "Red", 14 "Magenta", 15 "Brown", 16 "Light Gray", 17 "Dark Gray", 18 "Light Blue", 19 "Light Green", 20 "Light Cyan", 21 "Light Red", 22 "Light Magenta", 23 "Yellow", 24 "White" 25 }; 26 const char *logo[11] = { 27 " ", 28 " ", 29 " `7MMF' ", 30 " ,mmmmMMmmmm. ", 31 "6MP MM YMb ", 32 "8M MM M8 ", 33 "YMb MM dM9 ", 34 " `YmmmMMmmmP' ", 35 " .JMML. ", 36 " ", 37 " " 38 }; 39 40 vga_set_mode(VGA_MODE_TEXT_80x25); 41 vga_text_setcolor(15, 1); 42 vga_text_cls(); 43 vga_text_gotoxy(0, 0); 44 vga_text_puts("PhotonX Demo: Text Colors\r\n"); 45 46 vga_text_setcolor(14, 0); 47 vga_text_puts("Index shown with matching foreground color:\r\n\r\n"); 48 49 vga_text_setcolor(15, 0); 50 for (j = 0; j < 11; ++j) 51 { 52 vga_text_gotoxy(60, 5 + j); 53 vga_text_puts(logo[j]); 54 } 55 56 vga_text_gotoxy(0, 3); 57 58 for (i = 0; i < 16; ++i) 59 { 60 if (i == 0) 61 vga_text_setcolor(i, 7); 62 else 63 vga_text_setcolor(i, 0); 64 65 vga_text_puts("Color "); 66 67 if (i < 10) 68 vga_text_putch('0' + i); 69 else 70 { 71 vga_text_putch('1'); 72 vga_text_putch('0' + (i - 10)); 73 } 74 75 vga_text_puts(": "); 76 vga_text_puts(color_names[i]); 77 vga_text_puts("\r\n"); 78 } 79 80 vga_text_setcolor(15, 0); 81 vga_text_puts("\r\nPress any key to exit...\r\n"); 82 getch(); 83 84 vga_set_mode(VGA_MODE_TEXT_80x25); 85 vga_text_setcolor(15, 0); 86 vga_text_cls(); 87 88 return 0; 89} 90
[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.