Prev: 09860 Up: Map Next: 09929
09869: THE 'SCANNING DECIMAL' ROUTINE
The address of this routine is derived from an offset found in the scanning function table.
The routine at S_ALPHNUM continues here.
This routine deals with a decimal point or a number that starts with a digit. It also takes care of the expression 'BIN', which is dealt with in the 'decimal to floating-point' subroutine.
Input
A Code of the first character in the number
S_DECIMAL 09869 CALL SYNTAX_Z Jump forward if a line is being executed.
09872 JR NZ,S_STK_DEC
The action taken is now very different for syntax checking and line execution. If syntax is being checked then the floating-point form has to be calculated and copied into the actual BASIC line. However when a line is being executed the floating-point form will always be available so it is copied to the calculator stack to form a 'last value'.
During syntax checking:
09874 CALL DEC_TO_FP The floating-point form is found.
09877 RST 24 Set HL to point one past the last digit.
09878 LD BC,6 Six locations are required.
09881 CALL MAKE_ROOM Make the room in the BASIC line.
09884 INC HL Point to the first free space.
09885 LD (HL),14 Enter the number marker code.
09887 INC HL Point to the second location.
09888 EX DE,HL This pointer is wanted in DE.
09889 LD HL,(23653) Fetch the 'old' STKEND.
09892 LD C,5 There are 5 bytes to move.
09894 AND A Clear the carry flag.
09895 SBC HL,BC The 'new' STKEND='old' STKEND minus 5.
09897 LD (23653),HL
09900 LDIR Move the floating-point number from the calculator stack to the line.
09902 EX DE,HL Put the line pointer in HL.
09903 DEC HL Point to the last byte added.
09904 CALL TEMP_PTR1 This sets CH-ADD.
09907 JR S_NUMERIC Jump forward.
During line execution:
S_STK_DEC 09909 RST 24 Get the current character.
S_SD_SKIP 09910 INC HL Now move on to the next character in turn until the number marker code (14) is found.
09911 LD A,(HL)
09912 CP 14
09914 JR NZ,S_SD_SKIP
09916 INC HL Point to the first byte of the number.
09917 CALL STACK_NUM Move the floating-point number.
09920 LD (23645),HL Set CH-ADD.
This entry point is used by the routines at S_PI, S_ATTR and S_POINT.
A numeric result has now been identified, coming from RND, PI, ATTR, POINT or a decimal number, therefore bit 6 of FLAGS must be set.
S_NUMERIC 09923 SET 6,(IY+1) Set the numeric marker flag (bit 6 of FLAGS).
09927 JR S_CONT_1 Jump forward.
Prev: 09860 Up: Map Next: 09929