Create folder with examples of Forth code
The full screen editor in the ForthSoftware repo would be a good start. Ideally, it would be stuff that is not tied to a particular 65C02 platform. There are some double words in double_words.fs and file.fs from that repo that might also be useful, as Tali does not implement the entire set of double words.
It would be nice to fit the code into screens, as some people are using screens.
Sam, I have modified (very minor changes required) Sam Falvo's Vibe 2.2 to run on Tali. I haven't done a lot of testing but it works for me. Thanks for fixing the ANSI term off-by-one bug in Tali, which had me very confused when I was trying to get this to run. I'm using Jonathan Foucher's Planck SBC (https://planck6502.com/) which is screen-based and it runs from CF card-based block system. See attachment for code. vibe22.txt
Hi Ben, I'll get around to this eventually, and thanks for your updated version of VIBE - it was this software that made me realize there was a bug in the AT-XY word. I do like the included marker to allow unloading of the editor when done with it. If you want to push this along, I'd be happy to accept a pull request with a forth_examples folder (in the main directory) that contains your updated version of VIBE. I'll probably add (or you can add) a README.md to list file names and a short description for all of the example files that end up here. I ended up writing my own editor with a few emacs keybindings that I can include, so it will be nice to have both vim and emacs type editors available for everyone.
The only potential bug I see is the line that has Samuel Falvo's copyright in it (line 4) - the closing parenthesis of the (c) ends the comment. Changing to something like {c} should solve the issue.
You could also consider adding allow-native after the ; of each of your helper words at the top - it modifies the most recently defined word and allows those short words to be natively compiled into the words below (if the user has native compiling turned on, which is it by default). Without the allow-native, any new words are always compiled as a JSR. The only words that can't have allow-native are those with flow control (IF, DO, etc or JMP if in assembly) in them. You can see the Native Compiling section in the docs for more details. It will work fine as-is, so I'll accept it either way. -SamCoVT
SamCoVT, Thanks for the prompt response! I'll make the suggested changes and I'll a pull request put together.
I have made the changes; however, I see that some combination of VIBE commands leaves numbers on the stack at exit. I'm going to see what I can figure out before submitting the pull request.
Hi @bjchapm - I played around a bit with your VIBE source and it appears you get values left on the stack if you type a letter while in COMMAND mode (which it starts in) that is not a valid command. The values are the ASCII codes for the unrecognized letters. I was able to reproduce the effect in gforth. Trying to use arrow keys or HOME/END can also cause issues when in command mode as they are not handled.
I think the issue is with handlerword where it calls nomapping because it couldn't find the command. nomapping drops the address (of the name of the word/command that couldn't be found by FIND) and puts the xt for beep there instead. The issue is that beep will not drop the value from KEY that is still there. Note that all of the other commands start with DROP to drop the last keypress (I think it's the last keypress that is there).
beep is only ever used once, and only for this purpose, so putting DROP at the beginning of beep (line 103 in the source I'm playing with) seems to fix things. Let me know if that works for you.
: beep drop 7 EMIT ;
Note that this editor redraws the entire screen every time. That may be painfully slow over a serial link, but might be perfectly acceptable on your hardware if you are using the VGA board (it looks like that is memory mapped).
Thanks for the detailed analysis. I had gotten to the invalid keys, but didn't know where to go from there. Yes, that fixes the stack issue.
You are right about it being slow! I'm using it on the Planck via serial -- the serial itself is very fast (115200) and the Planck runs at 12Mhz, but the response seems very slow, possibly because I am currently using a 6551 with a delay loop. It's certainly a nice reminder of why line editors like ed were popular. Speaking of which, VIBE writes over ed with its own ed word. We might want to comment that out or rename it.
It might make sense to name it vi as that seems to be what it's modeled after. You are welcome to fix it up however makes sense to you and I'll be happy to include it. Seeing as Samuel Falvo's copyright declaration reserves all rights, I'll probably need to add a note in this forth_examples folder that some of the examples may not follow Tali2's public domain licensing. If you're happy with how it works now, then just create a forth_examples folder and add this code and send me a pull request. I can handle adding the README.md and I have some other examples that can go in there as well.
Also, if you were looking for a full-screen screen editor that works reasonably well over a serial connection, I'd be happy if you'd give my editor a try. The keybindings that are fully tested are listed in the comments at the top. There is experimental copy/paste (you can look down in the key handling code for the key strokes for those), but I think there's a bug or two lurking in there. I recommend overwrite mode (hit INSERT to toggle) for use over a serial link.
You can find it here in my ForthSoftware repository: https://github.com/SamCoVT/ForthSoftware/blob/master/editor.fs
SamCo, Finally got a chance to play with your editor, after getting derailed by a failing CF card. It's great! Very nice screen updating and easy to use. I'll rename Mr. Falvo's ed to vi; I've already chatted with him about licensing and he confirmed that Mozilla license applies. I'll work up the pull request shortly. Thanks!
I'm going to leave this issue open for a bit longer as a reminder that I'd like to add a few more examples into the (now created) forth_examples folder