From 1b93cab4f6d78d6caa30d1cdc360dab398e73ebb Mon Sep 17 00:00:00 2001 From: andromeda Date: Thu, 12 Mar 2026 14:26:38 +0100 Subject: add warn print, clean up a little --- twasm/asm/main.asm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'twasm/asm') 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 -- cgit v1.3.1