summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandromeda <andromeda@lenovo>2026-03-12 14:26:38 +0100
committerandromeda <andromeda@lenovo>2026-03-12 14:26:38 +0100
commit1b93cab4f6d78d6caa30d1cdc360dab398e73ebb (patch)
treedfeaf93bdabf25676c4b0fbcc7246613074d8148
parent9e68a6bb6ef295b6d0f721d1da42842706313391 (diff)
add warn print, clean up a little
-rw-r--r--twasm/.bootle/diskbin0 -> 1474560 bytes
-rw-r--r--twasm/asm/main.asm16
2 files changed, 12 insertions, 4 deletions
diff --git a/twasm/.bootle/disk b/twasm/.bootle/disk
new file mode 100644
index 0000000..189ce17
--- /dev/null
+++ b/twasm/.bootle/disk
Binary files differ
diff --git a/twasm/asm/main.asm b/twasm/asm/main.asm
index 8cab49e..f6828a9 100644
--- a/twasm/asm/main.asm
+++ b/twasm/asm/main.asm
@@ -120,7 +120,7 @@ assemble:
; di = next tte
call get_opcode
; al = opcode
- mov [.pending_operator_opcode], al ; save it fttb
+ mov [.pending_operator_opcode], al ; save opcode fttb
pop rdi
pop rax ; from start of label .operator
@@ -142,7 +142,11 @@ assemble:
; of 2 args, it could also be the
; last of 1
- ; otherwise, quietly discard the token, reset things, and keep going :/
+ ; otherwise, discard the token, reset things, and keep going :/
+ push rsi
+ mov rsi, .warn_unexpected_register
+ call print.warn
+ pop rsi
call .reset_state
jmp .continue_register
@@ -192,6 +196,10 @@ assemble:
.break:
ret
+ ; constants
+
+ .warn_unexpected_register db "ignoring unexpected register", 0x0A, 0x00
+
; procedures
; al = byte to write
@@ -212,11 +220,11 @@ assemble:
ret
.reset_state:
- ; I don't actually know if these `word` and `byte` directives are needed
+ ; I don't actually know if these `word` directives are needed
; TODO check that. I think they are, becasue Nasm doesn't record the size
; of labels?
mov word [.pending_operator_opcode], UNRECOGNISED_TOKEN_ID
- mov byte [.pending_operator_num_args], 0x00
+ mov [.pending_operator_num_args], 0x00
mov word [.first_argument], UNRECOGNISED_TOKEN_ID
ret