Commit a1526ba7362d1017f635ed2a2adc776c4b073fb4

Commits
[COMMIT BEGIN]
commit a1526ba7362d1017f635ed2a2adc776c4b073fb4
Author: 0x4248 <[email protected]>
Date:   Mon Mar 9 23:42:48 2026 +0000

    PhotonX: move to src and add README

diff --git a/systems/IBM-PC/PhotonX/README.md b/systems/IBM-PC/PhotonX/README.md
new file mode 100644
index 0000000..062dfeb
--- /dev/null
+++ b/systems/IBM-PC/PhotonX/README.md
@@ -0,0 +1,15 @@
+# PhotonX Graphics
+
+PhotonX Graphics is a set of Graphical Software development toolkits and drivers
+for the IBM-PC platform. Fully written in C, it provides a simple API for making
+graphical applications on the IBM-PC.
+
+```
+    `7MMF'     
+ ,mmmmMMmmmm.  
+6MP   MM   YMb 
+8M    MM    M8 
+YMb   MM   dM9 
+ `YmmmMMmmmP'  
+    .JMML.     
+```
\ No newline at end of file
diff --git a/systems/IBM-PC/PhotonX/demos/RANDOM.C b/systems/IBM-PC/PhotonX/demos/RANDOM.C
deleted file mode 100644
index 92cf5af..0000000
--- a/systems/IBM-PC/PhotonX/demos/RANDOM.C
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "VGA.H"
-#include <time.h>
-#include <stdlib.h>
-
-int rand_range(int min, int max)
-{
-    return (rand() % (max - min + 1)) + min;
-}
-
-int main()
-{
-    int i = 0;
-    int x;
-    int y;
-    int lastx = 160;
-    int lasty = 100;
-    srand((unsigned int)time(NULL));
-    vga_set_mode(VGA_MODE_320x200x256);
-    vga_gfx_setclscolor(1);
-    vga_gfx_cls();
-
-    while (i++ < 100)
-    {
-        x = rand_range(0, 20);
-        y = rand_range(0, 20);
-        vga_gfx_line((uint16_t)lastx, (uint16_t)lasty, (uint16_t)x, (uint16_t)y, (uint8_t)(i % 256));
-        lastx = x;
-        lasty = y;
-        vga_beep(rand_range(100, 500), 40);
-        delay(40);
-        if (kbhit())
-            break;
-    }
-
-    return 0;
-}
\ No newline at end of file
diff --git a/systems/IBM-PC/PhotonX/demos/TESTUTIL.C b/systems/IBM-PC/PhotonX/demos/TESTUTIL.C
deleted file mode 100644
index c195c6a..0000000
--- a/systems/IBM-PC/PhotonX/demos/TESTUTIL.C
+++ /dev/null
@@ -1,202 +0,0 @@
-#include <conio.h>
-#include <dos.h>
-#include "VGA.H"
-
-static void red_lines_test(void)
-{
-	int x;
-	int y;
-	int i;
-
-	vga_gfx_setclscolor(0);
-	vga_gfx_cls();
-
-	for (i = 0; i < 64; i++)
-		vga_set_palette((uint8_t)i, (uint8_t)i, 0, 0);
-
-	for (x = 0; x < 320; x++)
-		for (y = 0; y < 200; y++)
-			vga_gfx_putpixel((uint16_t)x, (uint16_t)y, (uint8_t)(x % 64));
-
-	vga_gfx_puts("RED TEST", 8, 8, 63);
-	vga_wait_key();
-}
-
-static void green_lines_test(void)
-{
-	int x;
-	int y;
-	int i;
-
-	vga_gfx_setclscolor(0);
-	vga_gfx_cls();
-
-	for (i = 0; i < 64; i++)
-		vga_set_palette((uint8_t)i, 0, (uint8_t)i, 0);
-
-	for (x = 0; x < 320; x++)
-		for (y = 0; y < 200; y++)
-			vga_gfx_putpixel((uint16_t)x, (uint16_t)y, (uint8_t)(x % 64));
-
-	vga_gfx_puts("GREEN TEST", 8, 8, 63);
-	vga_wait_key();
-}
-
-static void blue_lines_test(void)
-{
-	int x;
-	int y;
-	int i;
-
-	vga_gfx_setclscolor(0);
-	vga_gfx_cls();
-
-	for (i = 0; i < 64; i++)
-		vga_set_palette((uint8_t)i, 0, 0, (uint8_t)i);
-
-	for (x = 0; x < 320; x++)
-		for (y = 0; y < 200; y++)
-			vga_gfx_putpixel((uint16_t)x, (uint16_t)y, (uint8_t)(x % 64));
-
-	vga_gfx_puts("BLUE TEST", 8, 8, 63);
-	vga_wait_key();
-}
-
-static void grid_test(void)
-{
-	int x;
-	int y;
-
-	vga_gfx_setclscolor(0);
-	vga_gfx_cls();
-
-	for (x = 0; x < 320; x++)
-		for (y = 0; y < 200; y++)
-			if (x % 10 == 0 || y % 10 == 0)
-				vga_gfx_putpixel((uint16_t)x, (uint16_t)y, 63);
-			else
-				vga_gfx_putpixel((uint16_t)x, (uint16_t)y, 10);
-
-	vga_gfx_puts("GRID TEST", 8, 8, 63);
-	vga_wait_key();
-}
-
-static void full_color_test(void)
-{
-	int x;
-	int y;
-	int i;
-
-	vga_gfx_setclscolor(0);
-	vga_gfx_cls();
-
-	for (i = 0; i < 64; i++)
-		vga_set_palette((uint8_t)i, (uint8_t)i, 0, 0);
-
-	for (i = 0; i < 64; i++)
-		vga_set_palette((uint8_t)(i + 64), 63, (uint8_t)i, 0);
-
-	for (i = 0; i < 64; i++)
-		vga_set_palette((uint8_t)(i + 128), (uint8_t)(63 - i), 63, (uint8_t)i);
-
-	for (i = 0; i < 64; i++)
-		vga_set_palette((uint8_t)(i + 192), 0, (uint8_t)(63 - i), 63);
-
-	for (x = 0; x < 320; x++)
-		for (y = 0; y < 200; y++)
-			vga_gfx_putpixel((uint16_t)x, (uint16_t)y, (uint8_t)(x % 256));
-
-	vga_gfx_puts("FULL COLOR TEST", 8, 8, 15);
-	vga_wait_key();
-}
-
-static void math_spiral_test(void)
-{
-	int x = 160;
-	int y = 100;
-	int nx = x;
-	int ny = y;
-	int len = 4;
-	int dir = 0;
-	uint8_t color = 1;
-
-	vga_gfx_setclscolor(0);
-	vga_gfx_cls();
-
-	while (len < 220)
-	{
-		switch (dir)
-		{
-			case 0: nx = x + len; ny = y; break;
-			case 1: nx = x; ny = y - len; break;
-			case 2: nx = x - len; ny = y; break;
-			default: nx = x; ny = y + len; break;
-		}
-
-		vga_gfx_line((uint16_t)x, (uint16_t)y, (uint16_t)nx, (uint16_t)ny, color);
-
-		x = nx;
-		y = ny;
-		dir = (dir + 1) & 3;
-		color = (uint8_t)(color + 2);
-		if (dir == 0 || dir == 2)
-			len += 6;
-	}
-
-	vga_gfx_puts("MATH SPIRAL", 8, 8, 63);
-	vga_gfx_puts("PRESS KEY", 8, 18, 63);
-	vga_wait_key();
-}
-
-int main()
-{
-	char start_key;
-
-	vga_set_mode(VGA_MODE_TEXT_80x25);
-	vga_text_setcolor(15, 1);
-	vga_text_cls();
-	vga_text_gotoxy(0, 0);
-	vga_text_puts("PhotonX VGA Library Demo\r\n");
-	vga_text_setcolor(14, 1);
-	vga_text_puts("Whitepaper API: text + graphics\r\n");
-	vga_text_setcolor(15, 0);
-	vga_text_puts("Press N to cancel, any other key to start...\r\n");
-
-	vga_beep(1200, 80);
-	vga_beep(1400, 80);
-	start_key = getch();
-	if (start_key == 'N' || start_key == 'n')
-	{
-		vga_text_puts("\r\nCancelled.\r\n");
-		vga_beep(300, 160);
-		return 0;
-	}
-
-	vga_set_mode(VGA_MODE_320x200x256);
-	vga_gfx_setclscolor(0);
-	vga_gfx_cls();
-
-	vga_gfx_rect(10, 10, 309, 189, 12);
-	vga_gfx_line(10, 10, 309, 189, 10);
-	vga_gfx_line(309, 10, 10, 189, 10);
-	vga_gfx_circle(160, 100, 50, 14);
-	vga_gfx_puts("PhotonX VGA", 108, 96, 15);
-	vga_gfx_puts("Press any key", 104, 112, 11);
-
-	vga_wait_key();
-	red_lines_test();
-	green_lines_test();
-	blue_lines_test();
-	grid_test();
-	full_color_test();
-	math_spiral_test();
-
-	vga_set_mode(VGA_MODE_TEXT_80x25);
-	vga_text_setcolor(10, 0);
-	vga_text_cls();
-	vga_text_puts("Demo complete.\r\n");
-	vga_beep(1000, 120);
-	vga_beep(1400, 120);
-
-	return 0;
-}
diff --git a/systems/IBM-PC/PhotonX/demos/VGA.H b/systems/IBM-PC/PhotonX/demos/VGA.H
deleted file mode 100644
index a2ed438..0000000
--- a/systems/IBM-PC/PhotonX/demos/VGA.H
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef VGA_H
-#define VGA_H
-
-#include <dos.h>
-
-#define VGA_SEG 0xA000
-#define VGA_MODE_TEXT_80x25 0x03
-#define VGA_MODE_320x200x256 0x13
-#define VGA_MODE_640x480x16 0x12
-
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-
-extern unsigned char far *vga;
-
-void vga_set_mode(uint8_t mode);
-void vga_beep(int freq, int ms);
-void vga_wait_key(void);
-
-void vga_text_setcolor(uint8_t fg, uint8_t bg);
-void vga_text_gotoxy(uint8_t x, uint8_t y);
-void vga_text_putch(char c);
-void vga_text_puts(const char *str);
-void vga_text_cls(void);
-
-void vga_set_palette(uint8_t index, uint8_t r, uint8_t g, uint8_t b);
-void vga_gfx_setclscolor(uint8_t color);
-void vga_gfx_cls(void);
-void vga_gfx_putpixel(uint16_t x, uint16_t y, uint8_t color);
-void vga_gfx_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint8_t color);
-void vga_gfx_rect(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint8_t color);
-void vga_gfx_circle(uint16_t x, uint16_t y, uint16_t radius, uint8_t color);
-void vga_gfx_putch(char c, int x, int y, uint8_t color);
-void vga_gfx_puts(const char *str, int x, int y, uint8_t color);
-
-void set_mode(unsigned char mode);
-void beep(int freq, int ms);
-void set_palette(unsigned char index, unsigned char r, unsigned char g, unsigned char b);
-void clear_screen(unsigned char color);
-void put_pixel(int x, int y, unsigned char color);
-void wait_key(void);
-
-#endif
diff --git a/systems/IBM-PC/PhotonX/FONT.C b/systems/IBM-PC/PhotonX/src/FONT.C
similarity index 100%
rename from systems/IBM-PC/PhotonX/FONT.C
rename to systems/IBM-PC/PhotonX/src/FONT.C
diff --git a/systems/IBM-PC/PhotonX/VGA.C b/systems/IBM-PC/PhotonX/src/VGA.C
similarity index 90%
rename from systems/IBM-PC/PhotonX/VGA.C
rename to systems/IBM-PC/PhotonX/src/VGA.C
index d18f3f7..9364d4d 100644
--- a/systems/IBM-PC/PhotonX/VGA.C
+++ b/systems/IBM-PC/PhotonX/src/VGA.C
@@ -30,17 +30,6 @@ void vga_set_mode(uint8_t mode)
     int86(0x10, &regs, &regs);
 }
 
-void vga_beep(int freq, int ms)
-{
-    sound(freq);
-    delay(ms);
-    nosound();
-}
-
-void vga_wait_key(void)
-{
-    getch();
-}
 
 void vga_text_setcolor(uint8_t fg, uint8_t bg)
 {
@@ -224,11 +213,6 @@ void set_mode(unsigned char mode)
     vga_set_mode((uint8_t)mode);
 }
 
-void beep(int freq, int ms)
-{
-    vga_beep(freq, ms);
-}
-
 void set_palette(unsigned char index, unsigned char r, unsigned char g, unsigned char b)
 {
     vga_set_palette((uint8_t)index, (uint8_t)r, (uint8_t)g, (uint8_t)b);
@@ -248,11 +232,6 @@ void put_pixel(int x, int y, unsigned char color)
     vga_gfx_putpixel((uint16_t)x, (uint16_t)y, (uint8_t)color);
 }
 
-void wait_key(void)
-{
-    vga_wait_key();
-}
-
 void vga_reset(void)
 {
     vga_set_mode(VGA_MODE_TEXT_80x25);
diff --git a/systems/IBM-PC/PhotonX/VGA.H b/systems/IBM-PC/PhotonX/src/VGA.H
similarity index 90%
rename from systems/IBM-PC/PhotonX/VGA.H
rename to systems/IBM-PC/PhotonX/src/VGA.H
index 2e402f3..08336a9 100644
--- a/systems/IBM-PC/PhotonX/VGA.H
+++ b/systems/IBM-PC/PhotonX/src/VGA.H
@@ -14,8 +14,6 @@ extern unsigned char far *vga;
 
 /* Core mode + utility */
 void vga_set_mode(uint8_t mode);
-void vga_beep(int freq, int ms);
-void vga_wait_key(void);
 
 /* Text mode API (whitepaper-aligned) */
 void vga_text_setcolor(uint8_t fg, uint8_t bg);
@@ -37,10 +35,8 @@ void vga_gfx_puts(const char *str, int x, int y, uint8_t color);
 
 /* Compatibility names for existing code */
 void set_mode(unsigned char mode);
-void beep(int freq, int ms);
 void set_palette(unsigned char index, unsigned char r, unsigned char g, unsigned char b);
 void clear_screen(unsigned char color);
 void put_pixel(int x, int y, unsigned char color);
-void wait_key(void);
 
 #endif
\ No newline at end of file
diff --git a/systems/IBM-PC/PhotonX/demos/HELLO.C b/systems/IBM-PC/PhotonX/src/demos/HELLO.C
similarity index 100%
rename from systems/IBM-PC/PhotonX/demos/HELLO.C
rename to systems/IBM-PC/PhotonX/src/demos/HELLO.C
diff --git a/systems/IBM-PC/PhotonX/demos/REDSCRN.C b/systems/IBM-PC/PhotonX/src/demos/REDSCRN.C
similarity index 78%
rename from systems/IBM-PC/PhotonX/demos/REDSCRN.C
rename to systems/IBM-PC/PhotonX/src/demos/REDSCRN.C
index 7bcf455..5404fa8 100644
--- a/systems/IBM-PC/PhotonX/demos/REDSCRN.C
+++ b/systems/IBM-PC/PhotonX/src/demos/REDSCRN.C
@@ -17,8 +17,6 @@ int main()
         for (y = 0; y < 200; y++)
             vga_gfx_putpixel((uint16_t)x, (uint16_t)y, 63);
 
-    vga_gfx_puts("RED SCREEN", 120, 96, 0);
-    vga_gfx_puts("PRESS KEY", 124, 108, 0);
     vga_wait_key();
 
     vga_set_mode(VGA_MODE_TEXT_80x25);
[COMMIT 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.