Jump to content
IGNORED

Using math FP routines of math pack and basic


Recommended Posts

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 by Heaven/TQA
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by Heaven/TQA
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by Heaven/TQA
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:

 

 

In the sites above, I have insert examples why...
Please see the comparison with Excel 2013... ;-)
  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...