6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat May 04, 2024 9:20 am

All times are UTC




Post new topic Reply to topic  [ 43 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: No love for FORTRAN?
PostPosted: Mon Oct 01, 2018 12:57 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1207
Location: Soddy-Daisy, TN USA
OK, I've tried and tried to learn Forth. I know it's a popular language around here. And, despite being a developer by trade, I just can't wrap my head around it.

I understand how Reverse Polish Notation works. But I just don't think that way. Sigh...

Anyway, I was reading some old BYTE ads (circa 1978) and I noticed just about every computer ad claimed compatibility with FORTRAN IV.

So, anyone here ever work in FORTRAN? Either professionally or otherwise?

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Mon Oct 01, 2018 1:22 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 9:02 pm
Posts: 1683
Location: Sacramento, CA
My only use of FORTRAN was a college FORTRAN class on a TI mainframe. As I recall, it is a number crunching program that worked in fixed decimal. It was a great tool for business database and column-type reports, but not really designed for anything graphic intensive. I never used it outside of that class.

Daryl

_________________
Please visit my website -> https://sbc.rictor.org/


Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Mon Oct 01, 2018 1:28 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1207
Location: Soddy-Daisy, TN USA
That's cool.

According to Wikipedia, it's still used for really computational tasks like weather prediction, traffic analysis, etc. But I guess Forth is the "new kid" in town, being a young language of 48 years. :-)

Fortran, being 61 years old.

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Mon Oct 01, 2018 1:45 pm 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 574
My last use of FORTRAN was in 1985 for a numerical computing class, and there have been several revisions to the language since that time. I recall it being a straight forward language, but lacking the expressive power compared of Pascal and C, or the elegance of Lisp. However, that simplicity is what made it so fast, and why it flourished in numerical computing.


Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Mon Oct 01, 2018 2:21 pm 
Offline

Joined: Sun Apr 10, 2011 8:29 am
Posts: 597
Location: Norway/Japan
My first FORTRAN program was something I wrote in 1982 to read CP/M 8" SS/SD floppies, on the minicomputer I used. I still have that code (and some more code) on my computer, copied from old CCT backups. The compiler on the mini had just a few extensions that made it great for processing data buffers and strings.

Since then I wrote a bit of FORTRAN, and maintained even more. I much preferred Fortran-77 over earlier versions though. The code could be made very structured and nice when using proper coding standards. What surprised me most was when we forwarded new coding standards to the mathematician who wrote some highly advanced (and huge!) code for data processing, with a humble suggestion of using it for newly developed code. What we got back was the whole thing, now nicely formatted and structured. Readable to this day, and at one point I wrote a translator to convert it to Pascal.. it actually worked. Something I did just in order to test it on the new-fangled PCs that started to show up.


Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Mon Oct 01, 2018 2:37 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1401
Location: Scotland
I've worked in FORTRAN, but I'd not say extensively. More to support some other stuff and I did have a summer job porting a FORTRAN project to (apple ucsd) Pascal once upon a time

Is there (was there?) a 6502 FORTRAN system? (a quick google suggests there was at least an Apple version, but I don't recall ever seeing it)

From a language point of view, if you can do BASIC you can mostly do FORTRAN (well, older FORTRANs, anyway) It was (is) liked in the scientific community due to complex number handling and there are some really whacky compilers now (and in the early 90's when I last dabbled) that would recognise certain things like nested loops going over an array and vectorise the code for you for the target processor (e.g. cray)

Today? Other than curiosity, I'd give it a miss, however how many of us use I (and J, K, L, M and N) as loop variables in other languages? That comes from FORTRANs implicit number types - if a variable started with the letters I through N then it was implicitly an INteger ...

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Mon Oct 01, 2018 3:19 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1928
Location: Sacramento, CA, USA
I'm with drogon on all of his points. I learned some FORTRAN 77 on a CDC mainframe back in the mid-80s, but it looks like the language has seen substantial additions since then, judging by a few of the code examples here.

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Mon Oct 01, 2018 5:45 pm 
Offline
User avatar

Joined: Tue Mar 02, 2004 8:55 am
Posts: 996
Location: Berkshire, UK
My final year project at University was 'Implementation of the Graphical Kernel System (GKS) in Fortran 77'. GKS is a standard 2D graphics API. I wrote the library and all the demo programs in F77 including the device drivers for the graphics terminals. I only had two PL/1 functions (to interface with Multics) to enable and disable raw character output.

After graduating I worked on an Oil/Gas field analysis package for UNIX that was largely coded in F77 on top of C libraries for X Windows, dynamic memory and data base access. I mainly worked on C but I did my fair share of the F77 as well.

_________________
Andrew Jacobs
6502 & PIC Stuff - http://www.obelisk.me.uk/
Cross-Platform 6502/65C02/65816 Macro Assembler - http://www.obelisk.me.uk/dev65/
Open Source Projects - https://github.com/andrew-jacobs


Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Mon Oct 01, 2018 8:41 pm 
Offline

Joined: Tue Oct 24, 2017 1:08 am
Posts: 10
drogon wrote:
Is there (was there?) a 6502 FORTRAN system? (a quick google suggests there was at least an Apple version, but I don't recall ever seeing it)

I have Apple Fortran but it isn't a 6502 compiler; It runs under Apple's Pascal environment and compiles to UCSD P-Code.


Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Mon Oct 01, 2018 9:48 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10793
Location: England
Looks like there was a Fortran for Acorn's BBC Micro, but again it's not a compiler - some kind of interpreter.
https://stardot.org.uk/forums/viewtopic.php?p=75039

Fortran is not unlike Basic, except no strings, IIRC, and usually compiled. Some of the best optimising compilers were for Fortrans.


Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Tue Oct 02, 2018 12:09 am 
Offline

Joined: Sat Dec 13, 2003 3:37 pm
Posts: 1004
Uncle Warthog wrote:
drogon wrote:
Is there (was there?) a 6502 FORTRAN system? (a quick google suggests there was at least an Apple version, but I don't recall ever seeing it)

I have Apple Fortran but it isn't a 6502 compiler; It runs under Apple's Pascal environment and compiles to UCSD P-Code.

Yea, UCSD had a P-Machine Fortran. I've never seen or used it. They also had a BASIC.

My Dad had a copy of Fortran for the TRS-80. I spent a couple of days, even borrowed a book on Fortran, trying to suss it out to no avail.

It was my first programming classic college, and we got to use Fortran V/Fortran 77 (as in 1977). Fortran V was much better, it was much easier for character work (just say no to Hollerith kthx). Fortran 4/IV was known as Fortran 66 (1966).

The microcomputer was not the typical environment in which Fortran was used, so the book wasn't super helpful. Great for the language, but I couldn't even get "Hello World" to work. So, I left it.

In Fortran V:
Code:
       PROGRAM TEST
       WRITE(*,*) 'HELLO WORLD'
       END

Pretty sure that's close, and that "just worked". The problem I was having on the TRS-80 was that I had no idea what the unit numbers were for reading and writing the keyboard. And I didn't even know I was looking for unit numbers. The "*,*" specified the unit number and... something else...a format line? Maybe? Anyway, I think in the end, they were like 2 and 3 on the TRS-80, (maybe it was 4 and 5, but like stdin and stdout, the mappings are "common knowledge"), but I didn't know that. The book I was reading was talking about cards and tape drives. Not really helpful.

I wrote a simple BBS in Fortran back in the day.

And I will say this about Fortran. Before college, I was working on PETs and the TRS-80. In College I got dumped in to a time share CDC Cyber 780 mainframe. Let me tell you how utterly different these two environments are. From PET BASIC to NOS with a line editor (XEDIT) and Fortran.

I don't think I could have picked a better thing to have done than Fortran on the Cyber. They were great examples of the commonality of computing, along with their vast differences. Cryptic job control language vs BASIC. Disk files and persistent storage. Data record processing (which I had little experience with in BASIC, having done only a class grading program for a teacher). 60 bit words vs 8 bit. But also, a multi user system vs standalone. Way different, but much the same as well.

It was great to let someone use the differences and details to focus on the abstractions that they represented. It (to me) was important to have that experience early rather than later. One of my computing epiphanies. (First was INPUT and PRINT and simple expressions in BASIC, second was Arrays, third was this with fortran, and utterly different computer architecture, 4th was dynamic memory and pointers in Pascal -- the light that goes on when you keep a linked list in your head, it's bright one, and, finally, let and lambda in Scheme, and all the AHA that brings).

I took to the mainframe environment like a duck to water. Later, when I saw everyone learning on PCs with DOS and Turbo Pascal instead of the Cyber or PDP, it was just...a sad day.

The only reason for Fortran on micros is to port other code. As others have said, it's just not expressive enough for what most folks want to do. Not easily. No doubt there were Fortran extensions that would let you Peek and Poke in to raw memory. But Fortran was noted for it's floating point math, its first class COMPLEX math, masterful array handling, and all the scary hacky fun times that can be had with static data, and infinite ways to map in to them. Thank you Mr. COMMON Block.

Micros back in the day were not Floating Point powerhouses, so "real work" was done on "real computers" with Fortran.

I did many early Data Structure assignments in Fortran, grateful I didn't have to write any compilers in it.


Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Tue Oct 02, 2018 7:54 am 
Offline

Joined: Sun Apr 10, 2011 8:29 am
Posts: 597
Location: Norway/Japan
drogon wrote:
That comes from FORTRANs implicit number types - if a variable started with the letters I through N then it was implicitly an INteger ...
One of the coding standards we introduced was a mandatory 'implicit off' pragma. That's the most important one we ever introduced. With tons of code there will always be typos, which would go unnoticed with implicit types.

As for strings.. Fortran had (and have) strings, but the compiler I used had some extra extensions which made them even more useful. You could for example use -1 to indicate white space begins/ends, in order to easily strip whitespace from a string. That was particularly useful for command line processing.

A character string " abcdef " addressed as (1:-1) would become
" abcdef", or (-1:-1) just "abcdef"

Edit: Typo


Last edited by Tor on Wed Oct 03, 2018 9:39 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Tue Oct 02, 2018 3:13 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1928
Location: Sacramento, CA, USA
Tor wrote:
... With tons of codes there will always be typos, which would go unnoticed with implicit types ...

A read a story several years ago about a guy who was reviewing a gigantic FORTRAN program in preparation for translating it or upgrading/extending it, and decided to write a script to do some automated analysis of the source. This was working code, but his script found a variable buried deep within it that was initialized but never used. The initialized value was 1.2 and the variable was named something like DO31670I ... doh!

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Tue Oct 02, 2018 3:40 pm 
Offline

Joined: Sat Dec 12, 2015 7:48 pm
Posts: 123
Location: Lake Tahoe
Although FORTRAN was never big on the 8 bitters, it was successful on the IBM PC (especially on the 386 and above). My good friend Tom Lahey had a Fortran company and he liked to relate a story about a user who had a program he would run on a Cray, but it was expensive and the queue time was 24 hours. With a PC and Lahey Fortran, he could run his code locally and get his results after 24 hours of runtime. So he reached price and performance parity with a Cray using a PC.


Top
 Profile  
Reply with quote  
 Post subject: Re: No love for FORTRAN?
PostPosted: Tue Oct 02, 2018 5:57 pm 
Offline
User avatar

Joined: Mon May 12, 2014 6:18 pm
Posts: 365
I found a very old FORTRAN book at my local library in high school one summer and spent a lot of time playing with it on our PC. FORTRAN 90 and 95 were out by then but I didn't know anything about them since they weren't mentioned in the book. I got used to doing output like WRITE (10, 500) before I found out about WRITE (*,*). Later I started using Force Fortran, which has a color coded editor but the compiler (at least at the time) was not that great. I got a copy of Salford Fortran, which can do fancy graphics, and tried redirecting the output of the Force editor to the Salford command line compiler. Unfortunately, Force would hang since it somehow kept track of the execution of whatever program it thought was its compiler (and any programs that program started) and didn't expect it to keep running, so you couldn't just replace its compiler with renamed Salford files. My solution was to replace the Force compiler with a small program that passed the name of the file to compile to a daemon running in the background then quietly exited to appease the editor while the daemon compiled and ran the program with the Salford compiler. I think this qualifies as my very first hack :D


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 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: