From c1f02faf5cbb522f092b6e9f3c564f5327baa8d1 Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Sat, 15 Aug 2020 13:43:19 +0300 Subject: [PATCH] added Einar Saukas' optimisation to disasm, cut 2 bytes --- disz80.zas | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/disz80.zas b/disz80.zas index e6a5ad9..9ded2a7 100644 --- a/disz80.zas +++ b/disz80.zas @@ -16,6 +16,8 @@ CHROP_RET: ret DISASM_USE_HEX_PREFIX equ 1 +; Einar Saukas' optimisation, cut 2 bytes +DISASM_EINAR_OPTIMISATION equ 1 ; ==================== ; DIS-Z80 was published in the SUBSET column of Personal Computer World 1987. @@ -34,6 +36,7 @@ DISASM_USE_HEX_PREFIX equ 1 ; ; k8: sadly, i had to add some mode code, so it is 1101 bytes now ; (including `EMIT_CB` variable) +; or 1099 bytes with Einar's optimisation ;-) ; ; IN: ; DE: address to disasm from @@ -722,17 +725,28 @@ $ENDIF ;**************** +$IF DISASM_EINAR_OPTIMISATION +SKIP: + bit 7,(hl) + inc hl + jr z,SKIP + dec a XTRACT: or a - jr z,COPY + jr nz,SKIP +$ELSE + +XTRACT: + or a + jr z,COPY SKIP: bit 7,(hl) inc hl jr z,SKIP - dec a jr nz,SKIP +$ENDIF COPY: ld a,(hl) -- 2.11.4.GIT