From 0d7693a163998b7f0363fa6dff2cc7f7984bb15e Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 13 Dec 2019 09:56:23 -0500 Subject: [PATCH] core: remove writeHLinDE It wasn't used much so I inlined it. --- apps/zasm/instr.asm | 28 ++++++++++++++++------------ kernel/blockdev.asm | 28 +++++++--------------------- kernel/core.asm | 11 ----------- 3 files changed, 23 insertions(+), 44 deletions(-) diff --git a/apps/zasm/instr.asm b/apps/zasm/instr.asm index d25b808..85e0464 100644 --- a/apps/zasm/instr.asm +++ b/apps/zasm/instr.asm @@ -842,6 +842,7 @@ spitUpcode: ret ; Parse argument in (HL) and place it in (DE) +; DE is not preserved ; Sets Z on success, reset on error. processArg: call parseArg @@ -852,15 +853,20 @@ processArg: ; We don't use the space allocated to store those numbers in any other ; occasion, we store IX there unconditonally, LSB first. inc de - push hl - push ix \ pop hl - call writeHLinDE - pop hl - cp a ; ensure Z is set + ex (sp), ix ; (SP) is kept in IX and will be restored + ex (sp), hl ; old HL is on (SP) + ld a, l + ld (de), a + 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 .error: ld a, ERR_BAD_ARG - call unsetZ + or a ; unset Z ret ; Parse instruction specified in A (I_* const) with args in I/O and write @@ -880,14 +886,14 @@ parseInstruction: jr nz, .nomorearg ld de, INS_CURARG1 call processArg - jr nz, .error ; A is set to error + jr nz, .end ; A is set to error, Z is unset call readComma jr nz, .nomorearg call readWord jr nz, .badfmt ld de, INS_CURARG2 call processArg - jr nz, .error ; A is set to error + jr nz, .end ; A is set to error, Z is unset .nomorearg: ; 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 @@ -914,7 +920,8 @@ parseInstruction: jr nz, .loop ; No signature match ld a, ERR_BAD_ARG - jr .error + or a ; unset Z + jr .end .match: ; We have our matching instruction row. We're getting pretty near our ; goal here! @@ -923,9 +930,6 @@ parseInstruction: .badfmt: ; Z already unset ld a, ERR_BAD_FMT -.error: - ; A is set to error already - call unsetZ .end: pop de pop hl diff --git a/kernel/blockdev.asm b/kernel/blockdev.asm index b62cf12..95a7323 100644 --- a/kernel/blockdev.asm +++ b/kernel/blockdev.asm @@ -82,31 +82,17 @@ blkSet: push af push de push hl + push bc - ; Write GETC - push hl ; <| - call intoHL ; | - call writeHLinDE ; | - inc de ; | - inc de ; | - pop hl ; <| - inc hl - inc hl - ; Write PUTC - call intoHL - call writeHLinDE - inc de - inc de + ld bc, 4 + ldir ; Initialize pos + ld b, 4 xor a - ld (de), a - inc de - ld (de), a - inc de - ld (de), a - inc de - ld (de), a + ex de, hl + call fill + pop bc pop hl pop de pop af diff --git a/kernel/core.asm b/kernel/core.asm index 4305358..3091bcd 100644 --- a/kernel/core.asm +++ b/kernel/core.asm @@ -57,17 +57,6 @@ intoIX: pop ix 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 ; callIX callIXI: