core: remove writeHLinDE

It wasn't used much so I inlined it.
This commit is contained in:
Virgil Dupras 2019-12-13 09:56:23 -05:00
parent 1b8b113536
commit 0d7693a163
3 changed files with 23 additions and 44 deletions

View File

@ -842,6 +842,7 @@ spitUpcode:
ret ret
; Parse argument in (HL) and place it in (DE) ; Parse argument in (HL) and place it in (DE)
; DE is not preserved
; Sets Z on success, reset on error. ; Sets Z on success, reset on error.
processArg: processArg:
call parseArg call parseArg
@ -852,15 +853,20 @@ processArg:
; We don't use the space allocated to store those numbers in any other ; We don't use the space allocated to store those numbers in any other
; occasion, we store IX there unconditonally, LSB first. ; occasion, we store IX there unconditonally, LSB first.
inc de inc de
push hl ex (sp), ix ; (SP) is kept in IX and will be restored
push ix \ pop hl ex (sp), hl ; old HL is on (SP)
call writeHLinDE ld a, l
pop hl ld (de), a
cp a ; ensure Z is set inc de
ld a, h
ld (de), a
ex (sp), hl ; restore old HL from (SP)
ex (sp), ix ; restore old (SP) from IX
cp a ; ensure Z
ret ret
.error: .error:
ld a, ERR_BAD_ARG ld a, ERR_BAD_ARG
call unsetZ or a ; unset Z
ret ret
; Parse instruction specified in A (I_* const) with args in I/O and write ; Parse instruction specified in A (I_* const) with args in I/O and write
@ -880,14 +886,14 @@ parseInstruction:
jr nz, .nomorearg jr nz, .nomorearg
ld de, INS_CURARG1 ld de, INS_CURARG1
call processArg call processArg
jr nz, .error ; A is set to error jr nz, .end ; A is set to error, Z is unset
call readComma call readComma
jr nz, .nomorearg jr nz, .nomorearg
call readWord call readWord
jr nz, .badfmt jr nz, .badfmt
ld de, INS_CURARG2 ld de, INS_CURARG2
call processArg call processArg
jr nz, .error ; A is set to error jr nz, .end ; A is set to error, Z is unset
.nomorearg: .nomorearg:
; Parsing done, no error, let's move forward to instr row matching! ; Parsing done, no error, let's move forward to instr row matching!
; To speed up things a little, we use a poor man's indexing. Full ; To speed up things a little, we use a poor man's indexing. Full
@ -914,7 +920,8 @@ parseInstruction:
jr nz, .loop jr nz, .loop
; No signature match ; No signature match
ld a, ERR_BAD_ARG ld a, ERR_BAD_ARG
jr .error or a ; unset Z
jr .end
.match: .match:
; We have our matching instruction row. We're getting pretty near our ; We have our matching instruction row. We're getting pretty near our
; goal here! ; goal here!
@ -923,9 +930,6 @@ parseInstruction:
.badfmt: .badfmt:
; Z already unset ; Z already unset
ld a, ERR_BAD_FMT ld a, ERR_BAD_FMT
.error:
; A is set to error already
call unsetZ
.end: .end:
pop de pop de
pop hl pop hl

View File

@ -82,31 +82,17 @@ blkSet:
push af push af
push de push de
push hl push hl
push bc
; Write GETC ld bc, 4
push hl ; <| ldir
call intoHL ; |
call writeHLinDE ; |
inc de ; |
inc de ; |
pop hl ; <|
inc hl
inc hl
; Write PUTC
call intoHL
call writeHLinDE
inc de
inc de
; Initialize pos ; Initialize pos
ld b, 4
xor a xor a
ld (de), a ex de, hl
inc de call fill
ld (de), a
inc de
ld (de), a
inc de
ld (de), a
pop bc
pop hl pop hl
pop de pop de
pop af pop af

View File

@ -57,17 +57,6 @@ intoIX:
pop ix pop ix
ret ret
; Write the contents of HL in (DE)
; de and hl are preserved, so no pushing/popping necessary
writeHLinDE:
ex de, hl
ld (hl), e
inc hl
ld (hl), d
dec hl
ex de, hl
ret
; Call the method (IX) is a pointer to. In other words, call intoIX before ; Call the method (IX) is a pointer to. In other words, call intoIX before
; callIX ; callIX
callIXI: callIXI: