Tuesday, May 9, 2017

I finally took a look at the colon issue the other day, and what I thought might be the best approach is to just issue an SN ERROR if there is no colon.  But this was met with unintended consequences, so I have to look at more code before I have a final solution.

The problem,is how IF THEN ELSE is parsed and executed.  Once the interpreter evaluates the test that follows the IF, it has to either execute the THEN condition which can contain multiple statements, and skip what follows the ELSE, or it has to skip to the ELSE and execute what lies after it.  Having to execute multiple statements means jumping back to the main interpreter which expects colons between commands.   But somewhere in the mix the interpreter is running off to never never land which can be difficult to trace.  I think it's in an endless loop and keeps pushing to the stack until it overwrites the hardware registers.  I'm guessing it just needs to advance the pointer like a previous fix, but I haven't located where yet.

Correction... it needs to issue an SN ERROR instead of going into an endless loop.


Edit...
Or I could be issuing an RTS when there isn't a return value on the stack.
ELSE reuses to the REM code... but it shouldn't.
At least that appears to be the problem.  Working on the fix...
One question... why does REM use RTS when it should JMP to the code to process the next line?
!!!!!!!!!!!!!!!!!

No comments:

Post a Comment