0 Members and 3 Guests are viewing this topic.
Hmm, isn't 16-bit math sufficient, then? Also, in good news, I actually shaved off close to 18000 more clock cycles from the square root routine, putting it at a little over 3 times faster than TI's. I am back to working on the exponential and logarithm routine, but they are table based (using a single 64-element LUT with 9 bytes to each element). From this I will build the Float->Str routine.
or a \ sbc hl,de \ jr c,$+7 \ set 7,b \ jp $+4 \ add hl,de \ srl d \ rr e
Xeda, i was just looking through the 24-bit division routine and saw this line:Code: [Select]or a \ sbc hl,de \ jr c,$+7 \ set 7,b \ jp $+4 \ add hl,de \ srl d \ rr eI was just wondering if instead of all those "jp $+4"s, if you tried using "set 7,b \ .db $56 ;jr c,... \ add hl,de \ ; ..." you might be able to save a byte and 3 t-states (x 15 repetitions). Since the carry will never be set there, it'll just skip the add hl,de which it will read as part of the jr. When the condition is false, jr is actually faster (and, of course, smaller) than a jp.
ld hl,const_pi ;pi is the first arg ld d,h \ ld e,l ;pi is also the second ld bc,scrap call mulSingle ;pi*pi = pi^2 ld h,b \ ld l,c ;Gonna square the result ld d,b \ ld e,c ;BC points to the result of the previous multiply, now HL and DE do, too. call mulSingle ;= pi^4 call mulSingle ;= pi^8 call mulSingle ;= pi^16 call mulSingle ;= pi^32 call invSingle ;= 1/pi^32 = pi^-32 call lgSingle ;= lg(pi^-32) call single2string bcall(_PutS)
absSingle func: |x| -> z mem: NoneaddSingle func: x+y -> z mem: 6 bytes Note: special cases not donesubSingle func: x-y -> z mem: 10 bytes Note: special cases not donersubSingle func: -x+y -> z mem: 10 bytes Note: special cases not doneinvSingle func: 1/x -> z mem: 5 bytesdivSingle func: x/y -> z mem: 5 bytescmpSingle func: compare x to y, no output return z flag if x=y (error is up to the last 2 bits) return c flag if x<y return nc if x>=y mem: Nonesingle2string func: string(x) -> z mem: 44 bytesmulSingle func: x*y -> z mem: 6 bytesnegSingle func: -x -> z mem: None