Dr Jefyll wrote:
It's a warning, not an error. Your new definition was successfully created. MSG#4 means "Not unique" Forth will warn you that the name already exists but it won't stop you from creating a new word by the same name.
Yea, I finally tracked down the text of the 2 screens with the FIG error messages on it. Kind of annoying they're not in the original FIG listings. I stumbled upon a listing for an old Atari Forth that had them. After poking around, I see they're also in the Users Guide for the PDP-11 Forth (I remember when my friend keyed that in to our PDP-11 at school).
Thanks for the info though.
But, in other news, HAZAH! I found my FORGET bug. It wasn't my CPU at all!
If anything, it was my assembler.
In the FIG listing, all of the ZBRANCH and BRANCH offsets are hard coded constants ("hand crafted"), save for 1, in the core of FORGET.
There's this code:
Code:
L3220 .WORD R,OVER,ULESS
.WORD ZBRAN,L3225-*
.WORD FORTH,DEFIN,AT,DUP
.WORD VOCL,STORE
.WORD BRAN,$FFFF-24+1 ; L3220-*
L3225 .WORD DUP,CLIT
The culprit is that "L3225-*".
In MY assembler, I get a value of 20 ($14), but if you use the eenie-meenie-minie-moe method of counting bytes using the Mark 1 Eyeball and Digitus Indexitus, I count that it should be 18 ($12). So, I guess I'm not advancing the '*' PC at the right point in my assembler. I can honestly say I haven't put any thought whatsoever in to how '*' is handled, specifically in this kind of situation. Arguably I'm doing it "wrong" since here's evidence of "wrongness", but I don't really know. (Does any one know how '*' should behave? Comments welcome...)
For the moment, I worked around it by simply changing it to "L3225-*-2", and HAZAH!, success. Now my FORTH can be as forgetful and I am.
So, that's good. One less thing.
While I'm not willing to stick this thing on a rocket to mars, I'm getting more confident that this beast is actually working. I can start adding mass storage to the emulator and implementing the disk primitives in the Forth. Then I can hunt down the awful Forth line editor to see if I can get that working. Next would be adding, perhaps, ANSI-ish escape handling and keyboard arrows (Forget arrows, WordStar diamond yo!) and such so I can hack out a Forth screen editor for my "smart" terminal.
And then...then...uh...I don't know then. Don't have a then set up for, um, then.
Debugging going back and forth from machine code to high level Forth is a bit of a pain. I added memory read/write breakpoints to the emulator, that helped a lot. Updated my memory dump display, that was handy too. Highlighting differences between display updates was helpful as well.
With the memory read breakpoints, I was able to "single step" high level Forth words by putting a BP on each word in the Parameter Field. I can safely say I'm glad I'm not debugging this on hardware with a 80x25 terminal staring at hex dumps from a machine monitor. (Though I was thinking about adding SuperMon to this...) Mind, if I was doing that I'd likely have a CPU that worked along with an Assembler that worked, but what fun is that?
Anyway, onward...Zoiks, and away!