diff options
| author | andromeda <andromeda@lenovo> | 2026-03-18 20:52:00 +0100 |
|---|---|---|
| committer | andromeda <andromeda@lenovo> | 2026-03-18 20:52:00 +0100 |
| commit | ad6a79d9376144cf6261f0d3c3558637ba3e8d19 (patch) | |
| tree | 5cbc8926c106b3a688c9f6f5859623db6694f677 | |
| parent | ac0a10fafd5745f5c50539a079340504f5e060ad (diff) | |
throw error with non-register operands
| -rw-r--r-- | twasm/asm/main.asm | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/twasm/asm/main.asm b/twasm/asm/main.asm index 9c8d483..29095c0 100644 --- a/twasm/asm/main.asm +++ b/twasm/asm/main.asm @@ -661,17 +661,27 @@ tokenise: mov cx, ax ; cx = length counter for safe keeping call evaluate_operand + ; dl = return code ; ax = register's token ID - pop rsi pop rdi ; rdi = first byte of operand - add di, cx ; rdi = last byte of operand - mov cx, ax ; cx = register's token ID for safe keeping + add di, cx ; rdi = last byte of operand + mov rcx, rax ; rcx = evaluate_operand's return value pop rax ; rax = number of tokens processed + ; operand is a register + ; cx = token ID + cmp dl, 0x00 + je .operand_register + + jmp .unexpected_operand + + .operand_register: mov [TOKEN_TABLE_ADDR + rax * TOKEN_TABLE_ENTRY_SIZE], cx inc rax ; another token processed + jmp .operand_break_continue + .operand_break_continue: mov byte [.expecting], E_COMMENT | E_NEWLINE | E_WHITESPACE | E_COMMA jmp .loop |
