Re: A86: Sorry Dux. =-|
[Prev][Next][Index][Thread]
Re: A86: Sorry Dux. =-|
Tercero wrote:
> > 200 * 6 would loop an extra 5 times.
>
> That's why you ld 200 into hl not b
>
> > > ;African Swallow Algorithm_________________________
> > > ;Input: hl * b |
> > > ;Output: hl |
> > > ;Destroys: a, b, de |
> > > ;Size: 27 bytes |
> > > ;--------------------------------------------------
> > > ASMult:
> > > xor a
> > > ld d, a
> > > ld e, a
> > > cp b
> > > jp z, Bzero
> > > cp l
> > > jp nz, ASTop
> > > cp h
> > > ret z
Don't worry about checking for zero. I meant that zero should be in the
register shifted right. A lot of times people don't know which value is
the smaller value; I thought it would be nice to put in the routine.
> > > ASTop:
> > > srl b
> > > jp nc, ASkipadd
> > > ex de, hl
> > > add hl, de
> >
> > you need ex de,hl again here
>
> No, I don't. Check for yourself.
I don't see why. If de and hl are reversed, you will shift the wrong
register pair in the second loop through (the second loop through with
the bit set in b).
>
>
> > > ASkipadd:
> > > ret z
this should be jr z,Bzero right?
> > > add hl, hl
> > > jp ASTop
> > > Bzero:
> > > ld h, a
> > > ld l, a
> > > ret
>
> --
> Tercero -- Email: mailto:tercero@busprod.com
>
> "The stone the builders rejected has become the capstone;"
> --Psalms 118:22
> "Everyone who falls on that stone will be broken to pieces,
> but he on whom it falls will be crushed."
> --Luke 20:18
References: