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

zasm: allow leading whitespace in parsed lines

This commit is contained in:
Virgil Dupras 2019-04-30 16:08:21 -04:00
parent 57c3dfece8
commit eb5c974573
2 changed files with 5 additions and 6 deletions

View File

@ -0,0 +1,2 @@
add a, b
inc a

View File

@ -18,6 +18,7 @@ tokenize:
ld (tokArg1), a ld (tokArg1), a
ld (tokArg2), a ld (tokArg2), a
ld de, tokInstr ld de, tokInstr
call toWord
ld a, 4 ld a, 4
call readWord call readWord
call toWord call toWord
@ -105,14 +106,10 @@ toWord:
inc hl inc hl
jr .loop jr .loop
.error: .error:
; we need the Z flag to be unset and it is set now. Let's CP with call JUMP_UNSETZ
; something it can't be equal to, something not a line end.
cp 'a' ; Z flag unset
ret ret
.success: .success:
; We need the Z flag to be set and it is unset. Let's compare it with xor a ; ensure Z
; itself to return a set Z
cp a
ret ret
; Advance HL to the beginning of the next line, that is, right after the next ; Advance HL to the beginning of the next line, that is, right after the next