summaryrefslogtreecommitdiff
path: root/ROMs/lib.c
diff options
context:
space:
mode:
authorMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-28 14:44:51 +1000
committerMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-28 14:44:51 +1000
commitcf7e621c104cb4aea801392585d2dcc9335bc013 (patch)
treeee4aef401c399995968afe217d06557587707c51 /ROMs/lib.c
parent7f96fc5e7f412a66d460dcaa82bbdbcaea08f360 (diff)
added preprocessor (wip)
Diffstat (limited to 'ROMs/lib.c')
-rw-r--r--ROMs/lib.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/ROMs/lib.c b/ROMs/lib.c
new file mode 100644
index 0000000..32378c0
--- /dev/null
+++ b/ROMs/lib.c
@@ -0,0 +1,42 @@
+int setPixel(int x, int y, int c)
+{
+ char* screenStart = 0x402F;
+ int i = (y * 128) + x;
+ screenStart[i] = c;
+}
+
+int setPixel(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 getMouseIndex()
+{
+ return *(0x602F);
+}
+
+int getMouseState()
+{
+ return *(0x602F + 2);
+} \ No newline at end of file