+dhe Posted March 28, 2020 Author Share Posted March 28, 2020 VORTICON, I see a couple of things, I don't know, if they are wrong, but would try differently, just for a comparison. 1) I try to never use multiple disk i/o on the same drive, so I would use: For compile: dsk2.{source} dsk3.{object} dsk5.{listing} For linking: dsk3.{object} dsk4.{executable} dsk5.{listing} Also, I watched twice and didn't see you load the file, I've find when loading the file from the fortran99 menu, it sometimes will give you good tips about things that it doesn't thank our good. Quote Link to comment Share on other sites More sharing options...
Tursi Posted March 28, 2020 Share Posted March 28, 2020 (edited) 47 minutes ago, Vorticon said: 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. Thanks! I gave it a try but it's working okay here? Are you on the latest? (399.018?) I recently fixed a bug that caused the emulator to incorrectly parse files on disk images files with more than two fragments. Shouldn't happen on a new disk, but maybe something else was also fixed by that...? (Also, I assume you are using the "DSK Image" option, and not "TI DSK Controller". The latter has no checks for improperly sized disk images, for instance, and that might be biting you if the image is greater than 180k...) Edited March 28, 2020 by Tursi Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted March 28, 2020 Share Posted March 28, 2020 2 hours ago, Tursi said: Thanks! I gave it a try but it's working okay here? Are you on the latest? (399.018?) I recently fixed a bug that caused the emulator to incorrectly parse files on disk images files with more than two fragments. Shouldn't happen on a new disk, but maybe something else was also fixed by that...? (Also, I assume you are using the "DSK Image" option, and not "TI DSK Controller". The latter has no checks for improperly sized disk images, for instance, and that might be biting you if the image is greater than 180k...) Yup, I am using version 399.018 and the DSK Image option for all the drives 1-3. Below is a video of the issue. Note that the source file is truncated at the end when I reload it. Weird that you are not able to duplicate the issue... Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted March 28, 2020 Share Posted March 28, 2020 4 hours ago, dhe said: 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. If you use TI99Dir to view the file, you should be able to cut and paste without issues. Here's the compiler output for the PICALCFT program 1 PICALCFT Version 4.42 Page 0001 . 0 0001 PROGRAM PICALCFT 0002 0003 INTEGER *4 N, I, TOTAL 0004 REAL *8 X, Y, D, PI 0005 0006 C GET NUMBER OF ITERATIONS 0007 READ(6, 10, END=9999, ERR=9999) N 0008 0009 C MAIN PROGRAM LOOP 0010 I = 1 0011 DO WHILE(I .LE. N) 0012 X = IRAND(10) / 10 0013 Y = IRAND(10) / 10 0014 D = X**2 + Y**2 0015 IF (D .LE. 1) THEN **Warning- Mixed Mode Arithmetic 0016 TOTAL = TOTAL + 1 **Warning- Mixed Mode Arithmetic 0017 ENDIF 0018 WRITE(6, 20) I 0019 I = I + 1 **Warning- Mixed Mode Arithmetic 0020 REPEAT 0021 0022 C FINALIZE RESULT AND DISPLAY 0023 PI = TOTAL / N * 4 **Warning- Mixed Mode Arithmetic 0024 WRITE(6, 30) PI 0025 0026 10 FORMAT('+', C12, M1.1, 'Number of iterations? ', I8) 0027 20 FORMAT('+', M12.1, 'Iteration # ', I8) 0028 30 FORMAT('+', M23.1, 'Approximate PI = ', F1.6) 0029 9999 STOP 0030 END 1 PICALCFT Allocation Version 4.42 Page 0002 . 0 Statement Labels: 0010 01DC 0020 0208 0030 0228 9999 024C 0 Subprogram References: IRAND DI$ DADD$ DCMP$ J4DIV$ J4MUL$ STOP$ CALL$ IDCVT$ JDCVT$ 0 Local Data Area: 000C j TOTAL 0010 j I 0014 j N 0018 d PI 0020 d D 0028 d Y 0030 d X 0 Logic Size: 0254 Data Size: 0038 0 Module Size: 028C 0004 Warning(s) 0000 Error(s) I should also mention that 80 column works perfectly fine with Classic99 and on real iron with the F18A. Just set it up from the Fortran 99 Utilities menu. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted March 28, 2020 Share Posted March 28, 2020 OK I figured out what the problem was: The FORMAT statement for the initial READ statement was incorrect. This really takes some getting used to... I also optimized the program a bit as I got more familiar with the language. Here's the new listing: PROGRAM PICALCFT C GET NUMBER OF ITERATIONS WRITE(6, 10) READ(6, 15) N C MAIN PROGRAM LOOP WRITE(6, 20) I = 1 DO 1 I = 1, N X = IRAND(10) Y = IRAND(10) D = (X / 10)**2 + (Y / 10)**2 IF (D .LE. 1.0) TOTAL = TOTAL + 1 1 WRITE(6, 25) I C FINALIZE RESULT AND DISPLAY PI = (TOTAL / N) * 4 WRITE(6, 30) PI WRITE(6, 35) 10 FORMAT('+', C12, M5.1, 'Number of iterations? ', M5.23) 15 FORMAT(I8) 20 FORMAT('+', M12.1, 'Iteration # ') 25 FORMAT('+', M12.13, I8) 30 FORMAT('+', M20.1, 'Approximate PI = ', F8.6) 35 FORMAT('0 ') STOP END And here it is running. It's pretty fast! This also proves that the library files are not corrupted. 2 Quote Link to comment Share on other sites More sharing options...
+dhe Posted March 28, 2020 Author Share Posted March 28, 2020 Great Job VorTIcon. You beat me, and in iteration 2, did all of my thoughts plus. 1) D is a real and the compiler didn't like D .LE. 1 - it really wanted 1 to be 1.0 - real vs interger. 2) You declared a number of variables in program iteration 1, and in 2, you went with the flow, leaving variable types as it's default cast. I-N being int, otherwise real. I think, like most compilers, this one doesn't like being forced to do things. You did do something that I didn't think would work, in that I thought the format commands had to appear before their use. Your program *PROVES* that isn't true with this compiler! ? And I like the trick of C12 to clear the screen! d. 1 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted March 28, 2020 Share Posted March 28, 2020 I got the C12 trick from the sample program in Beard's introduction Incidentally, I did end up needing to add the following types to the program in order to allow for an iteration number > 32767, and the compiler complained but still complied INTEGER *4 N, I REAL *8 TOTAL I must say, Fortran is a beast to use... But I'm starting to warm up to it he he... Quote Link to comment Share on other sites More sharing options...
Tursi Posted March 29, 2020 Share Posted March 29, 2020 10 hours ago, Vorticon said: Yup, I am using version 399.018 and the DSK Image option for all the drives 1-3. Below is a video of the issue. Note that the source file is truncated at the end when I reload it. Weird that you are not able to duplicate the issue... Yeah, I'd like to fix it if I can... Below is my video of trying - did I miss a step? Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted March 29, 2020 Share Posted March 29, 2020 Not that I could tell. So on a hunch, I deleted the disk image I was using for DSK3 and created a new one, and now everything works as it should. I must have had a bad image for some reason. Sorry about the fuss! Should have done that from the get go. Quote Link to comment Share on other sites More sharing options...
Tursi Posted March 29, 2020 Share Posted March 29, 2020 2 hours ago, Vorticon said: Not that I could tell. So on a hunch, I deleted the disk image I was using for DSK3 and created a new one, and now everything works as it should. I must have had a bad image for some reason. Sorry about the fuss! Should have done that from the get go. Erf. I wish you still had the bad disk... I'd like to know if it's another fragmentation issue. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted March 29, 2020 Share Posted March 29, 2020 7 hours ago, Tursi said: Erf. I wish you still had the bad disk... I'd like to know if it's another fragmentation issue. It was still in the Recycle bin. Here you go FORTWORK.dsk Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted March 29, 2020 Share Posted March 29, 2020 Incidentally, I wasn't too happy about the value of PI I was getting, so I checked the random number generator function in Fortran 99 and got this: The expected values are: MEAN = 4.5 STANDARD DEVIATION = 2.87 What still trips me on occasion is the range of variables. For example, if an operation brings a simple integer variable out of range (32767), it goes negative but no overflow error is generated. This is not something we had to worry about in loosely typed languages like Basic or Python... Quote Link to comment Share on other sites More sharing options...
+dhe Posted March 29, 2020 Author Share Posted March 29, 2020 no fair! post the code! ? Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted March 29, 2020 Share Posted March 29, 2020 6 minutes ago, dhe said: no fair! post the code! ? Here you go It's based on Moulinaie's XB program. PROGRAM RANDTEST INTEGER IRAND, X INTEGER *4 T(10) REAL S, S2, SD CALL RANDOM PRINT ,'Number of data points?' ACCEPT ,N DO 10 I = 1, N X = IRAND(10) 10 T(X + 1) = T(X + 1) + 1 S = 0 S2 = 0 DO 20 I = 0, 9 S = S + (T(I + 1) * I) 20 S2 = S2 + (T(I + 1) * I * I) S = S / N S2 = S2 / N SD = SQRT(S2 - S * S) PRINT , 'MEAN = ', S PRINT , 'STANDARD DEVIATION = ', SD STOP END Quote Link to comment Share on other sites More sharing options...
+dhe Posted March 29, 2020 Author Share Posted March 29, 2020 I modified the example 1 program from navetrad. I also got my first experience and debugging run time errors. C234567 C MCADAMS (A SAMPLE FORTRAN PROGRAM INTEGER X, SUM, I DIMENSION X(15) 1 FORMAT (I5) 2 FORMAT ('+','ANSWER ', I8) I=1 3 READ (6,1) X(I) I=I+1 IF (I.EQ.16) GO TO 10 GO TO 3 10 SUM=0 DO 20 I = 1,15,1 SUM=SUM+X(I) 20 CONTINUE WRITE(6,2) SUM STOP END <EOD> (Version 4.4) How, do you get the nice printouts, that copy above is just a copy screen from Classic99, and a CTRL-V here at atariage. It isn't nearly as read able. Quote Link to comment Share on other sites More sharing options...
+TheBF Posted March 29, 2020 Share Posted March 29, 2020 At the top of the editor when you post something click the </> icon. It will open a code window that you paste into and your code will be fixed width font. Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted March 29, 2020 Share Posted March 29, 2020 As I read the manual Errata, I was very pleasantly surprised to find that bitmap support had been added to the package, including the ability to draw lines and circles as well as place text anywhere on the bitmap screen and individual pixel plot routines. This made Fortran 99 quite a powerful package! As an exercise, I coded the chaotic logistic equation and plotted it on the bitmap screen. Requires the GL, ML and FL libraries. Fun:) PROGRAM LOGISTIC INTEGER X, Y CALL FILES(1) CALL CLEAR CALL SETMOD(4) CALL SCREEN(2, 16) WRITE(6, 20) P = 0.4 R = 2.5 DO WHILE (X .LE. 250) P = P * R * (1 - P) Y = IFIX(191 - (P * 191)) X = IFIX((R - 2.5) * 170) CALL SETPIX(X, Y) R = R + 0.0001 REPEAT 10 CALL KEY(0, KEYC, ISTATUS) IF (ISTATUS .EQ. 0) GOTO 10 20 FORMAT('+', M24.1, 'Logistic equation') STOP END 3 Quote Link to comment Share on other sites More sharing options...
+DuaneAL Posted April 1, 2020 Share Posted April 1, 2020 (edited) Sorry if this was asked before, how does the speed of the compiled program compare to other languages like c99 or xb(compiled)? (Edit) I’m not asking about a specific program on this thread, just in general, how does FORTRAN compare to the other commonly used languages in speed? I knew there was FORTRAN for the TI but I didn’t realize how complete it was. Edited April 1, 2020 by DuaneAL Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 1, 2020 Share Posted April 1, 2020 10 hours ago, DuaneAL said: Sorry if this was asked before, how does the speed of the compiled program compare to other languages like c99 or xb(compiled)? (Edit) I’m not asking about a specific program on this thread, just in general, how does FORTRAN compare to the other commonly used languages in speed? I knew there was FORTRAN for the TI but I didn’t realize how complete it was. It compares very favorably to assembly. Probably vey close to the speed of compiled XB, but with major advantage of direct bitmap access, access to the VDP (memory and registers), and double precision floating point operations when needed. There is even a sound facility! With the exception of speech, it's pretty much complete. An impressive feat and a very under-appreciated package. 3 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted April 1, 2020 Share Posted April 1, 2020 Does the Fortran compiler emit Assembly language or is there another way to see the code? Quote Link to comment Share on other sites More sharing options...
+dhe Posted April 1, 2020 Author Share Posted April 1, 2020 fortran99 does not use an intermediate assembly source file like say Clint Pulleys c99. The procedure to create a program, is compile (produce an object file) and then link. There are extensive facilities to include things like symbol files for debugging, as well as a whole chapter devoted to debugging the assembled output. Most people will only need to worry about compiler errors and run time errors. Quote Link to comment Share on other sites More sharing options...
+TheBF Posted April 1, 2020 Share Posted April 1, 2020 3 minutes ago, dhe said: fortran99 does not use an intermediate assembly source file like say Clint Pulleys c99. The procedure to create a program, is compile (produce an object file) and then link. There are extensive facilities to include things like symbol files for debugging, as well as a whole chapter devoted to debugging the assembled output. Most people will only need to worry about compiler errors and run time errors. From that I guess the only way to see the generated code would be with a dis assembler then. Good to know. Thanks. It sounds like an amazing development system. Quote Link to comment Share on other sites More sharing options...
+mizapf Posted April 1, 2020 Share Posted April 1, 2020 Yes, together with the 9938 support on the Geneve this was a good reason why I used it for my diploma thesis. 2 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted April 1, 2020 Share Posted April 1, 2020 3 hours ago, dhe said: Most people will only need to worry about compiler errors and run time errors. Unfortunately, I feel this is an area of weakness with this package. The compiler is not very good at catching all errors, and to date all the run time errors I have encountered only give the address of the error in the compiled code and not a pointer to the source code line causing the error, which makes debugging slow and painful. Quote Link to comment Share on other sites More sharing options...
+dhe Posted April 1, 2020 Author Share Posted April 1, 2020 I agree, fortran99 absolutely expects your code to be 100% correct and only the grossest of syntax errors are flagged - which is unfortunate when your getting acquainted with a language. Having said that, my next personal challenge is a snippet of code to open and read from a file. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.