gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 05acfe9c3fa4b4100c554bec9fd0f8549b11ce70 parent 844c3b8cd003759af0ade639004a9ee375353913 Author: toxa <untoxa@mail.ru> Date: Tue, 3 Nov 2020 14:15:03 +0300 MUL8 macro, minor optimizations to mul.s Diffstat:
| M | gbdk-lib/libc/asm/gbz80/mul.s | 8 | ++++---- |
| M | gbdk-lib/libc/gb/global.s | 15 | +++++++++++++++ |
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/gbdk-lib/libc/asm/gbz80/mul.s b/gbdk-lib/libc/asm/gbz80/mul.s @@ -79,7 +79,7 @@ signexte: sbc a,a ld d,a - jp .mul16 + jr .mul16 __muluchar: ld hl,#2 @@ -95,7 +95,7 @@ __muluchar: ld d,a ld b,a - jp .mul16 + jr .mul16 __mulint: ld hl,#2 @@ -133,7 +133,7 @@ __mulint: ;; Optimise for the case when this side has 8 bits of data or ;; less. This is often the case with support address calls. or a - jp NZ,1$ + jr NZ,1$ ld b,#8 ld a,c @@ -143,7 +143,7 @@ __mulint: add hl,hl rl c rla ;DLE 27/11/98 - jp NC,2$ + jr NC,2$ add hl,de 2$: dec b diff --git a/gbdk-lib/libc/gb/global.s b/gbdk-lib/libc/gb/global.s @@ -182,3 +182,18 @@ lbl: INC A SIGNED_ADD_A_REG16 regH, regL .endm + +.macro MUL8_DE_RET_HL reg8 ?lbl1 ?lbl2 + ; Multiply DE by B or C, return result in HL; preserves: BC, DE + LD HL, #0 + LD A, #8 +lbl1: + ADD HL, HL + RLC reg8 + JR NC, lbl2 + ADD HL, DE +lbl2: + DEC A + JR NZ, lbl1 + +
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.