During testing I came across an error where -32768/2 was being interpreted as -(32768/2) rather than (-32768)/2. Since I had hit the 1K limit, some significant work was required to free up enough memory to fix this. The changes were:
- Make all calls to ExpEvaluateNum happen from pages 0,2 or 3, and place all operator subroutines on page 1. So that ‘empty operator stack’ can be detected using that distinction.
- Also place ABS, USR, RND on page 1, and all other token subroutines on page 2. This makes more space available for implementing token subroutines and reduces the out of page jumps required when all had to start in page 2.
- Change the way that end-of-TokenList is detected when searching for Tokens, saving 1 byte. This requires the last byte of TokenList to be at address 03FFh. This fits in well with the other changes listed above.
These changes made it possible to effectively add a Negation operator and give it highest precedence.
Several bugs were introduced and subsequently fixed during the course of doing this.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.