GARTHWILSON wrote:
[color=#000000]It's always good to have some sort of manual available as you program, whether on the screen, on paper, whatever. I have all my 6502 or '816 Forth source code available in text files and a quick search always gets me everything I could ever want to know about a word.
Yep. I wouldn't have accomplished as much if it wasn't for the ability to multi-task on a modern machine. Very handy to keep lots of notes. But I will be uploading my work to a group of people who want to play on their real machines. Multi-tasking and tons of text files for notes won't be an option.
Quote:
I would encourage sticking with the standards anytime you don't have a good reason to deviate though. For example, the standard word for returning the data stack depth is DEPTH, not DEPTH? which sounds like it should return a flag. PAD returns an address, and the standard way to get the contents would be PAD @ . However, PAD is used for strings, including pictured numeric output, meaning you might not have much use for a word that returns the contents of just the one byte at address PAD. For my '816 Forth, I have the equivalent of shadow-screen files (although they're text files, not screen files) that have more explanation on the words that need it, including a few short paragraphs on the use of PAD.
The one nice thing about the Forth I am using is that it can be programmed to follow any standard without actuall following a standard. My Forth (which is an adaptation between all Forths from 78 to Ansi) is actually quite a bit less convoluted than any single Forth standard. Which means it is a lot less complicated and a lot easier to understand. I will leave it up to the user to create the necessary words to which standard they wish to follow. For now though still picking out the best methods of each standard to adopt. Although Ansi is the newest standard to follow, I still find it somewhat restrictive in some cases and over-bloated in others for what I need to accomplish.
?DEPTH is supposed to do exactly what you understood. It is meant to leave a flag to indicate if the stack is empty. For instance, the normal way to do a
LIST is (screen #)
LIST. But if I program
?DEPTH into
LIST, LIST can now be used without a number on the data stack, and if the data stack is empty, it will use the last screen number that was saved into
SCR. Very handy when the screen constantly scrolls off the top of the monitor window when testing code and have to constantly re-list the current screen.
.PAD was just an example but yes I agree, maybe {b]."PAD[/b] is a better choice for printing
PAD.
Although I am programming using an emulator with all my notes handy, I am also thinking and adapting Forth for those who don't have multi-tasking and want to use Forth on their real 8-bit machines.