• Please review our updated Terms and Rules here

Nevada FORTRAN

CP/M User

Veteran Member
Joined
May 2, 2003
Messages
2,986
Location
Back of Burke (Guday!), Australia
Hey I'm just wondering if anyone here has used Nevada FORTRAN??

I'm trying to run a FORTRAN 77 program under Nevada FORTRAN and it's chocking up on this:

Code:
CHARACTER*80  ROW

which defines ROW as a Type Character either 101 Character in length or 80 Characters in length.

I've looked at some of the other Nevada FORTRAN programs which accompany the Disc Image - though it doesn't appear Nevada FORTRAN allows it! :-o I also tried defining ROW as an Array with DIMENSION ROW(80) or something though it wasn't happy using Characters in a line like this:

Code:
 ROW(J:J) = '+'
(J represents a loop which counts from 1 to 80).

Anyone know a way around it using Nevada FORTRAN?
 
It sure sounds like Nevada Fortran isn't a Fortran 77 compiler. It could be that it only supports Fortran 66 or earlier. Then the Character type isn't supported. It was one of the novelties in Fortran 77, I think.

// Z
 
Zeela wrote:

It sure sounds like Nevada Fortran isn't a Fortran 77 compiler. It could be that it only supports Fortran 66 or earlier. Then the Character type isn't supported. It was one of the novelties in Fortran 77, I think.

Well it would be a bummer if that were the situation. I don't know the FORTRAN well and rewriting this program would be difficult for me. I have Pseudocode for this program though (which almost looks like the FORTRAN code), so I maybe able to rewrite it into BASIC or Pascal - I would have liked to have done it in FORTRAN though.

Is there a FORTRAN 66? According to my list FORTRAN 77 is derived from FORTRAN IV which goes back to 1962! This version of Nevada FORTRAN was done in 1982!

Actually I'll post the Refined Pseudocode cause it's quite interesting:

Code:
PROGRAM GRAPH
  CHARACTER*101 ROW
  XDELT = 1/5
  YDELT = 1/3
  Y = 10.0
  DO I,1,61
    X = -10.0
    DO J = 1,101
       R1 = √(X-1)[SIZE=3]²[/SIZE]+(Y-1)[SIZE=3]²[/SIZE]
     R2 = √(X+1)[SIZE=3]²[/SIZE]+(Y+1)[SIZE=3]²[/SIZE]
     Z = COS(R1)+COS(R2)
       IF Z ≤ 0.0 THEN
          ROW(J:J) = apostrophe
       ELSE
       IF Z ≤ 1.0 THEN
          IF Z ≤ 0.5 THEN
             ROW(J:J) = '+'
          ELSE
             ROW(J:J) = '%'
          ENDIF
       ELSE
          IF Z ≤ 1.5 THEN
             ROW(J:J) = '@'
          ELSE
             ROW(J:J) = '#'
          ENDIF
       ENDIF
       IF |Y| ≤ 0.001 THEN
           ROW(J:J) = '-'
       IF |X| ≤ 0.001 THEN
           ROW(J:J) = '!'
       X = X + XDELT
     ENDDO
     Y = Y + YDELT
     PRINT ROW
   ENDDO
 STOP

If anyone is wondering what the Vertical lines are between Y and X in FORTRAN those are ABS statements - IF (ABS(X).LE.0.001) for exmaple.

I keep thinking that ROW is some kind of array even though it's setup as a CHARACTER and in this Pseudocode it's 101 ROW long. Does anyone understand why it's ROW(J:J) though? to me that's almost like a 2 Dimensional Array, J as shown in the Pseudocode is a loop between 1 and 101. IF I were doing that in BASIC I would use the loops (as shown in the Pseudocode) to locate where the symbols should go after calculate them based on that IF, or do a 2D Array to store those characters and PRINT it all after that - be quicker I guess to display! :-D
 
Last edited:
There was a Fortran 66 between Fortran IV and 77. Standardized by ANSI. It was in this version they included FUNCTION, FORMAT and explicit data type (like INTEGER) among other things.

My Fortran is really rusty, haven't touched it in ages...

But in Fortran 77, ROW(J:J) is a span of characters from position J to position J = one character...

You could write ROW(J:M) to get a string of all chars between J and M (inclusive). Or you could write ROW(2: ) meaning all but the first char of the string.

And you can of course assign TO such a substring if you'd like. Just as your program does.

// Z
 
A hint from May 1985:

info-cpm mailing list said:
I don't know about any F77 compilers, but I have seen ads in Byte for NEVADA FORTRAN from ELLIS COMPUTING, which claims to be F66, for only 29.99 or 39.99 (?), so it certainly is affordable.
http://www.nelsonit.net/~jon/info-cpm/1985/05/16/084600.html

See also Bill Silvert's response a few days later. A third guy ends the discussion pointing out that there are also Microsoft's and Supersoft's Fortran compilers, although much more expensive.

Probably the guys at Ellis Computing thought Fortran 77 was too complex to implement on a CP/M computer, and instead settled for Fortran 66 and sell it for 1/10th of the price of the nearest competitor.
 
carlsson wrote:

A hint from May 1985:


http://www.nelsonit.net/~jon/info-cpm/1985/05/16/084600.html

See also Bill Silvert's response a few days later. A third guy ends the discussion pointing out that there are also Microsoft's and Supersoft's Fortran compilers, although much more expensive.

Probably the guys at Ellis Computing thought Fortran 77 was too complex to implement on a CP/M computer, and instead settled for Fortran 66 and sell it for 1/10th of the price of the nearest competitor.

Thanks Carlsson. For some reason I couldn't find Disc Images of the Microsoft FORTRAN ready to go for my Amstrad CPC Emulator, so I might it on Gene Buckles CP/M Commercial Software Archive - it's just the hassle of puting it onto a Disk Image and finding out if it works or not! :-o

I've got the PSEUDOCODE into some kind of BASIC program at the moment, though because the original program is like 101 Rows x 61 Columns, I'm only geting a fragment of what the original program produced - it appears to be working, though obviously the original program runs off the information in XDELT, YDELT, X & Y to show everything as set square. My program seems to be displaying the bottom half and running into additional information not seen in the original and 'am a little bit bambouzled as to how to get it square - I'm trying for 40x20, though obviously since there's less conbinations in the array, the calculations and fractions will work out differently.

CP/M User.
 
Nope I returned the parameters back to their rightful order, though this BASIC program isn't displaying itself correctly. Not sure what's happening - I check all the other parameters are correct, though still no luck - annoying, so my BASIC program isn't quite doing what it's supposed to be doing. I suspect it maybe the 'IF' statement - I have one long line of IF statements which looks like this:

Code:
IF Z<=0 THEN R$(I,J) = "'" ELSE IF Z<=1.0 THEN IF Z<=0.5 THEN R$(I,J) = "+" ELSE R$(I,J) = "%" ELSE IF Z<=1.5 THEN R$(I,J) = "@" ELSE R$(I,J) = "#"

and:
Code:
IF ABS(Y)<=0.001 THEN R$(I,J) = "-"
IF ABS(X)<=0.001 THEN R$(I,J) = "!"
X = X + XDELT
NEXT J
Y = Y + YDELT
NEXT I

My concern is that nested 'IF' statement, in the Pseudocode the second 'IF' is clearly terminated with an ENDIF, but then there's an 'ELSE' which relates to the 'IF Z<=1.0' condition, I would have thought that my BASIC program is conditioning that 'ELSE' to that 'IF' statement and not the nested 'IF' which also has it's own 'ELSE', so that could be working. It still doesn't explain why my BASIC program isn't being displayed correctly! :-o
 
At the beginning of the pseudocode, shouldn't Y be initialized to -10 ? Otherwise it runs between +10 and +30.

X = -10 .. 10 (101 * 0.20 - 10)
Y = -10 .. 10 (61 * 0.33 - 10)

For a 40x24 column screen, I would write the Basic program something as follows:

Code:
10 LET DX=1/2:LET DY=5/6:LET Y=-10:DIM ROW$(40)
15 FOR I=1 TO 24:LET X=-10:FOR J=1 TO 40
20 LET R1=SQR((X-1)*(X-1)+(Y-1)*(Y-1)):LET R2=SQR((X+1)*(X+1)+(Y+1)*(Y+1))
25 LET Z=[B]COS(R1)+COS(R2)[/B]
30 IF Z<=0 THEN LET ROW$(J)="´":GOTO 45
35 IF Z>1 THEN 40
36 IF Z<=0.5 THEN LET ROW$(J)="+":GOTO 45
37 LET ROW$(J)="%":GOTO 45
40 IF Z<=1.5 THEN LET ROW$(J)="@":GOTO 45
41 LET ROW$(J)="#"
45 IF ABS(Y)<0.001 THEN LET ROW$(J)="-"
46 IF ABS(X)<0.001 THEN LET ROW$(J)="!"
50 LET X=X+DX:NEXT J
55 LET Y=Y+DY:FOR N=1 TO 40:PRINT ROW$(N);:NEXT N
56 NEXT I
60 END

Regarding line 25: I suppose Fortran works with radians as the input argument is a square root? Most micro computer Basics work with radians, although some have optional degrees.

If you don't like all the IF's and GOTO's (ELSE could be used if your Basic dialect contains it), I think it can be completely rewritten like this:

Code:
10 LET DX=1/2:LET DY=5/6:LET Y=-10:DIM ROW$(40)
12 LET SYM$="´+%@#"
15 FOR I=1 TO 24:LET X=-10:FOR J=1 TO 40
20 LET R1=SQR((X-1)*(X-1)+(Y-1)*(Y-1)):LET R2=SQR((X+1)*(X+1)+(Y+1)*(Y+1))
25 LET Z=COS(R1)+COS(R2)
30 LET C=0:LET D=1
35 IF Z<C THEN LET ROW$(J)=MID$(SYM$,D,1)):LET D=5
36 LET D=D+1:LET C=C+0.5:IF D=5 THEN LET C=1000
37 IF D<6 THEN 35
45 IF ABS(Y)<0.001 THEN LET ROW$(J)="-"
46 IF ABS(X)<0.001 THEN LET ROW$(J)="!"
50 LET X=X+DX:NEXT J
55 LET Y=Y+DY:FOR N=1 TO 40:PRINT ROW$(N);:NEXT N
56 NEXT I
60 END

This second approach uses a predefined string of characters, and relies on that the Z is observed in intervals of 0.5. The extra condition for D=5 is because even when Z>=2 there should be a value plotted.

Hm, it just struck me that COS + COS will always be less than 2.0, no matter if you specify the angles in radians or degrees. In that case, the extra condition is bogus. :)

Disclaimer for that I haven't run these programs, so they may be buggy.
 
Hi Carlsson, there seems to be more to this FORTRAN program than meets the eye. I hope you can bare with me on this Locomotive BASIC that the CPC has. I've had a go at your first program and tested it again by applying the original values into it, and doing what the original program does - by displaying something which is 101 Rows across x 61 Columns. Anyway here's what I've done to your program:

Code:
1 MODE 1:INK 0,0:INK 1,26
10 LET DX=1/5: LET DY=1/3: LET Y=10:DIM ROW$(101)
15 FOR I=1 TO 61:LET X=-10:FOR J=1 TO 101
20 LET R1=SQR((X-1)*(X-1)+(Y-1)*(Y-1)):LET R2=SQR((X+1)*(X+1)+(Y+1)*(Y+1))
25 LET Z=COS(R1)+COS(R2)
30 IF Z<=0 THEN LET ROW$(J)="'":GOTO 45
35 IF Z>=1 THEN 40
36 IF Z<=0.5 THEN LET ROW$(J)="+":GOTO 45
37 LET ROW$(J)="%":GOTO 45
40 IF Z<=1.5 THEN LET ROW$(J)="@":GOTO 45
41 LET ROW$(J)="#"
45 IF ABS(Y)<0.001 THEN LET ROW$(J)="-"
46 IF ABS(X)<0.001 THEN LET ROW$(J)="!"
50 LET X=X+DX:NEXT J
55 LET Y=Y+DY:FOR N=1 TO 101:PRINT#8,ROW$(N);:NEXT N:PRINT#8,CHR$(13)
56 NEXT I
60 END

The first line sets up the screen mode and Inks (set to Black display with Bright White text) - Locomotive BASIC stuff! And the other line I want to draw your attention to is line 55 with the "PRINT#8 - etc" statement which sents the output to the Printer.

At first I thought you were onto something which I saw your program - which is why I wanted to test it as is and here's the Output from your program:

Code:
'++%%@@############@@@%%%++++'''''''''''''''''''''!''''''''''''''''''''''+++++++++++++++++++++++++++'
'''++%%@@############@@@@%%%%++++'''''''''''''''''!''''''''''''''''''++++++++++++++++++++++++++++++''
'''''++%%@@@############@@@@%%%%%++++++'''''''''''!''''''''''''++++++++++++++++++++++++++++++++++''''
'''''''++%%@@@#############@@@@@%%%%%%++++++++++++!++++++++++++++++++++++++++++++++++++++++++++''''''
'''''''''++%%%@@@#############@@@@@@@%%%%%%%%%++++!+++++++++++++++++++%%%%%++++++++++++++++++''''''''
'''''''''''+++%%@@@@@############@@@@@@@@@%%%%%%%%!%%%%%%%%%%%%%%%%%%%%%%%%%++++++++++++++'''''''''''
''''''''''''''++%%%%@@@@@##########@@@@@@@@@@@@@%%!%%%%%%%%%%%%%%%%%%%%%%%%+++++++++++++'''''''''''''
'''''''''''''''''+++%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@!@@%%%%%%%%%%%%%%%%%%%+++++++++++++''''''''''''''''
''''''''''''''''''''+++%%%%%@@@@@@@@@@@@@@@@@@@@@@!@@%%%%%%%%%%%%%%%%%++++++++++++'''''''''''''''''''
''''''''''''''''''''''''++++%%%%%%%%@@@@@@@@@@@@@%!%%%%%%%%%%%%%%%++++++++++++'''''''''''''''''''''''
''''''''''''''''''''''''''''++++++%%%%%%%%%%%%%%%%!%%%%%%%%%++++++++++++++'''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''+++++++++++++++++!+++++++++++++++++'''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''++++++++!++++++++''''''''''''''''''''''''''''''''''''''''''
+++'''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''++
%%%++'''''''''''''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''''''''''''+++++
@@@%%+++''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''++++++++
##@@@%%%+++'''''''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''''''+++++++++++
#####@@@%%%++++'''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''++++++++++++++
#######@@@@%%%%++++'''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''++++++++++++++++++
##########@@@@@%%%%++++'''''''''''''''''''''''''''!''''''''''''''''''''''''''''++++++++++++++++++++++
#############@@@@@%%%%%++++++'''''''''''''''''''''!''''''''''''''''''''''++++++++++++++++++++++++++++
@@@#############@@@@@@%%%%%%++++++++''''''''''''''!''''''''''''''++++++++++++++++++++++++++++++++++++
%%%@@@@#############@@@@@@@%%%%%%%%+++++++++++++++!++++++++++++++++++++++++++++%%%%%%%%%%++++++++++++
+++%%%@@@@@############@@@@@@@@@@%%%%%%%%%%%%%++++!+++++++++++++++%%%%%%%%%%%%%%%%%%%%%++++++++++++++
'''+++%%%%@@@@@@##########@@@@@@@@@@@@@@%%%%%%%%%%!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%++++++++++++++''
''''''+++%%%%%@@@@@@@@@@@#@@@@@@@@@@@@@@@@@@@@@@%%!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%+++++++++++++''''''
''''''''''++++%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@!@@@@%%%%%%%%%%%%%%%%%%%%%%%%+++++++++++++'''''''''
''''''''''''''++++%%%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@!@@@%%%%%%%%%%%%%%%%%%%%%+++++++++++++'''''''''''''
''''''''''''''''''++++++%%%%%%%%%%%%%@@@@@@@@@%%%%!%%%%%%%%%%%%%%%%%%++++++++++++++''''''''''''''''''
''''''''''''''''''''''''++++++++%%%%%%%%%%%%%%%%%%!%%%%%%%%%%%++++++++++++++++'''''''''''''''''''''''
'''''''''''''''''''''''''''''''+++++++++++++++++++!++++++++++++++++++++''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''+++++++!++++++++''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''''
+'''''''''''''''''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''''''''''''''''+
%++++'''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''++++
@%%%%++++'''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''++++++++
@@@@@%%%%++++'''''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''''+++++++++++++
###@@@@@%%%%%++++++'''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''+++++++++++++++++++
######@@@@@@@%%%%%%+++++++''''''''''''''''''''''''!'''''''''''''''''''''''''++++++++++++++++++++%%%%%
##########@@@@@@@@%%%%%%%++++++++++'''''''''''''''!'''''''''''''''++++++++++++++++++++++%%%%%%%%%%%%+
@@############@@@@@@@@@%%%%%%%%%%+++++++++++++++++!+++++++++++++++++++++++++++%%%%%%%%%%%%%%%%%%%%+++
@@@@@@@##########@@@@@@@@@@@@@%%%%%%%%%%%%%%%%%%++!++++++++++++%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%++++++
%%%%@@@@@@@@@@######@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%+++++++++
++++%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%+++++++++++++
''''+++++%%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@!@@@@@%%%%%%%%%%%%%%%%%%%%%%%%%%%%+++++++++++++''''
'''''''''+++++%%%%%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@!@@@@%%%%%%%%%%%%%%%%%%%%%%%%++++++++++++++''''''''
''''''''''''''+++++++%%%%%%%%%%%%%%%%%%%%%%%%%%%%%!%%%%%%%%%%%%%%%%%%%%%+++++++++++++++''''''''''''''
'''''''''''''''''''''++++++++++%%%%%%%%%%%%%%%%%%%!%%%%%%%%%%%%++++++++++++++++++''''''''''''''''''''
'''''''''''''''''''''''''''''+++++++++++++++++++++!+++++++++++++++++++++'''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''++++!+++++'''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''''
++++''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''++++
%%%%+++++'''''''''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''''''''+++++++++
@@@%%%%%%+++++++''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''+++++++++++++++
@@@@@@@@%%%%%%%+++++++++''''''''''''''''''''''''''!'''''''''''''''''''''''''''+++++++++++++++++++%%%%
####@@@@@@@@@@%%%%%%%%%++++++++++++'''''''''''''''!'''''''''''''''+++++++++++++++++++++++%%%%%%%%%%%%
########@@@@@@@@@@@@%%%%%%%%%%%%++++++++++++++++++!++++++++++++++++++++++++++++%%%%%%%%%%%%%%%%%%%%%%

Which might look a bit funny here - I have the file if you want it.

And here's my program:

Code:
10 MODE 1:INK 0,0:INK 1,26:BORDER 0
20 DIM R$(61,101)
30 XDELT = 1/5
40 YDELT = 1/3
50 Y = 10
60 FOR I = 1 TO 61
70 X = -10
80 FOR J = 1 TO 101
90 R1 = SQR(((X-1)*(X-1))+((Y-1)*(Y-1)))
100 R2 = SQR(((X+1)*(X+1))+((Y+1)*(Y+1)))
110 Z=COS(R1)+COS(R2)
120 IF Z<=0 THEN R$(I,J)="'" ELSE IF Z<=1 THEN IF Z<=0.5 THEN R$(I,J) = "+" ELSE R$(I,J) = "%" ELSE IF Z<=1.5 THEN R$(I,J) = "@" ELSE R$(I,J) = "#"
130 IF ABS(Y)<=0.001 THEN R$(I,J) = "-"
140 IF ABS(X)<=0.001 THEN R$(I,J) = "!"
150 X = X + XDELT
160 NEXT J
170 Y = Y + YDELT
180 NEXT I
190 FOR I = 1 TO 61 : FOR J = 1 TO 101 : PRINT#8,R$(I,J); : NEXT J :PRINT#8,CHR$(13): NEXT I

And the output:

Code:
Code:
'++%%@@############@@@%%%++++'''''''''''''''''''''!''''''''''''''''''''''+++++++++++++++++++++++++++'
'''++%%@@############@@@@%%%%++++'''''''''''''''''!''''''''''''''''''++++++++++++++++++++++++++++++''
'''''++%%@@@############@@@@%%%%%++++++'''''''''''!''''''''''''++++++++++++++++++++++++++++++++++''''
'''''''++%%@@@#############@@@@@%%%%%%++++++++++++!++++++++++++++++++++++++++++++++++++++++++++''''''
'''''''''++%%%@@@#############@@@@@@@%%%%%%%%%++++!+++++++++++++++++++%%%%%++++++++++++++++++''''''''
'''''''''''+++%%@@@@@############@@@@@@@@@%%%%%%%%!%%%%%%%%%%%%%%%%%%%%%%%%%++++++++++++++'''''''''''
''''''''''''''++%%%%@@@@@##########@@@@@@@@@@@@@%%!%%%%%%%%%%%%%%%%%%%%%%%%+++++++++++++'''''''''''''
'''''''''''''''''+++%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@!@@%%%%%%%%%%%%%%%%%%%+++++++++++++''''''''''''''''
''''''''''''''''''''+++%%%%%@@@@@@@@@@@@@@@@@@@@@@!@@%%%%%%%%%%%%%%%%%++++++++++++'''''''''''''''''''
''''''''''''''''''''''''++++%%%%%%%%@@@@@@@@@@@@@%!%%%%%%%%%%%%%%%++++++++++++'''''''''''''''''''''''
''''''''''''''''''''''''''''++++++%%%%%%%%%%%%%%%%!%%%%%%%%%++++++++++++++'''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''+++++++++++++++++!+++++++++++++++++'''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''++++++++!++++++++''''''''''''''''''''''''''''''''''''''''''
+++'''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''++
%%%++'''''''''''''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''''''''''''+++++
@@@%%+++''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''++++++++
##@@@%%%+++'''''''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''''''+++++++++++
#####@@@%%%++++'''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''++++++++++++++
#######@@@@%%%%++++'''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''++++++++++++++++++
##########@@@@@%%%%++++'''''''''''''''''''''''''''!''''''''''''''''''''''''''''++++++++++++++++++++++
#############@@@@@%%%%%++++++'''''''''''''''''''''!''''''''''''''''''''''++++++++++++++++++++++++++++
@@@#############@@@@@@%%%%%%++++++++''''''''''''''!''''''''''''''++++++++++++++++++++++++++++++++++++
%%%@@@@#############@@@@@@@%%%%%%%%+++++++++++++++!++++++++++++++++++++++++++++%%%%%%%%%%++++++++++++
+++%%%@@@@@############@@@@@@@@@@%%%%%%%%%%%%%++++!+++++++++++++++%%%%%%%%%%%%%%%%%%%%%++++++++++++++
'''+++%%%%@@@@@@##########@@@@@@@@@@@@@@%%%%%%%%%%!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%++++++++++++++''
''''''+++%%%%%@@@@@@@@@@@#@@@@@@@@@@@@@@@@@@@@@@%%!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%+++++++++++++''''''
''''''''''++++%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@!@@@@%%%%%%%%%%%%%%%%%%%%%%%%+++++++++++++'''''''''
''''''''''''''++++%%%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@!@@@%%%%%%%%%%%%%%%%%%%%%+++++++++++++'''''''''''''
''''''''''''''''''++++++%%%%%%%%%%%%%@@@@@@@@@%%%%!%%%%%%%%%%%%%%%%%%++++++++++++++''''''''''''''''''
''''''''''''''''''''''''++++++++%%%%%%%%%%%%%%%%%%!%%%%%%%%%%%++++++++++++++++'''''''''''''''''''''''
'''''''''''''''''''''''''''''''+++++++++++++++++++!++++++++++++++++++++''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''+++++++!++++++++''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''''
+'''''''''''''''''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''''''''''''''''+
%++++'''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''++++
@%%%%++++'''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''++++++++
@@@@@%%%%++++'''''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''''+++++++++++++
###@@@@@%%%%%++++++'''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''+++++++++++++++++++
######@@@@@@@%%%%%%+++++++''''''''''''''''''''''''!'''''''''''''''''''''''''++++++++++++++++++++%%%%%
##########@@@@@@@@%%%%%%%++++++++++'''''''''''''''!'''''''''''''''++++++++++++++++++++++%%%%%%%%%%%%+
@@############@@@@@@@@@%%%%%%%%%%+++++++++++++++++!+++++++++++++++++++++++++++%%%%%%%%%%%%%%%%%%%%+++
@@@@@@@##########@@@@@@@@@@@@@%%%%%%%%%%%%%%%%%%++!++++++++++++%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%++++++
%%%%@@@@@@@@@@######@@@@@@@@@@@@@@@@@@%%%%%%%%%%%%!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%+++++++++
++++%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%+++++++++++++
''''+++++%%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@!@@@@@%%%%%%%%%%%%%%%%%%%%%%%%%%%%+++++++++++++''''
'''''''''+++++%%%%%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@!@@@@%%%%%%%%%%%%%%%%%%%%%%%%++++++++++++++''''''''
''''''''''''''+++++++%%%%%%%%%%%%%%%%%%%%%%%%%%%%%!%%%%%%%%%%%%%%%%%%%%%+++++++++++++++''''''''''''''
'''''''''''''''''''''++++++++++%%%%%%%%%%%%%%%%%%%!%%%%%%%%%%%%++++++++++++++++++''''''''''''''''''''
'''''''''''''''''''''''''''''+++++++++++++++++++++!+++++++++++++++++++++'''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''++++!+++++'''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''''''
++++''''''''''''''''''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''''''''''''''''''++++
%%%%+++++'''''''''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''''''''+++++++++
@@@%%%%%%+++++++''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''+++++++++++++++
@@@@@@@@%%%%%%%+++++++++''''''''''''''''''''''''''!'''''''''''''''''''''''''''+++++++++++++++++++%%%%
####@@@@@@@@@@%%%%%%%%%++++++++++++'''''''''''''''!'''''''''''''''+++++++++++++++++++++++%%%%%%%%%%%%
########@@@@@@@@@@@@%%%%%%%%%%%%++++++++++++++++++!++++++++++++++++++++++++++++%%%%%%%%%%%%%%%%%%%%%%

Which amazingly enough are both the same! So I'm unsure what the deal is. However I did notice a mistake in my Pseudocode which defines where one of the IF statements finishes. Before the ABS(F) statement there is a Third 'ENDIF' which must stem back to 'IF Z<=0.0 then etc' statement. I'm wondering if that could be causing that problem and if that's the reason why BASIC cannot tackle something like that?

I don't know a great deal about the COS function, apart from it being used extensively in Circles. Usually I've seen a COS accompanied by a SIN. However the original FORTRAN 77 program uses 2 COS, perhaps this is another trick FORTRAN has up it's sleeve perhaps? Yes all the values I've taken from the program are used like that in the FORTRAN program - the X being set to -10 and y = 10, XDELT = 1/5 or 0.2 in the FORTRAN program itself and YDELT = 1/3. I tried your program in Degrees though it ended up in '#' being printed across the screen (lovely), so RADians seems to be the go in this case (at least I hope so! :-o). There's other code within the FORTRAN program itself though I don't know it very well when the image is printed for example which looks like this:

Code:
         WRITE(6,15)ROW
  10     FORMAT(5X,A101)

I don't believe the lack of a BASIC equivalent of a FORMAT statement will have any impact on how the image should look - or at least I hope not. Otherwise it's cheating! :-o
 
I get the impression the Fortran computer the program originally was written for can display 101 columns x 61 rows, and thus the loops were set up as such. If your target computer doesn't have those dimensions on screen, you'd rather want shorter loops and adjust the delta coefficients so the function space always is the same:

X = -10 to +10
Y = -10 to +10 (or +10 to +30 in your original program)
 
carlsson wrote:

I get the impression the Fortran computer the program originally was written for can display 101 columns x 61 rows, and thus the loops were set up as such. If your target computer doesn't have those dimensions on screen, you'd rather want shorter loops and adjust the delta coefficients so the function space always is the same:

No well, when I'm reading the FORTRAN 77 book for which the original program is in, I'm under the impression that the Program outputs to the Printer. I'm not sure how many Microcomputers are in 1983 out there would of had a text resolution of 101x61, not many I would imagine - and then I guess it really depends on what type of computer is being used here besides Microcomputer (i.e Minicomputer, Mainframe, Supercomputer!). My book assumes the student (who has obtained this book) to have no prior knowledge to Computers and introduces the concept of that to them, roughtly ranging the largest computers down to Microcomputers.

No perhaps it's best to scrap idea of displaying that program to the display and try and get the right output to the printer. Because I'm using an emulator though I'm actually dumping the image to a printer file (.PRN), which saves on paper! :-D Later on if I want to I had a TP program somewhere which demonstrated the use of displaying something bigger than the screen to the screen, which worked in conjunction with setting up an array larger than the screen and using the arrows to scroll around that!
 
Oh now this is becomming very frustrating. I've written the program in TP - which is giving me something totally different and incorrect! The program is perhaps closer to the FORTRAN program again and yet the result is nothing like the BASIC program! :-o

Surely the calculations which the programs do, don't return different results - there can only be one answer in all cases and now it seems FORTRAN is breaking all those rules! TP like BASIC also returns the results in RADians, I tested the BASIC program out in DEGrees - which also gave the wrong result! :-o So it looks as if I have a FORTRAN 77 program which breaks those rules.

Strange as it is - I have some examples of the equivalent code in various languages which the original FORTRAN code is an IF statement!

Here goes the FORTRAN code:

Code:
IF(HOURS.LE.40.0)THEN
   SALARY = HOURS*PAYRATE
ELSE
   SALARY = 40*PAYRATE + (HOURS - 40.0)*PAYRATE*1.5
ENDIF

And BASIC:

Code:
     IF H > 40.0 THEN 200
     LET S = H*P
     GOTO 250
200 LET S = 40.0*P + (H - 40.0)*P*1.5
250 .
     .
     .

And Pascal:

Code:
IF HOURS <=40.0 THEN
     SALARY := HOURS * PAYRATE
ELSE
     SALARY := 40.0*PAYRATE + (HOURS - 40.0)*PAYRATE*1.5;

Personally the BASIC code looks very messy, it's almost as if the original BASIC didn't reconise the 'less than equal to' code ('<=') to have it read as hours 'greater than' 40 hours then goto 200 (I prefer GOSUB personally).

Perhaps I should write a little FORTRAN program to see what those values are saying in order for that to draw a circular Vortex!?
 
I'm unsure if <= and >= were available in the first Basic implementations. Perhaps you only had access to >, < and = so a program had to be rewritten as above.

Ah, output goes to printer? That explains all the columns and rows at least. I believe what you are plotting is a pie chart (?) of circles, like a dart board. The formulas with squares and square roots seem familiar, and then you use COS to get a point relative to the unit circle.
 
carlsson wrote:

I'm unsure if <= and >= were available in the first Basic implementations. Perhaps you only had access to >, < and = so a program had to be rewritten as above.

What's also interesting is the first BASIC (Dartmouth BASIC) is a compiled BASIC! :-o

Ah, output goes to printer? That explains all the columns and rows at least. I believe what you are plotting is a pie chart (?) of circles, like a dart board. The formulas with squares and square roots seem familiar, and then you use COS to get a point relative to the unit circle.

Yes the book seems to indicate that the program is supposed to be sent to the printer. I was also reading within the book that while there's a PRINT statement in FORTRAN, it can only be used to output to the screen - while the PSEUDOCODE I've posted here has a PRINT statement, the FORTRAN program is using a single:

Code:
       WRITE(6,15)ROW
15     FORMAT(5X,A101)

at the end of the program. WRITE needs to be used if the output is going somewhere else - though can also send text to the screen. I'm unsure if this formatting has any direct consequence on how the output should look - hence the difference between the BASIC and Turbo Pascal programs, though the TP program is really off the charts with the output produced. The BASIC output looks closer to the FORTRAN though, though is still incorrect! :-o
 
Solved

Solved

Have only got back to this problem I was trying to solve with this wormholey effect which was written in FORTRAN77. The good news is I had everything correct and still couldn't get the correct effect, the bad news was their pseudocode was wrong and only just found the mistake when I checked out the FORTRAN program! :-o

Here's my BASIC program now which produces the correct effect, as you will see I went to the extreme of writing a bullet-proof series of IF statements before finding the mistake and have simply left it cause as I said - it's bullet-proof! :-D

Code:
10 MODE 1:INK 0,0:INK 1,26:BORDER 0
20 DIM R$(61,101)
30 XDELT = 1/5
40 YDELT = 1/3
50 Y = 10
60 FOR I = 1 TO 61
70 X = -10
80 FOR J = 1 TO 101
90 R1 = SQR((X-1)*(X-1)+(Y-1)*(Y-1))
100 R2 = SQR((X+1)*(X+1)+(Y+1)*(Y+1))
110 Z=COS(R1)+COS(R2)
120 IF Z<=0 THEN R$(I,J)="'" ELSE IF (z>0.5) AND (Z<=1) THEN r$(i,j) = "%" ELSE IF (z>0) AND (Z<=0.5) THEN R$(I,J) = "+" ELSE IF (z>1) AND (Z<=1.5) THEN R$(I,J) = "@" ELSE IF (z>1.5) AND (z<=2) THEN R$(I,J) = "#"
130 IF ABS(Y)<=0.001 THEN R$(I,J) = "-"
140 IF ABS(X)<=0.001 THEN R$(I,J) = "!"
150 X = X + XDELT
160 NEXT J
170 Y = Y - YDELT
180 NEXT I
190 FOR I = 1 TO 61 : FOR J = 1 TO 101 : PRINT#8,R$(I,J); : NEXT J :PRINT#8,CHR$(13): NEXT I

Oops I should warn others the program has some Amstrad CPC stuff in there and usually in BASIC it's nice to put some LET statements, in Locomotive BASIC you don't need the LET statement (even though it's got it!), perhaps check out Carlsson's program for a more universal code! :-o For people who wish to interpret mine, line 10 isn't really all that important because I'm dumping it to the printer. And line 190 is the line which prints the output to the printer (PRINT#8) - if you're using GWBASIC or something LPRINT I believe is the equivalent.

The culprit in my program was line 170 which originally read as "Y = Y + YDELT" which is what the Pseudocode had instead of "Y = Y - YDELT". Looks better now - here's the output!

Code:
'++%%@@############@@@%%%++++'''''''''''''''''''''!''''''''''''''''''''''+++++++++++++++++++++++++++'
+%%@@############@@@%%+++'''''''''''''''''''''''''!''''''''''''''''''''''''''++++++++++++++++++++++++
%@@@###########@@%%%++''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''+++++++++++++++++++++
@@###########@@%%+++''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''+++++++++++++++++++
@##########@@%%++'''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''+++++++++++++++++
#########@@%%++'''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''+++++++++++++++
#######@@@%%+'''''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''''+++++++++++++
######@@%%++''''''''''''''''''''''''''''''''++++++!+++++++''''''''''''''''''''''''''''''''+++++++++++
####@@@%++''''''''''''''''''''''''''''++++++++++++!+++++++++++++'''''''''''''''''''''''''''++++++++++
###@@%%++'''''''''''''''''''''''''++++%%%%%%%%%%%%!%%%%%%+++++++++++'''''''''''''''''''''''''++++++++
##@@%%+''''''''''''''''''''''''+++%%%%@@@@@@@@@@@@!%%%%%%%%%+++++++++++'''''''''''''''''''''''+++++++
#@@%++''''''''''''''''''''''+++%%%@@@@@@@@@@@@@@@@!@%%%%%%%%%%++++++++++++'''''''''''''''''''''++++++
@@%++'''''''''''''''''''''++%%%@@@@########@@@@@@@!@%%%%%%%%%%%+++++++++++++'''''''''''''''''''''++++
@%++''''''''''''''''''''++%%@@@############@@@@@@@!%%%%%%%%%%%%+++++++++++++++''''''''''''''''''''+++
%++''''''''''''''''''''+%%@@@############@@@@@%%%%!%%%%%%%%%+++++++++++++++++++''''''''''''''''''''++
++'''''''''''''''''''++%%@@############@@@@%%%%%%+!++++++++++++++++++++++++++++++''''''''''''''''''++
+'''''''''''''''''''+%%@@###########@@@@%%%+++++++!+++++++++++++++++++++++++++++++''''''''''''''''''+
''''''''''''''''''++%%@@##########@@@%%%++++''''''!''''''''++++++++++++++++++++++++''''''''''''''''''
'''''''''''''''''++%%@@##########@@%%+++''''''''''!''''''''''''+++++++++++++++++++++'''''''''''''''''
''''''''''''''''++%%@@#########@@%%++'''''''''''''!''''''''''''''++++++++++++++++++++''''''''''''''''
''''''''''''''''+%%@@########@@@%%+'''''''''''''''!''''''''''''''''+++++++++++++++++++'''''''''''''''
'''''''''''''''+%%@@########@@%%++''''''''''''''''!''''''''''''''''''++++++++++++++++++''''''''''''''
''''''''''''''++%%@@#######@@%%+''''''''''''''''''!'''''''''''''''''''+++++++++++++++++''''''''''''''
''''''''''''''+%%@@######@@@%%+'''''''''''''''''''!''''''''''''''''''''+++++++%%%%++++++'''''''''''''
'''''''''''''++%%@@#####@@@%%+''''''''''''''''''''!'''''''''''''''''''''+++++%%%%%%%++++'''''''''''''
'''''''''''''+%%@@@@###@@@%%+'''''''''''''''''''''!'''''''''''''''''''''+++++%%%%%%%%++++''''''''''''
''''''''''''++%%@@@@@@@@@%%++'''''''''''''''''''''!''''''''''''''''''''''++++%%%%%%%%%+++''''''''''''
''''''''''''++%%@@@@@@@@%%++''''''''''''''''''''''!+++++'''''''''''''''''++++%%%%%%%%%+++''''''''''''
''''''''''''++%%@@@@@@@%%%++'''''''''''''''''''''+!+++++'''''''''''''''''+++%%%%%%%%%%%++''''''''''''
''''''''''''++%%%@@@@@@%%+++'''''''''''''''''''+++!+++++''''''''''''''''''++%%%%%@%%%%%++''''''''''''
--------------------------------------------------!--------------------------------------------------
''''''''''''++%%%%%@%%%%%++''''''''''''''''''+++++!+++'''''''''''''''''''+++%%@@@@@@%%%++''''''''''''
''''''''''''++%%%%%%%%%%%+++'''''''''''''''''+++++!+'''''''''''''''''''''++%%%@@@@@@@%%++''''''''''''
''''''''''''+++%%%%%%%%%++++'''''''''''''''''+++++!''''''''''''''''''''''++%%@@@@@@@@%%++''''''''''''
''''''''''''+++%%%%%%%%%++++''''''''''''''''''''''!'''''''''''''''''''''++%%@@@@@@@@@%%++''''''''''''
''''''''''''++++%%%%%%%%+++++'''''''''''''''''''''!'''''''''''''''''''''+%%@@@###@@@@%%+'''''''''''''
'''''''''''''++++%%%%%%%+++++'''''''''''''''''''''!''''''''''''''''''''+%%@@@#####@@%%++'''''''''''''
'''''''''''''++++++%%%%+++++++''''''''''''''''''''!'''''''''''''''''''+%%@@@######@@%%+''''''''''''''
''''''''''''''+++++++++++++++++'''''''''''''''''''!''''''''''''''''''+%%@@#######@@%%++''''''''''''''
''''''''''''''++++++++++++++++++''''''''''''''''''!''''''''''''''''++%%@@########@@%%+'''''''''''''''
'''''''''''''''+++++++++++++++++++''''''''''''''''!'''''''''''''''+%%@@@########@@%%+''''''''''''''''
''''''''''''''''++++++++++++++++++++''''''''''''''!'''''''''''''++%%@@#########@@%%++''''''''''''''''
'''''''''''''''''+++++++++++++++++++++''''''''''''!''''''''''+++%%@@##########@@%%++'''''''''''''''''
''''''''''''''''''++++++++++++++++++++++++''''''''!''''''++++%%%@@@##########@@%%++''''''''''''''''''
+''''''''''''''''''+++++++++++++++++++++++++++++++!+++++++%%%@@@@###########@@%%+'''''''''''''''''''+
++''''''''''''''''''++++++++++++++++++++++++++++++!+%%%%%%@@@@############@@%%++'''''''''''''''''''++
++''''''''''''''''''''+++++++++++++++++++%%%%%%%%%!%%%%@@@@@############@@@%%+''''''''''''''''''''++%
+++''''''''''''''''''''+++++++++++++++%%%%%%%%%%%%!@@@@@@@############@@@%%++''''''''''''''''''''++%@
++++'''''''''''''''''''''+++++++++++++%%%%%%%%%%%@!@@@@@@@########@@@@%%%++'''''''''''''''''''''++%@@
++++++'''''''''''''''''''''++++++++++++%%%%%%%%%%@!@@@@@@@@@@@@@@@@%%%+++''''''''''''''''''''''++%@@#
+++++++'''''''''''''''''''''''+++++++++++%%%%%%%%%!@@@@@@@@@@@@%%%%+++''''''''''''''''''''''''+%%@@##
++++++++'''''''''''''''''''''''''+++++++++++%%%%%%!%%%%%%%%%%%%++++'''''''''''''''''''''''''++%%@@###
++++++++++'''''''''''''''''''''''''''+++++++++++++!++++++++++++''''''''''''''''''''''''''''++%@@@####
+++++++++++''''''''''''''''''''''''''''''''+++++++!++++++''''''''''''''''''''''''''''''''++%%@@######
+++++++++++++'''''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''''+%%@@@#######
+++++++++++++++'''''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''''++%%@@#########
+++++++++++++++++'''''''''''''''''''''''''''''''''!'''''''''''''''''''''''''''''''''++%%@@##########@
+++++++++++++++++++'''''''''''''''''''''''''''''''!''''''''''''''''''''''''''''''+++%%@@###########@@
+++++++++++++++++++++'''''''''''''''''''''''''''''!''''''''''''''''''''''''''''++%%%@@###########@@@%
++++++++++++++++++++++++''''''''''''''''''''''''''!'''''''''''''''''''''''''+++%%@@@############@@%%+
'+++++++++++++++++++++++++++''''''''''''''''''''''!'''''''''''''''''''''++++%%%@@@############@@%%++'
 
Last edited:
Incidently if you want a good printout effect of it, try Courier New, Size 6 on a portrait page - you can adjust the size between 6 and 6.9 - 7 will print the character on the next line and look horrible. Also try playing around with the effect using different FONTs at Size 2 and get some usual effects.
 
Last edited:
Back
Top