summaryrefslogtreecommitdiff
path: root/ROMs/hello_c.c
diff options
context:
space:
mode:
authorMelodi <62381002+Melodi17@users.noreply.github.com>2026-03-17 20:49:22 +1000
committerMelodi <62381002+Melodi17@users.noreply.github.com>2026-03-17 20:49:22 +1000
commit18868128e18d38b706e7df14e8e683e1a9739c17 (patch)
tree6f0e0e5eee646f10cbad9c0c89c24d330bc58cc6 /ROMs/hello_c.c
parentd87ab8af4c86a3fc6ee237444e372d87e536e3ef (diff)
chore: Initial commit
Diffstat (limited to 'ROMs/hello_c.c')
-rw-r--r--ROMs/hello_c.c55
1 files changed, 0 insertions, 55 deletions
diff --git a/ROMs/hello_c.c b/ROMs/hello_c.c
deleted file mode 100644
index 6be9385..0000000
--- a/ROMs/hello_c.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#load "font.bin"
-
-int drawChar(int ch, int x, int y, int color)
-{
- // adjust for jmp instruction
- char* fontStart = 0x1FFF + 2;
- int charStart = ch * 8;
-
- for (int yOff = 0; yOff < 8; yOff++)
- {
- int row = fontStart[charStart + yOff];
-
- for (int xOff = 0; xOff < 8; xOff++)
- {
- int bit = (row >> (7 - xOff)) & 1;
- int pix = bit ? 0 : color;
- setPixel(x + xOff, y + yOff, pix);
- }
- }
-}
-
-int setPixel(int x, int y, int c)
-{
- char* screenStart = 0x402F;
- int i = (y * 128) + x;
- 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 main()
-{
- int color = 1;
- int* text = "HELLO WORLD!";
- int len = 12;
-
- clear(0);
- while (1)
- {
- for (int i = 0; i < len; i++)
- {
- int ch = text[i];
- drawChar(ch, i * 8, 0, color);
- }
- color++;
- }
-} \ No newline at end of file