summaryrefslogtreecommitdiff
path: root/ROMs/paint.c
diff options
context:
space:
mode:
authorMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-28 12:35:24 +1000
committerMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-28 12:35:24 +1000
commit7f96fc5e7f412a66d460dcaa82bbdbcaea08f360 (patch)
tree67ebd30bce45f8e5ffed73212f287b4152a5b71d /ROMs/paint.c
parent634681ce2bb36cd686943102a0f071cd6a09049f (diff)
everything is finally at peace
Diffstat (limited to 'ROMs/paint.c')
-rw-r--r--ROMs/paint.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/ROMs/paint.c b/ROMs/paint.c
new file mode 100644
index 0000000..443719a
--- /dev/null
+++ b/ROMs/paint.c
@@ -0,0 +1,55 @@
+int setPixel(int x, int y, int c)
+{
+ char* screenStart = 0x402F;
+ int i = (y * 128) + x;
+ screenStart[i] = c;
+}
+
+int setPixelIndex(int i, int c)
+{
+ char* screenStart = 0x402F;
+ screenStart[i] = c;
+}
+
+int clear(int c)
+{
+ char* screenStart = 0x402F;
+ char screenSize = 64 * 128;
+ for (int i = 0; i < screenSize; i++)
+ {
+ screenStart[i] = c;
+ }
+}
+
+int getKeyState(int scanCode)
+{
+ char* hid = 0x6033;
+ int index = scanCode / 8;
+ int bit = scanCode % 8;
+
+ int val = hid[index - 1];
+ return (val & (1 << bit)) != 0;
+}
+
+int main()
+{
+ int color = 0;
+ while (1)
+ {
+ int* hid = 0x602F;
+ int mouseIndex = hid[0];
+ int mouseState = hid[1];
+
+ if (mouseState & 1)
+ setPixelIndex(mouseIndex, (color % 3) + 1);
+
+ if (getKeyState(67))
+ clear(8);
+
+ if (getKeyState(65))
+ {
+ color++;
+ while (getKeyState(65)) { }
+ }
+ }
+} \ No newline at end of file