Added mulAbyHL
This commit is contained in:
parent
240d49b928
commit
05787a20e3
1
FSHa.asm
1
FSHa.asm
|
|
@ -12,7 +12,6 @@ Setup:
|
|||
LD HL, 0
|
||||
CALL fshvarfill
|
||||
|
||||
|
||||
Input:
|
||||
LD C, $00
|
||||
CALL fshcmdfill
|
||||
|
|
|
|||
BIN
bin/FSHa.8xp
BIN
bin/FSHa.8xp
Binary file not shown.
|
|
@ -28,6 +28,7 @@ cpBCDE:
|
|||
sbc hl, de
|
||||
pop hl
|
||||
ret
|
||||
|
||||
;; mulAbyB
|
||||
;; Multiplys AxB
|
||||
;; Inputs:
|
||||
|
|
@ -45,50 +46,30 @@ mulAbyBLoop:
|
|||
pop bc
|
||||
ret
|
||||
|
||||
;; mul8By8 [Maths]
|
||||
;; Performs an unsigned multiplication of H and E
|
||||
;; mulAbyHL
|
||||
;; Multiplys AxHL
|
||||
;; Inputs:
|
||||
;; H: Multiplier
|
||||
;; E: Multiplicand
|
||||
;; A: Multiplier
|
||||
;; HL: Multiplicand
|
||||
;; Outputs:
|
||||
;; HL: Product of H and E.
|
||||
mul8By8:
|
||||
;; HL: Product of A and HL.
|
||||
mulAbyHL:
|
||||
push bc
|
||||
push de
|
||||
ld l, 0
|
||||
ld d, l
|
||||
|
||||
sla h
|
||||
jr nc, $ + 3
|
||||
ld l, e
|
||||
|
||||
add hl, hl
|
||||
jr nc, $ + 3
|
||||
ld de, 0
|
||||
ex de, hl
|
||||
cp 0
|
||||
jr z, mulAbyHLEnd
|
||||
ld b, a
|
||||
mulAbyHLLoop:
|
||||
add hl, de
|
||||
add hl, hl
|
||||
jr nc, $ + 3
|
||||
add hl, de
|
||||
add hl, hl
|
||||
jr nc, $ + 3
|
||||
add hl, de
|
||||
add hl, hl
|
||||
jr nc, $ + 3
|
||||
add hl, de
|
||||
add hl, hl
|
||||
jr nc, $ + 3
|
||||
add hl, de
|
||||
add hl, hl
|
||||
jr nc, $ + 3
|
||||
add hl, de
|
||||
add hl, hl
|
||||
jr nc, $ + 3
|
||||
add hl, hl
|
||||
jr nc, $ + 3
|
||||
add hl, de
|
||||
add hl, de
|
||||
|
||||
djnz mulAbyHLLoop
|
||||
mulAbyHLEnd:
|
||||
pop de
|
||||
pop bc
|
||||
ret
|
||||
|
||||
|
||||
;; mul32By8 [Maths]
|
||||
;; Performs an unsigned multiplication of DEHL and A.
|
||||
;; Outputs:
|
||||
|
|
|
|||
Loading…
Reference in New Issue