add warn print, clean up a little

This commit is contained in:
andromeda
2026-03-12 14:26:38 +01:00
parent 9e68a6bb6e
commit 1b93cab4f6
2 changed files with 12 additions and 4 deletions

BIN
twasm/.bootle/disk Normal file

Binary file not shown.

View File

@@ -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