Re: A83: Signed Division


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

Re: A83: Signed Division




I don't think that will work, because you can't subtract a signed and
unsigned number from each other.

> Will this work?  If it does, I don't know if it would be faster than the
other routine, but it is smaller.
>
> Div: ; hl = bc/de, a = ???
>  ld a,d
>  or e
>  scf
>  ret z
>  ld h,b
>  ld l,c
> DivLoop:
>  or a
>  sbc hl,de
>  jr nc,DivLoop
>  add hl,de
>  res 7,h
>  ld a,b
>  xor d
>  and 10000000b
>  or h
>  ld h,a
>  ret




References: