summaryrefslogtreecommitdiff
path: root/ROMs/hello_c.asm
diff options
context:
space:
mode:
authorMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-09 00:16:57 +1000
committerMelodi <62381002+Melodi17@users.noreply.github.com>2025-08-09 00:16:57 +1000
commitd36d51429d604f0ab3b2076c4c05e28ebf9b52c5 (patch)
tree9a3755684359aa041bf391f4ef5d3f30837a2271 /ROMs/hello_c.asm
parente62b66dd08ca445d1f7e5b802a503ad3ec83b2df (diff)
updated block syntax and removed body grammar, fixed issue with if requiring an else branch
Diffstat (limited to 'ROMs/hello_c.asm')
-rw-r--r--ROMs/hello_c.asm14
1 files changed, 11 insertions, 3 deletions
diff --git a/ROMs/hello_c.asm b/ROMs/hello_c.asm
index 6eba849..e06d4e0 100644
--- a/ROMs/hello_c.asm
+++ b/ROMs/hello_c.asm
@@ -1,9 +1,17 @@
_main:
; 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
+ push [$51FF] ; left operand
+ mov 5, V1 ; right operand
+ pop V0 ; get left operand back
+ cmp V0, V1 ; compute equality check
+ bz LX ; check if condition
+ not
+ jmp _end_1 ; if succeeds, continue, else jump to end
+ mov 99, V0 ; return value
+ ret
+_end_1:
+ mov 0, V0 ; return value
ret
mov 0, V0 ; fallback return 0
ret