Prev: 2684 Up: Map Next: 26C9
268D: 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 268D CALL SYNTAX_Z Jump forward if a line is being executed.
2690 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:
2692 CALL DEC_TO_FP The floating-point form is found.
2695 RST $18 Set HL to point one past the last digit.
2696 LD BC,$0006 Six locations are required.
2699 CALL MAKE_ROOM Make the room in the BASIC line.
269C INC HL Point to the first free space.
269D LD (HL),$0E Enter the number marker code.
269F INC HL Point to the second location.
26A0 EX DE,HL This pointer is wanted in DE.
26A1 LD HL,($5C65) Fetch the 'old' STKEND.
26A4 LD C,$05 There are 5 bytes to move.
26A6 AND A Clear the carry flag.
26A7 SBC HL,BC The 'new' STKEND='old' STKEND minus 5.
26A9 LD ($5C65),HL
26AC LDIR Move the floating-point number from the calculator stack to the line.
26AE EX DE,HL Put the line pointer in HL.
26AF DEC HL Point to the last byte added.
26B0 CALL TEMP_PTR1 This sets CH-ADD.
26B3 JR S_NUMERIC Jump forward.
During line execution:
S_STK_DEC 26B5 RST $18 Get the current character.
S_SD_SKIP 26B6 INC HL Now move on to the next character in turn until the number marker code (+0E) is found.
26B7 LD A,(HL)
26B8 CP $0E
26BA JR NZ,S_SD_SKIP
26BC INC HL Point to the first byte of the number.
26BD CALL STACK_NUM Move the floating-point number.
26C0 LD ($5C5D),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 26C3 SET 6,(IY+$01) Set the numeric marker flag (bit 6 of FLAGS).
26C7 JR S_CONT_1 Jump forward.
Prev: 2684 Up: Map Next: 26C9