Willsy Posted February 5, 2022 Share Posted February 5, 2022 18 hours ago, Lee Stewart said: Here it is for TurboForth: I have not tested it, but it should work. ...lee I've entered it into TF and it compiles successfully, but how do I run it? When I execute RKEY it just leaves 13 on the stack (enter key). Any example calling code? Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted February 5, 2022 Share Posted February 5, 2022 1 minute ago, Willsy said: I've entered it into TF and it compiles successfully, but how do I run it? When I execute RKEY it just leaves 13 on the stack (enter key). Any example calling code? It is typically part of an infinite key-in loop. RKEY was initially part of the block text editor in TI Forth. You use something very similar in TurboForth, as do I in fbForth. Both of the latter are in ALC. ...lee Quote Link to comment Share on other sites More sharing options...
+TheBF Posted February 5, 2022 Share Posted February 5, 2022 56 minutes ago, Willsy said: I've entered it into TF and it compiles successfully, but how do I run it? When I execute RKEY it just leaves 13 on the stack (enter key). Any example calling code? : TEST BEGIN RKEY DUP EMIT 90 = UNTIL ; Is what I do. 4 Quote Link to comment Share on other sites More sharing options...
Willsy Posted February 5, 2022 Share Posted February 5, 2022 Thanks @TheBF :-) Hey @Lee Stewart - it works like a champ! Duly stolen! Thanks 4 Quote Link to comment Share on other sites More sharing options...
GDMike Posted February 6, 2022 Author Share Posted February 6, 2022 (edited) I just completed my key input routine. Pat on back. It's good for 1 line and cannot extend past column 80. But that's because I put a filter on it. But I've made it this way so that the enter key has a function. Anyway, it took me all night lol... VID_20220206_043625147.mp4 Edited February 6, 2022 by GDMike 2 Quote Link to comment Share on other sites More sharing options...
GDMike Posted February 6, 2022 Author Share Posted February 6, 2022 I'm just cleaning up the code and adding comments. Then I'll post it so somebody can tell me another way of doing it..lol and that's all fun. Quote Link to comment Share on other sites More sharing options...
GDMike Posted February 6, 2022 Author Share Posted February 6, 2022 Code here VID_20220206_054255162.mp4 1 Quote Link to comment Share on other sites More sharing options...
Willsy Posted February 6, 2022 Share Posted February 6, 2022 Three observations: 1) You're not using stack comments. In a month, you won't remember how the more complex words work and you'll have to decode them again! 2) The word DISP is misleading. It implies that it displays something, but it doesn't. It just pushed ROW and COL to the stack - consider renaming it. 3) Nice use of LEAVE in the word DEL1 It's much easier for us if you can post your code into Atariage, rather than read it from a video. You know you can export your blocks to Windows, right? Then you can just paste your code directly in to Atariage. See BLK>FILE on block 20. Boot from the standard TF boot disk, and type FILES - it will show you the files utilities. BLK>FILE is on block 20. 75 80 BLK>FILE CLIP That will export blocks 75 to 80 to the Windows clipboard, and you can simply paste the text into Atariage or notepad or whatever. Works in Linux too if you're running Classic99 under wine. 3 Quote Link to comment Share on other sites More sharing options...
GDMike Posted February 6, 2022 Author Share Posted February 6, 2022 (edited) Oh, right about using clipboard, I totally forgot that you mentioned that earlier. Gotcha. On the same Note, honestly, I was in a hurry because as soon as my last hour was up, bam! The code came together. But yes, I'll practice clipping some code tonight, my last night on my Forth weekend. Comments, I actually have written notes in my TF booklet that takes me step by step, because there's just no room to make adequate comments, unless I dedicate more screen blocks for that sole purpose. I hear you regarding comments. BTW, that was sorta a mad dash as well as I'd be embarrassed if I show code with no comments at all. Thx, I really appreciate the feedback. Tonight ought to be interesting, as I get to fine tune this, and hopefully not frankenforth my code at the same time. Edited February 6, 2022 by GDMike 1 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted February 6, 2022 Share Posted February 6, 2022 2 hours ago, GDMike said: Comments, I actually have written notes in my TF booklet that takes me step by step, because there's just no room to make adequate comments, unless I dedicate more screen blocks for that sole purpose. I hear you regarding comments. BTW, that was sorta a mad dash as well as I'd be embarrassed if I show code with no comments at all. Though commenting the code is, indeed, important, @Willsy was talking specifically about ALWAYS including stack effects, which are inline comments to show what is expected on the stack before execution (represented by ‘--’) and what is left on the stack, with the most accessible item (top of stack) on the right on either side of ‘--’: Here are examples from the code I posted earlier plus an extra one to show stack before execution, with only the stack effect comments: : ?KEY ( -- key|0 ) <<---expects nothing..leaves ASCII key value or 0 KEY? DUP 0< IF DROP 0 THEN ; : CURPOS ( -- pos ) <<---expects nothing..leaves screen position of cursor $A02A @ $A02C @ * $A028 @ + ; : GCH ( -- ) <<---expects nothing..leaves nothing [usually safe to omit empty stack effects, but still useful] CURPOS V@ CURCHR ! ; : MYADD ( n1 n2 -- sum ) <<---expects two 16-bit numbers..leaves 16-bit sum + ; Of course, it is always good to include as much descriptive commenting as you can afford to make sense of your code down the road. But, the most important comments are the stack effects! You should always include them. ...lee 1 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted February 6, 2022 Author Share Posted February 6, 2022 1 hour ago, Lee Stewart said: ( -- key|0 ) My brain has to capture this meaning, after I wake up a bit.. bwhhaha...ok...thx lee for this. You're both absolutely correct. I need to figure this out. Quote Link to comment Share on other sites More sharing options...
+TheBF Posted February 6, 2022 Share Posted February 6, 2022 43 minutes ago, GDMike said: My brain has to capture this meaning, after I wake up a bit.. bwhhaha...ok...thx lee for this. You're both absolutely correct. I need to figure this out. Some might say the stack diagram tells you the "gazintas and gazouttas" of a word. ( what 'goes into" and what "goes out of") 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted February 6, 2022 Author Share Posted February 6, 2022 (edited) 2 minutes ago, TheBF said: Some might say the stack diagram tells you the "gazintas and gazouttas" of a word. ( what 'goes into" and what "goes out of") Yes sir, thx. Was just looking at the"snake" comments over on another POST..it's starting to come together for me. Edited February 6, 2022 by GDMike 1 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted February 6, 2022 Share Posted February 6, 2022 40 minutes ago, GDMike said: My brain has to capture this meaning, after I wake up a bit.. bwhhaha...ok...thx lee for this. You're both absolutely correct. I need to figure this out. Stack effects: ‘--’ represents the execution of the word being defined. Elements to the left of ‘--’ are relevant stack contents before execution. Elements to the right of ‘--’ are relevant stack contents after execution. On either side of ‘--’, the rightmost element is the top of the stack. The vertical bar ‘|’ means ‘or’. It is separating two possible outcomes. ...lee 3 Quote Link to comment Share on other sites More sharing options...
GDMike Posted February 6, 2022 Author Share Posted February 6, 2022 (edited) 11 minutes ago, Lee Stewart said: Stack effects: ‘--’ represents the execution of the word being defined. Elements to the left of ‘--’ are relevant stack contents before execution. Elements to the right of ‘--’ are relevant stack contents after execution. On either side of ‘--’, the rightmost element is the top of the stack. The vertical bar ‘|’ means ‘or’. It is separating two possible outcomes. ...lee Ok.. this is something I tried finding in Forth books, and it wasn't this clear to me from what I remember reading..I do have another book coming in though, and not much in those books as far as what they expect the user to know about the hardware. I'm finding myself having to learn both at the same time, I mean, it's understandable that you need to know the hardware, but look at basic for example, I can say print to the screen, and know nothing about the hardware except for the rules of the command. I Know much more hardware than I used to from doing assembly, but still, it's knowing, well, all the hardware for programming in Forth.. and it mean this in a good way, it's just, if someone wanted to learn Forth and is coming from BASIC, then they really need to know this. Edited February 6, 2022 by GDMike Quote Link to comment Share on other sites More sharing options...
Willsy Posted February 6, 2022 Share Posted February 6, 2022 There's a write-up on stack comments in the TF tutorials section: http://turboforth.net/tutorials/the_stack.html#sojourn 1 Quote Link to comment Share on other sites More sharing options...
Willsy Posted February 6, 2022 Share Posted February 6, 2022 Also, have a look here, and look at the stack comments (we sometimes call them stack signatures). They should start to make sense: http://turboforth.net/lang_ref/words_by_glossary_category.asp?ID=2 1 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted February 6, 2022 Share Posted February 6, 2022 53 minutes ago, GDMike said: Ok.. this is something I tried finding in Forth books, and it wasn't this clear to me from what I remember reading . . . Stack effects (also stack signature or stack comments—see @Willsy’s posts above) are discussed in pretty much every Forth book out there, among them Leo Brodie’s Starting FORTH, pp. 39 – 41 and my fbForth 2.0: A File-Based Cartridge Implementation of TI Forth, p. 10. ...lee 2 Quote Link to comment Share on other sites More sharing options...
GDMike Posted February 7, 2022 Author Share Posted February 7, 2022 1 hour ago, Lee Stewart said: Stack effects (also stack signature or stack comments—see @Willsy’s posts above) are discussed in pretty much every Forth book out there, among them Leo Brodie’s Starting FORTH, pp. 39 – 41 and my fbForth 2.0: A File-Based Cartridge Implementation of TI Forth, p. 10. ...lee Yes, I found in Leo Brodie's book, in the first few pages, but I couldn't make sense out of it at the time. And I think it was only a couple pages or just 1 Page..I'll have to go back and review it..I can't remember it now... Quote Link to comment Share on other sites More sharing options...
GDMike Posted February 7, 2022 Author Share Posted February 7, 2022 I'm reviewing TF block 20 as Willsy reminded me about... that's homework Tonight.. Quote Link to comment Share on other sites More sharing options...
GDMike Posted February 7, 2022 Author Share Posted February 7, 2022 (edited) Hmm I loaded block 20, received message.. e.g. 1 21 BLK>FILE DSK2.BLKDUMP I tried, 79 80 BLK>FILE DSK4.TEST and received a file in my DSK4 directory, but couldn't read it with notepad. I tried this a couple more times.. with Same results. AHh.... it was notepad itself... Figured it out... Edited February 7, 2022 by GDMike Quote Link to comment Share on other sites More sharing options...
GDMike Posted February 7, 2022 Author Share Posted February 7, 2022 (edited) This is great!! Hahaha ..so what do I do...I make a photo....go figure... bwhhaha Edited February 7, 2022 by GDMike 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted February 7, 2022 Author Share Posted February 7, 2022 Catching up on... 1.5 Forth: A Sojourn Into Stack Comments. Turboforth.net site good reading 1 Quote Link to comment Share on other sites More sharing options...
GDMike Posted February 7, 2022 Author Share Posted February 7, 2022 (edited) Took care of some reading and then I went back to my work on the Foxit command window where I was able to finish adding the directional left,right keys and adding the ENTER key along with the boundary honks. Everything is looking really good in my tests. I guess next week will start to work on the command line string lookup comparison things. At the same time I'll need to do some screen builder stuff... not quite ready for heavy stuff, but I'm making a dent. I know TF already has string handling, so I suppose I'll need to read up on that. VID_20220207_011931475.mp4 Edited February 7, 2022 by GDMike 1 Quote Link to comment Share on other sites More sharing options...
Willsy Posted February 7, 2022 Share Posted February 7, 2022 7 hours ago, GDMike said: Hmm I loaded block 20, received message.. e.g. 1 21 BLK>FILE DSK2.BLKDUMP I tried, 79 80 BLK>FILE DSK4.TEST and received a file in my DSK4 directory, but couldn't read it with notepad. I tried this a couple more times.. with Same results. AHh.... it was notepad itself... Figured it out... Don't send it to a disk file - if you do that, Classic99 will create the file as a DV80 file and it will have a bunch of crap at the top and also the line endings and stuff will all be wrong. Use CLIP. CLIP is a special feature in Classic99 that allows a TI program to write to the Windows copy & paste buffer. So, try this: Load block 20 (the BLK>FILE program) type 10 20 BLK.FILE CLIP Open notepad or notepad++ Right click in the notepad document and select PASTE Voila. 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.