Prev: 25AF Up: Map Next: 25E8
25B3: THE 'SCANNING QUOTE' ROUTINE
The address of this routine is derived from an offset found in the scanning function table.
This routine deals with string quotes, whether simple like "name" or more complex like "a ""white"" lie" or the seemingly redundant VAL$ """a""".
S_QUOTE 25B3 RST $18 Fetch the current character.
25B4 INC HL Point to the start of the string.
25B5 PUSH HL Save the start address.
25B6 LD BC,$0000 Set the length to zero.
25B9 CALL S_QUOTE_S Call the "matching" subroutine.
25BC JR NZ,S_Q_PRMS Jump if zero reset - no more quotes.
S_Q_AGAIN 25BE CALL S_QUOTE_S Call it again for a third quote.
25C1 JR Z,S_Q_AGAIN And again for the fifth, seventh etc.
25C3 CALL SYNTAX_Z If testing syntax, jump to reset bit 6 of FLAGS and to continue scanning.
25C6 JR Z,S_Q_PRMS
25C8 RST $30 Make space in the work space for the string and the terminating quote.
25C9 POP HL Get the pointer to the start.
25CA PUSH DE Save the pointer to the first space.
S_Q_COPY 25CB LD A,(HL) Get a character from the string.
25CC INC HL Point to the next one.
25CD LD (DE),A Copy last one to work space.
25CE INC DE Point to the next space.
25CF CP "\"" Is last character a '"'?
25D1 JR NZ,S_Q_COPY If not, jump to copy next one.
25D3 LD A,(HL) But if it was, do not copy next one; if next one is a '"', jump to copy the one after it; otherwise, finished with copying.
25D4 INC HL
25D5 CP "\""
25D7 JR Z,S_Q_COPY
S_Q_PRMS 25D9 DEC BC Get true length to BC.
Note that the first quote was not counted into the length; the final quote was, and is discarded now. Inside the string, the first, third, fifth, etc., quotes were counted in but the second, fourth, etc., were not.
25DA POP DE Restore start of copied string.
This entry point is used by the routine at S_SCREEN.
S_STRING 25DB LD HL,$5C3B This is FLAGS; this entry point is used whenever bit 6 is to be reset and a string stacked if executing a line. This is done now.
25DE RES 6,(HL)
25E0 BIT 7,(HL)
25E2 CALL NZ,STK_STO
25E5 JP S_CONT_2 Jump to continue scanning the line.
Note that in copying the string to the work space, every two pairs of string quotes inside the string ("") have been reduced to one pair of string quotes(").
Prev: 25AF Up: Map Next: 25E8