Prev: 09647 Up: Map Next: 09704
09651: 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 09651 RST 24 Fetch the current character.
09652 INC HL Point to the start of the string.
09653 PUSH HL Save the start address.
09654 LD BC,0 Set the length to zero.
09657 CALL S_QUOTE_S Call the "matching" subroutine.
09660 JR NZ,S_Q_PRMS Jump if zero reset - no more quotes.
S_Q_AGAIN 09662 CALL S_QUOTE_S Call it again for a third quote.
09665 JR Z,S_Q_AGAIN And again for the fifth, seventh etc.
09667 CALL SYNTAX_Z If testing syntax, jump to reset bit 6 of FLAGS and to continue scanning.
09670 JR Z,S_Q_PRMS
09672 RST 48 Make space in the work space for the string and the terminating quote.
09673 POP HL Get the pointer to the start.
09674 PUSH DE Save the pointer to the first space.
S_Q_COPY 09675 LD A,(HL) Get a character from the string.
09676 INC HL Point to the next one.
09677 LD (DE),A Copy last one to work space.
09678 INC DE Point to the next space.
09679 CP "\"" Is last character a '"'?
09681 JR NZ,S_Q_COPY If not, jump to copy next one.
09683 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.
09684 INC HL
09685 CP "\""
09687 JR Z,S_Q_COPY
S_Q_PRMS 09689 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.
09690 POP DE Restore start of copied string.
This entry point is used by the routine at S_SCREEN.
S_STRING 09691 LD HL,23611 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.
09694 RES 6,(HL)
09696 BIT 7,(HL)
09698 CALL NZ,STK_STO
09701 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: 09647 Up: Map Next: 09704