Heaven/TQA Posted October 13, 2015 Share Posted October 13, 2015 (edited) are there any examples to use internal FP routines in assembler? esp. in combination of division, multiplication and trigonometry (sin/cos/atn) and INT. just to make it clear. I know how to do that with LUTs etc but I want explicitly use the internal routines of the maths/basic ROM even they are slow... or would MAD Pascal help here? (I am little bit concerned regarding MP memory footprint). just found this: http://wiki.strotmann.de/wiki/Wiki.jsp?page=Floating%20point%20Routines Edited October 13, 2015 by Heaven/TQA Quote Link to comment Share on other sites More sharing options...
tebe Posted October 13, 2015 Share Posted October 13, 2015 (edited) mads ..\examples\libraries\fp\example.asm Edited October 13, 2015 by tebe Quote Link to comment Share on other sites More sharing options...
ricortes Posted October 13, 2015 Share Posted October 13, 2015 De Re Atari has a short chapter dedicated to FP routines. http://www.atariarchives.org/dere/chapt08.php#H8_8 It was enough to get some of my stuff working from assembler and Action *BUT* I didn't need trig functions. IIRC the trig functions are in the BASIC cart and fairly short since they use the FP package to do most of the heavy lifting. Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted October 13, 2015 Author Share Posted October 13, 2015 thanks Tebe! Coolio... so much knowledge in the MADS pack! Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted October 13, 2015 Author Share Posted October 13, 2015 (edited) maybe I not only should look into examples but in "lib" folders, too. @Tebe what is the difference between the lib (which contains sin/cos) while missing SQR and ATN (ATN would be not a problem as it can be done with sin/cos) or is sqr done with ^-2 etc? (but how with fexp10 = $DDCC ; 10 ^ fr0 -> fr0)? ah and INT would be cool as well... Edited October 13, 2015 by Heaven/TQA Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted October 14, 2015 Author Share Posted October 14, 2015 aaaah.... don't tell me after nearly 30 years that INT = integer = INT() in Basic? as the FP pack has FP to INTeger functionality... Quote Link to comment Share on other sites More sharing options...
Rybags Posted October 14, 2015 Share Posted October 14, 2015 It doesn't actually - when the docs for the FP package refer to integers, they mean the 16-bit unsigned binary variety, not the truncated BCD float type. Additionally, when you call the routine to turn an FP into integer, it performs rounding, not truncation so is of not much use to do a slow and dirty INT function. Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted October 14, 2015 Author Share Posted October 14, 2015 maybe it is enough... any idea how to do the SQR? Quote Link to comment Share on other sites More sharing options...
MaPa Posted October 14, 2015 Share Posted October 14, 2015 I'm not a math expert, but SQR can be done via logarithm. Ie. If you want SQR(9) you do exp(0.5*log(9)). Quote Link to comment Share on other sites More sharing options...
mono Posted October 14, 2015 Share Posted October 14, 2015 (edited) Or by SQR(9)=9^(1/2) (not -2 as Heaven wrote earlier). Edit: Good example how to use FP is Atari BASIC source code. Edited October 14, 2015 by mono Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted October 14, 2015 Author Share Posted October 14, 2015 thx... its been long time since I was at middle school... Quote Link to comment Share on other sites More sharing options...
Heaven/TQA Posted October 14, 2015 Author Share Posted October 14, 2015 (edited) would it not be possible... to have embedded in my assemling code "basic source code" and let BASIC ROM interpretate it? it could be shorter and easier few lines of basic code generating lookup tables than recode the FP my own? http://www.atariarchives.org/dere/chapt10.php#H10_1 will check that. ok... information on the net are wrong regarding XRUN of Basic... at least I can execute basic code with PLA JMP $b755 when using original atari basic... is there any official OS vector to that adress as there are different basic variants? esp. for turbo basic this would be invalid... Edited October 14, 2015 by Heaven/TQA Quote Link to comment Share on other sites More sharing options...
MaPa Posted October 14, 2015 Share Posted October 14, 2015 Or by SQR(9)=9^(1/2) (not -2 as Heaven wrote earlier). Of course, but FP routines have only base e or 10 exponent. Quote Link to comment Share on other sites More sharing options...
Rybags Posted October 14, 2015 Share Posted October 14, 2015 There's no OS relationship with Basic insofar as maintained vectors for special functions - only the stuff that's common among carts, ie the Run/Init stuff around $BFF8. The only special processing relating to Basic is the on/off processing during cold/warmstarts. Additionally there's no vectors or jump tables relating to FP functions - the entry points are where they happen to occur within the code which created a bit of a headache for those producing the faster FP Roms in the day. It might be easier to just rip certain routines from the Basic source. I doubt INT( would be too complex - I would imagine that you could process that function in-place on unexpanded FP numbers since it only affects numbers where the mantissa is within the small overall window that actually allows fractional numbers. Quote Link to comment Share on other sites More sharing options...
ricortes Posted October 14, 2015 Share Posted October 14, 2015 Not relevant, just trying to exercise my brain a bit. log(9)= 0.95424250943932487459005580651023 sqr in log's is divide by two, likewise cube root would be divide by 3 0.95424250943932487459005580651023/2= 0.47712125471966243729502790325512 inverse log(0.47712125471966243729502790325512)= 3 *BUT* I don't think most people would do it that way. I think once you get trig functions like sin() you can use ~Pythagorean Theory to get the answer. i.e. sin(45)= .707 => (1/.707)= 1.414 or sqr(2). Bill Wilkinson's degree was in mathematics from Berkeley, so long ago I don't think they offered a degree in CS yet! Probably had a dozen ways of doing the FP package and BASIC but just went with what was on his mind that day. Quote Link to comment Share on other sites More sharing options...
luckybuck Posted October 14, 2015 Share Posted October 14, 2015 Hi together! Additionally, I would like to mention, that just 2 programs on A8 are able, as of this moment(!), to do the fp the right way: https://atariwiki.org/wiki/Wiki.jsp?page=Atari%20Calculator https://atariwiki.org/wiki/Wiki.jsp?page=Hypra-Soft-Basic In the sites above, I have insert examples why... Please see the comparison with Excel 2013... 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.