Switch1995 Posted December 18, 2023 Share Posted December 18, 2023 (edited) My favorite Christmas movie is Trading Places and I love the 80s tech in the movie. Using this picture of the Telerate monitors that were in the back of the Duke's limo and in Eddie Murphy/Dan Akroyd's office for inspiration, I put together a holiday program in Turboforth 40 column mode. I'll attach the code. To run in Classic99, just copy the text and paste in TF after selecting option 2. Happy Holidays!! Trading Places.txt IMG_2141.mov Edited December 18, 2023 by Switch1995 Added video 5 1 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted December 18, 2023 Share Posted December 18, 2023 Wow it's great to see someone else working with Forth. This was nicely factored. I have a question. Do you have a reason for not using ." to type text? It would look like this : news6 ( -- addr len ) 0 15 GOTOXY ." NEWS - HAPPY HOLIDAYS TO ALL " CR CR ." THE 99ERS OUT THERE! " CR CR ." WISHING YOU AND YOURS A " CR CR ." PEACEFUL AND JOYOUS SEASON " CR ; In many Forth systems it compiles the same code as you wrote ( S" and TYPE) but it looks a little cleaner. Quote Link to comment Share on other sites More sharing options...
Switch1995 Posted December 18, 2023 Author Share Posted December 18, 2023 (edited) 8 hours ago, TheBF said: I have a question. Do you have a reason for not using ." to type text? I've just started learning FORTH this year and could be wrong, but it seems like using S" TYPE gives more flexibility than ." and so I'm trying to get into the habit of "always" using it for strings. For example: : test S" Hello World!" ; test 2DUP TYPE TYPE btw, In my top post, I neglected to thank @Willsy and @Lee Stewart for their fantastic FORTH products and, more importantly, taking the time to document and teach those that follow. Edited December 18, 2023 by Switch1995 typo 3 2 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted December 18, 2023 Share Posted December 18, 2023 4 hours ago, Switch1995 said: I've just started learning FORTH this year and could be wrong, but it seems like using S" TYPE gives more flexibility than ." and so I'm trying to get into the habit of "always" using it for strings. For example: : test S" Hello World!" ; test 2DUP TYPE TYPE btw, In my top post, I neglected to thank @Willsy and @Lee Stewart for their fantastic FORTH products and, more importantly, taking the time to document and teach those that follow. Congratulations on jumping into this strange world. Lee and Willsy have done a superb job of documenting their systems. (I have been focused on trying to learn compiler design stuff so my docs are bit stale compared to the current system) In Forth we are free to use words as we see fit. So there is nothing wrong with what you coded. Since you are in a learning mode I will share some stuff I have learned over the years. In BASIC we don't think about this much but there are string variables and also string "literals" 10 PRINT "Hello World!" creates a string literal in BASIC. Your definition of TEST above also creates a string literal with S" . In both examples it is assumed that you never want to change the string in a running program. (of course you could change it with Forth but you might corrupt the dictionary if you try it) Here is a simple definition of ." in Forth : ." ( ccc" -- ) [COMPILE] S" COMPILE TYPE ; IMMEDIATE You can see that it is actually just replacing the word ." with S" and TYPE. I you want to explore string variables you can use Willsy's string library. It lets you do what BASIC can do with strings. However in my experience after having made these kind of libraries myself, most of the time they are not needed. A few much simpler words is all we need for normal programs. I will post some options over on the Fun with Forth thread. 2 3 Quote Link to comment Share on other sites More sharing options...
GDMike Posted December 18, 2023 Share Posted December 18, 2023 I like to work with the help binder too TurboForth Language Reference Manual.docx 1 1 Quote Link to comment Share on other sites More sharing options...
Switch1995 Posted December 18, 2023 Author Share Posted December 18, 2023 I've been building my physical book library as items pop-up on eBay. Here is a great resource for a lot of the legacy books: https://www.jupiter-ace.co.uk/index_forth_books.html 3 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted December 19, 2023 Share Posted December 19, 2023 13 hours ago, Switch1995 said: I've just started learning FORTH this year and could be wrong, but it seems like using S" TYPE gives more flexibility than ." and so I'm trying to get into the habit of "always" using it for strings. For example: : test S" Hello World!" ; test 2DUP TYPE TYPE btw, In my top post, I neglected to thank @Willsy and @Lee Stewart for their fantastic FORTH products and, more importantly, taking the time to document and teach those that follow. In fbForth, that would be : TEST S" Hello World!" ; TEST COUNT OVER OVER TYPE TYPE \ or TEST DUP COUNT TYPE COUNT TYPE because fbForth does not have 2DUP and defines S" to leave the address of a counted string rather than the address of a string followed by its length as with TurboForth and CAMEL99Forth. Of course, you could define TEST as : TEST S" Hello World!" COUNT ; and 2DUP as : 2DUP OVER OVER ; to duplicate your TurboForth results. ...lee 3 Quote Link to comment Share on other sites More sharing options...
GDMike Posted December 19, 2023 Share Posted December 19, 2023 I always redefine gotoxy to : GTXY gotoxy ; just to shorten the word. I just don't like long words 2 Quote Link to comment Share on other sites More sharing options...
Gary from OPA Posted December 19, 2023 Share Posted December 19, 2023 On 12/17/2023 at 7:25 PM, Switch1995 said: My favorite Christmas movie is Trading Places and I love the 80s tech in the movie. Using this picture of the Telerate monitors that were in the back of the Duke's limo and in Eddie Murphy/Dan Akroyd's office for inspiration, I put together a holiday program in Turboforth 40 column mode. I'll attach the code. To run in Classic99, just copy the text and paste in TF after selecting option 2. Happy Holidays!! I liked the movie as well, and you did a great recreation of the telerate monitors, i did something similar but for news and weather, with some graphics, like the old local TV cable channel, and all in X/Basic. nice to see you using forth. I posted it on twitter, so you might get a bunch of more viewers in this thread. Happy holidays. 3 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.