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