| Spectrum ROM | Routines |
| Prev: 10929 | Up: Map |
|
This subroutine returns the result of evaluating the 'next expression' as an integer value held in the BC register pair. The subroutine also tests this result against a limit-value supplied in the HL register pair. The carry flag becomes set if there is an 'out of range' error.
The A register is used as an 'error register' and holds +00 if there is no 'previous error' and +FF if there has been one.
|
|||||||||||||
| INT_EXP1 | 10956 | XOR A | Clear the 'error register'. | ||||||||||
|
This entry point is used by the routine at SLICING.
|
|||||||||||||
| INT_EXP2 | 10957 | PUSH DE | Save both the DE and HL register pairs throughout. | ||||||||||
| 10958 | PUSH HL | ||||||||||||
| 10959 | PUSH AF | Save the 'error register' briefly. | |||||||||||
| 10960 | CALL CLASS_06 | The 'next expression' is evaluated to give a 'last value' on the calculator stack. | |||||||||||
| 10963 | POP AF | Restore the 'error register'. | |||||||||||
| 10964 | CALL SYNTAX_Z | Jump forward if checking syntax. | |||||||||||
| 10967 | JR Z,I_RESTORE | ||||||||||||
| 10969 | PUSH AF | Save the error register again. | |||||||||||
| 10970 | CALL FIND_INT2 | The 'last value' is compressed Into BC. | |||||||||||
| 10973 | POP DE | Error register to D. | |||||||||||
| 10974 | LD A,B | A 'next expression' that gives zero is always in error so jump forward if it is so. | |||||||||||
| 10975 | OR C | ||||||||||||
| 10976 | SCF | ||||||||||||
| 10977 | JR Z,I_CARRY | ||||||||||||
| 10979 | POP HL | Take a copy of the limit-value. This will be a 'dimension-size', a 'DIM-limit' or a 'string length'. | |||||||||||
| 10980 | PUSH HL | ||||||||||||
| 10981 | AND A | Now compare the result of evaluating the expression against the limit. | |||||||||||
| 10982 | SBC HL,BC | ||||||||||||
|
The state of the carry flag and the value held in the D register are now manipulated so as to give the appropriate value for the 'error register'.
|
|||||||||||||
| I_CARRY | 10984 | LD A,D | Fetch the 'old error value'. | ||||||||||
| 10985 | SBC A,0 | Form the 'new error value': +00 if no error at any time, +FF or less if an 'out of range' error on this pass or on previous ones. | |||||||||||
|
Restore the registers before returning.
|
|||||||||||||
| I_RESTORE | 10987 | POP HL | Restore HL and DE. | ||||||||||
| 10988 | POP DE | ||||||||||||
| 10989 | RET | Return; 'error register' is the A register. | |||||||||||
| Prev: 10929 | Up: Map |