finally change .gitignore, correctly handle register operands
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
result*
|
result*
|
||||||
|
.bootle*
|
||||||
|
|||||||
Binary file not shown.
@@ -635,6 +635,10 @@ tokenise:
|
|||||||
test byte [.expecting], E_OPERAND ; make sure an operand was expected
|
test byte [.expecting], E_OPERAND ; make sure an operand was expected
|
||||||
jz .unexpected_operand ; if not, error
|
jz .unexpected_operand ; if not, error
|
||||||
|
|
||||||
|
push rax
|
||||||
|
push rdi
|
||||||
|
xor eax, eax ; rax = length of operand
|
||||||
|
|
||||||
.operand_loop:
|
.operand_loop:
|
||||||
mov dl, [rdi]
|
mov dl, [rdi]
|
||||||
|
|
||||||
@@ -645,10 +649,29 @@ tokenise:
|
|||||||
cmp dl, 0x00
|
cmp dl, 0x00
|
||||||
je .operand_break
|
je .operand_break
|
||||||
|
|
||||||
inc rdi
|
inc rax ; inc length counter
|
||||||
|
inc rdi ; inc byte pointer
|
||||||
jmp .operand_loop
|
jmp .operand_loop
|
||||||
|
|
||||||
.operand_break:
|
.operand_break:
|
||||||
|
pop rdi ; rdi = first byte of operand
|
||||||
|
push rdi
|
||||||
|
push rsi
|
||||||
|
mov rsi, rax ; rsi = length of operand in bytes
|
||||||
|
|
||||||
|
mov cx, ax ; cx = length counter for safe keeping
|
||||||
|
call evaluate_operand
|
||||||
|
; 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
|
||||||
|
pop rax ; rax = number of tokens processed
|
||||||
|
|
||||||
|
mov [TOKEN_TABLE_ADDR + rax * TOKEN_TABLE_ENTRY_SIZE], cx
|
||||||
|
inc rax ; another token processed
|
||||||
|
|
||||||
mov byte [.expecting], E_COMMENT | E_NEWLINE | E_WHITESPACE | E_COMMA
|
mov byte [.expecting], E_COMMENT | E_NEWLINE | E_WHITESPACE | E_COMMA
|
||||||
jmp .loop
|
jmp .loop
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user