1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 18:48:07 +11:00

zasm: move token variables from tok.asm into main.asm

This commit is contained in:
Virgil Dupras 2019-04-30 17:04:42 -04:00
parent a7635cb1ea
commit 79b5c701f6
2 changed files with 27 additions and 28 deletions

View File

@ -24,9 +24,16 @@ main:
; to where we should write the next upcode.
parseLine:
push bc
call gotoNextNotBlankLine
push de
ld de, tokInstr
call tokenize
jr nz, .error
ld de, tokArg1
call tokenizeInstrArg
ld de, tokArg2
call tokenizeInstrArg
pop de
call parseTokens
or a ; is zero?
jr z, .error
@ -47,3 +54,13 @@ parseLine:
#include "util.asm"
#include "tok.asm"
#include "instr.asm"
; *** Variables ***
tokInstr:
.fill 5
tokArg1:
.fill 9
tokArg2:
.fill 9

View File

@ -6,33 +6,24 @@
; JUMP_UPCASE
; *** Code ***
; Parse line in (HL) and place each element in tokInstr, tokArg1, tokArg2. Those
; values are null-terminated and empty if not present. All letters are
; Parse line in (HL) and read the next token in (DE). For now, it only supports
; instructions. Arguments must be tokenized with the appropriate specialized
; routine. Values are null-terminated and empty if not present. All letters are
; uppercased.
; Sets Z on success, unsets it on error. Blank line is not an error.
; (as of now, we don't have any error condition. We always succeed)
tokenize:
push de
xor a
ld (tokInstr), a
ld (tokArg1), a
ld (tokArg2), a
ld de, tokInstr
ld (de), a
call toWord
ld a, 4
call readWord
ret
tokenizeInstrArg:
xor a
ld (de), a
call toWord
jr nz, .end
ld de, tokArg1
ld a, 8
call readWord
call toWord
jr nz, .end
ld de, tokArg2
call readWord
.end:
xor a ; ensure Z
pop de
ret
; Sets Z is A is ';', CR, LF, or null.
@ -156,12 +147,3 @@ gotoNextNotBlankLine:
ret nz
jr gotoNextNotBlankLine
; *** Variables ***
tokInstr:
.fill 5
tokArg1:
.fill 9
tokArg2:
.fill 9