Jump to content

Photo

What modern high level languages are available for the 8-Bit Atari?


9 replies to this topic

#1 Geister OFFLINE  

Geister

    Space Invader

  • 35 posts
  • Location:Lehigh Valley, PA

Posted Sat Feb 10, 2018 10:29 AM

Hi.  By high level, I mean Basic, Pascal, C, etc. and by Modern I mean languages developed since the 1980's.

 

I'm not interested in assembler.  I don't have the mindset to develop at that level.  It's too much like the art form of composing a picture using seeds.  You can do amazing things with it, but it just seems tedious to me.

 

I know about all the older software like Turbo Basic XL and Action!.  They are both great and I've used them both, but i want to hear about what has been happening in the years since I left the scene. 

 

I've heard about Fast Basic, but real information on the language seems hard to find.  Is there a Github or a website with documentation on this language?

 

What is Mads Pascal.  I've seen the website and it is very reasonable to read in translation, but it seems to assume you know some basics about the system that are not obvious to me...like does this actually run on the Atari or is it a Windows-based development system that targets the Atari?

 

What else is out there?

 

I'm also interested in some of the older languages that I was never able to get my hands on BITD.  I've tried the APX Atari Pascal, and I vaguely remember  Kyan Pascal, but they both seem to suffer from being a closed system like many Pascals back then.  They were an ecosystem  that your compiled code had to live within and they couldn't produce a native executable, more like a P-Code that had to be executed in the Pascal Monitor.  Because of this performance suffers and seems to run as slowly as Atari Basic...or slower!  Maybe CLSN Pascal is better but I haven't had time to dig in yet.

 

Older versions of C like Deep Blue C or C65 seem to be either lost to the sands of time, or I've heard that they were buggy.  I can't find the images on Atarimania for C65, if anyone knows where to find a copy, I'd appreciate a link.

 

I don't mind hearing about Windows based tools like WUDSN, but again.  not a fan of assembler.

 

One reason I'm interested in doing this is an idea I had to benchmark the various languages running a familiar demo, the "HAT" sine program from a very early ANALOG issue.  This program is only a dozen lines or so, but takes nearly 3 hours to run in Atari Basic.   The finished image was pretty iconic for the A8 and it appeared in advertising and magazine covers.  I translated it to C64 basic (which was a pain without graphic commands) and discovered that the program appears to have been designed for a 320x200 pixel display..  The TRAP statement catches any excursions beyond the bottom of the Atari hi-res screen and wasn't necessary (or even possible) in C64 Basic.  The end result on the C64 looks pretty much the same as on the Atari if you ignore the fact that I had to remove the Drawto(X,Y) statement that cleans up any obscured points.  I had enough trouble writing a "Plot(X,Y) subroutine. 

 

I did not have an actual C64 to test the program on, but the emulator ran the program nearly as fast (or slow) as on the Atari emulator. If I'd taken the time to implement the Drawto in Basic code, it probably would have crawled.

    



#2 tschak909 ONLINE  

tschak909

    River Patroller

  • 2,114 posts
  • Location:USA

Posted Sat Feb 10, 2018 10:38 AM

Do not cut yourself off from a development tool, language, or methodology, You never know until you try it.

 

The 6502 is a very simple processor, with the ability to have the entire instruction set in your head. It was never designed for what most people consider high level languages today. The reason is because the 6502 has a _VERY_ small stack, only 256 bytes, and it is fixed in memory, so languages that require a stack require an implementation that  will give them a large enough stack to handle recursion, subroutine calls, and argument passing without exhausting the stack, this means implementing the stack in software, which means slower performance.

 

With that said, there is a C implementation for the 6502, called CC65, which provides a modern C99 implementation, and can create binaries for any 6502 based machine. The constraints aren't obvious unless you've DONE 6502 assembler:

 

* For best results use unsigned char as your primary data type.

* Use linear arrays for access as much as possible, these get turned into directly indexed X loads and stores.

* Use global variables wherever possible, this cuts down on software stack use, greatly increasing performance and reducing size.

* Use multiplies and divides provided by the compiler and runtime sparingly, the 6502 does not have a multiply or divide, and doing so will chew tons of cycles each time you use one of them.

 

Again, you should seriously spend some time and actually learn 6502 assembler, the effort will help you, should you decide to use a high level language. 

 

-Thom



#3 dmsc OFFLINE  

dmsc

    Moonsweeper

  • 321 posts
  • Location:Viņa del Mar, Chile

Posted Sat Feb 10, 2018 10:53 AM

Hi Geister,
 

Hi.  By high level, I mean Basic, Pascal, C, etc. and by Modern I mean languages developed since the 1980's.


Are you interested in Atari tool or cross-compilers?
 

I've heard about Fast Basic, but real information on the language seems hard to find.  Is there a Github or a website with documentation on this language?


Of course, FastBasic is open-source and lives on https://github.com/dmsc/fastbasic. There is a full manual at https://github.com/d...aster/manual.md and a cross-compiler with more optimizations that the Atari one is also available.
 

What is Mads Pascal.  I've seen the website and it is very reasonable to read in translation, but it seems to assume you know some basics about the system that are not obvious to me...like does this actually run on the Atari or is it a Windows-based development system that targets the Atari?


MadPascal is a cross-compiler, it's a command line tool that runs in a PC (Linux, Mac or Windows) and produces an atari executable, with a dialect similar to old Turbo Pascal 7.

 

What else is out there?


For cross-compiling from a PC, CC65 http://cc65.github.io/cc65/is a good C language compiler, that also tries to make C programming portable to other 6502 computers.

 

One reason I'm interested in doing this is an idea I had to benchmark the various languages running a familiar demo, the "HAT" sine program from a very early ANALOG issue.  This program is only a dozen lines or so, but takes nearly 3 hours to run in Atari Basic.   The finished image was pretty iconic for the A8 and it appeared in advertising and magazine covers.  I translated it to C64 basic (which was a pain without graphic commands) and discovered that the program appears to have been designed for a 320x200 pixel display..  The TRAP statement catches any excursions beyond the bottom of the Atari hi-res screen and wasn't necessary (or even possible) in C64 Basic.  The end result on the C64 looks pretty much the same as on the Atari if you ignore the fact that I had to remove the Drawto(X,Y) statement that cleans up any obscured points.  I had enough trouble writing a "Plot(X,Y) subroutine.


The "hat" sine program is not a very demonstrative benchmark, as it is mostly trigonometric functions (really slow in the original Atari math-pack) and line plotting.

About 3 years ago I programmed a very fast version of that, in assembler, see http://atariage.com/...-hat/?p=3198021, the runtime was about 22 seconds.

#4 gozar OFFLINE  

gozar

    Dragonstomper

  • 842 posts
  • Location:Ohio

Posted Sat Feb 10, 2018 7:53 PM

Back in the day I only used Atari Basic and Turbo Basic, which really limited what I could do on the machine. I wish I would have invested in Action! or better yet, learned Assembler. 

 

Today I use either CC65 or MAD Pascal and cross compile. My current project is an excuse to learn MAD Pascal, and it is more approachable than C. I haven't touched Pascal in almost 30 years, but it comes back pretty easily.

 

Assembler is pretty tedious, but you probably will want to learn it eventually. I'm slowly learning it myself.



#5 Spaced Cowboy ONLINE  

Spaced Cowboy

    Star Raider

  • 50 posts

Posted Sat Feb 10, 2018 8:36 PM

I'm having some fun writing a cross-compiler at the moment - tailored to the 6502, so it locates variables in zero-page etc. I'm planning on using SQLite as the intermediate format of the compiler, which ought to open up some interesting things in terms of optimisation routines later. It'll be trivial to test one out in PHP before committing to writing it in c++ :)

 

There's a "spec" (it's really not [grin], it's a bunch of notes, but it'll give you an idea) in the GitHub repostitory

 

It'll do 'C' like type-promotion and expression-reduction (it already does a fair amount of this), it'll run the C pre-processor to handle includes, and since I'll have an intimate knowledge of the workings of it, I'll be able to expand it easily. I have a hardware project ongoing as well (in fact, this is the main focus) and giving support for that is one of the primary (but as yet unspoken) goals :) 

 

I'd also like to get some support for native hardware - ie: handle bank-programming, PMG etc.

 

The plan is to produce assembly output from the intermediate stage, and then run Mads or something to produce the final executable. I'm more interested in the higher-level optimizations (loop unrolling, variable hoisting, etc.) 

 

I've only had a week - give me another 3-6 months and it'll be a contender :)



#6 Geister OFFLINE  

Geister

    Space Invader

  • Topic Starter
  • 35 posts
  • Location:Lehigh Valley, PA

Posted Sat Feb 10, 2018 9:34 PM

I'm mostly looking for tools that run on the Atari, but I wouldn't mind a cross compiler if it had support for the 65c816.  I'm not new to programming on either the Atari or the PC.  However, I'm sick of the PC world and all the complications.  Being pretty mush retired from IT and the type of programming I used to do (Lab and Plant automation) I wanted to get back to where it all started and do some fun things with the Atari again.  Since I heard about the current hardware upgrades (and intend to play those as soon as I can afford to)  I was wondering if there were similar improvements to the programming languages to take advantage of the new hardware.

 

To dmsc: the Hat Sine program has some emotional (nostalgic) connections with me as it was the first programming demonstration of the Atari's graphics that made me go wow!  I guess I was easily impressed back then. I took nearly an hour to type the program in on the 400's membrane keyboard (actually I typed it twice because I didn't know the the break key didn't do the same thing as the enter key,,,it appeared to).  Eventually, I got the program typed in and saved to cassette tape and then I never got to run it to completion because we always had somewhere to go or something to do and it took hours for this program to run!  So one night, Superman was making it's network premier on TV and my wife wanted to watch it.  We knew that with commercials, the run time of the movie and the demo would be about the same.  So I started the program and sat down to watch the movie making a dash now and then to the computer to see the progress.  After awhile, I got wrapped up in the movie and stopped running in to check on the program.  My wife went into the kitchen to get some snacks and I heard her ask from the other room "is the screen supposed to be blank?"  That's when I learned to check my typing of the program listing carefully before running the program.   I had forgotten to type the last line of the program  "260  GOTO 260"  The program had plotted the last point and then dropped to Graphics 0. 

 

My wife thought it was hilarious that I had wasted three hours for a blank screen.  But I learned a lot from that little program.

 

I disagree with you than the program is not a demonstrative benchmark.  I think it would demonstrate quite clearly whether a language has better math libraries, better graphics libraries, or just more optimized  code than old Atari basic.  Turbo Basic XL proved it has all three  I suppose if I added instrumentation to the program I could even determine how the program was improved running on a different package.  Conversely, Atari Pascal performed worse than Atari basic and I think it shows that the developers of this Pascal had been too successfully in replicating poor old Basic's graphics and math functions.  In any case, that's not important It's still the measuring stick I plan to use while I explore the different programming languages.  I think it's more visually interesting than say calculating primes.   Who knows maybe I'll collect some other retro computers and see how well they do with this program.  I already have a version that runs on the C64. 



#7 Philsan OFFLINE  

Philsan

    River Patroller

  • 3,466 posts
  • New Orleans Saints Super Bowl XLIV Champions
  • Location:Switzerland

Posted Sun Feb 11, 2018 2:45 AM

I like FastBasic because is similar to AtariBasic but faster.

 

A good high level languagee is Quick.

Rubber Ball was programmed with it.



#8 Sheddy OFFLINE  

Sheddy

    Dragonstomper

  • 687 posts
  • Location:UK

Posted Sun Feb 11, 2018 2:47 AM

I'm having some fun writing a cross-compiler at the moment - tailored to the 6502, so it locates variables in zero-page etc. I'm planning on using SQLite as the intermediate format of the compiler, which ought to open up some interesting things in terms of optimisation routines later. It'll be trivial to test one out in PHP before committing to writing it in c++ :)
 
There's a "spec" (it's really not [grin], it's a bunch of notes, but it'll give you an idea) in the GitHub repostitory
 
It'll do 'C' like type-promotion and expression-reduction (it already does a fair amount of this), it'll run the C pre-processor to handle includes, and since I'll have an intimate knowledge of the workings of it, I'll be able to expand it easily. I have a hardware project ongoing as well (in fact, this is the main focus) and giving support for that is one of the primary (but as yet unspoken) goals :) 
 
I'd also like to get some support for native hardware - ie: handle bank-programming, PMG etc.
 
The plan is to produce assembly output from the intermediate stage, and then run Mads or something to produce the final executable. I'm more interested in the higher-level optimizations (loop unrolling, variable hoisting, etc.) 
 
I've only had a week - give me another 3-6 months and it'll be a contender :)

SQL?! Sounds intriguing. Hope you have fun 👍

#9 baktra OFFLINE  

baktra

    Moonsweeper

  • 428 posts
  • Location:Czech republic

Posted Tue Feb 13, 2018 11:29 AM

* Use global variables wherever possible, this cuts down on software stack use, greatly increasing performance and reducing size.

 

 

CC65 provides an option that treats automatic variables declared in functions as they were global variables. Of course, when this option is set, no recursive calls are possible.

I admit, I do like that option. The code stays legible (variables are declared close to the place where used in the source code), but has smaller footprint. I sacrifice recursion happily.



#10 slx OFFLINE  

slx

    Stargunner

  • 1,315 posts
  • Location:Vienna, Austria

Posted Tue Feb 13, 2018 2:43 PM

Have you tried Forth? Good to keep your brain flexible, entirely different and apparently fast if used correctly ;)






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users