mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-30 20:58:05 +11:00
zasm: adjust parseLine success condition
De-couple "success" from "wrote something to (DE)" so that directive parsing can be considered successful without writing to (DE).
This commit is contained in:
parent
a00bc8cc4b
commit
28e1ba5e26
@ -9,9 +9,9 @@ main:
|
|||||||
ld bc, 0 ; C is our written bytes counter
|
ld bc, 0 ; C is our written bytes counter
|
||||||
.loop:
|
.loop:
|
||||||
call parseLine
|
call parseLine
|
||||||
or a ; is zero? stop
|
jr nz, .stop
|
||||||
jr z, .stop
|
ld a, c
|
||||||
add a, c
|
add a, ixl
|
||||||
ld c, a
|
ld c, a
|
||||||
call gotoNextLine
|
call gotoNextLine
|
||||||
jr nz, .stop ; error? stop
|
jr nz, .stop ; error? stop
|
||||||
@ -25,8 +25,9 @@ main:
|
|||||||
#include "directive.asm"
|
#include "directive.asm"
|
||||||
|
|
||||||
; Parse line in (HL), write the resulting opcode(s) in (DE) and returns the
|
; Parse line in (HL), write the resulting opcode(s) in (DE) and returns the
|
||||||
; number of written bytes in A. Advances HL where tokenization stopped and DE
|
; number of written bytes in IXL. Advances HL where tokenization stopped and DE
|
||||||
; to where we should write the next upcode.
|
; to where we should write the next upcode.
|
||||||
|
; Sets Z if parse was successful, unset if there was an error or EOF.
|
||||||
parseLine:
|
parseLine:
|
||||||
push bc
|
push bc
|
||||||
|
|
||||||
@ -51,9 +52,14 @@ parseLine:
|
|||||||
call copy
|
call copy
|
||||||
pop hl
|
pop hl
|
||||||
call JUMP_ADDDE
|
call JUMP_ADDDE
|
||||||
|
jr .success
|
||||||
|
.success:
|
||||||
|
ld ixl, a
|
||||||
|
xor a ; ensure Z
|
||||||
jr .end
|
jr .end
|
||||||
.error:
|
.error:
|
||||||
xor a
|
xor ixl
|
||||||
|
call JUMP_UNSETZ
|
||||||
.end:
|
.end:
|
||||||
pop bc
|
pop bc
|
||||||
ret
|
ret
|
||||||
|
Loading…
Reference in New Issue
Block a user