GDMike Posted July 18, 2022 Share Posted July 18, 2022 (edited) Working with some TurboForth ideas. So I decided to play around with making splash screen to start off with and I can throw in little things like, sound, SAMs support and assembler and it just loads up and ready for me. Today I'm experimenting with my version of an include file. Where I can just call a WORD and that word, in this case, would set active a blocks file and display a listing of available routines for that file. I've tried making a FORGET routine to dump a routine, but TF doesn't seem to like that sometimes... and since I'm on real hardware tonight, that can make things take Ionger if things go south. But, I'm having fun getting back into the forth feeling. I'm having second thoughts on the naming of the blocks disk I'll use though, instead of calling them INDEX1,2 etc...I'll just stick to block 1,2 etc So my call looks like "CALL BLOCK1" Edited July 21, 2022 by GDMike Too isolating of a title 3 Quote Link to comment Share on other sites More sharing options...
Willsy Posted July 18, 2022 Share Posted July 18, 2022 Have you looked at MARKER? That might be what you're looking for. Nice to see someone playing with TF 1 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted July 18, 2022 Share Posted July 18, 2022 What does CALL do? All Forth words "call" themselves. Have you seen the word THRU that lets you load a range of contiguous blocks? 1 30 THRU 2 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 18, 2022 Author Share Posted July 18, 2022 Thx. Will be checking on each of the previous comments. My use of "CALL" is just cosmetic, Ill have to look again and see what I did when I get back to the computer. On another note, I was successful at keeping the screen active with, : TS 1 $83D4 ! ; And dropping that into my TI splash routine. I'll read up on what you guys pointed out. Thx Quote Link to comment Share on other sites More sharing options...
+TheBF Posted July 18, 2022 Share Posted July 18, 2022 Here is my definition for CALL in Forth : CALL ; 1 Quote Link to comment Share on other sites More sharing options...
Willsy Posted July 18, 2022 Share Posted July 18, 2022 12 minutes ago, TheBF said: Here is my definition for CALL in Forth : CALL ; Shhhirely it's missing an IMMEDIATE tag? 2 Quote Link to comment Share on other sites More sharing options...
Willsy Posted July 18, 2022 Share Posted July 18, 2022 (edited) 44 minutes ago, TheBF said: What does CALL do? All Forth words "call" themselves. Have you seen the word THRU that lets you load a range of contiguous blocks? 1 30 THRU Yeah - it's included in TF. I just checked its definition as I was worried it may have been somewhat nieve (thought it might be nesting, leading to a potential return stack overflow - but it isn't). I think it's okay, it's defined as: : THRU ( start-block end-block -- ) 1+ SWAP DO I LOAD LOOP ; See https://github.com/Mark-Wills/TurboForth/blob/main/bank0/0-18-Blocks.asm Edited July 18, 2022 by Willsy 3 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted July 18, 2022 Share Posted July 18, 2022 (edited) 2 hours ago, GDMike said: : TS 1 $83D4 ! ; And dropping that into my TI splash routine. The Screen Timeout Timer is at $83D6, so : TS 1 $83D6 ! ; And, $83D6 gets reset to 0 (i.e., even) every pass through KSCAN that detects a key-press. ...lee Edited July 18, 2022 by Lee Stewart CORRECTION Quote Link to comment Share on other sites More sharing options...
+TheBF Posted July 18, 2022 Share Posted July 18, 2022 57 minutes ago, Lee Stewart said: The Screen Timeout Timer is at $83D6, so : TS 1 $83D6 ! ; And, $83D6 gets reset to 0 (i.e., even) every pass through KSCAN. ...lee I forget this one too. So he should modify KEY as the next line in the BLOCK if he wants to keep the screen on all the time. ? : KEY KEY 1 $8ED6 ! ; 2 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted July 18, 2022 Share Posted July 18, 2022 7 minutes ago, TheBF said: I forget this one too. So he should modify KEY as the next line in the BLOCK if he wants to keep the screen on all the time. ? : KEY KEY 1 $8ED6 ! ; Note my correction that $83D6 is reset only when KSCAN detects a key-press. To my knowledge, KEY and KEY? are the only TurboForth words that call the console ROM’s KSCAN, so you might want to do something after KEY? as well, but, if you did it for every call of KEY? , it would slow a loop with KEY? in it (important in gaming). ...lee 3 Quote Link to comment Share on other sites More sharing options...
Willsy Posted July 18, 2022 Share Posted July 18, 2022 1 hour ago, Lee Stewart said: To my knowledge, KEY and KEY? are the only TurboForth words that call the console ROM’s KSCAN, so you might want to do something after KEY? as well, but, if you did it for every call of KEY? , it would slow a loop with KEY? in it (important in gaming). ...lee AFAIR, yes. Agree. In a game or something, it would be better to write to the screen timeout counter periodically in some other routine away from the main loop. The word JOYST in TF also sets >83d6, so if you're using joysticks it already taken care of. It actually writes the value 36, which appears to be the base CRU address for the joysticks. https://github.com/Mark-Wills/TurboForth/blob/main/bank1/1-02-Console.asm 1 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 18, 2022 Author Share Posted July 18, 2022 3 hours ago, Lee Stewart said: The Screen Timeout Timer is at $83D6, so : TS 1 $83D6 ! ; And, $83D6 gets reset to 0 (i.e., even) every pass through KSCAN that detects a key-press. ...lee Correction, I made an error..it's >83D6 . I was relying on my memory again this morning when I wrote that . See, never trust my cranial ram. Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 18, 2022 Author Share Posted July 18, 2022 I had made the word "CALL" with this.. : CALL DECIMAL ; Quote Link to comment Share on other sites More sharing options...
+TheBF Posted July 18, 2022 Share Posted July 18, 2022 14 minutes ago, GDMike said: I had made the word "CALL" with this.. : CALL DECIMAL ; As the song says "If it makes you happy..." (That's 14 bytes that you could use later) 1 Quote Link to comment Share on other sites More sharing options...
Willsy Posted July 18, 2022 Share Posted July 18, 2022 17 minutes ago, GDMike said: I had made the word "CALL" with this.. : CALL DECIMAL ; A better version would be: : CALL ( -- ) ; IMMEDIATE This will take up precisely 0 bytes (and therefore 0 time) when you use it in your own words. Boot up TF from the normal disks, and load block 27 from the UTILS disk (the SEE decompiler). Then try this: : CALL ( -- ) ; IMMEDIATE; : TEST CALL 1 2 + ; SEE TEST As you can see, the word TEST has no reference to CALL at all. CALL is just syntactic sugar. 2 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 18, 2022 Author Share Posted July 18, 2022 In this case I wanted my screen pages to be called in decimaI as not to load a hex valued screen. 2 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 19, 2022 Author Share Posted July 19, 2022 On 7/18/2022 at 3:24 PM, Willsy said: A better version would be: : CALL ( -- ) ; IMMEDIATE This will take up precisely 0 bytes (and therefore 0 time) when you use it in your own words. Boot up TF from the normal disks, and load block 27 from the UTILS disk (the SEE decompiler). Then try this: : CALL ( -- ) ; IMMEDIATE; : TEST CALL 1 2 + ; SEE TEST As you can see, the word TEST has no reference to CALL at all. CALL is just syntactic sugar. Got it. But I'm just now seeing what IMMEDIATE does...so sorry for being slow... but better now than never ever. Quote Link to comment Share on other sites More sharing options...
+TheBF Posted July 19, 2022 Share Posted July 19, 2022 Note: Mark has his English tongue firmly pressed into his cheek on this one. 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 19, 2022 Author Share Posted July 19, 2022 (edited) Well I'm sorry..there's a few things I've gotta get. But...btw, im working with real iron most of the time, except weekends, and I noticed the little fan on my tipi/ raspberry quit working, I actually had another very similar, removed, cleaned up the dirt buildup, hot glued the loose tipi communication wiring, put everything together and I'm back in biz.. with my essentials forth boot disk. Now where were we...oh..yeah, I know IMMEDIATE now, yup.. got it down. Edited July 19, 2022 by GDMike Quote Link to comment Share on other sites More sharing options...
+TheBF Posted July 19, 2022 Share Posted July 19, 2022 Yes the content was all correct and it helped explain how immediate words act inside a definition so that was all excellent. The use of immediate words to do something useful takes a while for us mere mortals to get our heads around but once grokked they are pretty powerful. 2 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 20, 2022 Author Share Posted July 20, 2022 Made a couple words. : STOPSC 1 $83D6 ! ."Screensaver is off " ; : STARTSC 50 $83D6 ! ." Screensaver is on" ; Well see how it acts.. Quote Link to comment Share on other sites More sharing options...
+TheBF Posted July 20, 2022 Share Posted July 20, 2022 46 minutes ago, GDMike said: Made a couple words. : STOPSC 1 $83D6 ! ."Screensaver is off " ; : STARTSC 50 $83D6 ! ." Screensaver is on" ; Well see how it acts.. Remember Lee reminded us that 83D6 is reset to 0 after every KSCAN. So as soon as your press enter or any key your words are done working. You can see it at the console HEX : ? @ . ; 83D6 ? Hit enter and it's zero. 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 20, 2022 Author Share Posted July 20, 2022 (edited) Right. Yup I know. this reserves the original "RESET" feeling of the console, for what I'm doing, because it's a word that I can call when needed and reset back to defaults as a key press occurs. But my SD card in tipi just died. I've got to order two highspeed cards because the one I was using is "super" slow. This lost it's partition and I can't find any software that can build it. Putting it into a phone doesn't do the trick either. Windows disk manager can't do it as well. I've been successful in the past but not this time. It's toast. Edited July 20, 2022 by GDMike 1 Quote Link to comment Share on other sites More sharing options...
Willsy Posted July 20, 2022 Share Posted July 20, 2022 Mike, For a TF tutorial on IMMEDIATE words, have a look at this article. Once you understand it you've got immediate words down. Try the examples. Type them in and see what they do! Ask if you get stuck 3 Quote Link to comment Share on other sites More sharing options...
GDMike Posted July 20, 2022 Author Share Posted July 20, 2022 6 hours ago, Willsy said: Mike, For a TF tutorial on IMMEDIATE words, have a look at this article. Once you understand it you've got immediate words down. Try the examples. Type them in and see what they do! Ask if you get stuck Ok. Will do, I'll run on classic 99, my tipi and real hw is broke at the moment. I'll run it over the weekend, when I normally do classic 99 at work. Thx 1 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.