Re: A85: What i really need is...


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

Re: A85: What i really need is...



Well, again, i made my own routine.  if any one else is interested,
here it is.  If you know a simple way, i would love to hear it.

-mike pearce

; de = d * e
SMul8:
   push bc
   ld c,0
   bit 7,d
   jr z,Check2ND
   ld a,d
   neg
   ld d,a
   inc c
Check2ND:
   bit 7,e
   jr z,DoUMul8
   ld a,e
   neg
   ld e,a
   ld a,1
   xor c
   ld c,a

DoUMul8:
   ld b,8
   xor a
DoUMul8Loop:
   bit 0,e
   jr z,DoUMul8Skip
   add a,d
DoUMul8Skip:
   rra
   rr e
   or a
   djnz DoUMul8Loop
   ld d,a

   dec c
   pop bc
   ret nz
   push hl
   xor a                        ;\
   ld h,a                       ; |
   ld l,a                       ; |negate de
   sbc hl,de                    ; |
   ld d,h                       ; |
   ld e,l                       ;/
   pop hl                       
   ret



On Tue, 19 Aug 1997 04:18:12 GMT, you wrote:

>I didn't really need a multiplication earlier, what i needed was a
>*signed* multiplication routine.  Still 8 bit * 8 bit.  Again, if
>anyone has one, i'd like to see it.
>
>-mike pearce
>


References: