[A83] Re: Faster Multiplication


[Prev][Next][Index][Thread]

[A83] Re: Faster Multiplication





;quick multiply
;Input: C and E
;Output: Hl = C*E
mult:
    xor a       ;flush a
    ld h,a      ;flush hl and d
    ld l,a
    ld d,a
    ld a,c      ;save c to a to check...
    cp e        ;here we check too see which one is bigger, c or e
    jp c,mulswitch  ;if c is smaller then e, switch them!
:MulCode1
    xor a       ;reset a
    cp c        ;and the check for 0
:MulCode        ;normal multiplication code...
    ret z
    add hl,de
    dec c
    jp MulCode
:mulswitch      ;switch c and e, then run the main code
    ld a,c
    ld c,e
    ld e,a
;    ld a,0
;    cp c
    jp MulCode1


just 3 bytes smaller...


------------------------------------------------------------
Want a free mail at http://www.mail.be ?



Follow-Ups: