Re: A86: Sorry Dux. =-|


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

Re: A86: Sorry Dux. =-|




hm... if you used ld h,a and ld l,a you would save one byte instead of
using ld hl,$0000... but it might take an extra clock cycle. plus you
could use jr instead of jp depending on whether you want size or speed.
and the last instruction should be "ret" since the Z flag will always be
set. (i mean, since we're nitpicking, i thought i'd get in my 2 cents
worth :)

Tercero wrote:
> 
> I have very few ideas of my own but I can easily take
> someone elses theory, routine or whatever and make it
> better.  Sorry in advance Dux.  I took his Russian
> Peasant algorithm and made it better...voila.
> 
> ;African Swallow Algorithm_________________________
> ;Input: de * b                                    |
> ;Output: hl                                       |
> ;Destroys: af, b, de, hl                          |
> ;Size: 15 bytes                                   |
> ;--------------------------------------------------
> ASMult:
>         xor a           ;stylish way to clear a
>         ld hl, $0000    ;most stylish way to clear hl...bummer
> ASMultLp:
>         srl b           ;check bit
>         jp nc, ASkipadd ;if bit = 1 then hl + de
>         add hl, de      ;add'm up
> ASkipadd:
>         add hl, hl      ;mult hl by 2
>         jp nz, ASMultLp ;if b != 0 then keep going
>         ret z           ;ret if b = 0
> 
> --
> 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

-- 

=====================================
=                                   =
=   Kirk Meyer (mailto:_@ibm.net)   =
= http://www.bigfoot.com/~kirkmeyer =
=  http://simcommunity.home.ml.org  =
=                                   =
=   "Set your affection on things   =
=    above, not on things on the    =
=      earth."  Colossians 3:2      =
=                                   =
=====================================


Follow-Ups: References: