Re: A83: Calculating this formula...


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

Re: A83: Calculating this formula...





I wouldn't use ops if I did this.  Floating Point Arithmetic is much more
expensive than using Integers.  Since the desired return value (de) can
only be 16 bits, we don't need the extra precision of FP math.  So don't
overdo the work.


 just use this format to multiply:

; de goes in
;  b is the multiplicand
 ld hl,0
multLoop:
 add hl,de
 djnz multLoop

 ; hl = answer


also remember that a / 2 or a * 2 is much faster with shift operations

ie. sla a = a*2
srl a = a/2

if you already know this, then sorry for the lecture.  I'd be willing to
bet that a good bit of people on this list don't fully understand this. 
-harper




Follow-Ups: References: