Fortran on the HPLX: Possible, but why would you?

I have an HP200LX. It is a real computer — a DOS 16-bit computer, yes, but one with the flexibility that comes with being able to run various (old) compilers. As a science-ist, I recommend and use Fortran, though preferably a modern variant. There are not many Fortran compilers that work on a 16-bit system, and I did not want to bother with a DOS extender on such a constrained environment. Of course, in truth running any language on this old thing is no more than a curiosity.

For the record, I’m writing this in an old DOS port of vi (calvin) on the LX.

On the Web one can find a thing called BC Fortran. It is in German. It is not terribly modern — essentially, FORTRAN 77 — but it works. This is how I used it on the LX.  Works in DOSBox as well.

1. Googled around for the archive bcf7713b.zip (‘Use of the compiler is free for non-commercial uses.’)

2. Copied it to my CF card in directory \BC.  See this post for how to use a Compact Flash card on a modern computer, if you do not have a card reader with a CF slot in it.

3. Put the card back into the LX. Turned on the LX.

4. Closed down the program manager (Menu -> File -> Terminate all).

5. The CF card is A: so changed to directory A:\BC.

6. Unzipped the archive.

7. For simplicity, I decided to simply copy all the Fortran files into the \BC directory, so I don’t need to worry about the path or anything.

8. I loaded the resident part (necessary for compiling and running programs; not doing this can lock up the LX such that neither the on/off button nor Ctrl-Alt-Del will work… a problem!).

LH BCRTSY.EXE

Only do this once; I recommend using command mem /c to look at what has already been loaded. Also, I do not know how to unload it (short of rebooting), or if that is even possible.  There used to be old DOS utilities for unloading arbitrary TSRs.

9. It is now ready. There is a compiling step followed by a linking step.

To compile file.f:

bcf -u file.f

To link, explicitly include the library on the command line:

bcl -o file.exe file lib

Here is a session, grabbed from a DOSBox window, not from the LX:

bcf -u short.f
BC-FORTRAN77 Compiler 1.3b1711, (c)1990 Andre Koestli, Stuttgart
File short.f
bcl -o short lib
BC-Linker 1.3b1711, (c)1990 Andre Koestli, Stuttgart
short.b             2996
lib.b              71948
       2 Commons    1600
      79 Module    74876
         frei     407220
      25 Module geloescht
       2 Commons    1600
      54 Module    58204
         frei     423892
      13 Module geloescht
       2 Commons    1600
      41 Module    44764
         frei     437332
       4 Module geloescht
       2 Commons    1600
      37 Module    42172
         frei     439924
       1 Module geloescht
       2 Commons    1600
      36 Module    41388
         frei     440708
short.exe          42416

 

Now, it seems to be Fortran 77 without any extensions (‘BCC-FORTRAN77 compiles the complete standard from ANSI/ISO’ — from ENGLISH.TXT, which is included in some of the archives); it does not have ‘end do’ for example, though it does have ‘endif’ and ‘else’.

FYI: ‘geloescht’ = ‘deleted’.

See http://folk.uio.no/hpl/scripting/doc/f77/tutorial/comments.html
See http://www.pcorner.com/list/MISC/BCF7713B.ZIP/ENGLISH.TXT/

This link gives a random number generator that works with the compiler: https://www.cisl.ucar.edu/zine/96/spring/articles/3.random-6.html

Even more pointless, possibly more nifty.

Advertisements

Tags: , , , ,

About Darren

I'm a scientist by training, based in Australia.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: