Re: A86: Sorry Dux. =-|


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

Re: A86: Sorry Dux. =-|




Kirk Meyer wrote:
> 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.

Thanx.  Nope two ticks and one byte less!

> could use jr instead of jp depending on whether you want size or speed.

Speed...I'm all for speed.  (Come on, it's got 98k)

> and the last instruction should be "ret" since the Z flag will always be
> set.

I forgot to take out the z after ret because I was demonstrating
to my brother the changes I had made.

> (i mean, since we're nitpicking, i thought i'd get in my 2 cents
> worth :)

Russian Peasant's Algorithm:
made by Dux Gregis
modified and renamed by Tim Farrell
nitpicked by Kirk Meyer

;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 h, a		;Kirk Meyer's good
	ld l, a		;suggestion
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             ;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


Follow-Ups: References: