zasm: make instr unt write directly to ioPutC

Couldn't get rid of instrUpcode though, too complicated.
This commit is contained in:
Virgil Dupras 2019-05-17 15:35:49 -04:00
parent 26d6dd1912
commit b0318f4891
2 changed files with 16 additions and 22 deletions

View File

@ -381,7 +381,7 @@ handleJPIXY:
ld c, 2
ret
.error:
xor c
ld c, 0
ret
; Handle the first argument of BIT. Sets Z if first argument is valid, unset it
@ -394,7 +394,7 @@ handleBIT:
cp a ; ensure Z
ret
.error:
xor c
ld c, 0
call unsetZ
ret
@ -733,8 +733,8 @@ processArg:
ret
; Parse instruction specified in A (I_* const) with args in I/O and write
; resulting opcode(s) in (instrUpcode). Returns the number of bytes written in
; A.
; resulting opcode(s) in I/O.
; Sets Z on success.
parseInstruction:
push bc
push hl
@ -775,9 +775,19 @@ parseInstruction:
; We have our matching instruction row. We're getting pretty near our
; goal here!
call getUpcode
or a ; is zero?
jr z, .error
ld b, a ; save output byte count
ld hl, instrUpcode
.loopWrite:
ld a, (hl)
call ioPutC
inc hl
djnz .loopWrite
cp a ; ensure Z
jr .end
.error:
xor a
call unsetZ
.end:
pop de
pop hl

View File

@ -150,23 +150,7 @@ parseLine:
_parseInstr:
ld a, c ; I_*
call parseInstruction
or a ; is zero?
jr z, .error
ld b, a ; save output byte count
ld hl, instrUpcode
.loopInstr:
ld a, (hl)
call ioPutC
inc hl
djnz .loopInstr
; continue to success
.success:
xor a ; ensure Z
ret
.error:
call unsetZ
ret
jp parseInstruction
_parseDirec:
ld a, c ; D_*