Page 3 of 3

Fast Math in assembly language

Posted: Tue May 17, 2022 1:29 am
by Ed Minchau


On 5/16/2022 at 5:11 PM, BruceMcF said:




This is exactly the kind of ROM home I would like to see for a Sweet16 VM.



Zsound should probably find a home in ROM, too.


Fast Math in assembly language

Posted: Wed May 18, 2022 10:15 pm
by BruceMcF


On 5/16/2022 at 9:29 PM, Ed Minchau said:




Zsound should probably find a home in ROM, too.



While I concur, when I was talking about a "home in ROM", even though my open source Sweet16VM is "fat" compared to Woz's masterwork of spaghetti 6502 code ... it's still under 0.75K, so it it's going to find a home in ROM, it has to ride along with something else that is (1) more substantial but (2) under 16K in its own right.

The alternative is to implement enough applets using the Sweet16 VM to justify putting the whole collection in a ROM, but I am working 11 hour shifts at present, so I probably don't have the time for that


Fast Math in assembly language

Posted: Thu Jun 23, 2022 9:51 am
by Ed Minchau

Version 2 has been uploaded here:


 

I've shuffled some things around and managed to add 14 new subroutines.  Two of them are for saving and restoring the data in zero page addresses F0-FF, so that FASTMATH doesn't stomp on BASIC.  Four of them are for type conversions between 2 or 3 byte integers and the fractional notation used by FASTMATH (which on reflection is really a sort of floating point notation without the logarithms).  There's also a new Clamp function, Determinant, and 4 functions for adding or subtracting 2d or 3d vectors.

I also rewrote the ATN function and modified the lookup table it used significantly, and now there are three arctan(x,y) functions available, with precisions of 8, 9, or 10 bits.

I've got something special coming soon to demonstrate this in action.


Fast Math in assembly language

Posted: Thu Jun 23, 2022 5:43 pm
by desertfish

FIFTY functions?   Wowwwww!

Also. Does the library use 65C02 instructions? Or is it usable on 6502 as well?


Fast Math in assembly language

Posted: Thu Jun 23, 2022 6:22 pm
by svenvandevelde


On 6/23/2022 at 11:51 AM, Ed Minchau said:




I've got something special coming soon to demonstrate this in action.



You're a wizard!


Fast Math in assembly language

Posted: Thu Jun 23, 2022 6:37 pm
by Ed Minchau


On 6/23/2022 at 11:43 AM, desertfish said:




FIFTY functions?   Wowwwww!



Also. Does the library use 65C02 instructions? Or is it usable on 6502 as well?



65c02 only, because I'm using the BBR/BBS commands.  And although there are 50, quite often there's only small differences, such as a 2d vector version and a 3d vector version. 


Fast Math in assembly language

Posted: Thu Jun 23, 2022 8:28 pm
by Fabio

i have read your work : it's impressive but i have a doubt:what's the use of "fabs" lookup table ? given that it can be calculated as

eor FF

inc A


Fast Math in assembly language

Posted: Thu Jun 23, 2022 10:58 pm
by ZeroByte

Can it do log2 of a 16bit into an 8.8 or 8.16 fixedpoint?

 


Fast Math in assembly language

Posted: Thu Jun 23, 2022 11:05 pm
by Ed Minchau


On 6/23/2022 at 2:28 PM, Fabio said:




i have read your work : it's impressive but i have a doubt:what's the use of "fabs" lookup table ? given that it can be calculated as



eor FF



inc A



 If you've got the value in A, and you've already determined that it's negative (bit 7 = 1), then that works. The FABS table just avoids having to do the compare and branch, saving a few cycles. 


Fast Math in assembly language

Posted: Thu Jun 23, 2022 11:07 pm
by Ed Minchau


On 6/23/2022 at 4:58 PM, ZeroByte said:




Can it do log2 of a 16bit into an 8.8 or 8.16 fixedpoint?



 



No, I avoided logs.  I initially tried using an 8 bit log method for division and the error bars were huge and bimodal.