6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Sep 27, 2024 9:30 am

All times are UTC




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Tue Apr 20, 2010 4:11 pm 
Offline

Joined: Tue Apr 20, 2010 4:02 pm
Posts: 33
Hi, I would like to introduce new programming language for 6502 - ATALAN, I'm developing.

It is optimizing compiler.

You can find out more on http://atalan.kutululu.org

It is still work in progress, but it already compiles some small example programs for 8bit ATARI computers (you can use for example ALTIRRA emulator to run the examples).


Rudla Kudla


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 21, 2010 10:53 am 
Offline
User avatar

Joined: Fri Oct 31, 2003 10:00 pm
Posts: 200
rudla.kudla wrote:
Hi, I would like to introduce new programming language for 6502 - ATALAN, I'm developing.


Rudla Kudla


Very interesting!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 22, 2010 2:14 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
404.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 22, 2010 9:11 am 
Offline

Joined: Tue Apr 20, 2010 4:02 pm
Posts: 33
Do you mean the site is not working?
I clicked it 10 seconds ago and it was working...


Top
 Profile  
Reply with quote  
PostPosted: Fri Apr 23, 2010 2:29 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8402
Location: Midwestern USA
The site was up when I clicked the link.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Apr 25, 2010 3:29 am 
Offline

Joined: Sat Jan 04, 2003 10:03 pm
Posts: 1706
When I accessed it previously, I had received a 404 error. However, it is working for me now.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 18, 2011 9:00 pm 
Offline

Joined: Tue Apr 20, 2010 4:02 pm
Posts: 33
Hi.

I just wanted to report, that Atalan project is still alive and kicking.
Atalan is becoming quite usable and has many nice features and waste (and still growing) range of optimizations.

Atalan can be easily targeted to any 6502 based platform.

So if you are interested, look at http://http://atalan.kutululu.org/.

Source code is available at http://code.google.com/p/atalan/.

Rudla


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 18, 2011 10:09 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Nice project (open source, cross platform, docs and examples) - well done and thanks!

(Edit: here's a link to "6502 Simulator platform by Michal Kowalski" because people are having trouble finding the new location.)


Last edited by BigEd on Mon Nov 07, 2011 2:45 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Mar 19, 2011 5:46 pm 
Offline

Joined: Tue Apr 20, 2010 4:02 pm
Posts: 33
I have added support for 6502 Simulator platform by Michal Kowalski.

It is now possible to compile applications and run it using the simulator.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Mar 23, 2011 10:59 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
Hi R.K.

I am software (except 6502 ML/assembly) ignorant. Could you explain your hard work please, on how you took advantage of M.K.'s assembler?
Could you show us an example on how to use what you've made?

Thanks!

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 25, 2011 9:54 pm 
Offline

Joined: Tue Apr 20, 2010 4:02 pm
Posts: 33
Hi,

basic info can be found at http://atalan.kutululu.org/sim6502.html

I'm not using the M.K. assembler. Simulator is capable of loading XEX binary file, which s what Atalan generates for this (6502 Simulator) platform.

With some extra work, generated source could be probably M.K. assembler compatible.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Mar 25, 2011 11:56 pm 
Offline

Joined: Mon Mar 02, 2009 7:27 pm
Posts: 3258
Location: NC, USA
I'll definately try to use it when I get my 6502 system up and running... How do you think your compiler would work for graphic routines, e.g. a typical Basic sin(x)?

_________________
65Org16:https://github.com/ElEctric-EyE/verilog-6502


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Mar 26, 2011 2:22 pm 
Offline

Joined: Tue Apr 20, 2010 4:02 pm
Posts: 33
If I find some routines for trigonometric functions, they may be added.
Trouble is, currently Atalan supports just integers (no floating point numbers), so this would be of limited use directly.

I was thinking about support in compile phase, where it would be possible to specify table calculated using some defined expression (including sin, cos, etc.) and use this table in runtime.

Something like:

const sini:array(0..359) of -127..127 = sin(#/2*PI) * 127

and later in code sini(180) could be used to get sinus.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Mar 26, 2011 6:46 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8520
Location: Southern California
Quote:
If I find some routines for trigonometric functions, they may be added.
Trouble is, currently Atalan supports just integers (no floating point numbers), so this would be of limited use directly.

Floating-point is not needed nearly as much as we all initially tend to think. Scaled-integer math is far more efficient and works fine for trig, log, square-root, and other functions. I started a topic on it here (really more of a series of articles that people could comment on and ask questions since it's a forum) but like so many other projects, I never finished it.

For 16-bit precision, sin & cos can be calculated accurately with just use the first four terms of the infinite series, with the coefficients tweaked slightly to compensate for the fact that you're not using more terms. You just calculate them for the first 45°, and from that you can get the rest of the circle. The output will usually be accurate to all 16 bits, and the worst error I've found in my testing is 1 lsb high. For scaling, the input angle is represented by $10000 being the whole circle, so for example 90° is 4000H, 45° is $2000, 1 radian is $28BE etc., giving you .0055° resolution, and the wrap-around is perfect (ie, 359°+2°=1° and so on). The output of -1 to +1 is scaled by $7FFF if you want maximum resolution, giving a range of -$7FFF to +$7FFF so the granularity is .0000305 if you're stopping at 16 bits.

For TAN, you just return both SIN and COS since otherwise you have the problem that TAN has this nasty habit of going to ±infinity at ±90°.

Arctan can be interpolated accurately from a surprisingly small table. It works much better than X(1+BX²)/(1+CX²)-DX^^6, not to mention the infinite series which does not converge anywhere nearly as quickly as it does for sin & cos! A table of 16 16-bit numbers, with linear interpolation, gives a maximum error of <.02° if the table entries are tweaked slighly to minimize the maximum error instead of just putting in the straight arctan's. Doubling the size of the table makes the accuracy skyrocket. Without digging up my notes, I can't remember if it makes it four times or eight times as accurate, but the point is that you don't need a big table. Again, you start with just the first 45°, and get the rest from that. Resolution is about .007° worst case (near 0°). This again is if you're stopping at 16 bits of scaled-integer representation.

Logs and antilogs can be interpolated from relatively small tables too if you do them in base 2 (not e, not 10, etc.) and convert from there.

Of course if you have a couple of megabytes for big tables, you can have all the values pre-calculated and just look them up quickly and get every last bit accurate. I have these tables calculated and sitting in Intel hex files but have not used them yet. [Edit, June 2012: They are now published at http://WilsonMinesCo.com/16bitMathTables/index.html ]

Obviously I did not mention all the functions, but the above should be convincing enough that lack of floating-point is hardly a handicap. Floating-point burdens the processor with the job of keeping track of the decimal point during run time. Fixed-point and scaled-integer math puts the burden on the programmer during programming time (which isn't as bad as it sounds, you'll find with experience) and lets the computer be much more efficent at run time.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Mar 27, 2011 6:16 am 
Offline

Joined: Tue Nov 18, 2003 8:41 pm
Posts: 250
GARTHWILSON wrote:
Arctan can be interpolated accurately from a surprisingly small table. It works much better than X(1+BX²)/(1+CX²)-DX^^6, not to mention the infinite series which does not converge anywhere nearly as quickly as it does for sin & cos! A table of 16 16-bit numbers, with linear interpolation, gives a maximum error of <.02° if the table entries are tweaked slighly to minimize the maximum error instead of just putting in the straight arctan's. Doubling the size of the table makes the accuracy skyrocket. Without digging up my notes, I can't remember if it makes it four times or eight times as accurate, but the point is that you don't need a big table. Again, you start with just the first 45°, and get the rest from that. Resolution is about .007° worst case (near 0°). This again is if you're stopping at 16 bits of scaled-integer representation.

Logs and antilogs can be interpolated from relatively small tables too if you do them in base 2 (not e, not 10, etc.) and convert from there.



Somewhat tangential to this discussion but here's a moderately interesting paper.

http://www.ac.usc.es/system/files/gac2005-j02.pdf.gz

It's hardware oriented.

My version of "...efficient evaluation of the second-degree polynomial
(using a specialized squaring unit.." would be leveraging a table of squares,
which you might have just lying around if you were using a quarter-
square multiply.


High-Speed Function Approximation using a Minimax Quadratic Interpolator

Abstract
A table-based method for high-speed function approximation in single-precision floating-point format is presented in this paper. Our focus is the approximation of reciprocal, square root, square root reciprocal, exponentials, logarithms, trigonometric functions, powering (with a fixed exponent p), or special functions. The algorithm presented here combines table look-up, an enhanced minimax quadratic approximation, and an efficient evaluation of the second-degree polynomial (using a specialized squaring unit, redundant arithmetic, and multioperand addition). The execution times and area costs of an architecture implementing our method are estimated, showing the achievement of the fast execution times of linear approximation methods and the reduced area requirements of other second-degree interpolation algorithms. Moreover, the use of an enhanced minimax approximation which, through an iterative process, takes into account the effect of rounding the polynomial coefficients to a finite size allows for a further reduction in the size of the look-up tables to be used, making our method very suitable for the implementation of an elementary function generator in state-of-the-art DSPs or graphics processing units (GPUs).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: