Quote:
I maybe should've explained that INTERPRET first checks whether the input string is a Forth word -- that's what -FIND is for. Only if that fails does it attempt to treat the string as a number. Conclusion: NUMBER may or may not be broken, but if the machine can't find a known word like DUP or SWAP then something else has already gone wrong. My suggestion is to look for the first problem first.
Oh yea, it's definitely getting that far.
the number '1' is a Forth word, so -FIND and (FIND) should find it. But that's clearly failing because as I understand it, FIND is tried first and if it fails, then NUMBER is tried.
I have some archive of a Fig doc, that seems to be missing Chapter 7. It's in some mostly plain text format, but there's obvious garbage at the start and end. But it's legible.
In Chap. 8, it describes the NUMBER code, and I can see exactly what code is failing.
From that document there's this excerpt;
Code:
BEGIN Start the conversion process
DPL ! Store the decimal point counter
(NUMBER) Convert one digit after another until an invalid char occurs.
Result is accumulated into d .
DUP C@ Fetch the invalid digit
BL - Is it a blank?
WHILE Not a blank, see if it is a decimal point
DUP C@ Get the digit again
2EH - Is it a decimal point?
0 ?ERROR Not a decimal point. It is an illegal character for a number.
Issue an error message and quit.
0 A decimal point was found. Set DPL to 0 the next time.
REPEAT Exit here if a blank was detected. Otherwise repeat the
conversion process.
That "is it a decimal point?" is where I'm getting the error message from. But clearly, that's not the issue -- in this case, it simply shouldn't even be here. So it's something else. That implies -FIND or (FIND).
It could be as simple as Forth seeing my LF (line feed, ascii 10) while it's looking for a CR. I found the one reference in EXPECT, perhaps there are others. It's not "configurable" like DEL/RUBOUT/BS is in a user variable(?, I think). No, nothing glaringly obvious at least.
Since (FIND) is machine code, that could easily be a bug in the simulator. It's clear that NEXT and friends is all working, or we wouldn't be this far. They work much better now that INC does the right thing lol.
But if it's in (FIND) I should have a decent chance of hunting it down, as I said, it's easier to debug machine code that Forth at this point.