summaryrefslogtreecommitdiff
path: root/ROMs
diff options
context:
space:
mode:
authorMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-08 23:57:26 +1000
committerMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-08 23:57:26 +1000
commite62b66dd08ca445d1f7e5b802a503ad3ec83b2df (patch)
tree8cdb4ee09d1eefe096f51d6c9150dc361d08ccb9 /ROMs
parent33e1c5fc6e37549b4eba833ae7e534f9da250b10 (diff)
added branching to compiler and comment generation
Diffstat (limited to 'ROMs')
-rw-r--r--ROMs/hello_c.asm12
-rw-r--r--ROMs/hello_c.c4
-rw-r--r--ROMs/hello_c.q1bin22 -> 56 bytes
3 files changed, 10 insertions, 6 deletions
diff --git a/ROMs/hello_c.asm b/ROMs/hello_c.asm
index 8cdf58b..6eba849 100644
--- a/ROMs/hello_c.asm
+++ b/ROMs/hello_c.asm
@@ -1,8 +1,10 @@
_main:
- push 0
- mov 1, V1
- pop V0
- or V0, V1
- mov DX, V0
+ ; comment
+ mov 5, [$51FF] ; int a = 5
+ add [$51FF], 5 ; compute addition
+ mov AX, [$51FF] ; store back into left param
+ mov [$51FF], V0 ; return value
+ ret
+ mov 0, V0 ; fallback return 0
ret
diff --git a/ROMs/hello_c.c b/ROMs/hello_c.c
index 1f79a53..d0abdd5 100644
--- a/ROMs/hello_c.c
+++ b/ROMs/hello_c.c
@@ -1,4 +1,6 @@
int main()
{
- return 0 | 1;
+ //comment
+ int a = 5;
+ return a += 5;
} \ No newline at end of file
diff --git a/ROMs/hello_c.q1 b/ROMs/hello_c.q1
index 5e4d71e..0ca60e8 100644
--- a/ROMs/hello_c.q1
+++ b/ROMs/hello_c.q1
Binary files differ