Jump to content

TheBF

+AtariAge Subscriber
  • Content Count

    2,737
  • Joined

  • Last visited

Everything posted by TheBF

  1. Lot's of points in that post Erik. All it takes is one unbalanced stack event, and it's a hopeless mess to work on. I'm thinking you didn't test the words in the interpreter as you went along. The console is the debugger. IMHO it's the compensation for the whacky stack language. If you have a big definition that is messing up the data stack, cut out each line, name them and test them one at a time. Then put them back into the definition. Forth is said to take a "bottom up" approach, Forth let's you build bottom up. Design top down is still where you begin I think. The actual process is circular because with Forth you can write 5 lines and test your assumptions even about hardware details, rather that waiting until the whole thing is finished and you realize that interrupts actually take 3 times longer than the design spec. 馃サ Maybe your design part was weaker than ideal? Maybe frustrated by the editor. Yes that can happen with a block editor. Not for everybody. That's why the commercial systems all let you set a path for where your editor is. Here is some code that indicates where Forth goes in the hands of these full-time Forth guys. Below is code from VFX Forth. Doesn't look like my Forth code. These guys programmed Forth to become what they needed. That's the ticket IMHO but also why when you come from a conventional "this is what you get" compiler it takes some getting used to. Is it easier? Probably not in the beginning, but it gets easier the more you make it what you need. #define IDW_FORTHWINDOW $3801 IDW_FORTHWINDOW WINDOW 0, 0, 100, 100 BEGIN Caption "Forth Console" Style WS_CHILD | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX ExStyle WS_EX_MDICHILD ClassStyle CS_HREDRAW | CS_VREDRAW Icon IDI_APPLICATION Cursor IDC_ARROW Brush WHITE_BRUSH Menu NULL WndProc ForthWindowProc END DialogBox: TextDlg 50 10 110 50 Position&Size Modal Caption "Enter Name" WS_VISIBLE Style WS_CAPTION WS_POPUP or Style+ WS_BORDER Style+ 8 100 0 Font "MS Sans Serif" 5 5 100 12 IDC_EditBox z" Hello" EditBox 10 25 40 15 IDC_OK z" &OK" PushButton 60 25 40 15 IDC_CANCEL z" &Cancel" PushButton WM_INITDIALOG does TB-DoInit WM_COMMAND does TB-DoCommand end-dialog
  2. I had not looked at MPE's web site for a long time. Stephen Pelc, the founder told me 10 years ago that a company with a "fruit" in the logo used their new VFX compilers. I guess it's more public now. From: https://vfxforth.com/ (I Bolded the fruit company name) CUSTOMERS On some consultancy jobs clients have asked us to sign non-disclosure agreements covering not only the work but the client name as well. They regard Forth as a competitive advantage for their work. The following is thus just a partial list from our customer base. Apple, Astell Scientific, AWE, BAE, British Telecom, British Gas, Brown Root Vickers, CDS Advanced Technology bv, CEGB, Cementation, CMON Systems, Construction Computer Software, Department of Transport, Disarmco, Europay International, Farnell, GEC Plessey Avionics, Intersil, ISRO, ITT, JWK International, Lucas CAV, Marconi Space and Defence, Metropolitan Police, NASA, Nuclear Electric, Philips, Rolls Royce, Rushton Diesels, Rutherford Appleton Labs, Saab, Safer Systems, Shell UK Oil, Sun Microsystems, Thorn EMI, Trafalgar House, Yorkshire TV, and many universities and research labs. On one space shuttle flight, three out of four experiments were programmed in Forth, each team having chosen Forth individually. Forth is approved by NASA for high reliability applications.
  3. Something else is worth noting regarding Forth tool chains. The Forth's that people are exposed to or build themselves are many times using concepts from the 1970s and 80s. All modern Forth systems are not using threaded code. It doesn't make much sense with 32bit or larger machines. So if you want to see what commercial Forth tools are like you can download the two big systems for non-commercial use for free. VFX generates faster code and some people like it better. Their compilers were used for some European space missions and for a 1 million line project called Candy. Compile time is ~one minute I believe for 1 M LOC. They also have compilers for a Forth CPU (RTX2000) used in space missions like Galileo and the one that visited the comet. (Rossetta?) https://www.mpeforth.com/software/pc-systems/vfx-forth-for-windows/ SwiftForth is from Forth Inc. the first Forth company, headquartered in USA. https://www.forth.com/download/ Forth Inc. has a long list of clients. https://www.forth.com/resources/who-uses-forth/ SP Forth is also a native code generating compiler from some very clever folks from Russia. They developed the nnCron product and something called EServ. The site has a lot Russian which I don't read unfortunately, but Chrome translates reasonably well. http://spf.sourceforge.net/ Here is a listing of the rather significant library set for SP.Forth. http://spf.sourceforge.net/docs/devel.en.html All that to say these are not like the Forth's we see used on our legacy systems. These may affect the quality of a project. However using a legacy system didn't slow down @Vorticon in anyway with JetPack. Nice work there.
  4. Took some looking but here is one. https://github.com/nnCron/nnCron
  5. You clearly know how to code so the words below are just me talking. Maybe it's useful. If not flush it. (not to disk) As you know Forth is not a popular language these days so the amount of code you find online is pretty small. Forth is mostly used for niche applications where size is critical or very low level control is required but Assembler is not productive enough or not well enough known for the specific processor. The niche getting smaller in a world where tiny uPs have 256K of RAM. One of the things that is hardest to learn when trying to write a substantial program in Forth is the understanding that you really don't want to program in "Forth". (that's my opinion) To use it well you actually create a new language that helps you write the program. This makes the front-end of the project more challenging but can make the back end and modifications simpler. I have been looking at a game that was published in 1982 in Byte. It was written in Forth, but clearly by someone who had a solid background in BASIC and then wrote the game like it was BASIC only using Forth statements. It is arguably the worst example of how to write Forth code I have ever seen. I am writing some of my thoughts on that here: CAMEL99-V2/On Forth Coding Style.md at master 路 bfox9900/CAMEL99-V2 (github.com) I think one the best examples I have of Forth "style" in the Vibe editor by Sam Falvo. It's not a game but it shows the point. I have ported it to TI-99 for my own education with permission from Sam. I removed the extra commands that I added in this listing so not to obscure Sam's style. Interesting things to notice. There are four variables. The definitions are very short. The word definitions become part of how you describe to solution to make the editor. There is no loop structure used to list the text on the screen. The loop is un-wound because calling overhead is less than the loop overhead. There is no case statement for the command control. What??? The Forth interpreter's dictionary search mechanism is the case statement. Each command is looked up by dynamically creating a short string from the key stroke pressed and passing the string to FIND. One thing I don't agree with in this example is the stack diagram comments have been omitted. Using them allows new people to understand your Forth code much faster and with a memory like mine they help me remember my own intentions. If you struggle to understand your code a few weeks later then you might be writing long definitions that make understanding the stack nearly impossible a few lines into it. The secret to making Forth understandable from what I read from Chuck Moore and others is factor factor factor. Even if you do that however you still have to work extra hard at creating the right names for things so that their purpose is implied by the name. That's more art than science in my experience.
  6. I was thinking of a Forth ROM for further hardware exploration but it will need some RAM to work in so first things first. Once you have RAM, Forth gives you a nice debugger environment where you can test all the hardware for validity interactively or write simple test programs in Forth or Forth Assembler, to exercise the hardware. I can cross-compile an image with 9902 communication support. I have a version running on TI-99. I have not finished documenting my Forth cross-compiler so I have not shared that yet. It runs in DOSBOX at the moment.
  7. Yes I had a similar issue in early versions so then I kind of cheated by resorting to EVALUATE. Could you make an equivalent with to my code below with: ASCII , WORD INTERPRET HEX : BYTE ( -- ) BEGIN [CHAR] , PARSE-WORD DUP WHILE EVALUATE DUP FF00 AND ABORT" Not a byte" C, REPEAT 2DROP ; : DATA ( -- ) BEGIN [CHAR] , PARSE-WORD DUP WHILE EVALUATE , REPEAT 2DROP ;
  8. The assembled coding talent in this forum just blows my mind. I was away for a few days and started looking at Time Pilot source code by @retroclouds So wonderful to read it. One of the downsides of working in Forth is the constant need to re-invent the wheel or doing a lot of translating of source code since Forth is unusual. I saw the KONAMI font in the Time Pilot source code and realized I could adapt that pretty quickly with DATABYTE library. So here is how to "borrow" fonts from Assembler projects and use them in Camel99. We don't need the '>' character. A little search and replace fixed it up. Then we just needed a bit of editing to get something that works. In this case we are recording the data in expansion RAM like the original program did. Each block of data is given a name in the Forth dictionary with the CREATE word. At the bottom we use the interpreter to write the data blocks into VDP RAM and then compile a short TEST word to see how it looks. \ Taken from TIME PILOT SOURCE CODE, translated for CAMEL99 FORTH \ *************************************************************** \ * KONAMI Game Font - from Konami's Athletic Land for MSX \ * Letter A-Z \ **************************************************************** INCLUDE DSK1.DATABYTE INCLUDE DSK1.GRAFIX HEX CREATE KONAMI BYTE 00,1C,36,63,63,7F,63,63 \ A BYTE 00,7E,63,63,7E,63,63,7E \ B BYTE 00,3E,63,60,60,60,63,3E \ C BYTE 00,7C,66,63,63,63,66,7C \ D BYTE 00,7F,60,60,7E,60,60,7F \ E BYTE 00,7F,60,60,7E,60,60,60 \ F BYTE 00,3E,63,60,67,63,63,3F \ G BYTE 00,63,63,63,7F,63,63,63 \ H BYTE 00,3C,18,18,18,18,18,3C \ I BYTE 00,1F,06,06,06,06,66,3C \ J BYTE 00,63,66,6C,78,7C,6E,67 \ K BYTE 00,60,60,60,60,60,60,7F \ L BYTE 00,63,77,7F,7F,6B,63,63 \ M BYTE 00,63,73,7B,7F,6F,67,63 \ N BYTE 00,3E,63,63,63,63,63,3E \ O BYTE 00,7E,63,63,63,7E,60,60 \ P BYTE 00,3E,63,63,63,6F,66,3D \ Q BYTE 00,7E,63,63,62,7C,66,63 \ R BYTE 00,3E,63,60,3E,03,63,3E \ S BYTE 00,7E,18,18,18,18,18,18 \ T BYTE 00,63,63,63,63,63,63,3E \ U BYTE 00,63,63,63,63,36,1C,08 \ V BYTE 00,63,63,6B,6B,7F,77,22 \ W BYTE 00,63,76,3C,1C,1E,37,63 \ X BYTE 00,66,66,7E,3C,18,18,18 \ Y BYTE 00,7F,07,0E,1C,38,70,7F \ Z \ *************************************************************** \ * KONAMI Game Font - from Konami's Athletic Land for MSX \ * Digits 0-9, SPACE and HYPHEN \ *************************************************************** CREATE KONAMI# BYTE 00,1C,22,63,63,63,22,1C \ 0 BYTE 00,18,38,18,18,18,18,7E \ 1 BYTE 00,3E,63,03,0E,3C,70,7F \ 2 BYTE 00,3E,63,03,0E,03,63,3E \ 3 BYTE 00,0E,1E,36,66,66,7F,06 \ 4 BYTE 00,7F,60,7E,63,03,63,3E \ 5 BYTE 00,3E,63,60,7E,63,63,3E \ 6 BYTE 00,7F,63,06,0C,18,18,18 \ 7 BYTE 00,3E,63,63,3E,63,63,3E \ 8 BYTE 00,3E,63,63,3F,03,63,3E \ 9 BYTE 00,00,00,00,00,00,00,00 \ SPACE BYTE 00,00,00,7E,00,00,00,00 \ - DECIMAL KONAMI CHAR A ]PDT 26 8* VWRITE KONAMI# CHAR 0 ]PDT 12 8* VWRITE : TEST PAGE ." WE HAVE KONAMI FONT" CR CR ." FOR CAMEL99 FORTH" KEY DROP ; Alternatively after loading the code above, we could save this VDP RAM data as font file and load it on program start. INCLUDE DSK1.LOADSAVE S" DSK3.KONAMI" SAVE-FONT
  9. Hey that's great news. Congratulations. Almost time for a Forth ROM?
  10. Now I am curious about why you did it this way versus using a sprite.
  11. I had to take my head out of that game for a while. :) I explored the key discussion we had earlier and it started to come back to me that one problem I had before was it took a while for the fast key detection code to clear the last key pressed. I added FLUSHKEY to wait until the mechanism is clear. This code seems to work ok and would only add 140 bytes to the multi-tasking system so it might be worth making it the default. The only caveat is that FLUSHKEY would have to be run before the program starts. I have not yet tried patching this into the main KEY routine in Forth. That's the next part of the job. \ FASTKEY is better for multi-tasking \ KSCAN in the system ROM uses internal delays for debounce. \ It takes 1.2 mS to run even if no key is pressed! \ This slows down cooperative multi-tasking by slowing down \ the context switch time while waiting for a key keypress. NEEDS WORDLIST FROM DSK1.SUPERTOOLS \ Source: \ http://www.unige.ch/medecine/nouspikel/ti99/keyboard.htm#quick%20scan FORTH DEFINITIONS ALSO ASSEMBLER HERE HEX CODE (KEY?) ( -- ?) \ return TRUE if any key pressed TOS PUSH, \ TOS CLR, \ TOS=false R1 CLR, \ Start with column 0 BEGIN, R12 0024 LI, \ R12-address for column selection R1 0003 LDCR, \ Select a column R12 0006 LI, \ R12-address to read rows R2 SETO, \ Make sure all bits are 1 R2 0008 STCR, \ read 8 row values R2 INV, \ pressed keys read as 0 so flip all bits NE IF, \ A key was pressed TOS SETO, \ Set TOS true for Forth NEXT, \ return to Forth ENDIF, R1 0100 AI, \ Next column R1 0600 CI, \ Are we done? EQ UNTIL, NEXT, \ Return to Forth ENDCODE : FLUSHKEY ( -- ) \ make sure no key is pressed BEGIN (KEY?) WHILE REPEAT ; : WAITKEY ( -- ) BEGIN PAUSE \ Essential for Multi-tasking with Console CURS @ \ fetch 2 char cursor (space & _ ) [email protected] 1FFF < IF >< THEN VPUT \ swap cursor bytes & write (KEY?) UNTIL ; \ over-write the old version : KEY ( -- c) WAITKEY KEY ; HERE SWAP - DECIMAL . .( bytes) : TEST1 FLUSHKEY BEGIN KEY EMIT ?TERMINAL UNTIL ;
  12. LOL (You can make one flip-flop with these suckers!)
  13. Well trying to improve 39 year old software is rather time consuming... But I have something that is getting closer to playable. Some people have got Cosmic conquest running on 6502 emulators but it has been a challenge from what I am told. We know it ran on a Fig Forth dialect but we don't which one. Nobody seems to know how to interpret the graphics definitions in the program so I just punted and made my own. I took my first look at the code last Monday. When I regained consciousness... I decided it needed some Forthifying cuz it looked a lot like BASIC written in Forth syntax. That works fine in BASIC but it makes Forth harder to read and Forth doesn't need any help in that department. Here is a sample: : BUY ( purchasing of ships at planet) BUY-V @ 0= IF ( it's ok to buy) 5 BUY-V ! ( stop continous buying) RANDOM1 5 / [email protected] INFO1 [email protected] 10 / + 1+ DUP TEMP1 ! 10 0 VHTAB ." COST PER SHIP = " 2 .R 12 0 VHTAB ." HOW MANY DO YOU WANT?" INPUT CREDIT @ TEMP1 @ / MIN ( no more than he can afford) DUP 3 F @ + 3 F ! ( update ships in fleet) TEMP1 @ * CREDIT @ SWAP - CREDIT ! ( update credit) 16 1 F [email protected] 2 F [email protected] GALAXY C! ( make sure fleet symbol there) ELSE 10 0 VHTAB ." NO SHIPS AVAILABLE" ENDIF ; "F" is the name of an array. Not good form, since "F" is also a valid HEX number. And so on... It actually wants a complete re-write to be a better Forth program but I will settle for band-aids. I still don't have my head around one aspect of the data that manages two fleets for the player but it mostly works now and I can make changes easier now. It is coming in at over 900 lines. The full thing is here with a screen shot. CAMEL99-V2/CosmicConquest at master 路 bfox9900/CAMEL99-V2 路 GitHub Its a very old game and a little boring by today's standards. I want to stay true to the original but I think I have to add some sound effects. I already added beeps and honk. When I finally get there I will build a binary and people can beat it up. COSMIC99-CLIP.mp4
  14. Ya removing the '138 chip should tell the tail if something is shorted elsewhere but man you have got some gremlins to deal with there. I think I am way to old for surface mount. Give me a couple of 12AT7s and I am happy for hours.
  15. I liked "Fernwood Tonight"
  16. I have used it capture misc output from a program that I wanted to edit on the PC. My favourite use was for DocGen, a program that read my library source code and created rough documentation. Opening output file as CLIP was amazing! I just pasted the text into Libre Office and made a book.
  17. I get stressed just reading about it! I will leave it in your culpable capable hands.
  18. Or how about curly brackets? { 馃槃 } (just kidding)
  19. Over on Reddit r/Forth a bunch of people found a game from Byte Magazine written in Forth in 1982. Byte Magazine Volume 07 Number 12 - Game Plan 1982 : Free Download, Borrow, and Streaming : Internet Archive It was for some Forth that ran on 6502. Rick Carlino translated it into something the runs on GForth. It wasn't too hard to make ANS GForth code run on ANS Camel Forth but it is still kind of ugly. Actually I can tell that the original author was still getting his head around Forth because the factoring is not good. Anyway I put it up here and will see what I can do to make it into something fun for TI-99. CAMEL99-V2/CosmicConquest at master 路 bfox9900/CAMEL99-V2 路 GitHub
  20. Exactly. 10 or more lines is normal for other languages but can get hard to read in Forth. I read that after Chuck Moore saw how other people wrote Forth code he said something like "Maybe not everybody should use Forth" :) I got the sense that he was shocked by what he saw. Oh well us mere mortals will just have to carry on.
  21. Backing Thinkwards Just read this article about an problem solving methodology that I had never heard of. https://newsletter.butwhatfor.com/p/invert-always-invert-avoid-failure The article describes solving problems by actively searching for ways that will fail. I never thought of it quite so brutally but it reminds of something I said once at a Forth conference and Elizabeth Rather and a few others looked at me like I was out of my mind. I said: "Forth let's me make more mistakes per minute" By that I meant that by cutting programs into tiny pieces that could be tested in seconds interactively, I could make a lot of mistakes in a short time and therefore could find the best solution faster. Looks like I didn't invent the concept.
  22. On Windows 10 I use the game recorder system on a Classic99 window. https://www.pcmag.com/how-to/how-to-capture-video-clips-in-windows-10 It's pretty ham dandy.
  23. That's the approach I took and SAMS made that quite simple.
  24. Ok I cleaned up the code. There was a lot of unused cruft in there. I also made an E/A5 program so there a little screen saver for everyone. For some strange reason I find to funny to have these eyes looking around from inside my computer. Things I learned: You must run INIT-MULTI in your startup code if you want to run the multi-tasker. DUH! It runs automatically when you compile the multi-tasker. I just write the stuff. I don't know how to USE it. (See GO in the code) This version uses only 2 extra tasks and the console task handles the up/down eye motion. EYES.zip
  25. Before I get to my key problems I had this crazy idea this morning since I have now some fluency with the graphics and multi-tasking functions. This might make a neat screen saver. EYES.mp4
  • Create New...