Thanks for the instructional videos, Birt! The general Forth-y bits of it
have been helpful and If I had a C=64 kicking around I'd definitely give
DurexForth a try.

The problem with .S is that if the stack has underflowed, it just keeps
reading past the bottom until I assume it wraps all the way around memory
and ends up back at the real bottom of the stack. Normally this means reset
and you don't get a chance to see what you did wrong. Yesterday I was able
to write a wrapper that checks DEPTH first and says something instead of
spewing garbage:

: .SS DEPTH 0 < IF ." YOU DUN GOOFED" ELSE .S THEN ;

This has saved me a lot of resetting in the interim, but it'd be nice to
not have to re-enter it every time, and I think it might be corrupting 4
bytes of memory just below MFORTH's stack with that DEPTH and subsequent 0
comparison. Maybe also for the error message string? Guess I'll find out
eventually. :D

Since DEPTH seems to know where the end of the stack is, and appropriately
gives a negative number if you underflow, idk why .S couldn't do the same.
If I can wrap my head around the assembly source for MFORTH, I might try to
patch that in a sanity check and make a new ROM image. A project for
another day I suppose.

On Tue, Mar 30, 2021 at 8:49 AM Jeffrey Birt <bir...@soigeneris.com> wrote:

> The word .S prints out what is on the stack at that time without
> disturbing it. It will never show you more or less than what is on the
> stack. If what is on the stack does not make sense it is because of an
> error in programming and this is very, very easy to do.
>
>
>
> One of the most helpful things for me was to write out each line of code
> (each Word) on a different line and add a comment to the left as to what
> the stack contents would be afterwards. While this is time consuming it has
> the benefit of making it clear what is happening to the stack after each
> step.
>
>
>
> One of the best parts of Forth is that it encourages you to create small
> modules which are easier to debug. If you create a new word that is
> supposed to take two values off the stack and manipulate them and return
> the result you can check the functionality by clearing the stack, typing in
> two test values and then executing your new Word. Then to a .S to check the
> result. Remember though that .S leave the stack contents there so if you
> want to run another such test you would want to clear the stack first.
>
>
>
> Jeff Birt
>
>
>
> *From:* M100 <m100-boun...@lists.bitchin100.com> *On Behalf Of *Alex ...
> *Sent:* Monday, March 29, 2021 1:25 PM
> *To:* m...@bitchin100.com
> *Subject:* Re: [M100] Does anyone actually use MFORTH?
>
>
>
> Cool, so newbie mistakes and ignorance. As long as my computer's working
> properly. :)
>
>
>
> What threw me off is in the book, (pg.25) it talks about returning usually
> 0 and printing STACK EMPTY, which is definitely not how the machine behaved
> when trying it.
>
>
>
> I don't expect everything to have bounds checking, but I'm using .S a lot
> to inspect the stack, so having to reset the machine all the time and start
> over kind of sucks. If I knew more about the system maybe I could rewrite
> .S to know if it's looking at the stack or what's underneath?
>
>
>
> About the editor: I skipped over the whole chapter on the arcane line
> editor and page/block-based disk storage since this machine has none of
> that. Using TEXT with .DO files works ok, as long as whatever I'm doing
> doesn't trample the files in RAM.
>
>
>
> Thanks for the tutorial videos, Birt. They've been helpful! If I had a
> C=64 kicking around here I would definitely give DurexForth a try.
>
> On Mon, Mar 29, 2021, 08:37 Jeffrey Birt <bir...@soigeneris.com> wrote:
>
> This is the default behavior for most all vintage 8-bit Forth
> implementations. To do a bounds check might take 6-10 machine cycles for
> every word. This does not seem like a lot, but it would have a noticeable
> impact on performance.
>
>
>
> When I ventured Forth a few years ago I found that Forth Inc has a PC
> based Forth Dev system that is pretty forgiving and a good way to learn
> without crashing a machine. https://www.forth.com/ . There is also a good
> online Forth tutorial with a web based Forth implementation:
> https://skilldrick.github.io/easyforth/
>
>
>
> I got the most out of DurexForth which is a modern Forth implementation on
> the C64. You still get the vintage goodness but with a good VI like editor
> and actual file support rather than the super goofy and crude typical Forth
> screens and blocks. I did a few cheesy Forth videos at the time too:
> https://www.youtube.com/watch?v=TXIDqptXmiM (lots of links in the
> description).
>
>
>
> Jeff Birt
>
>
>
> *From:* M100 <m100-boun...@lists.bitchin100.com> *On Behalf Of *Alex ...
> *Sent:* Sunday, March 28, 2021 9:39 PM
> *To:* Model 100 Discussion <m100@lists.bitchin100.com>
> *Subject:* [M100] Does anyone actually use MFORTH?
>
>
>
> Hello Tandy laptop nerds,
>
> So I've been reading Leo Brodie's "Starting Forth" and using my '102 as a
> playground / labrat. There's been a few inconsistencies I expected and can
> live with/work around, but I've noticed what seems like really bad bugs. It
> seems trivially easy to underflow the stack into la-la land. (For example:
> . . .S after a fresh boot will get it stuck spewing memory all over the
> screen)
>
> Has anyone actually used MFORTH for more than just simple tests? Is there
> maybe some hardware quirks involved here that don't exist on the Virtual-T
> emulator?
>
>
>
> Figured I'd cast this one out and see if anyone bites.
>
> -Alex
>
>
> --
>
> Disclaimer: Any resemblance between the above views and those of my
> employer, my terminal, or the view out my window are purely coincidental.
> Any resemblance between the above and my own views is non-deterministic.
> The question of the existence of views in the absence of anyone to hold
> them is left as an exercise for the reader.
> The question of the existence of the reader is left as an exercise for the
> second god coefficient.  (A discussion of non-orthogonal, non-integral
> polytheism is beyond the scope of this article.) Thanks /usr/games/fortune
>
>

-- 
Disclaimer: Any resemblance between the above views and those of my
employer, my terminal, or the view out my window are purely coincidental.
Any resemblance between the above and my own views is non-deterministic.
The question of the existence of views in the absence of anyone to hold
them is left as an exercise for the reader.
The question of the existence of the reader is left as an exercise for the
second god coefficient.  (A discussion of non-orthogonal, non-integral
polytheism is beyond the scope of this article.) Thanks /usr/games/fortune

Reply via email to