diff options
| author | Melodi <62381002+Melodi17@users.noreply.github.com> | 2025-08-28 12:35:24 +1000 |
|---|---|---|
| committer | Melodi <62381002+Melodi17@users.noreply.github.com> | 2025-08-28 12:35:24 +1000 |
| commit | 7f96fc5e7f412a66d460dcaa82bbdbcaea08f360 (patch) | |
| tree | 67ebd30bce45f8e5ffed73212f287b4152a5b71d /ROMs/paint.c | |
| parent | 634681ce2bb36cd686943102a0f071cd6a09049f (diff) | |
everything is finally at peace
Diffstat (limited to 'ROMs/paint.c')
| -rw-r--r-- | ROMs/paint.c | 55 |
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 |
