summaryrefslogtreecommitdiff
path: root/ROMs
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
parentd87ab8af4c86a3fc6ee237444e372d87e536e3ef (diff)
chore: Initial commit
Diffstat (limited to 'ROMs')
-rw-r--r--ROMs/_old/hello_world.asm42
-rw-r--r--ROMs/_old/hello_world.q1bin2151 -> 0 bytes
-rw-r--r--ROMs/_old/manual.q1bin10 -> 0 bytes
-rw-r--r--ROMs/_old/write_display_direct.asm21
-rw-r--r--ROMs/_old/write_display_direct.q1bin51 -> 0 bytes
-rw-r--r--ROMs/font.binbin2048 -> 0 bytes
-rw-r--r--ROMs/hello_c.asm215
-rw-r--r--ROMs/hello_c.c55
-rw-r--r--ROMs/hello_c.q1bin2842 -> 0 bytes
-rw-r--r--ROMs/hid.c80
-rw-r--r--ROMs/logictest.asm140
-rw-r--r--ROMs/logictest.c37
-rw-r--r--ROMs/logictest.q1bin477 -> 0 bytes
-rw-r--r--ROMs/paint.asm264
-rw-r--r--ROMs/paint.c25
-rw-r--r--ROMs/paint.q1bin872 -> 0 bytes
-rw-r--r--ROMs/screen.c48
-rw-r--r--ROMs/std.c4
-rw-r--r--ROMs/typewriter.asm461
-rw-r--r--ROMs/typewriter.c75
-rw-r--r--ROMs/typewriter.q1bin3627 -> 0 bytes
21 files changed, 0 insertions, 1467 deletions
diff --git a/ROMs/_old/hello_world.asm b/ROMs/_old/hello_world.asm
deleted file mode 100644
index 1d812fb..0000000
--- a/ROMs/_old/hello_world.asm
+++ /dev/null
@@ -1,42 +0,0 @@
-.org $1FFF
-JMP program
-
-font:
- .include "font.bin"
-
-program:
- MOV 0, V0 ; Load character #12
- MOV 0, V1 ; X position
- MOV 0, V2 ; Y position
- MOV 1, V3 ; Color (1 = white)
- CALL write_char ; Call function to write character
- SUS
-
-write_char:
- ; V0: Character to write
- ; V1: X position
- ; V2: Y position
- ; V3: Color
- ; Write a character to the screen at (V1, V2) with color V3
-
- MUL V0, 64 ; V0 = Character * 64 (character size)
- MOV AX, V0 ; Store result back into character
-
- MUL V2, 64
- ADD AX, V1
- MOV AX, V4 ; V4 = X position + Y position * 64 (screen index)
-
- MOV V4, [$EFFF] ; Debug
-
- MOV [V0 + $2003], V5 ; Read character (1FFF + 4 since jump address is 1FFF)
- MOV V5, [$EFFF] ; Debug
- AND V5, $01 ; Mask to get first bit (color)
- MOV DX, V5
- MOV V5, [$EFFF] ; Debug
- MUL V5, V3 ; V5 = Character * Color (color index)
- MOV AX, V5 ; Store result into V5
-
- MOV V5, [$EFFF] ; Debug
-
- MOVB V5, [V4 + $402F] ; Write character to screen memory
- RET \ No newline at end of file
diff --git a/ROMs/_old/hello_world.q1 b/ROMs/_old/hello_world.q1
deleted file mode 100644
index fd66ffe..0000000
--- a/ROMs/_old/hello_world.q1
+++ /dev/null
Binary files differ
diff --git a/ROMs/_old/manual.q1 b/ROMs/_old/manual.q1
deleted file mode 100644
index b166c7a..0000000
--- a/ROMs/_old/manual.q1
+++ /dev/null
Binary files differ
diff --git a/ROMs/_old/write_display_direct.asm b/ROMs/_old/write_display_direct.asm
deleted file mode 100644
index 9fde417..0000000
--- a/ROMs/_old/write_display_direct.asm
+++ /dev/null
@@ -1,21 +0,0 @@
-.org $1FFF
-
-program:
-MOV $0000, V0
-MUL 32, 64 ; Set AX to 32 * 64
-MOV AX, V1 ; Copy AX to V1
-MOV 1, V2 ; Color value 1
-
-reset:
-MOV 0, V0
-INC V2 ; Increment color value
-
-draw:
-GT V0, V1 ; V0 > V1?
-BZ ; If number exceeds, branch to reset
-JMP reset
-
-MOVB V2, [V0+$402F] ; Set pixel at V0 to color 6
-INC V0 ; Increment V0
-
-JMP draw ; Repeat drawing \ No newline at end of file
diff --git a/ROMs/_old/write_display_direct.q1 b/ROMs/_old/write_display_direct.q1
deleted file mode 100644
index 4041649..0000000
--- a/ROMs/_old/write_display_direct.q1
+++ /dev/null
Binary files differ
diff --git a/ROMs/font.bin b/ROMs/font.bin
deleted file mode 100644
index 89f2af5..0000000
--- a/ROMs/font.bin
+++ /dev/null
Binary files differ
diff --git a/ROMs/hello_c.asm b/ROMs/hello_c.asm
deleted file mode 100644
index 16eb6bc..0000000
--- a/ROMs/hello_c.asm
+++ /dev/null
@@ -1,215 +0,0 @@
- jmp _main
- .include "font.bin"
-_drawChar_int_ch__int_x__int_y__int_color:; int drawChar(int ch, int x, int y, int color)
- pop V0 ; preserve function return address
- pop [$71FF] ; param int ch
- pop [$7201] ; param int x
- pop [$7203] ; param int y
- pop [$7205] ; param int color
- push V0 ; restore function return address
- ; adjust for jmp instruction
- push $1FFF ; left operand
- mov 2, V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- mov AX, [$7207] ; int fontStart = AX
- push [$71FF] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- mul V0, V1 ; compute multiplication
- mov AX, [$7209] ; int charStart = AX
- mov 0, [$720B] ; int yOff = 0
-_body_1:
- push [$720B] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- lt V0, V1 ; compute less than check
- not LX
- bz
- jmp _end_2 ; if for condition fails, jump to end
- push [$7207] ; store index obj
- push [$7209] ; left operand
- mov [$720B], V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- mov AX, V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- mov [V0], [$720D] ; int row = [V0]
- mov 0, [$720F] ; int xOff = 0
-_body_3:
- push [$720F] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- lt V0, V1 ; compute less than check
- not LX
- bz
- jmp _end_4 ; if for condition fails, jump to end
- push [$720D] ; left operand
- push 7 ; left operand
- mov [$720F], V1 ; right operand
- pop V0 ; get left operand back
- sub V0, V1 ; compute subtraction
- mov AX, V1 ; right operand
- pop V0 ; get left operand back
- shr V0, V1 ; compute right shift
- push DX ; left operand
- mov 1, V1 ; right operand
- pop V0 ; get left operand back
- and V0, V1 ; compute and
- mov DX, [$7211] ; int bit = DX
- bz [$7211] ; check ternary condition
- jmp _then_5
- mov [$7205], V0 ; store ternary fail result
- jmp _end_6
-_then_5:
- mov 0, V0 ; store ternary success result
-_end_6:
- mov V0, [$7213] ; int pix = V0
- push [$7213] ; arg int c
- push [$7203] ; left operand
- mov [$720B], V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- push AX ; arg int y
- push [$7201] ; left operand
- mov [$720F], V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- push AX ; arg int x
- call _setPixel_int_x__int_y__int_c; int setPixel(int x, int y, int c)
- push [$720F] ; i++
- inc [$720F]
- pop V0
- jmp _body_3
-_end_4:
- push [$720B] ; i++
- inc [$720B]
- pop V0
- jmp _body_1
-_end_2:
- mov 0, V0 ; fallback return 0
- ret
-
-_setPixel_int_x__int_y__int_c:; int setPixel(int x, int y, int c)
- pop V0 ; preserve function return address
- pop [$7215] ; param int x
- pop [$7217] ; param int y
- pop [$7219] ; param int c
- push V0 ; restore function return address
- mov $402F, [$721B] ; int screenStart = $402F
- push [$7217] ; left operand
- mov 128, V1 ; right operand
- pop V0 ; get left operand back
- mul V0, V1 ; compute multiplication
- push AX ; left operand
- mov [$7215], V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- mov AX, [$721D] ; int i = AX
- push [$721B] ; store index obj
- mov [$721D], V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- movb [$7219], [V0] ; [V0] = [$7219]
- mov 0, V0 ; fallback return 0
- ret
-
-_clear_int_c: ; int clear(int c)
- pop V0 ; preserve function return address
- pop [$721F] ; param int c
- push V0 ; restore function return address
- mov $402F, [$7221] ; int screenStart = $402F
- push 64 ; left operand
- mov 128, V1 ; right operand
- pop V0 ; get left operand back
- mul V0, V1 ; compute multiplication
- mov AX, [$7223] ; int screenSize = AX
- mov 0, [$7225] ; int i = 0
-_body_7:
- push [$7225] ; left operand
- mov [$7223], V1 ; right operand
- pop V0 ; get left operand back
- lt V0, V1 ; compute less than check
- not LX
- bz
- jmp _end_8 ; if for condition fails, jump to end
- push [$7221] ; store index obj
- mov [$7225], V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- movb [$721F], [V0] ; [V0] = [$721F]
- push [$7225] ; i++
- inc [$7225]
- pop V0
- jmp _body_7
-_end_8:
- mov 0, V0 ; fallback return 0
- ret
-
-_main: ; int main()
- mov 1, [$7227] ; int color = 1
- mov 72, [$722B]
- mov 69, [$722D]
- mov 76, [$722F]
- mov 76, [$7231]
- mov 79, [$7233]
- mov 32, [$7235]
- mov 87, [$7237]
- mov 79, [$7239]
- mov 82, [$723B]
- mov 76, [$723D]
- mov 68, [$723F]
- mov 33, [$7241]
- mov $722B, [$7229] ; int text = $722B
- mov 12, [$7243] ; int len = 12
- push 0 ; arg int c
- call _clear_int_c ; int clear(int c)
-_body_9:
- not 1
- bz
- jmp _end_10 ; if while condition fails, jump to end
- mov 0, [$7245] ; int i = 0
-_body_11:
- push [$7245] ; left operand
- mov [$7243], V1 ; right operand
- pop V0 ; get left operand back
- lt V0, V1 ; compute less than check
- not LX
- bz
- jmp _end_12 ; if for condition fails, jump to end
- push [$7229] ; store index obj
- mov [$7245], V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 2 ; multiply indexer by 2
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- mov [V0], [$7247] ; int ch = [V0]
- push [$7227] ; arg int color
- push 0 ; arg int y
- push [$7245] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- mul V0, V1 ; compute multiplication
- push AX ; arg int x
- push [$7247] ; arg int ch
- call _drawChar_int_ch__int_x__int_y__int_color; int drawChar(int ch, int x, int y, int color)
- push [$7245] ; i++
- inc [$7245]
- pop V0
- jmp _body_11
-_end_12:
- push [$7227] ; i++
- inc [$7227]
- pop V0
- jmp _body_9
-_end_10:
- mov 0, V0 ; fallback return 0
- ret
-
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
diff --git a/ROMs/hello_c.q1 b/ROMs/hello_c.q1
deleted file mode 100644
index 5e3248c..0000000
--- a/ROMs/hello_c.q1
+++ /dev/null
Binary files differ
diff --git a/ROMs/hid.c b/ROMs/hid.c
deleted file mode 100644
index 11730e9..0000000
--- a/ROMs/hid.c
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "std.c"
-
-#define BUS_HID_SK_START 0x6033
-#define BUS_HID_MS_INDEX 0x602F
-#define BUS_HID_MS_STATE 0x602F + 2
-
-#define SK_MAX 256
-#define SK_NEWLINE 13
-#define SK_BACKSPACE 8
-#define SK_SHIFT 160
-#define SK_A 65
-#define SK_B 66
-#define SK_C 67
-#define SK_D 68
-#define SK_E 69
-#define SK_F 70
-#define SK_G 71
-#define SK_H 72
-#define SK_I 73
-#define SK_J 74
-#define SK_K 75
-#define SK_L 76
-#define SK_M 77
-#define SK_N 78
-#define SK_O 79
-#define SK_P 80
-#define SK_Q 81
-#define SK_R 82
-#define SK_S 83
-#define SK_T 84
-#define SK_U 85
-#define SK_V 86
-#define SK_W 87
-#define SK_X 88
-#define SK_Y 89
-#define SK_Z 90
-
-#define MS_LEFT 1
-#define MS_RIGHT 2
-#define MS_MIDDLE 4
-
-int hid_getKeyState(int scanCode)
-{
- char* sk_table = BUS_HID_SK_START;
- int index = scanCode / 8;
- int bit = scanCode % 8;
-
- int val = sk_table[index - 1];
- return (val & (1 << bit)) != 0;
-}
-
-int hid_getPressedKey()
-{
- for (int sk = 0; sk < SK_MAX; sk++)
- {
- if (hid_getKeyState(sk) && sk != SK_SHIFT)
- return sk;
- }
- return 0;
-}
-
-int hid_waitForPressedKey()
-{
- while (true)
- {
- int sk = hid_getPressedKey();
- if (sk != 0)
- return sk;
- }
-}
-
-int hid_getMouseIndex()
-{
- return *(BUS_HID_MS_INDEX);
-}
-
-int hid_getMouseState()
-{
- return *(BUS_HID_MS_STATE);
-} \ No newline at end of file
diff --git a/ROMs/logictest.asm b/ROMs/logictest.asm
deleted file mode 100644
index 6a2aac1..0000000
--- a/ROMs/logictest.asm
+++ /dev/null
@@ -1,140 +0,0 @@
- jmp _main
-_screen_setPixel_int_x__int_y__int_c:; int screen_setPixel(int x, int y, int c)
- pop V0 ; preserve function return address
- pop [$71FF] ; param int x
- pop [$7201] ; param int y
- pop [$7203] ; param int c
- push V0 ; restore function return address
- mov $402F, [$7205] ; int screenStart = $402F
- push [$7201] ; left operand
- mov 128, V1 ; right operand
- pop V0 ; get left operand back
- mul V0, V1 ; compute multiplication
- push AX ; left operand
- mov [$71FF], V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- mov AX, [$7207] ; int i = AX
- push [$7205] ; store index obj
- mov [$7207], V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- movb [$7203], [V0] ; [V0] = [$7203]
- mov 0, V0 ; fallback return 0
- ret
-
-_screen_setPixel_int_i__int_c:; int screen_setPixel(int i, int c)
- pop V0 ; preserve function return address
- pop [$7209] ; param int i
- pop [$720B] ; param int c
- push V0 ; restore function return address
- mov $402F, [$720D] ; int screenStart = $402F
- push [$720D] ; store index obj
- mov [$7209], V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- movb [$720B], [V0] ; [V0] = [$720B]
- mov 0, V0 ; fallback return 0
- ret
-
-_screen_clear_int_c: ; int screen_clear(int c)
- pop V0 ; preserve function return address
- pop [$720F] ; param int c
- push V0 ; restore function return address
- mov $402F, [$7211] ; int screenStart = $402F
- mov 0, [$7213] ; int i = 0
-_body_1:
- push [$7213] ; left operand
- push 128 ; left operand
- mov 64, V1 ; right operand
- pop V0 ; get left operand back
- mul V0, V1 ; compute multiplication
- mov AX, V1 ; right operand
- pop V0 ; get left operand back
- lt V0, V1 ; compute less than check
- not LX
- bz
- jmp _end_2 ; if for condition fails, jump to end
- push [$7211] ; store index obj
- mov [$7213], V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- movb [$720F], [V0] ; [V0] = [$720F]
- push [$7213] ; i++
- inc [$7213]
- pop V0
- jmp _body_1
-_end_2:
- mov 0, V0 ; fallback return 0
- ret
-
-_main: ; int main()
- ; Test values
- mov 0, [$7215] ; int a = 0
- ; 170
- mov 0, [$7217] ; int b = 0
- ; 204
- mov 0, [$7219] ; int c = 0
- ; AND
- movb [$7215], [$7219] ; [$7219] = [$7215]
- push [$7219] ; left operand
- mov [$7217], V1 ; right operand
- pop V0 ; get left operand back
- and V0, V1 ; compute and
- ; expect 0b10001000 = 136
- mov $7100, V0 ; move pointer into register for dereference
- mov [V0], V0 ; move pointer into register for dereference
- ; OR
- movb [$7215], [$7219] ; [$7219] = [$7215]
- push [$7219] ; left operand
- mov [$7217], V1 ; right operand
- pop V0 ; get left operand back
- or V0, V1 ; compute or
- ; expect 0b11101110 = 238
- mov $7101, V0 ; move pointer into register for dereference
- mov [V0], V0 ; move pointer into register for dereference
- ; XOR
- movb [$7215], [$7219] ; [$7219] = [$7215]
- push [$7219] ; left operand
- mov [$7217], V1 ; right operand
- pop V0 ; get left operand back
- xor V0, V1 ; compute exclusive or
- ; expect 0b01100110 = 102
- mov $7102, V0 ; move pointer into register for dereference
- mov [V0], V0 ; move pointer into register for dereference
- ; NOT
- inv [$7215]
- movb DX, [$7219] ; [$7219] = DX
- ; expect 0b01010101 = 85
- mov $7103, V0 ; move pointer into register for dereference
- mov [V0], V0 ; move pointer into register for dereference
- ; SHL
- movb [$7215], [$7219] ; [$7219] = [$7215]
- push [$7219] ; left operand
- mov 2, V1 ; right operand
- pop V0 ; get left operand back
- shl V0, V1 ; compute left shift
- ; expect 0b10101000 = 168
- mov $7104, V0 ; move pointer into register for dereference
- mov [V0], V0 ; move pointer into register for dereference
- ; SHR
- movb [$7215], [$7219] ; [$7219] = [$7215]
- push [$7219] ; left operand
- mov 2, V1 ; right operand
- pop V0 ; get left operand back
- shr V0, V1 ; compute right shift
- ; expect 0b00101010 = 42
- mov $7105, V0 ; move pointer into register for dereference
- mov [V0], V0 ; move pointer into register for dereference
- ; Program ends cleanly
- mov 0, V0 ; return value
- ret
- mov 0, V0 ; fallback return 0
- ret
-
diff --git a/ROMs/logictest.c b/ROMs/logictest.c
deleted file mode 100644
index f2ef6d9..0000000
--- a/ROMs/logictest.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "std.c"
-#include "screen.c"
-
-int main()
-{
- // Test values
- char a = 0b10101010; // 170
- char b = 0b11001100; // 204
- char c;
-
- // AND
- c = a & b; // expect 0b10001000 = 136
- *((char*)0x7100) = c;
-
- // OR
- c = a | b; // expect 0b11101110 = 238
- *((char*)0x7101) = c;
-
- // XOR
- c = a ^ b; // expect 0b01100110 = 102
- *((char*)0x7102) = c;
-
- // NOT
- c = ~a; // expect 0b01010101 = 85
- *((char*)0x7103) = c;
-
- // SHL
- c = a << 2; // expect 0b10101000 = 168
- *((char*)0x7104) = c;
-
- // SHR
- c = a >> 2; // expect 0b00101010 = 42
- *((char*)0x7105) = c;
-
- // Program ends cleanly
- return 0;
-} \ No newline at end of file
diff --git a/ROMs/logictest.q1 b/ROMs/logictest.q1
deleted file mode 100644
index f68eb77..0000000
--- a/ROMs/logictest.q1
+++ /dev/null
Binary files differ
diff --git a/ROMs/paint.asm b/ROMs/paint.asm
deleted file mode 100644
index 9a853a4..0000000
--- a/ROMs/paint.asm
+++ /dev/null
@@ -1,264 +0,0 @@
- jmp _main
-_hid_getKeyState_int_scanCode:; int hid_getKeyState(int scanCode)
- pop V0 ; preserve function return address
- pop [$71FF] ; param int scanCode
- push V0 ; restore function return address
- mov $6033, [$7201] ; int sk_table = $6033
- push [$71FF] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- div V0, V1 ; compute division
- mov AX, [$7203] ; int index = AX
- push [$71FF] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- mod V0, V1 ; compute modulus
- mov AX, [$7205] ; int bit = AX
- push [$7201] ; store index obj
- push [$7203] ; left operand
- mov 1, V1 ; right operand
- pop V0 ; get left operand back
- sub V0, V1 ; compute subtraction
- mov AX, V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- mov [V0], [$7207] ; int val = [V0]
- push [$7207] ; left operand
- push 1 ; left operand
- mov [$7205], V1 ; right operand
- pop V0 ; get left operand back
- shl V0, V1 ; compute left shift
- mov DX, V1 ; right operand
- pop V0 ; get left operand back
- and V0, V1 ; compute and
- push DX ; left operand
- mov 0, V1 ; right operand
- pop V0 ; get left operand back
- cmp V0, V1 ; compute inequality check
- not
- mov LX, V0 ; return value
- ret
- mov 0, V0 ; fallback return 0
- ret
-
-_hid_getPressedKey: ; int hid_getPressedKey()
- mov 0, [$7209] ; int sk = 0
-_body_1:
- push [$7209] ; left operand
- mov 256, V1 ; right operand
- pop V0 ; get left operand back
- lt V0, V1 ; compute less than check
- not LX
- bz
- jmp _end_2 ; if for condition fails, jump to end
- push [$7209] ; arg int scanCode
- call _hid_getKeyState_int_scanCode; int hid_getKeyState(int scanCode)
- cmp V0, 0 ; logical and
- not
- bz
- jmp _clause_3
- mov 0, V0 ; first operand failed, store 0 and skip second
- jmp _end_4
-_clause_3:
- push [$7209] ; left operand
- mov 160, V1 ; right operand
- pop V0 ; get left operand back
- cmp V0, V1 ; compute inequality check
- not
- cmp LX, 0 ; compare result from second operand to 0
- not
- mov LX, V0 ; store second operand result
-_end_4:
- not V0
- bz ; check if condition
- jmp _end_5 ; if succeeds, continue, else jump to end
- mov [$7209], V0 ; return value
- ret
-_end_5:
- push [$7209] ; i++
- inc [$7209]
- pop V0
- jmp _body_1
-_end_2:
- mov 0, V0 ; return value
- ret
- mov 0, V0 ; fallback return 0
- ret
-
-_hid_waitForPressedKey: ; int hid_waitForPressedKey()
-_body_6:
- not 1
- bz
- jmp _end_7 ; if while condition fails, jump to end
- call _hid_getPressedKey ; int hid_getPressedKey()
- mov V0, [$720B] ; int sk = V0
- push [$720B] ; left operand
- mov 0, V1 ; right operand
- pop V0 ; get left operand back
- cmp V0, V1 ; compute inequality check
- not
- not LX
- bz ; check if condition
- jmp _end_8 ; if succeeds, continue, else jump to end
- mov [$720B], V0 ; return value
- ret
-_end_8:
- jmp _body_6
-_end_7:
- mov 0, V0 ; fallback return 0
- ret
-
-_hid_getMouseIndex: ; int hid_getMouseIndex()
- mov $602F, V0 ; move pointer into register for dereference
- mov [V0], V0 ; return value
- ret
- mov 0, V0 ; fallback return 0
- ret
-
-_hid_getMouseState: ; int hid_getMouseState()
- push $602F ; left operand
- mov 2, V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- mov AX, V0 ; move pointer into register for dereference
- mov [V0], V0 ; return value
- ret
- mov 0, V0 ; fallback return 0
- ret
-
-_screen_setPixel_int_x__int_y__int_c:; int screen_setPixel(int x, int y, int c)
- pop V0 ; preserve function return address
- pop [$720D] ; param int x
- pop [$720F] ; param int y
- pop [$7211] ; param int c
- push V0 ; restore function return address
- mov $402F, [$7213] ; int screenStart = $402F
- push [$720F] ; left operand
- mov 128, V1 ; right operand
- pop V0 ; get left operand back
- mul V0, V1 ; compute multiplication
- push AX ; left operand
- mov [$720D], V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- mov AX, [$7215] ; int i = AX
- push [$7213] ; store index obj
- mov [$7215], V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- movb [$7211], [V0] ; [V0] = [$7211]
- mov 0, V0 ; fallback return 0
- ret
-
-_screen_setPixel_int_i__int_c:; int screen_setPixel(int i, int c)
- pop V0 ; preserve function return address
- pop [$7217] ; param int i
- pop [$7219] ; param int c
- push V0 ; restore function return address
- mov $402F, [$721B] ; int screenStart = $402F
- push [$721B] ; store index obj
- mov [$7217], V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- movb [$7219], [V0] ; [V0] = [$7219]
- mov 0, V0 ; fallback return 0
- ret
-
-_screen_clear_int_c: ; int screen_clear(int c)
- pop V0 ; preserve function return address
- pop [$721D] ; param int c
- push V0 ; restore function return address
- mov $402F, [$721F] ; int screenStart = $402F
- mov 0, [$7221] ; int i = 0
-_body_9:
- push [$7221] ; left operand
- push 128 ; left operand
- mov 64, V1 ; right operand
- pop V0 ; get left operand back
- mul V0, V1 ; compute multiplication
- mov AX, V1 ; right operand
- pop V0 ; get left operand back
- lt V0, V1 ; compute less than check
- not LX
- bz
- jmp _end_10 ; if for condition fails, jump to end
- push [$721F] ; store index obj
- mov [$7221], V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- movb [$721D], [V0] ; [V0] = [$721D]
- push [$7221] ; i++
- inc [$7221]
- pop V0
- jmp _body_9
-_end_10:
- mov 0, V0 ; fallback return 0
- ret
-
-_main: ; int main()
- mov 0, [$7223] ; int color = 0
-_body_11:
- not 1
- bz
- jmp _end_12 ; if while condition fails, jump to end
- call _hid_getMouseIndex ; int hid_getMouseIndex()
- mov V0, [$7225] ; int mouseIndex = V0
- call _hid_getMouseState ; int hid_getMouseState()
- mov V0, [$7227] ; int mouseState = V0
- push [$7227] ; left operand
- mov 1, V1 ; right operand
- pop V0 ; get left operand back
- and V0, V1 ; compute and
- not DX
- bz ; check if condition
- jmp _end_13 ; if succeeds, continue, else jump to end
- push [$7223] ; left operand
- mov 3, V1 ; right operand
- pop V0 ; get left operand back
- mod V0, V1 ; compute modulus
- push AX ; left operand
- mov 1, V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- push AX ; arg int i
- push [$7225] ; arg int c
- call _screen_setPixel_int_i__int_c; int screen_setPixel(int i, int c)
-_end_13:
- push 67 ; arg int scanCode
- call _hid_getKeyState_int_scanCode; int hid_getKeyState(int scanCode)
- not V0
- bz ; check if condition
- jmp _end_14 ; if succeeds, continue, else jump to end
- push 8 ; arg int c
- call _screen_clear_int_c ; int screen_clear(int c)
-_end_14:
- push 65 ; arg int scanCode
- call _hid_getKeyState_int_scanCode; int hid_getKeyState(int scanCode)
- not V0
- bz ; check if condition
- jmp _end_15 ; if succeeds, continue, else jump to end
- push [$7223] ; i++
- inc [$7223]
- pop V0
-_body_16:
- push 65 ; arg int scanCode
- call _hid_getKeyState_int_scanCode; int hid_getKeyState(int scanCode)
- not V0
- bz
- jmp _end_17 ; if while condition fails, jump to end
- jmp _body_16
-_end_17:
-_end_15:
- jmp _body_11
-_end_12:
- mov 0, V0 ; fallback return 0
- ret
-
diff --git a/ROMs/paint.c b/ROMs/paint.c
deleted file mode 100644
index 71c478e..0000000
--- a/ROMs/paint.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include "std.c"
-#include "hid.c"
-#include "screen.c"
-
-int main()
-{
- int color = 0;
- while (true)
- {
- int mouseIndex = hid_getMouseIndex();
- int mouseState = hid_getMouseState();
-
- if (mouseState & MS_LEFT)
- screen_setPixel(mouseIndex, (color % 3) + 1);
-
- if (hid_getKeyState(SK_C))
- screen_clear(COLOR_BLACK);
-
- if (hid_getKeyState(SK_A))
- {
- color++;
- while (hid_getKeyState(SK_A)) { }
- }
- }
-} \ No newline at end of file
diff --git a/ROMs/paint.q1 b/ROMs/paint.q1
deleted file mode 100644
index ecf446d..0000000
--- a/ROMs/paint.q1
+++ /dev/null
Binary files differ
diff --git a/ROMs/screen.c b/ROMs/screen.c
deleted file mode 100644
index 0eff8c7..0000000
--- a/ROMs/screen.c
+++ /dev/null
@@ -1,48 +0,0 @@
-#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
diff --git a/ROMs/std.c b/ROMs/std.c
deleted file mode 100644
index aa0b85f..0000000
--- a/ROMs/std.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "std.c"
-
-#define true 1
-#define false 0 \ No newline at end of file
diff --git a/ROMs/typewriter.asm b/ROMs/typewriter.asm
deleted file mode 100644
index e9a5a4a..0000000
--- a/ROMs/typewriter.asm
+++ /dev/null
@@ -1,461 +0,0 @@
- jmp _main
- .include "font.bin"
-_screen_setPixel_int_x__int_y__int_c:; int screen_setPixel(int x, int y, int c)
- pop V0 ; preserve function return address
- pop [$71FF] ; param int x
- pop [$7201] ; param int y
- pop [$7203] ; param int c
- push V0 ; restore function return address
- mov $402F, [$7205] ; int screenStart = $402F
- push [$7201] ; left operand
- mov 128, V1 ; right operand
- pop V0 ; get left operand back
- mul V0, V1 ; compute multiplication
- push AX ; left operand
- mov [$71FF], V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- mov AX, [$7207] ; int i = AX
- push [$7205] ; store index obj
- mov [$7207], V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- movb [$7203], [V0] ; [V0] = [$7203]
- mov 0, V0 ; fallback return 0
- ret
-
-_screen_setPixel_int_i__int_c:; int screen_setPixel(int i, int c)
- pop V0 ; preserve function return address
- pop [$7209] ; param int i
- pop [$720B] ; param int c
- push V0 ; restore function return address
- mov $402F, [$720D] ; int screenStart = $402F
- push [$720D] ; store index obj
- mov [$7209], V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- movb [$720B], [V0] ; [V0] = [$720B]
- mov 0, V0 ; fallback return 0
- ret
-
-_screen_clear_int_c: ; int screen_clear(int c)
- pop V0 ; preserve function return address
- pop [$720F] ; param int c
- push V0 ; restore function return address
- mov $402F, [$7211] ; int screenStart = $402F
- mov 0, [$7213] ; int i = 0
-_body_1:
- push [$7213] ; left operand
- push 128 ; left operand
- mov 64, V1 ; right operand
- pop V0 ; get left operand back
- mul V0, V1 ; compute multiplication
- mov AX, V1 ; right operand
- pop V0 ; get left operand back
- lt V0, V1 ; compute less than check
- not LX
- bz
- jmp _end_2 ; if for condition fails, jump to end
- push [$7211] ; store index obj
- mov [$7213], V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- movb [$720F], [V0] ; [V0] = [$720F]
- push [$7213] ; i++
- inc [$7213]
- pop V0
- jmp _body_1
-_end_2:
- mov 0, V0 ; fallback return 0
- ret
-
-_hid_getKeyState_int_scanCode:; int hid_getKeyState(int scanCode)
- pop V0 ; preserve function return address
- pop [$7215] ; param int scanCode
- push V0 ; restore function return address
- mov $6033, [$7217] ; int sk_table = $6033
- push [$7215] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- div V0, V1 ; compute division
- mov AX, [$7219] ; int index = AX
- push [$7215] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- mod V0, V1 ; compute modulus
- mov AX, [$721B] ; int bit = AX
- push [$7217] ; store index obj
- push [$7219] ; left operand
- mov 1, V1 ; right operand
- pop V0 ; get left operand back
- sub V0, V1 ; compute subtraction
- mov AX, V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- mov [V0], [$721D] ; int val = [V0]
- push [$721D] ; left operand
- push 1 ; left operand
- mov [$721B], V1 ; right operand
- pop V0 ; get left operand back
- shl V0, V1 ; compute left shift
- mov DX, V1 ; right operand
- pop V0 ; get left operand back
- and V0, V1 ; compute and
- push DX ; left operand
- mov 0, V1 ; right operand
- pop V0 ; get left operand back
- cmp V0, V1 ; compute inequality check
- not
- mov LX, V0 ; return value
- ret
- mov 0, V0 ; fallback return 0
- ret
-
-_hid_getPressedKey: ; int hid_getPressedKey()
- mov 0, [$721F] ; int sk = 0
-_body_3:
- push [$721F] ; left operand
- mov 256, V1 ; right operand
- pop V0 ; get left operand back
- lt V0, V1 ; compute less than check
- not LX
- bz
- jmp _end_4 ; if for condition fails, jump to end
- push [$721F] ; arg int scanCode
- call _hid_getKeyState_int_scanCode; int hid_getKeyState(int scanCode)
- cmp V0, 0 ; logical and
- not
- bz
- jmp _clause_5
- mov 0, V0 ; first operand failed, store 0 and skip second
- jmp _end_6
-_clause_5:
- push [$721F] ; left operand
- mov 160, V1 ; right operand
- pop V0 ; get left operand back
- cmp V0, V1 ; compute inequality check
- not
- cmp LX, 0 ; compare result from second operand to 0
- not
- mov LX, V0 ; store second operand result
-_end_6:
- not V0
- bz ; check if condition
- jmp _end_7 ; if succeeds, continue, else jump to end
- mov [$721F], V0 ; return value
- ret
-_end_7:
- push [$721F] ; i++
- inc [$721F]
- pop V0
- jmp _body_3
-_end_4:
- mov 0, V0 ; return value
- ret
- mov 0, V0 ; fallback return 0
- ret
-
-_hid_waitForPressedKey: ; int hid_waitForPressedKey()
-_body_8:
- not 1
- bz
- jmp _end_9 ; if while condition fails, jump to end
- call _hid_getPressedKey ; int hid_getPressedKey()
- mov V0, [$7221] ; int sk = V0
- push [$7221] ; left operand
- mov 0, V1 ; right operand
- pop V0 ; get left operand back
- cmp V0, V1 ; compute inequality check
- not
- not LX
- bz ; check if condition
- jmp _end_10 ; if succeeds, continue, else jump to end
- mov [$7221], V0 ; return value
- ret
-_end_10:
- jmp _body_8
-_end_9:
- mov 0, V0 ; fallback return 0
- ret
-
-_hid_getMouseIndex: ; int hid_getMouseIndex()
- mov $602F, V0 ; move pointer into register for dereference
- mov [V0], V0 ; return value
- ret
- mov 0, V0 ; fallback return 0
- ret
-
-_hid_getMouseState: ; int hid_getMouseState()
- push $602F ; left operand
- mov 2, V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- mov AX, V0 ; move pointer into register for dereference
- mov [V0], V0 ; return value
- ret
- mov 0, V0 ; fallback return 0
- ret
-
-_drawChar_int_ch__int_x__int_y__int_color:; int drawChar(int ch, int x, int y, int color)
- pop V0 ; preserve function return address
- pop [$7223] ; param int ch
- pop [$7225] ; param int x
- pop [$7227] ; param int y
- pop [$7229] ; param int color
- push V0 ; restore function return address
- ; adjust for jmp instruction
- push $1FFF ; left operand
- mov 2, V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- mov AX, [$722B] ; int fontStart = AX
- push [$7223] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- mul V0, V1 ; compute multiplication
- mov AX, [$722D] ; int charStart = AX
- mov 0, [$722F] ; int yOff = 0
-_body_11:
- push [$722F] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- lt V0, V1 ; compute less than check
- not LX
- bz
- jmp _end_12 ; if for condition fails, jump to end
- push [$722B] ; store index obj
- push [$722D] ; left operand
- mov [$722F], V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- mov AX, V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 1 ; multiply indexer by 1
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- mov [V0], [$7231] ; int row = [V0]
- mov 0, [$7233] ; int xOff = 0
-_body_13:
- push [$7233] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- lt V0, V1 ; compute less than check
- not LX
- bz
- jmp _end_14 ; if for condition fails, jump to end
- push [$7231] ; left operand
- push 7 ; left operand
- mov [$7233], V1 ; right operand
- pop V0 ; get left operand back
- sub V0, V1 ; compute subtraction
- mov AX, V1 ; right operand
- pop V0 ; get left operand back
- shr V0, V1 ; compute right shift
- push DX ; left operand
- mov 1, V1 ; right operand
- pop V0 ; get left operand back
- and V0, V1 ; compute and
- mov DX, [$7235] ; int bit = DX
- bz [$7235] ; check ternary condition
- jmp _then_15
- mov [$7229], V0 ; store ternary fail result
- jmp _end_16
-_then_15:
- mov 8, V0 ; store ternary success result
-_end_16:
- mov V0, [$7237] ; int pix = V0
- push [$7237] ; arg int c
- push [$7227] ; left operand
- mov [$722F], V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- push AX ; arg int y
- push [$7225] ; left operand
- mov [$7233], V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- push AX ; arg int x
- call _screen_setPixel_int_x__int_y__int_c; int screen_setPixel(int x, int y, int c)
- push [$7233] ; i++
- inc [$7233]
- pop V0
- jmp _body_13
-_end_14:
- push [$722F] ; i++
- inc [$722F]
- pop V0
- jmp _body_11
-_end_12:
- mov 0, V0 ; fallback return 0
- ret
-
-_print_int*_text__int_len__int_x__int_y__int_color:; int print(int* text, int len, int x, int y, int color)
- pop V0 ; preserve function return address
- pop [$7239] ; param int* text
- pop [$723B] ; param int len
- pop [$723D] ; param int x
- pop [$723F] ; param int y
- pop [$7241] ; param int color
- push V0 ; restore function return address
- mov 0, [$7243] ; int i = 0
-_body_17:
- push [$7243] ; left operand
- mov [$723B], V1 ; right operand
- pop V0 ; get left operand back
- lt V0, V1 ; compute less than check
- not LX
- bz
- jmp _end_18 ; if for condition fails, jump to end
- push [$7239] ; store index obj
- mov [$7243], V1 ; store indexer
- pop V0 ; restore index obj
- mul V1, 2 ; multiply indexer by 2
- add AX, V0 ; add indexer and index obj
- mov AX, V0 ; move to general purpose register
- mov [V0], [$7245] ; int ch = [V0]
- push [$7241] ; arg int color
- push [$723F] ; arg int y
- push [$723D] ; left operand
- push [$7243] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- mul V0, V1 ; compute multiplication
- mov AX, V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- push AX ; arg int x
- push [$7245] ; arg int ch
- call _drawChar_int_ch__int_x__int_y__int_color; int drawChar(int ch, int x, int y, int color)
- push [$7243] ; i++
- inc [$7243]
- pop V0
- jmp _body_17
-_end_18:
- mov 0, V0 ; fallback return 0
- ret
-
-_main: ; int main()
- mov 0, [$7247] ; int x = 0
- mov 0, [$7249] ; int y = 0
-_body_19:
- not 1
- bz
- jmp _end_20 ; if while condition fails, jump to end
- push [$7247] ; left operand
- mov 128, V1 ; right operand
- pop V0 ; get left operand back
- cmp V0, V1 ; compute equality check
- bz
- jmp _end_21
- gt V0, V1
-_end_21:
- not LX
- bz ; check if condition
- jmp _end_22 ; if succeeds, continue, else jump to end
- mov 0, [$7247] ; [$7247] = 0
- push [$7249] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- push AX ; computation results
- pop V1 ; get computation results back
- mov V1, [$7249] ; store back into left param
-_end_22:
- push [$7249] ; left operand
- mov 64, V1 ; right operand
- pop V0 ; get left operand back
- cmp V0, V1 ; compute equality check
- bz
- jmp _end_23
- gt V0, V1
-_end_23:
- not LX
- bz ; check if condition
- jmp _end_24 ; if succeeds, continue, else jump to end
- mov 0, [$7247] ; [$7247] = 0
- mov 0, [$7249] ; [$7249] = 0
- push 8 ; arg int c
- call _screen_clear_int_c ; int screen_clear(int c)
-_end_24:
- call _hid_waitForPressedKey; int hid_waitForPressedKey()
- mov V0, [$724B] ; int sk = V0
-_body_25:
- push [$724B] ; arg int scanCode
- call _hid_getKeyState_int_scanCode; int hid_getKeyState(int scanCode)
- not V0
- bz
- jmp _end_26 ; if while condition fails, jump to end
- jmp _body_25
-_end_26:
- push [$724B] ; left operand
- mov 13, V1 ; right operand
- pop V0 ; get left operand back
- cmp V0, V1 ; compute equality check
- not LX
- bz ; check if condition
- jmp _end_27 ; if succeeds, continue, else jump to end
- push [$7249] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- push AX ; computation results
- pop V1 ; get computation results back
- mov V1, [$7249] ; store back into left param
- mov 0, [$7247] ; [$7247] = 0
- jmp _body_19 ; continue
-_end_27:
- push [$724B] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- cmp V0, V1 ; compute equality check
- not LX
- bz ; check if condition
- jmp _end_28 ; if succeeds, continue, else jump to end
- push [$7247] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- sub V0, V1 ; compute subtraction
- push AX ; computation results
- pop V1 ; get computation results back
- mov V1, [$7247] ; store back into left param
- push [$7247] ; left operand
- mov 0, V1 ; right operand
- pop V0 ; get left operand back
- lt V0, V1 ; compute less than check
- not LX
- bz ; check if condition
- jmp _end_29 ; if succeeds, continue, else jump to end
- mov 0, [$7247] ; [$7247] = 0
-_end_29:
- push 1 ; arg int color
- push [$7249] ; arg int y
- push [$7247] ; arg int x
- push 32 ; arg int ch
- call _drawChar_int_ch__int_x__int_y__int_color; int drawChar(int ch, int x, int y, int color)
- jmp _body_19 ; continue
-_end_28:
- push 1 ; arg int color
- push [$7249] ; arg int y
- push [$7247] ; arg int x
- push [$724B] ; arg int ch
- call _drawChar_int_ch__int_x__int_y__int_color; int drawChar(int ch, int x, int y, int color)
- push [$7247] ; left operand
- mov 8, V1 ; right operand
- pop V0 ; get left operand back
- add V0, V1 ; compute addition
- push AX ; computation results
- pop V1 ; get computation results back
- mov V1, [$7247] ; store back into left param
- jmp _body_19
-_end_20:
- mov 0, V0 ; fallback return 0
- ret
-
diff --git a/ROMs/typewriter.c b/ROMs/typewriter.c
deleted file mode 100644
index df8f3b7..0000000
--- a/ROMs/typewriter.c
+++ /dev/null
@@ -1,75 +0,0 @@
-#load "font.bin"
-#include "std.c"
-#include "screen.c"
-#include "hid.c"
-
-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 ? COLOR_BLACK : color;
- screen_setPixel(x + xOff, y + yOff, pix);
- }
- }
-}
-
-int print(int* text, int len, int x, int y, int color)
-{
- for (int i = 0; i < len; i++)
- {
- int ch = text[i];
- drawChar(ch, x + (i * 8), y, color);
- }
-}
-
-int main()
-{
- int x = 0;
- int y = 0;
- while (true)
- {
- if (x >= SCREEN_WIDTH)
- {
- x = 0;
- y += 8;
- }
-
- if (y >= SCREEN_HEIGHT)
- {
- x = 0;
- y = 0;
- screen_clear(COLOR_BLACK);
- }
-
- int sk = hid_waitForPressedKey();
- while (hid_getKeyState(sk)) { }
-
- if (sk == SK_NEWLINE)
- {
- y += 8;
- x = 0;
- continue;
- }
-
- if (sk == SK_BACKSPACE)
- {
- x -= 8;
- if (x < 0)
- x = 0;
- drawChar(' ', x, y, 1);
- continue;
- }
-
- drawChar(sk, x, y, COLOR_RED);
- x += 8;
- }
-} \ No newline at end of file
diff --git a/ROMs/typewriter.q1 b/ROMs/typewriter.q1
deleted file mode 100644
index 163bb6f..0000000
--- a/ROMs/typewriter.q1
+++ /dev/null
Binary files differ