+TheBF Posted June 22, 2022 Share Posted June 22, 2022 57 minutes ago, Reciprocating Bill said: Forth and Pascal couldn't be further apart in clarity and readability, however. I wrote a lot of code in Pascal when I got my first Mac in 1984 (TML Pascal, then Think Pascal), since Pascal was essentially the native language of the original MacOS. I still have the source files and can still figure out what I was up too fairly easily. Forth code I wrote last week can be a mystery. I know what you mean. I find if you try to write Forth the way you use a conventional language it is far to cryptic later. Raw Forth is Assembly language for a 2 stack machine. I go out of my way to make Forth into a "language" of sorts that describes the solution in words that relate to the problem so I can understand it easier later. This normally means factoring the problem into way more small pieces than you would every dream of in conventional language. I think using Forth requires changing how you think and if you have to jump back to other languages regularly its hard to keep the Forth head space. I read somewhere when Chuck Moore was first exposed to other people's Forth code he was shocked. How they wrote Forth was not what he had in mind. His definitions are always on one line, 5 to 7 words in each definition. 4 Quote Link to comment Share on other sites More sharing options...
apersson850 Posted June 23, 2022 Share Posted June 23, 2022 I guarantee that I can write a cryptic program in any language. Pascal was one of the first languages which took a grip on structure. Procedure nesting, logical constructs, data structures, dynamic variables and sets are some examples of features available to create better software structures. Later it was developed to allow classes too. The UCSD implementation on the TI is good. Considering its age, very good. 5 Quote Link to comment Share on other sites More sharing options...
Willsy Posted June 23, 2022 Share Posted June 23, 2022 16 hours ago, TheBF said: I go out of my way to make Forth into a "language" of sorts that describes the solution in words that relate to the problem so I can understand it easier later. Domain Specific Language is the term, I believe. Of course, Forth is a general language, but with its ability to call a word anything, and the fact that the language itself can be extended, its very open to use for production of DSLs. 3 Quote Link to comment Share on other sites More sharing options...
apersson850 Posted June 23, 2022 Share Posted June 23, 2022 That is correct. Sometimes a DSL is defined from the beginning to solve a specific kind of task. Sometimes it's so limited that that's about all it can do. Sometimes it's really a fully functional general programming language, but still designed from the beginning for a specific task. Pascal, for example, was from the beginning designed with the task to teaching programming to people in mind. The UCSD Pascal in the TI 99/4A has been expanded to allow it to also become an operating system language. A lot of the adaptability in Pascal comes from the data structure concept. It's for example quite simple to create a data structure which describes the disk and file structure on the 99/4A, and then write a Pascal program that can handle the standard operating system's files by mapping the disk data into these data structures. To do the opposite, i.e. write an Extended BASIC program which can read the p-system's files, is significantly more tricky. BASIC doesn't know any more complex data structure than arrays. Just like the Fortran it's a simplified variant of. Disk block based Forth doesn't contain words for handling files, but here too, you can create words that describe the data structure of these files, and then words that operate on this data. It's just not such a fundamental part of the language is it is in Pascal. When I look at benchmarking languages I don't just look at execution time. I consider the development and maintenance time to be important too. I typically develop everything in reasoanbly efficient Pascal (I know quite a lot about what's slow and what's efficient in the implementation for the 99/4A), then evaluate runtime performance. If it's not enough, I consider what's running most of the time, and convert that to assembly manually. Frequently I understand what will be the most time consuming part from the beginning, so I may have a conversion in my mind when I design the Pascal procedure, to make sure a converison is reasoanbly simple. For example, if I need dynamically allocted data in that procedure, I may allocate that one level before, so it's already there when the critical procedure is called. I just pass a pointer to the assembly routine. Allocating a dynamic variable inside the p-system environment directly from assembly is so complex that it's not worth the effort. 4 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted June 23, 2022 Share Posted June 23, 2022 2 hours ago, apersson850 said: That is correct. Sometimes a DSL is defined from the beginning to solve a specific kind of task. Sometimes it's so limited that that's about all it can do. Sometimes it's really a fully functional general programming language, but still designed from the beginning for a specific task. Pascal, for example, was from the beginning designed with the task to teaching programming to people in mind. The UCSD Pascal in the TI 99/4A has been expanded to allow it to also become an operating system language. A lot of the adaptability in Pascal comes from the data structure concept. It's for example quite simple to create a data structure which describes the disk and file structure on the 99/4A, and then write a Pascal program that can handle the standard operating system's files by mapping the disk data into these data structures. To do the opposite, i.e. write an Extended BASIC program which can read the p-system's files, is significantly more tricky. BASIC doesn't know any more complex data structure than arrays. Just like the Fortran it's a simplified variant of. Disk block based Forth doesn't contain words for handling files, but here too, you can create words that describe the data structure of these files, and then words that operate on this data. It's just not such a fundamental part of the language is it is in Pascal Forth 83 did not specify file access words. ISO Forth specifies a file wordset with READ-FILE , OPEN-FILE, WRITE-FILE, CLOSE-FILE etc. so it is part of the modern language. 2 hours ago, apersson850 said: When I look at benchmarking languages I don't just look at execution time. I consider the development and maintenance time to be important too. I typically develop everything in reasoanbly efficient Pascal (I know quite a lot about what's slow and what's efficient in the implementation for the 99/4A), then evaluate runtime performance. If it's not enough, I consider what's running most of the time, and convert that to assembly manually. Frequently I understand what will be the most time consuming part from the beginning, so I may have a conversion in my mind when I design the Pascal procedure, to make sure a converison is reasoanbly simple. For example, if I need dynamically allocted data in that procedure, I may allocate that one level before, so it's already there when the critical procedure is called. I just pass a pointer to the assembly routine. Allocating a dynamic variable inside the p-system environment directly from assembly is so complex that it's not worth the effort. The DSL concept is fundamental to using Forth. When you miss that in trying to use Forth it gets ugly as hell. I always like to say I stop programming in Forth after about the first 1/2 page of code. (That's hyperbole but it's what I strive for) This is a hard thing to get used to, creating the language as you go, when you are used to a set of given keywords. And it has it's own hazards for maintenance in a large team. You need to document the DSL so everybody conforms. (Cat herding comes to mind with Forth programmers) Forth is old. It is generation one of concatenative languages. There are new ones now that take the advantages of the Forth concept but bring in modern concepts. Factor (remarkably powerful) OForth (object Forth) 8th (full featured for commercial compiler, one source code can create Windows, Linux or Google apps) Kitten ( experimental graphics language) Data structures are an interesting case. Wirth did a wonderful job of creating language for defining data structures. Moore looked at data like an Assembly language programmer. It's just memory. Where is your confusion? His position is controversial but he simply gives you : a way to know where free memory begins, HERE gives you a way to name memory locations, CREATE allocate any number of bytes, ALLOT and the most innovative IMHO is the comma. Comma takes a number as an argument and puts it in the next available free location and bumps the memory tracking variable. a way to assign a code routine to a data structure , DOES> After that it's all up to you. : VARIABLE CREATE 0 , ; : CONSTANT CREATE , DOES> @ ; Extendable languages are not be the best for every project but they are sure cool when they fit the job. Exploring a new I/O board or CPU design come to mind. Interactive hardware control and interrogation beats the hell out of edit/compile/load/run/fail/repeat They are super cool when you need a new language feature that the compiler writer did not consider. An interesting case came up here where a forum member asked if you could add string comparison to a CASE structure in PASCAL. Hmm... ? Forth? When you can extend the compiler yourself... have at it. \ string case statement NEEDS DIM FROM DSK1.STRINGS NEEDS CASE FROM DSK1.CASE : $OF ( -- ) POSTPONE OVER POSTPONE =$ POSTPONE IF POSTPONE DROP ; IMMEDIATE : TEST ( $ -- ) CASE " APPLE" $OF ." Granny Smith" ENDOF " PEAR" $OF ." Barlett" ENDOF " GRAPE" $OF ." Concord" ENDOF ." Unknown fruit" ENDCASE ; </SERMON> 3 Quote Link to comment Share on other sites More sharing options...
apersson850 Posted June 23, 2022 Share Posted June 23, 2022 Note that I'm not any opponent towards Forth. I like the idea, the simplicity in the concept and the fact that you can run things interactively. The reason for me using Pascal for the TI are several: It was the language to use when I went to school. It was cool to be able to run that at home. The implementation on the TI 99/4A is very good, considering when it became available and the size of the computer. It was, at that time, clearly the best combination of language and operating system on the 99/4A for creating something useful. I've made a couple of applications, that solved real needs I had, that are thousands of lines long. They still run on the 99/4A, thanks to the p-system's memory management and the fact that a large part of the operating system is on a separate memory card. 36 Kbytes of memory in the Extended BASIC cartride implements many functions. The p-code card has 60 Kbytes... Sure I could have done that in Forth. But I would have had to define more basic support things before I could start doing the real work. Forth wasn't available when I got my TI either. That's another important point. One of my larger projects involve a large amount of arithmetic with floating point numbers too. It's not Forth's main strength. Pascal doesn't care. Just declare as integer or real. 2 Quote Link to comment Share on other sites More sharing options...
Reciprocating Bill Posted June 23, 2022 Share Posted June 23, 2022 1 hour ago, apersson850 said: 36 Kbytes of memory in the Extended BASIC cartride implements many functions. Say more about this. Having never seen a p-system in the silicon, I wasn't aware that Extended BASIC was a component of the system. I assumed that it had its own module, or ran strictly from its expansion box card and disk. 1 Quote Link to comment Share on other sites More sharing options...
apersson850 Posted June 23, 2022 Share Posted June 23, 2022 Sorry, I wasn't clear enough. I meant that Extended BASIC had 36 Kbytes, which implements quite a lot of functions in BASIC. The p-code card, on the other hand, has 60 Kbytes of memory for functions in that system. They are not related. It was just a comparision of memory sizes. Quote Link to comment Share on other sites More sharing options...
+RXB Posted June 23, 2022 Share Posted June 23, 2022 1 hour ago, apersson850 said: Sorry, I wasn't clear enough. I meant that Extended BASIC had 36 Kbytes, which implements quite a lot of functions in BASIC. The p-code card, on the other hand, has 60 Kbytes of memory for functions in that system. They are not related. It was just a comparision of memory sizes. Ok just wondering 36K where are you getting that? Original XB had 24K of GROM, and 12K of ROM so that is the original versions only. RXB has 40K of GROM and 20K of ROM, and XB 2.9 has about the same or more. As far as I know P-code card has not changed in 40 years, but many versions of XB have been released over the years and are presently up to date to this year 2022. Quote Link to comment Share on other sites More sharing options...
Reciprocating Bill Posted June 24, 2022 Share Posted June 24, 2022 (edited) I understood him to be referring to the original TI Extended BASIC. I've never been much interested in the UCSD p-system on the TI - until now. The more apersson (but not just any person) writes, the more intriguing it becomes. Alas, p-code cards are rare and expensive. Edited June 24, 2022 by Reciprocating Bill "the original" 2 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted June 24, 2022 Share Posted June 24, 2022 5 minutes ago, Reciprocating Bill said: I've never been much interested in the UCSD p-system on the TI - until now. The more apersson (but not just any person) writes, the more intriguing it becomes. Alas, p-code cards are rare and expensive. It is a very nice system. I think Classic99 would let you play with it with the correct disks on hand, but I have never tried it. 1 1 Quote Link to comment Share on other sites More sharing options...
senior_falcon Posted June 24, 2022 Share Posted June 24, 2022 2 hours ago, RXB said: Ok just wondering 36K where are you getting that? Original XB had 24K of GROM, and 12K of ROM so that is the original versions only. According to my soroban calculator, 24K + 12K = 36K, which is what is stated on the cover of the XB manual. Quote Link to comment Share on other sites More sharing options...
apersson850 Posted June 24, 2022 Share Posted June 24, 2022 7 hours ago, senior_falcon said: According to my soroban calculator, 24K + 12K = 36K, which is what is stated on the cover of the XB manual. That's also what I was referring to. 1 Quote Link to comment Share on other sites More sharing options...
apersson850 Posted June 24, 2022 Share Posted June 24, 2022 7 hours ago, TheBF said: It is a very nice system. I think Classic99 would let you play with it with the correct disks on hand, but I have never tried it. Yes, you can play with it there.Easy to run it at 200% speed too. The disks are there. Quote Link to comment Share on other sites More sharing options...
apersson850 Posted June 24, 2022 Share Posted June 24, 2022 8 hours ago, Reciprocating Bill said: I understood him to be referring to the original TI Extended BASIC. Alas, p-code cards are rare and expensive. Yes, since when I started using the 99/4A, that was the only Extended BASIC available. The p-system was expensive back in the 1980's too, since it required virtually everything to run. Hence they are rare today. Although it doesn't change the p-code card itself, it's already from the beginning designed to be easy to update. A large part of the GROM on the card makes up a virtual disk. The largest file on that disk is SYSTEM.PASCAL. That's the major part of the operating system. The file consists of 23 segments. If you want to, and have the knowledge, you can rewrite any such segment with a new version, compile it and create a library you call SYSTEM.PASCAL. Store that on the system disk, and it will replace the original file. It will now need to be in normal RAM, but only that segment you changed, not the entire file. I've done some minor changes to my operating system that way. Modifying the PME is trickier, but doable. It was easy already back then. Since the p-system fortunately doesn't need any specific cartridge, you could put in the Mini Memory module in the computer. Since part of the PME is in RAM, you can put in a wedge somewhere and branch to your own code. If you place it in Mini Memory, you don't need to change anything in how the PME uses memory. As the instruction pointer table for the interpreter is also i RAM, you can modify that too, and thus change how p-code is interpreted, if you want to. The BIOS is table driven too, so although the original BIOS is in ROM on the p-code card, you can rewrite sections of it to reside in cartridge space, then just change the pointer. The system's functions for devices, like initialize, clear, read and write to the units are in the BIOS, but they are pointed to by a memory structure in RAM. So unlike BASIC, the complete p-system was possible to modify already with the hardware available from TI back then. With today's memory devices, it's even easier. 1 Quote Link to comment Share on other sites More sharing options...
apersson850 Posted June 24, 2022 Share Posted June 24, 2022 19 hours ago, TheBF said: An interesting case came up here where a forum member asked if you could add string comparison to a CASE structure in PASCAL. Hmm... ? I didn't remember that question, but it's a typical case (pun intended) of when you get a "here is what we have - live with it" situation in Pascal. To make it efficient, there's even a special p-code instruction that executes the case statement. That p-code requires an enumerated data type to work with, like an integer, character or a user defined enumerated type. But not a complex datatype like real or string. On the other hand, case is (by p-system standards) lightning fast. 3 Quote Link to comment Share on other sites More sharing options...
+Vorticon Posted June 24, 2022 Share Posted June 24, 2022 12 hours ago, Reciprocating Bill said: Alas, p-code cards are rare and expensive. The SD-based storage solution currently in development has an integrated UCSD pascal system. 2 1 Quote Link to comment Share on other sites More sharing options...
Switch1995 Posted Saturday at 11:53 PM Share Posted Saturday at 11:53 PM (edited) On 7/6/2017 at 2:18 PM, Tursi said: We don't have TI LOGO in there, anyone want to try that one? It has been over 6 years since you asked....and my TI LOGO II code has finally finished running: //DEFINE PROCEDURES FOR EACH SIDE OF SCREEN TO TOP :NUM IF :NUM = 116 THEN STOP SX :NUM TOP :NUM + 1 END TO RGT :NUM IF :NUM = -81 THEN STOP SY :NUM RGT :NUM - 1 END TO BTM :NUM IF :NUM = -128 THEN STOP SX :NUM BTM :NUM - 1 END TO LFT :NUM IF :NUM = 96 THEN STOP SY :NUM LFT :NUM + 1 END //USE GRAPHICS EDITOR TO CREATE 16X16 ASTERISK MAKESHAPE 6 //INITIALIZE SPRITE IN UPPER LEFT CORNER OF SCREEN TELL SPRITE CARRY 6 SC :BLACK SXY -128 96 //CLEAR SCREEN AND LOOP 100 TIMES CS REPEAT 100 [TOP -128 RGT 96 BTM 116 LFT -81] Updated standings: On 7/26/2017 at 12:11 PM, TheBF said: Language First Pass Optimized GCC 15 sec 5 sec Assembly 17 sec 5 sec TurboForth 48 sec 29 sec CAMEL99 DTC 49 sec 27 sec Compiled XB 51 sec 37 sec CAMEL99 ITC 55 sec 29 sec FbForth 70 sec 26 sec GPL 80 sec none yet ABASIC 490 sec none yet LOGO II 1920 sec none yet XB 2000 sec none yet UCSD Pascal 7300 sec 273 sec Edited Saturday at 11:54 PM by Switch1995 1 Quote Link to comment Share on other sites More sharing options...
Reciprocating Bill Posted yesterday at 02:50 AM Share Posted yesterday at 02:50 AM A couple more datapoints: Cortex BASIC, 16-bit RAM in console, running entirely from 16-bit RAM: 231 seconds Cortex BASIC, 16-bit RAM in console, running from FinalGrom99: 297 seconds (I don't have a stock console set up to run this on) 2 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted yesterday at 03:09 AM Share Posted yesterday at 03:09 AM 3 hours ago, Switch1995 said: It has been over 6 years since you asked....and my TI LOGO II code has finally finished running: //DEFINE PROCEDURES FOR EACH SIDE OF SCREEN TO TOP :NUM IF :NUM = 116 THEN STOP SX :NUM TOP :NUM + 1 END TO RGT :NUM IF :NUM = -81 THEN STOP SY :NUM RGT :NUM - 1 END TO BTM :NUM IF :NUM = -128 THEN STOP SX :NUM BTM :NUM - 1 END TO LFT :NUM IF :NUM = 96 THEN STOP SY :NUM LFT :NUM + 1 END //USE GRAPHICS EDITOR TO CREATE 16X16 ASTERISK MAKESHAPE 6 //INITIALIZE SPRITE IN UPPER LEFT CORNER OF SCREEN TELL SPRITE CARRY 6 SC :BLACK SXY -128 96 //CLEAR SCREEN AND LOOP 100 TIMES CS REPEAT 100 [TOP -128 RGT 96 BTM 116 LFT -81] Updated standings: Hey thanks for this. Great to see a result. 2 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.