summaryrefslogtreecommitdiff
path: root/ROMs/screen.c
diff options
context:
space:
mode:
authorMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-28 22:30:02 +1000
committerMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-28 22:30:02 +1000
commit5d012f16b2a0200087afe9dffc906046d258b3b8 (patch)
treead7a8cee368d1b83e08df13243678a34d34c6aae /ROMs/screen.c
parent76cea79a46d42f8f59503d3bb421f0d298da66cb (diff)
seperated modules out
Diffstat (limited to 'ROMs/screen.c')
-rw-r--r--ROMs/screen.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/ROMs/screen.c b/ROMs/screen.c
new file mode 100644
index 0000000..0eff8c7
--- /dev/null
+++ b/ROMs/screen.c
@@ -0,0 +1,48 @@
+#include "std.c"
+
+#define SCREEN_WIDTH 128
+#define SCREEN_HEIGHT 64
+#define SCREEN_MAX 128 * 64
+
+#define COLOR_TRANSPARENT 0
+#define COLOR_RED 1
+#define COLOR_GREEN 2
+#define COLOR_BLUE 3
+#define COLOR_YELLOW 4
+#define COLOR_CYAN 5
+#define COLOR_MAGENTA 6
+#define COLOR_WHITE 7
+#define COLOR_BLACK 8
+#define COLOR_GRAY 9
+#define COLOR_ORANGE 10
+#define COLOR_PURPLE 11
+#define COLOR_BROWN 12
+#define COLOR_LIGHTGRAY 13
+#define COLOR_DARKGRAY 14
+#define COLOR_LIGHTBLUE 15
+#define COLOR_LIGHTGREEN 16
+
+#define BUS_SCREEN_PALETTE_START 0x3FFF
+#define BUS_SCREEN_PIXELS_START 0x402F
+
+int screen_setPixel(int x, int y, int c)
+{
+ char* screenStart = BUS_SCREEN_PIXELS_START;
+ int i = (y * SCREEN_WIDTH) + x;
+ screenStart[i] = c;
+}
+
+int screen_setPixel(int i, int c)
+{
+ char* screenStart = BUS_SCREEN_PIXELS_START;
+ screenStart[i] = c;
+}
+
+int screen_clear(int c)
+{
+ char* screenStart = BUS_SCREEN_PIXELS_START;
+ for (int i = 0; i < SCREEN_MAX; i++)
+ {
+ screenStart[i] = c;
+ }
+} \ No newline at end of file