Jump to content
IGNORED

Fortran99 Challenge


dhe

Recommended Posts

The fortran99 challenge:

  1) Download the fortran99 disks that are available here on atariage.

  2) Use them with your favorite emulator.

  3) Write a simple 'hello world program'

  4) Let everyone know:

        a) emulator used.

        b) steps taken to compile and run.

 

I've failed, I hope many of you can do better!

 

Thanks,

Dan

 

  • Like 3
  • Sad 1
Link to comment
Share on other sites

So the basic steps of compiling a program are:
Edit Source>Compile>Link
At this point you should be able to go to E/A and run your program.
Don't do that yet.

 

Instead, while in development, use:
Edit Source>Compile>Link>Load and Run (all from fortran99's menu).
Because there are errors, that you will only find out about if you use fortran99's load and run facility.
  (ie.. E/A will only do what it's told, fortran99 tries to help you out.)

 

In that, Fortran99 is a lot like Assembler. Yep, it all assembles (compiles) nicely, but doesn't run, and will fail silently.

 

Once of course, you verify everything runs as you would like, you can give others your executable and they can exec with E/A option 5.

 

A note about linking, when asked you can skip the part about scan library - that doesn't work very well, so when asked:
   'Scan Library Name?' go ahead and give FL - you'll know from the linker listing if you need to add others - READ THE LISTINGS
   
   You will also be asked about Symbols, while it appears you can create your own, your given some basic symbols set
   DSK1.TESTSYM - loading that in with the linker didn't cause any problems.

 

image.thumb.png.cab26550a82f3a77e6b569037c6c4b05.png

 

 


Note: There are some issues with Classic99, I have not been able to nail them precisely all down, but have gotten in to sitations, where DSKx couldn't be seen at all.
Getting a fresh start - closing Classic99 all the way, restarting and apply a cold start got everything back on to the correct path.

 

For those interested, here is my classic99.ini

 

>>List ini here<<


D:\classic99>type classic99.ini
[audio]
max_volume=80
samplerate=22050
[Disk0]
Type=0
[Disk1]
Type=2
Path=D:\classic99\mydisks\DSK1\fortcomp.dsk
FIAD_AllowMore127Files=0
IMAGE_UseV9T9DSSD=0
DISK_AutoMapDSK1=0
FIAD_WriteV9T9=0
FIAD_ReadTIFILES=1
FIAD_ReadV9T9=1
FIAD_WriteDV80AsText=0
FIAD_WriteAllDVAsText=0
FIAD_WriteDF80AsText=0
FIAD_WriteAllDFAsText=0
FIAD_ReadTextAsDV=1
FIAD_ReadTextAsDF=0
FIAD_ReadTextWithoutExt=0
FIAD_ReadImgAsTIAP=1
FIAD_AllowNoHeaderAsDF128=0
FIAD_EnableLongFilenames=0
[Disk2]
Type=2
Path=D:\classic99\mydisks\FORTSRC\source.dsk
FIAD_WriteV9T9=0
FIAD_ReadTIFILES=1
FIAD_ReadV9T9=1
FIAD_WriteDV80AsText=0
FIAD_WriteAllDVAsText=0
FIAD_WriteDF80AsText=0
FIAD_WriteAllDFAsText=0
FIAD_ReadTextAsDV=1
FIAD_ReadTextAsDF=0
FIAD_ReadTextWithoutExt=0
FIAD_ReadImgAsTIAP=1
FIAD_AllowNoHeaderAsDF128=0
FIAD_EnableLongFilenames=0
IMAGE_UseV9T9DSSD=0
DISK_AutoMapDSK1=0
FIAD_AllowMore127Files=0
[Disk3]
Type=2
Path=D:\classic99\mydisks\OBJECT\object.dsk
FIAD_WriteV9T9=0
FIAD_ReadTIFILES=1
FIAD_ReadV9T9=1
FIAD_WriteDV80AsText=0
FIAD_WriteAllDVAsText=0
FIAD_WriteDF80AsText=0
FIAD_WriteAllDFAsText=0
FIAD_ReadTextAsDV=1
FIAD_ReadTextAsDF=0
FIAD_ReadTextWithoutExt=0
FIAD_ReadImgAsTIAP=1
FIAD_AllowNoHeaderAsDF128=0
FIAD_EnableLongFilenames=0
IMAGE_UseV9T9DSSD=0
DISK_AutoMapDSK1=0
FIAD_AllowMore127Files=0
[Disk4]
Type=2
Path=D:\classic99\mydisks\LIST\list.dsk
FIAD_WriteV9T9=0
FIAD_ReadTIFILES=1
FIAD_ReadV9T9=1
FIAD_WriteDV80AsText=0
FIAD_WriteAllDVAsText=0
FIAD_WriteDF80AsText=0
FIAD_WriteAllDFAsText=0
FIAD_ReadTextAsDV=1
FIAD_ReadTextAsDF=0
FIAD_ReadTextWithoutExt=0
FIAD_ReadImgAsTIAP=1
FIAD_AllowNoHeaderAsDF128=0
FIAD_EnableLongFilenames=0
IMAGE_UseV9T9DSSD=0
DISK_AutoMapDSK1=0
FIAD_AllowMore127Files=0
[Disk5]
Type=2
Path=D:\classic99\mydisks\EXEC\exec.dsk
FIAD_WriteV9T9=0
FIAD_ReadTIFILES=1
FIAD_ReadV9T9=1
FIAD_WriteDV80AsText=0
FIAD_WriteAllDVAsText=0
FIAD_WriteDF80AsText=0
FIAD_WriteAllDFAsText=0
FIAD_ReadTextAsDV=1
FIAD_ReadTextAsDF=0
FIAD_ReadTextWithoutExt=0
FIAD_ReadImgAsTIAP=1
FIAD_AllowNoHeaderAsDF128=0
FIAD_EnableLongFilenames=0
IMAGE_UseV9T9DSSD=0
DISK_AutoMapDSK1=0
FIAD_AllowMore127Files=0
[Disk6]
Type=1
Path=d:\classic99\mydisks\utils\
FIAD_WriteV9T9=0
FIAD_ReadTIFILES=1
FIAD_ReadV9T9=1
FIAD_WriteDV80AsText=0
FIAD_WriteAllDVAsText=0
FIAD_WriteDF80AsText=0
FIAD_WriteAllDFAsText=0
FIAD_ReadTextAsDV=1
FIAD_ReadTextAsDF=0
FIAD_ReadTextWithoutExt=0
FIAD_ReadImgAsTIAP=1
FIAD_AllowNoHeaderAsDF128=0
FIAD_EnableLongFilenames=0
IMAGE_UseV9T9DSSD=0
DISK_AutoMapDSK1=0
[Disk7]
Type=1
Path=d:\classic99\mydisks\scratch\
FIAD_WriteV9T9=0
FIAD_ReadTIFILES=1
FIAD_ReadV9T9=1
FIAD_WriteDV80AsText=0
FIAD_WriteAllDVAsText=0
FIAD_WriteDF80AsText=0
FIAD_WriteAllDFAsText=0
FIAD_ReadTextAsDV=1
FIAD_ReadTextAsDF=0
FIAD_ReadTextWithoutExt=0
FIAD_ReadImgAsTIAP=1
FIAD_AllowNoHeaderAsDF128=0
FIAD_EnableLongFilenames=0
IMAGE_UseV9T9DSSD=0
DISK_AutoMapDSK1=0
[Disk8]
Type=0
[Disk9]
Type=1
Path=d:\classic99\dhe\
FIAD_WriteV9T9=0
FIAD_ReadTIFILES=1
FIAD_ReadV9T9=1
FIAD_WriteDV80AsText=0
FIAD_WriteAllDVAsText=0
FIAD_WriteDF80AsText=0
FIAD_WriteAllDFAsText=0
FIAD_ReadTextAsDV=1
FIAD_ReadTextAsDF=0
FIAD_ReadTextWithoutExt=0
FIAD_ReadImgAsTIAP=1
FIAD_AllowNoHeaderAsDF128=0
FIAD_EnableLongFilenames=0
IMAGE_UseV9T9DSSD=0
DISK_AutoMapDSK1=0
[CF7]
BIOS=
Disk=.\cf7Disk.img
Size=134217728
[emulation]
AVIFilename=C:\Classic99.AVI
cputhrottle=1
systemthrottle=0
maxcpf=48388
pauseinactive=0
ctrlaltreset=0
invertcaps=1
speechenabled=1
system=1
slowdown_keyboard=1
ps2keyboard=1
sams_enabled=1
sams_size=3
[joysticks]
active=1
joy1mode=0
joy2mode=1
[roms]
cartgroup=0
cartidx=2
[video]
FilterMode=4
frameskip=0
fullscreenmode=6
heatmapfadespeed=25
hzRate=62
MaintainAspect=1
EnableF18A=1
Enable80Col=1
Enable128k=0
InterleaveGPU=1
StretchMode=2
Flicker=0
ScreenScale=1
ScreenX=650
ScreenY=472
topX=1247
topY=355
[debug]
ScrambleRam=0
CorruptDSKRAM=0
[tvfilter]
hue=100
saturation=100
contrast=100
brightness=100
sharpness=100
scanlines=1
[LastDiskMRU]
MRU1=D:\classic99\mydisks\EXEC\exec.dsk
MRU2=D:\classic99\mydisks\LIST\list.dsk
MRU3=D:\classic99\mydisks\OBJECT\object.dsk
MRU4=D:\classic99\mydisks\FORTSRC\source.dsk
MRU5=D:\classic99\mydisks\DSK1\fortcomp.dsk
MRU6=D:\classic99\mydisks\dsk1\FORTRAN.DSK
MRU7=D:\classic99\mydisks\dsk1\fortrancom.dsk
MRU8=D:\classic99\mydisks\dsk1\fortran.dsk
MRU9=D:\classic99\mydisks\dsk1\TP99COMP.DSK
MRU10=D:\classic99\DSK1\TP99COMP.DSK
[LastPathMRU]
MRU1=d:\classic99\mydisks\scratch\
MRU2=d:\classic99\mydisks\utils\
MRU3=D:\classic99\mydisks\exec\
MRU4=D:\classic99\mydisks\utils\
MRU5=D:\classic99\mydisks\list\
MRU6=D:\classic99\mydisks\object\
MRU7=D:\classic99\mydisks\FORTSRC\
MRU8=D:\classic99\mydisks\DSK1\
MRU9=D:\CLASSIC99\MYDISKS\DSK1\
MRU10=D:\classic99\mydisks\dsk2\
[LastCartMRU]
MRU1=
MRU2=
MRU3=
MRU4=
MRU5=
MRU6=
MRU7=
MRU8=
MRU9=
MRU10=

D:\classic99\

 

 

Link to comment
Share on other sites

I have some problems with the archive files of the Fortran Package (99-9640_FORTRAN_v4.4.zip). My TIImageTool says that 9640COMP and FORTLIB2 are broken (Archive file is clipped). I tried to unpack 9640COMP with ARC3, but it crashes after unpacking F9640 (so there is obviously something wrong with it). I was able to unpack FORTLIB2 with ARC3, maybe there is some issue that is less obvious.

 

9640LIBR, FORTAPPS, FORTCOMP, FORTLIBR are OK.

 

Unfortunately, my original disks are all unreadable, and I only have the Geneve version on my hard drive.

 

Edit: The ML lib is broken after all. This lib is from the FORTLIB2 archive which failed to be unpacked by TIImageTool and was unpacked by ARC3, but obviously not successfully and without error message. I conclude that it is broken because when I try to load it by Link>Library name, I get an I/O error, while CL, GL, and FL load successfully.

 

Edited by mizapf
Link to comment
Share on other sites

1 hour ago, mizapf said:

I have some problems with the archive files of the Fortran Package (99-9640_FORTRAN_v4.4.zip). My TIImageTool says that 9640COMP and FORTLIB2 are broken (Archive file is clipped). I tried to unpack 9640COMP with ARC3, but it crashes after unpacking F9640 (so there is obviously something wrong with it). I was able to unpack FORTLIB2 with ARC3, maybe there is some issue that is less obvious.

 

9640LIBR, FORTAPPS, FORTCOMP, FORTLIBR are OK.

 

Unfortunately, my original disks are all unreadable, and I only have the Geneve version on my hard drive.

 

Edit: The ML lib is broken after all. This lib is from the FORTLIB2 archive which failed to be unpacked by TIImageTool and was unpacked by ARC3, but obviously not successfully and without error message. I conclude that it is broken because when I try to load it by Link>Library name, I get an I/O error, while CL, GL, and FL load successfully.

 

I will try to make a copy of the disks sometime this week and post them here.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

14 hours ago, dhe said:

Note: There are some issues with Classic99, I have not been able to nail them precisely all down, but have gotten in to sitations, where DSKx couldn't be seen at all.
Getting a fresh start - closing Classic99 all the way, restarting and apply a cold start got everything back on to the correct path.

Get the latest version. There was an issue I just discovered while updating DSK.DSKNAME wherein disk directory access didn't release the file handle - get enough directories, and Classic99 can't open anything anymore.

 

As always, I do not recommend disk images for doing serious work in Classic99.

 

  • Like 1
Link to comment
Share on other sites

Ok.. Will try.

For the record, I was using QI399.014.

I'm kind of stuck with disk at least on the compiler disk side, until you patch (directory = disk name), then I can give that a try.

 

I will report back if anything else comes up, I just pulled down QI399.018.

Edited by dhe
after download
  • Like 1
Link to comment
Share on other sites

6 hours ago, dhe said:

I'm kind of stuck with disk at least on the compiler disk side, until you patch (directory = disk name), then I can give that a try.

This has always worked, it was only sector level access that returned the wrong disk name. :)

 

The release I mentioned above (399.018) has that fix as well.

Link to comment
Share on other sites

When looking for information, one of the first places I start looking is the cyc. My methodology for this, is to use adobe to search the whole directory tree for something that I'm looking for like, in this case FORTRAN.

 

One of the hits, was in a file, called filelist.pdf (huge). 2344.dsk - Al Beard does an intro tutorial for FORTRAN99. So filelist.pdf is a listing of Genie files archived by Barry Traver when he was the sysop there. CADD came in to all of Barry's TI Disks, and most all of them have been moved from physical media, to PC files.

 

I couldn't find 2344.dsk, so I dug deeper. The directory structure is:
\cadd\cyc\vendors\genie\ under that there is disks - which are stand alone and then there is disksark which are still in Barry's original archive, but are pretty easy to pull with either the tools included with PC99, or I used Fred's TI99dir - since I already had it open on the desktop from getting the FORTRAN stuff together, to work under Classic99.

 

So here is the trick, if you look under \disks, you see:
06/07/2016  12:27 PM           260,240 2224.dsk
06/07/2016  12:10 PM           260,240 2228.dsk
08/11/2008  12:05 AM           260,240 2444.dsk
02/09/2008  09:08 PM           260,240 2466.dsk

 

Nope: No 2344 disk here.

 

But the disk does actually exists, so now you need to change to \diskark
09/18/2000  04:00 PM           549,760 2315PLUS.DSK
09/18/2000  07:27 PM           549,760 2325PLUS.DSK
09/18/2000  07:27 PM           549,760 2339PLUS.DSK
09/18/2000  07:50 PM           549,760 2350PLUS.DSK
09/18/2000  07:50 PM           549,760 2368PLUS.DSK

But, if you look inside 2339PLUS.DSK - there it is! w00t  

 

So disk 2339 contains, disks 2339 - 2349 inclusively.

 

Now, for the unfortunate part, when Barry dumped this out, he did it in 40 column mode, while the original was for 80-column, which required me to do some hand editing, if I wanted to get this in a readable format. (but below it is!).

This is what I was hoping to start out which, because, it theory, if you follow all of these instructions TO THE LETTER, you should in the end of a workable program, from which you can expand and play.
ACTION> (Next, Down, Xm, List) L
 
Understanding 99 FORTRAN, for your TI-99/4A and MYARC Geneve
       ------------------------------------------------------------
 
 The following is the start of a tuturial on 99 FORTRAN.  In this section, I give a little history of FORTRAN, and take the user through editing, compiling, linking, and running a small FORTRAN program.
 
             Part 1 - The basics
                -------------------
  99 FORTRAN offers unique capabilities for your TI-99 and GENEVE, a syntax
 similar to BASIC with the execution speed of a true compiler!  FORTRAN is
 more like BASIC than C or FORTH.
 
 FORTRAN is the oldest "higher level language" developed in the 1950's.  It
 is best known for numerical analysis (and is still probably the best suited
 language for such applications) but can easily handle other types of programs,
 such as games or database programs or just about anything.  As a matter of
 fact, the original granddaddy adventure game "ADVENTURE" was written in
 FORTRAN on a PDP-11.
 
 As FORTRAN evolved from a very simple numerical language, to a very rich
 and powerful language, various standards emerged.  FORTRAN II, FORTRAN III,
 and finally FORTRAN IV was standardized in 1966, with the ANSI standard
 FORTRAN 66.  During the 1970's, a new and very important style of pro-
 gramming emerged, structured programming.  What is it?  Well, look at
 the following pieces of FORTRAN code and see which is easier to understand:
 
           IF ( ICODE - 10 ) 100, 110, 100
   100     J = 2
           GOTO 120
   110     J = 3
   120     CONTINUE
 
                    or
 
           IF ( ICODE .EQ. 10 ) THEN
             J = 3
           ELSE
             J = 2
           ENDIF
 
 The first example shows a FORTRAN arithmetic IF statement, whereas the
 second a structured block IF statement.
   Both code segments do the exact same function, if the variable ICODE is
 equal to 10, then the variable J is set equal to 3, otherwise the vari
able J is set equal to 2.  The second example is MUCH easier to unders
tand, especially later when you go looking for statement labels.
 
 99 FORTRAN has some FORTRAN 66 and some FORTRAN 77 features.  Most important
 with FORTRAN 77 is the structured IF statement, as shown above.
 
                         Equipment Needed
                             ----------------
 
 To run 99 FORTRAN, you need a TI-99/4A with 32k memory, disk drive, console,
 monitor, and one of the modules Editor Assembler, MINI-Memory, Extended
 BASIC or TI-Writer.  If you have the MINI-Memory, then use it, 99 FORTRAN
 makes use of the extra 4k of memory to speed compilation and for the symbolic
 debugger.
 
 You also need a copy of 99 FORTRAN.  This is available from TENEX Computer
 Express, Disk Only Software, or Quality 99 Software, suggested retail of
 $49.95.
 
 99 FORTRAN can also be run on a GENEVE in GPL mode (sorry, MDOS version is
 not available, yet).  It can be run at the highest speed (5) available.
 It can also access RAM disks.
 
 Note that the released versions of 99 FORTRAN include 2.1, 2.1.1, 2.1.2,
 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.1.7, 3.1, 3.1.1, 3.1.2, 3.1.3.  If you
 currently have a version 2 (see the label on the boot or library disk,
 or read the VERSION file on the boot or library disk) then you should
 send in your warranty registration to LGMA Products.  You will then
 receive a letter explaining how to upgrade your system to the latest
 version 3 release.
 
 If you make copies of the boot disk, then make sure the name of the disk
 is kept the same, e.g. FORTCOMP for the boot disk, and FORTLIBR for the
 two library disks.  If you copy the boot disk to a RAM disk (e.g. DSK5),
 then make sure the name of the RAM disk is FORTCOMP also.  This can be
 changed with the preferences program, see the FORTRAN manual for a
 description.
 
                        Booting in FORTRAN
                        ------------------
  Booting in FORTRAN is easy, just put the BOOT disk in any drive (suggest
 drive one to cut down on searches), and enter BASIC, and type:
 
                        OLD "DSK.FORTCOMP.LOAD"
                        RUN
 
 There are several other ways of booting in FORTRAN.  A quick way with the
 editor/assembler module is to use option 5 (load and run), and type:
 
                        DSK.FORTCOMP.UTIL1
  If the boot process went ok, you will see a menu on the screen:
 
                         99 FORTRAN
                   1 Edit           6 Save
                  2 Compile        7 Load
                  3 Link           8 USER
                  4 Run            9 Utilities
                  5 Run/Debug
 
 a blinking underscore will also be at the bottom of the screen, this is
 the cursor.
 
 To perform a function, type the number associated with the function (e.g.
 1 to edit a program) followed by ENTER (or return).  The boot disk will
 be read for that function, the appropriate program(s) related to that
 function will be read, and the function initiated.  If you don't have the
 boot disk plugged into a drive, then you will get a cryptic "I/O Error"
 message.  Just put the boot disk in and try again.
 
                         Editing a program
                         -----------------
 
 Now that FORTRAN is booted, lets call in the EDITOR.  From the main menu
 screen (the one above), type the number 1 (for editing) and ENTER.  After
 a short delay, and some disk activity,the following MENU will appear:
 
                            99 Editor
 
                       Press:
 
                           1 To Load Program
                           2    Edit Program
                           3    Save Program
                           4    Purge Workspace
                           5    DisplayStatistics
                           6    Print File
 
 Lets first edit a program.  Press the number "2".  The screen will clear,
 and the following will be displayed:
 
        <EOD> (Version 3.0)
 
 Depress ENTER to open a line, then type in the following program lines:
 (note that every FORTRAN statement must be preceded by SIX or more blanks,
 and statement labels must fall in columns one through 5.  A character other
 than a blank or zero in column 6 meansthis is a continuation line.
 Characters past column 72 are ignored):
        c    cc
        o    oo
        l    ll
        1    67
        v    vv
              PROGRAM SAMPLE
              I = 0
              DO WHILE ( I .NE. 999 )
                WRITE ( 6, 9100 ) I
                READ ( 6, 9110, END=9999
, ERR=9999 ) I
              ENDDO
         9999 STOP
         9100 FORMAT ( '+', C12, M10.4,
'Value of I is: ',I6,
             +              M18.4, 'Enter New Value:', M18.22 )
         9110 FORMAT ( I6 )
              END
 
 When finished, depress fctn/back (function/9) to return to the menu display.
 Insert a blank, formatted, disk into DSK1, and select item 3 (Save Program).
 99 FORTRAN responds:
 
         File to save?
 
 Type in a file name of:
 
         DSK1.SAMPLE
 
 The program source will be saved to the disk in display/var/80 format.
 
 You have now created a program source.  Note that the 99 FORTRAN editor is a minimal editor, there is no string search or replace capability.  If you need to do a LOT of editing, you might chose to use the editor/assembler editor or TI-Writer, if it is available to you.  Just make sure to save the file in display/var/80 format!
 
 Exiting the editor is simple, type function/back (function/9).  The message:
          Are you sure (Y/N)?
  will be displayed.  Type a 'Y', and you will return to the MAIN MENU.
 
                       Compiling( "2" on the MAIN MENU (for Compile).  The compiler will load into memory, and the following message will be displayed:
 
                      99 FORTRAN Compiler V3.1
 
             Input File Name?
 
 Enter the name of the source input file you created above, DSK1.SAMPLE
 and press ENTER.  The next question is:
              Object File Name?
 
 Enter the name of the resulting object file:
              DSK1.SAMPOBJ
 
 and ENTER.  The next question is displayed:
              Listing File Name?
 
 If you want a listing to a printer, then you can enter the device name
 here.  Some device names that are common are:
 
             PIO  or RS232/1.BA=4800
 
 If you want the listing to be displayed on the screen, type in a device
 name of CRT.  If you don't want a listing, just press ENTER.
 
 The next question displayed is the Scratch Disk Number (1-3).  If your
 program is longer than about 80 lines, then 99 FORTRAN may have to create
 some temporary files on the disk.  It will delete them when the compilation
 is finished.  In this case, just use 1 (just hit ENTER).
 
 The last question is:
            Compilation Options?

 Just leave this blank for now (just hit ENTER).
 
 The message:
             Press ENTER to Continue
 
 will be displayed.  Press ENTER to start the compilation.
 
 After a few seconds (longer if you are printing the listing), the following
 should be displayed on the screen:
 
            Compilation in Progress
               0000 Warning(s)
               0000 Error(s)
            Compilation Complete
            Press ENTER to Continue
 
 If you have accumulated errors here, go back to the editor, load the program
 source, edit it to remove the errors, and recompile.  Do NOT attempt to
 run a program which has compilation errors!  The results are unpredictable.
 
 Press the ENTER key to return to the MAIN menu.
 
 99 FORTRAN "remembers" the last function executed, so that if you have
 multiple compilations to perform, just select item 2 again.  The compiler
 will be immediately available without reloading from disk.
 
                        Linking the Program
                        -------------------
 
 Before the program can be executed, the object must be "linked" to produce
 an absolute executable module.  To link your sample program, press "3"
 and ENTER on the MAIN MENU.
 
 You can now link the sample program.  The linker first displays the following
 question:
 
                          99 Linker V3
 
                Listing File Name?
 
 If you want a listing, enter the same device name you entered while compiling
 the program (e.g. PIO, or RS232/1.BA=4800, or CRT).  If you don't want a
 listing, just press ENTER.  The following question will then be displayed:
 
                Object File Name?
 
 Enter the name of DSK1.SAMPOBJ.  This will load your sample object into
 main memory, ready for execution.  Note that after the file is read the
 question:
 
                Object File Name?
 
 is displayed again!  This allows you to enter multiple object files for
 precompiled FORTRAN and Assembly Language subroutines.  Just hit ENTER
 for now.
 
 If you selected the listing option, a map will be produced on the selected
 listing device.  It should look like this:
 
                Fortran Map V3
                 Logic Area     Size = 009C
                  SAMPLE          A000
                 Spare Area     Size = 5A32
                 Data Area      Size = 0008
                  SAMPLE    *     FAD0
 
                Press ENTER to Continue
 
 This map shows the logic area location and size, the data area location and
 size, and the spare area (unused) sizein hexadecimal bytes.
 
 Press ENTER to return to the MAIN MENU.
 
                        Running the Program
                        -------------------
 
 To RUN your program, select item 4 (Run) on the MAIN MENU, and press enter.
 One file will be loaded from the disk, and the program will be started,
 displaying the following:
 
                       Value of I is:  0
 
                       Enter New Value:
  _
 
 enter the number 123 and ENTER.  The screen will be re-displayed showing
 this number.
 
 It is now time to examine the program line by line to see what it is doing:
 
 The first line is:
 
              PROGRAM SAMPLE
 
 this line really is just for documentation.  The program name will appear
 on the link map.  It serves no other function.
 
 The next line:
 
              I = 0
 
 assigns the value of zero to the integer variable I.  In FORTRAN, all
 variables starting with the letters I, J, K, L, M or N are defaulted to
 INTEGER, all other letters are of type REAL.  We are dealing with all
 integer variables here.  You can change the IMPLICIT defaults using the
 IMPLICIT statement, you can also change each variable EXPLICITLY using
 the INTEGER, REAL, LOGICAL, or DOUBLE PRECISION statements.
 
 The next statement starts a loop construct, starting with the DO WHILE
 statement and ending with the ENDDO statement:
 
              DO WHILE ( I .NE. 999 )
                   .
                   .  statements here
                   .
              ENDDO
 
 These statements say "do the following statements, up to the ENDDO statements,
 while the logical expression within the parenthesis is TRUE".  In this case,
 the statements will be executed as long as the variable I is not equal to
 the value 999.
 
 The following two statements are FORTRAN write and read statements:
 
                WRITE ( 6, 9100 ) I
                READ ( 6, 9110, END=9999, ERR=9999 ) I
 
 they are indented to the right to make the program easier to read (since
 the statements are part of a loop construct).  The first WRITE statement
 says "write on device 6, according to FORMAT statement starting with label
 9100, the variable I".  The READ statement says "read from device 6, according
 to the FORTRAN statement starting with label 9110, if an END condition occurs
 then branch to statement starting with label 9999, if an ERROR condition
 occurs, then branch to the statement starting with label 9999, the variable
 I".
 
 FORTRAN devices are opened via the CALL OPEN statement.  There is one
 device automatically assigned for both input and output for every FORTRAN
 program, device 6, the CRT.
 
 The next statement:
          9999 STOP
 
 is branched to when the loop exits (if the value of I is 999) or when an
 END condition or ERROR condition is detected on the READ statement.
 
 The next two statements are the associated FORMAT statements for the WRITE
 and READ statements:
          9100 FORMAT ( '+', C12, M10.4,'Value of I is: ',I6,
             +              M18.4, 'Enter New Value:', M18.22 )
         9110 FORMAT ( I6 )
 
 The first FORMAT (9100) is associated with the WRITE statement (write
 according to FORMAT 9100, remember?), and the next statement is associated
 with the READ statement (9110).
 
 The first FORMAT starts with a quoted string (single quotes in FORTRAN, not
 double), with a FORTRAN carraige control character ('+').  I am using a
 plus sign here to disable the FORTRAN carraige control convention.
 
 The next FORMAT literal is "C12".  This is a special 99 FORTRAN extension
 which says "write the ascii character whose value (12) follows".  This
 character, a form feed, clears the screen.
 
 The next FORMAT literal "M10.4" is again a special 99 FORTRAN extension which
 says "move the cursor to row 10, column 4".
 
 The next quoted string 'Value of I is:' displays that string at row 10,
 column 4 on the screen.  This is followed by a standard FORTRAN "I6"
 literal, which says "display an integer value (I) in a six character
 field, right justified, and padded to the left with blanks".
 
 The cursor is again moved to row 18, column 4 (via M18.4) and the quoted
 string 'Enter new value:' is di.there.
 This is followed by a( final cusor move M18.22, which moves t.he cursor to row 18, column 22.' Since I used the
 '+' carriage control,"above, then the cursor will remain.co..his..
 there for the next READ operation.
 
 The next format:
          9110 FORMAT ( I6 )
  is used in conjunction with the READ statement, and says "read an integer
 in an up to six character field".  Actually 99 FORTRAN works just like
 basic here, except the field width is limited to what you enter.  For
 example, the following numbers will be produced in response to the
 following (try it!):
                 c    c
                 o    o
                 l    l
 
                 2    2
                 2    7
                 v    v
 
                 12           produces 12
                    12        produces 12
                     12       produces 12
                  -12         produces -12
                 123456       produces -7616 (integer overflow)
 
 We can exit the program by entering the value 999, by entering a non-numeric
 character (remember the ERR= exit in the READ statement above), or by en-
 tering the "end of data" characters >EOD (remember the END= exit in the
 READ statement above).
 
 The final statement of the program terminates the program compilation.  If
 control is ever passed to the END statement, it is treated as a STOP state-
 ment:
 
              END
 
                            In Summary
                            ----------
 
 The procedures outlined above show you how to edit, compile, link, and
 run 99 FORTRAN programs.  It may seem tedious the first time through, but
 the reward are programs that are easy to follow and liberally commented,
 and run anywhere from twice as fast tohundreds of times faster than their
 TI BASIC counterparts.
 
 In future tutorials, I will go more in depth on the FORTRAN language itself,
 and how to use the extensive FORTRAN libraries.
 
 Enjoy!
 
 Copyright 1988
 by A.L.Beard       29-May-1988
 
       (please ask permission to reproduce or post on bulletin boards.
               permission given freely)
 
 

  • Like 2
Link to comment
Share on other sites

1 hour ago, dhe said:

Thanks to Michael, using the old 22/7 method, we get a pretty good approximation of PI.

Also, thanks to Beery, we have a name to go with the math routines:

Elmer Clausen - please stand up and take a bow! ?

 

image.thumb.png.b4191ce3ce8207d8b08196d22bd48545.png

What would happen if you tried 355/113 ?

 

In Forth using just integers you can get  31415  which you have to scale by 10,000 of course.

: PI   ( -- n ) 355 10000 113 */  ;  \ n is PI * 10000

 

Edited by TheBF
added code snippet
Link to comment
Share on other sites

So I played with the Fortran 99 package today.  

In emulation under Classic 99, you have to use a FIAD disk as your source file disk. If you use a disk image instead, the source file you edit will get corrupted. I am using the latest Classic 99 version. Also Fortran 99 will not run with js99er at all. Not sure why.

I was able to successfully edit, compile, link and run the sample program included in Beard's introduction, so I thought OK let me try something a little more interesting and went ahead a made a Fortran version of the simple PI approximation program we discussed in another thread. Unfortunately the compiled and linked program would not run. I have absolutely no idea where the issue is. When I compile, I get 4 warnings about using mixed variable types in computations which is fine, but no errors. The program uses the Fortran and Math libraries (for the IRAND function) and the linker does not throw any errors either and produces the proper executable files. I tried this in Classic 99 as well as real iron with similar results. 

Here's the program listing: anything looks out of order?

 

C CALCULATING AN APPROXIMATION OF PI
 
      PROGRAM PICALCFT
 
      INTEGER *4 N, I, TOTAL
      REAL *8 X, Y, D, PI
 
C GET NUMBER OF ITERATIONS
10    FORMAT('+', C12, M1.1, 'Number of iterations? ', I8)
      READ(6, 10) N
 
C MAIN PROGRAM LOOP
20    FORMAT('+', M12.1, 'Iteration # ', I8)
      I = 1
      DO WHILE(I .LE. N)
        X = IRAND(10) / 10
        Y = IRAND(10) / 10
        D = X**2 + Y**2
        IF (D .LE. 1) THEN
          TOTAL = TOTAL + 1
        ENDIF
        WRITE(6, 20) I
        I = I + 1
      REPEAT
 
C FINALIZE RESULT AND DISPLAY
30    FORMAT('+', M23.1, 'Approximate PI = ', F1.6)
      PI = TOTAL / N * 4
      WRITE(6, 30) PI
      STOP
      END

 

Link to comment
Share on other sites

One problem for me down. I put hands on a copy of PrEditor. I was playing with it to re-familiarize myself. (been about 30 years). I was surprised at how VI'ish the commands where - that's good for me. The PrEditor Quick-Reference Chart shows FCTN-Q to quit. Kept trying that - no dice, then I thought, maybe, this isn't a virgin copy of PR. Sure enough I ran CONFIGURE and the key to exit had been changed to CTRL-X (most have been a Procomm for DOS user!). DUH!

 

Of many to do's, I want to try to patch PrEditor in to FORTRAN's menu systems with the errat VORTICON posted a couple of days ago.

 

Jim Horn (An old navy guy himself) of Access Engineering Inc. (AEI) recommended NAVEDTRA 10078-2 - for learning FORTRAN, primarily because it was written in laymans terms, was primarily focused around FORTRAN 66/FORTRAN IV. NAVEDTRA has many good books it stands for Naval Education and Training.

 

I tryped in the first EX and have some work as it doesn't run correctly on the TI, if I was good, I would keep track of the changes I need to make to get the example to run. ...

Link to comment
Share on other sites

4 hours ago, Tursi said:

Can you give me a package/sequence of steps to reproduce the source file corruption in Classic99? I'm assuming we are assuming it's not Fortran's fault.

 

Create a blank disk image (I use TI99Dir) and set it up as DSK3. Start up XB with the compiler disk in DSK1 and one of the library files in DSK2. It will autoload Fortran 99. Press 1 for Edit from the menu then press 2 to start the editor. Paste the program source I posted earlier using Paste (not Paste XB to preserve formatting) and press Fctn-9 when done. Press 3 from the menu to save the source file to DSK3. Now press 7 to exit the edit menu, then go back into it again by pressing 1. Load the source file from disk by pressing 1 then press 2 to edit again. The file will be truncated and sometimes "rearranged". None of this is an issue when using a FIAD.

Link to comment
Share on other sites

6 hours ago, dhe said:

Attacking from another end. Can you post the compiler output?

Do you get any comments from the package when you try to load and or run?

Thanks,

dano

Here you go. I should mention that I merged the 2 library disks into a single one called FORTLIB. The original disks are SSSD, so I just dumped them into a DSSD disk using TI99Dir. That way I don't need to swap disks when linking.

 

FORTLIB.dsk

 

 

  • Like 1
Link to comment
Share on other sites

Another HUGE obstacle crushed thanks to Tursi. Fortran gives you the option to list compiler output. You can enter any device name. Ok. 40 years ago pio. would have been my go to, but now I'd just prefer to look at a file (saving trees and all).

Darn compiler, when you save to a file saves in a format called dis/var 120 - which no program seems to like.

I'd initially tried a device called CLIP in Classic99 - but CLIP works with text. It's clearly stated in the documentation. Tursi told me about the ?W option.

So this time when I compiled, and it asked me where to send the listing file I said: DSK5.?W.EX1_L (Example 1 list). Using a FIAD for DSK5. - I was then able to navigate to the directory and open the compiler listing with textpad.

 

image.thumb.png.9ff0ff2b6d78c17102a10f1ceb690663.png

 

This is HUGE for me, and removes a MAJOR hurdle....

 

Thanks Tursi.

 

PS.. A clue to the way the file, is the way it is... I tried to cut and paste the list from textpad, and it said - sorry, no can do, this listing has embedded NULLS.

 

 

image.png

  • Like 2
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...
  • Recently Browsing   0 members

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