* 
***                            ** 
**  <RESTORE STATEMENT> SYNTAX  **
***                            ** 
* qq
RSTRS JSB GETCR     END OF STATEMENT? 
      JMP RSTR1     YES 
      JSB BCKSP     NO, DEMAND
      JSB PRGIN       SEQUENCE NUMBER 
      JMP EOST      DEMAND END OF STATEMENT 
RSTR1 ISZ SBPTR     RECORD DUMMY OPERAND
      JMP ACCSA,I 
* 
***   STATEMENT SYNTAX ENTRY POINTS   *** 
* 
SYNTB DEF COMS     COM
      DEF LETS     LET
      DEF DIMS     DIM
      DEF DEFS     DEF
      DEF REMS     REM
      DEF GOTOS    GOTO 
      DEF IFS      IF 
      DEF FORS     FOR
      DEF NEXTS    NEXT 
      DEF GOTOS    GOSUB
      DEF ENDS     RETURN 
      DEF ENDS     END
      DEF ENDS     STOP 
      DEF DATAS    DATA 
      DEF INPTS    INPUT
      DEF READS    READ 
      DEF PRINS    PRINT
      DEF RSTRS    RESTORE
      DEF MATS     MAT
      DEF FILES    FILES
      DEF CHANS    CHAIN
      DEF LET0     'IMPLIED' LET
* 
***   DEMAND A RIGHT PARENTHESIS
* 
* 
*     IF (A) HOLDS ')' OR ']' RECORD A ')' AND EXIT 
*     WITH THE FOLLOWING CHARACTER IN (A), ELSE ERROR.
* 
#RPCK LDB .-2      ')'
      JSB SYMCK     OR
      DEF RPARN-1    ']'? 
      JSB SERRS+23,I  NO
      LDA RPOP     YES, RECORD
      STA SBPTR,I   A ')' 
      JSB SBPUD    RECORD A NULL OPERAND
      JSB GETCR    FETCH
      NOP           NEXT
      JMP RPCK,I     CHARACTER
* 
***   CHECK FOR A LETTER
* 
*     ENTER WITH CHARACTER IN (A). EXIT TO (P+2) IF A 
*     LETTER, ELSE EXIT TO (P+1). (A) IS NOT CHANGED. 
* 
#LTCK LDB 0        ASCII
      ADB D133      133B OR 
      SSB,RSS        GREATER? 
      JMP LETCK,I  YES
      ADB .+32B    NO, ASCII 101B 
      SSB,RSS       OR GREATER? 
      ISZ LETCK    YES
      JMP LETCK,I  NO 
**                              **
***  PROCESS CHARACTER STRING  ***
**                              **
* 
*  UPON ENTRY (A) CONTAINS THE STRING DELIMITER AND (B) 
*  INDICATES WHETHER THE FIRST CHARACTER IS TO BE STORED
*  IN THE LOWER HALF OF THE CURRENT BUFFER WORD ( (B) = 1)
*  OR THE UPPER HALF OF THE NEXT BUFFER WORD ( (B) = 0).
*  EXIT TO (P+1) ON EMPTYING THE INPUT STRING. EXIT TO
*  (P+2) ON FINDING THE STRING DELIMITER.  BLANKS ARE NOT 
*  STRIPPED OUT OF THE INPUT STRING IF (A) # 0 UPON ENTRY.  UPON
*  EXIT SBPTR POINTS TO THE FIRST BUFFER WORD NOT CONTAINING PART OF
*  THE STRING WHILE TEMP+1 CONTAINS A COUNT OF THE STRING 
*  CHARACTERS BIASED BY THE VALUE OF (B) UPON ENTRY.
* 
#CRST STB TEMP+1    SET CHARACTER FLAG AND COUNTER
      STA TEMP+2    NOTE TERMINATOR CHARACTER 
      LDB .+10      IF (A) # 0
      SZA             STOP BLANK
      STB BLANK         SUPPRESSION 
CHRS1 JSB GETCR     FETCH CHARACTER 
      JMP CHRS3+1   NONE FOUND
      LDA 1         ALLOW LOWER CASE             B] 
      CPA TEMP+2    TERMINATOR? 
      JMP CHRS3     YES 
      LDB TEMP+1    NO, COUNT CHARACTER 
      SLB,INB         AND SELECT WORD HALF
      JMP CHRS2     LOW HALF
      JSB SBPUD     HIGH HALF, MOVE TO NEXT WORD
      ALF,SLA,ALF   POSITION CHARACTER AND SKIP 
CHRS2 IOR SBPTR,I   COMBINE WITH PREVIOUS CHARACTER 
      STA SBPTR,I 
      STB TEMP+1    SAVE FLAG/COUNTER 
      JMP CHRS1 
CHRS3 ISZ CHRST     SET EXIT TO (P+2) 
      JSB SBPUD     ADVANCE POINTER 
      LDB .+40B     RESTORE BLANK 
      STB BLANK       SUPPRESSION 
      JMP CHRST,I 
* 
***   CHECK FOR A DIGIT 
* 
* 
*     ENTER WITH CHARACTER IN (A). IF NOT A DIGIT, EXIT 
*     TO (P+1) WITH CHARACTER IN (A). EXIT TO (P+2) 
*     WITH DIGIT (BINARY) IN (A) AND (B) IF FOUND.
* 
#DGCK LDB 0        ASCII
      ADB D72       72 OR 
      SSB,RSS        GRAETER? 
      JMP DIGCK,I  YES
      ADB .+12B    NO, ASCII 57B
      SSB           OR LESS 
      JMP DIGCK,I  YES
      LDA 1        NO, LOAD 
      ISZ DIGCK     DIGIT 
      JMP DIGCK,I    INTO (A) 
* qqq{
***   INSURE SPACE FOR NEW ENTRY
* qq
* qq
*     A CHECK IS MADE THAT THE UNUSED USER SPACE IS AT
*     LEAST AS LARGE AS THE NUMBER OF WORDS SPECIFIED BY
*     (A). EXIT TO ERROR IF NOT SE. (B) IS NOT CHANGED. 
*     ON NORMAL EXIT (A) CONTAINS ITS ENTRY VALUE + (PBPTR).
* 
#CUSP ADA PBPTR    AT LEAST 
      STA CU1      (A) WORDS
      CMA           OF AVAILABLE
      ADA LWAUS      USER 
      SSA,RSS         SPACE?
      JMP *+3      YES
CUSP1 JSB DCMPL    NO, DECOMPILE
      JSB RERRS+10,I  OUT OF STORAGE SPACE
      LDA CU1      RETURN WITH NEW
      JMP CUSP,I    VALUE OF PBPTR
      SKP 
**                         ** 
***  DELETE SOME PROGRAM  *** 
**                         ** 
* 
*  THAT PART OF THE PROGRAM REFERENCED BY CORE LOCATIONS
*  (TEMP+1)+(A) THROUGH (TEMP+1)+(B)-1 INCLUSIVE IS 
*  DELETED BY SLIDING UP ALL OF THE PROGRAM FROM
*  (TEMP+1)+(B) TO (PBPTR)-1 (I.E., THE REST OF THE 
*  PROGRAM FOLLOWING THE 'GAP').  PBPTR IS THEN 
*  UPDATED TO POINT TO LAST WORD +1 OF THE PROGRAM. 
* *q
#DLPR ADA TEMP+1    COMPUTE INITIAL 
      STA TEMP+2      DESTINATION ADDRESS 
      ADB TEMP+1    COMPUTE INITIAL SOURCE ADDRESS
DELP1 CPB PBPTR     DONE? 
      JMP DELP2     YES 
      LDA 1,I       NO, TRANSFER
      STA TEMP+2,I    A WORD
      ISZ TEMP+2    BUMP
      INB             POINTERS
      JMP DELP1 
DELP2 LDA TEMP+2    UPDATE
      STA PBPTR       END-OF-PROGRAM
      JMP DELPR,I       POINTER 
**                                **
***  DELETE A PROGRAM STATEMENT  ***
**                                **
* qq
*  THE STATEMENT REFERENCED BY THE SEQUENCE NUMBER IN 
*  (B) IS DELETED.  EXIT TO EXECUTIVE.
* 
DELST LDA PBPTR     LOAD SEARCH TERMINATION POINTER 
      JSB FNDPS     SEARCH FOR STATEMENT
      JMP ACC5A,I   NOT 
      JMP ACC5A,I     FOUND 
      CLA 
      INB           (B),I = STATEMENT LENGTH
      LDB 1,I       LOAD LENGTH OF OLD STATEMENT
      JSB DELPR     DELETE
      JMP ACC5A,I     STATEMENT 
      SKP 
**                        **
***  ACCEPT A STATEMENT  ***
**                        **
* qq
*  A CORRECT STATEMENT IS ADDED TO THE PROGRAM BUFFER.
*  IF ITS SEQUENCE NUMBER IS THE HIGHEST SO FAR, ONLY 
*  THE END-OF-PROGRAM POINTER REQUIRES CHANGE, SINCE THE
*  STATEMENT IS TRANSLATED IMMEDIATELY BELOW THE PREVIOUS 
*  PROGRAM.  OTHERWISE THE NEW STATEMENT IS INSERTED INTO 
*  THE PROGRAM IN PROPER SEQUENTIAL POSITION.  IF ITS 
*  SEQUENCE NUMBER COINCIDES WITH THAT OF A PREVIOUS
*  PROGRAM STATEMENT, IT REPLACES IT, WITH SPACE MADE OR
*  DELETED IN THE PROGRAM AS NECESSARY.  EXIT TO EXEC.
*  IF STATEMENT LENGTH = 0 THE STATEMENT WAS REJECTED DUE TO
*  A STORAGE OVERFLOW IN TAPE MODE.  IF IN KEYBOARD MODE AND
*  SYMTB = 4 AT LEAST ONE OVER/UNDERFLOW OCCURRED WHILE ANALYZING 
*  THE STATEMENT SO EMIT THE ERROR; OTHERWISE ECHO A LINE FEED. 
*  IF IN TAPE MODE MOVE THE START-OF-RECORD POINTER TO THE START
*  OF THE NEXT BUFFER AND IF IT IS COMPLETED SYNTAX IT NOW, ELSE
*  EXIT TO EXEC.
* 
ACCST LDB SBUFA 
      INB 
      LDA SBUFA     COMPUTE 
      CMA,INA         STATEMENT 
      ADA SBPTR         LENGTH
      SZA,RSS       UNPROCESSED STATEMENT?
      JMP ACCS6     YES 
      STA 1,I       NO, STORE LENGTH IN STATEMENT 
      STA TEMP+2    SAVE IT 
      LDA PBPTR     FIND STATEMENT'S
      LDB SBUFA,I     SEQUENTIAL
      JSB FNDPS         POSITION
      JMP ACCS4     APPEND STATEMENT TO PROGRAM 
      JMP ACCS2     INSERT STATEMENT INTO PROGRAM 
      INB           REPLACE PRIOR STATEMENT 
      LDA 1,I       COMPARE LENGTH
      CMA,INA         OF NEW STATEMENT
      ADA TEMP+2        WITH THAT OF OLD
      SZA,RSS       EQUAL?
      JMP ACCS1     YES 
      SSA,RSS       NO, LONGER? 
      JMP ACCS2+1   YES 
      LDA TEMP+2    NO, SHORTER 
      LDB 1,I       LOAD LENGTH OF OLD STATEMENT
      JSB DELPR     DELETE EXTRA LENGTH 
ACCS1 LDB SBUFA     LOAD FIRST SOURCE ADDRESS 
      LDA 1,I       TRANSFER
      STA TEMP+1,I    A WORD
      ISZ TEMP+1    ADVANCE DESTINATION 
      INB             AND SOURCE ADDRESSES
      CPB SBPTR     DONE? 
      JMP ACCS5     YES 
      JMP ACCS1+1   NO
ACCS2 LDA TEMP+2    LOAD SPACE REQUIREMENT
      ADA SBUFA     UPDATE POINTER
      STA SBUFA       TO NEW STATEMENT
      ADA TEMP+2    RESET 
      LDB SBPTR       END OF STATEMENT
      STA SBPTR         POINTER 
      STA TEMP+2    INITIALIZE DESTINATION ADDRESS
      CMA           USER
      ADA LWAUS       SPACE 
      SSA               OVERFLOW? 
      JSB SERRS,I   YES 
      LDA SBUFA     NO, UPDATE POINTER
      STA PBPTR       TO END-OF-PROGRAM 
ACCS3 CPB TEMP+1    EVERYTHING MOVED? 
      JMP ACCS1     YES 
      CCA           NO, BACK UP 
      ADA TEMP+2      SOURCE AND
      STA TEMP+2        DESTINATION 
      ADB .-1             ADDRESSES 
      LDA 1,I       TRANSFER
      STA TEMP+2,I    A WORD
      JMP ACCS3 rr
ACCS4 LDA SBPTR     RESET POINTER TO
      STA PBPTR       LAST WORD+1 OF PROGRAM
ACCS5 LDA TAPEF     TAPE
      AND LMSK
      SZA            MODE?
      JMP ACCS6     YES 
      LDB SYMTB     NO
      STA SYMTB     RESET UNDER/OVERFLOW FLAG 
      CPB .+4       UNDER/OVERFLOW ERROR(S)?
      JSB RERRS+32,I  YES 
      LDA .+12B     NO, 
      JSB OUTCR       OUTPUT A
      JMP SCHEN,I       LINE FEED 
ACCS6 LDB BADDR     ALLOW 
      INB 
      CPB PRBFE,I     MORE
      LDB PRBFA,I 
      CLF 0             INPUT 
      STB LBUFA,I 
      CPB LBUFE,I 
      JMP SCHEN,I   NONE
      LDA MLINK+1   MORE IN BUFFER               [E]
      ADA .+?MASK-?LINK                          [D]
      LDA A,I       SET PORT COMMUNICATIONS      [D]
      IOR MPCOM       BIT TO SCHEDULE USER       [D]
      STA MPCOM                                  (D)
      JMP SCHEN,I                                (D)
**                                            **
***  FIND A STATEMENT'S SEQUENTIAL POSITION  ***
**                                            **
* 
*  UPON ENTRY (A) POINTS TO THE LAST WORD+1 OF THE PROGRAM
*  AND (B) HOLDS A SEQUENCE NUMBER.  IF (B) IS LARGER THAN
*  ANY SEQUENCE NUMBER IN THE PROGRAM, EXIT TO (P+1) WITH 
*  (B) POINTING TO THE LAST WORD+1 OF THE PROGRAM.  IF (B)
*  FALLS BETWEEN TWO SEQUENCE NUMBERS, EXIT TO (P+2) WITH 
*  (B) POINTING TO THE STATEMENT WITH A LARGER SEQUENCE 
*  NUMBER.  IF A STATEMENT IN THE PROGRAM HAS THE SEQUENCE
*  NUMBER IN (B), EXIT TO (P+3) WITH (B) POINTING TO THIS 
*  STATEMENT (IF IT IS AN EMBEDDED ERROR MESSAGE, STATEMENT 
*  TYPE = 0, DECREMENT THE ERROR COUNT). IN ALL CASES TEMP+1
*  = (B) UPON EXIT. 
* qq
#FDPS STB TEMP+1    SAVE TEST SEQUENCE NUMBER 
      STA TEMP+3    SAVE TERMINATION POINTER
      LDB PBPTR                                  [E]
      CPB PBUFF                                  [E]
      JMP FNDP4                                  [E]
      LDB SPROG     START WITH FIRST WORD OF PROGRAM
FNDP1 CPB TEMP+3    PROGRAM EXHAUSTED?
      JMP FNDP4     YES, EXIT TO P+1
      LDA 1,I       NO, IS
      CMA,INA         PROGRAM 
      ADA TEMP+1        SEQUENCE NUMBER 
      SZA,RSS             THE SAME? 
      JMP FNDP2     YES, EXIT TO (P+3)
      SSA           NO, GREATER?
      JMP FNDP3+1   YES, EXIT TO (P+2)
      LDA 1         NO, CHECK                    (D)
      INA           STATEMENT                    (D)
      LDA 0,I       LENGTH AND                   (D)
      ADB 0        SET (B) TO POINT             (D) 
      JSB STLCK     TO THE                       (D)
      JMP FNDP1     NEXT STATEMENT               (D)
FNDP2 LDA 1         LOAD
      ADA .+2         STATEMENT 
      LDA 0,I       ERROR 
      AND OPMSK 
      SZA             STATEMENT?
      JMP FNDP3     NO
      CCA           YES,
      ADA ERRCT       DECREMENT 
      STA ERRCT         ERROR COUNT 
      SZA           ONLY ERROR? 
      JMP FNDP3 [[[[
      LDA CMSK      YES, SET FLAG 
      AND TERR        TO SAY 'NO
      STA TERR          EMBEDDED ERRORS'
FNDP3 ISZ FNDPS ]]
      ISZ FNDPS 
FNDP4 STB TEMP+1    SAVE POINTER TO              [E]
      JMP FNDPS,I     FINAL STATEMENT SEEN
**                                 ** 
***  FETCH PARENTHESIZED FORMULA  *** 
**                                 ** 
* 
*  AN END-OF-FORMULA OPERATOR FOLLOWS THE FORMULA 
* 
#GTPF LDB .+5       SAVE FSC
      JSB FRCUR       LOCAL VARIABLES 
      JSB SBPUD     UPDATE POINTER
      JSB GETCR     RECORD
      JSB SERRS+22,I  LEFT
      JSB LPCK          PARENTHESIS 
      JSB FSC       DEMAND FORMULA
      JSB SBPUD     RECORD END-OF-FORMULA OPERATOR
      JSB RPCK      RECORD RIGHT PARENTHESIS
      JSB FPOP      RESTORE FSC 
      JMP GETPF,I     LOCAL VARIABLES 
**                       ** 
***  RECORD AN INTEGER  *** 
**                       ** 
* 
*  PRGIN FLAGS THE PREVIOUS OPERATOR TO SAY 'INTEGER FOLLOWS'.
*  STORE THE INTEGER AND EXIT WITH IT IN (B) AND THE FOLLOWING
*  CHARACTER IN (A).
* 
#PGIN LDA SBPTR,I   SET 
      IOR INTFL       'INTEGER FOLLOWS' 
      STA SBPTR,I       FLAG
      JSB SBPUD     ADVANCE POINTER 
      JSB BLDIN     BUILD INTEGER 
      STB SBPTR,I   RECORD INTEGER
      JSB SBPUD     ADVANCE POINTER 
      JMP PRGIN,I 
**                      **
***  BUILD AN INTEGER  ***
**                      **
* qq
*  MISSING OR ILLEGAL INTEGER EXITS TO (P+2) OF PRGIN IF PFLAG = -1,
*  ELSE TO ERROR.  A LEGAL INTEGER IS NON-ZERO AND LESS THAN 10000. 
* 
#BLDI CLA           INITIALIZE TO 
      STA PINTG      ZERO INTEGER.
      JSB GETCR 
      JMP BLDI2 
      JSB DIGCK     DIGIT?
      JMP BLDI2     NO
      STA PINTG+1   YES, SAVE IT
      LDA PINTG     MULTIPLY PREVIOUS 
      MPY .+10        INTEGER BY 10 
      CLE           ADD IN
      ADA PINTG+1     NEW DIGIT 
      SEZ,SZB,RSS   OVERFLOW? 
      JMP #BLDI+1   NO
BLDI1 ISZ GFLAG     YES, RETURN ON ERROR? 
      JSB SERRS+1,I NO
      ISZ PRGIN     YES, EXIT TO
      JMP PRGIN,I     (P+2) OF PRGIN
BLDI2 LDB PINTG     ZERO
      CLE,SZB,RSS     INTEGER?
      JMP BLDI1     YES S
      ADB MAXSN     NO, INTEGER 
      SEZ             TOO LARGE?
      JMP BLDI1     YES 
      LDB PINTG     NO
      JMP BLDIN,I 
**                           ** 
***  SEEK RECORD REFERENCE  *** 
**                           ** 
* 
*  IF THE NEXT CHARACTER IS NOT '#', RESTORE SBPTR AS UPON ENTRY
*  AND EXIT TO (P+1) WITH THE CHARACTER IN (A).  OTHERWISE CHECK
*  CHARACTER RETURNED IN (A) FROM FILRF.  IF IT IS A COMMA OR A 
*  SEMICOLON RECORD IT.  EXIT TO (P+2) WITH THE CHARACTER IN (A)
*  IF IT IS A SEMICOLON.  IF A COMMA, PROCESS THE FOLLOWING RECORD
*  REFERENCE AND EXIT TO (P+2) WITH CHARACTER FOLLOWING IT IN (A) 
*  (IF A SEMICOLON, RECORD IT BEFORE EXITING).
* qq
#RECR JSB FILRF     SEEK FILE REFERENCE 
      JMP RECR1     NONE FOUND
      ISZ RECRF     FOUND 
      CPA .+54B     COMMA?
      RSS           YES 
      JMP RECR0     NO
      LDB B2000     RECORD
      STB SBPTR,I     COMMA 
      JSB FSC       PROCESS RECORD REFERENCE
RECR0 LDB B3000 
      CPA B73       SEMICOLON?
      STB SBPTR,I   YES 
      JMP RECRF,I 
RECR1 CCB           RESTORE 
      ADB SBPTR 
      STB SBPTR       SBPTR 
      JMP RECRF,I 
**                         ** 
***  SEEK FILE REFERENCE  *** 
**                         ** 
* 
*  IF THE NEXT CHARACTER IS NOT A '#' RETURN TO (P+1) WITH IT IN
*  (A).  OTHERWISE RECORD THE FILE REFERENCE AND RETURN TO (P+2)
*  WITH THE FOLLOWING CHARACTER IN (A). 
* 
#FILR ISZ SBPTR 
      JSB GETCR     NEXT
      JMP FILRF,I 
      CCB             CHARACTER 
      JSB SYMCK 
      DEF HATCH-1       A '#' ? 
      JMP FILRF,I   NO
      JSB FSC       YES, PROCESS FILE REFERENCE 
      ISZ FILRF 
      JMP FILRF,I 
      SKP 
**                                            **
***  SEARCH TABLE FOR MULTICHARACTER SYMBOL  ***
**                                            **
* 
*  UPON ENTRY (A) POINTS TO THE TABLE OF ACCEPTABLE 
*  SYMBOLS, (B) CONTAINS THE NUMBER OF ENTRIES IN THE 
*  TABLE (IN 2'S COMPLEMENT), MAXCR CONTAINS THE MAXIMUM
*  ACCEPTABLE NUMBER OF CHARACTERS IN THE SYMBOL, AND 
*  SBPTR,I CONTAINS THE FIRST CHARACTER OF THE PROSPECTIVE
*  SYMBOL IN BITS 7-0 AND EITHER 0 OR THE SECOND CHARACTER
*  IN BITS 15-8.  IF NO ACCEPTABLE SYMBOL IS FOUND, EXIT TO 
*  (P+1) WITH THE HALVES OF SBPTR,I SWAPPED AND THE INPUT 
*  STRING AS UPON ENTRY.  ON SUCCESS EXIT TO (P+2) WITH 
*  THE OPERATOR CODE IN BOTH (A) AND SBPTR,I; THE NEW INPUT 
*  STRING BEGINS WITH THE CHARACTER FOLLOWING THE SYMBOL. 
* 
#TBSR STA TABLE     SAVE TABLE ADDRESS
      STB LNGTH     SAVE -(NUMBER OF ENTRIES) 
      LDA BADDR     SAVE BUFFER 
      STA TEMP+3      POINTER 
      LDA SBPTR     SAVE CURRENT
      STA SMBGN       SYNTAX BUFFER POINTER 
      CLA,INA       COUNT FIRST CHARACTER 
      STA SLENG       OF SYMBOL 
      LDA SBPTR,I   LEFT JUSTIFY
      ALF,ALF         FIRST 
      STA SBPTR,I       CHARACTER 
      AND B177      TWO O
      SZA,RSS         CHARACTERS? 
      JMP TSRC4     NO
TSRC1 ISZ SLENG     COUNT NEW CHARACTER 
      LDB LNGTH     SET COUNTER 
      STB COUNT       FOR TABLE ENTRIES 
      LDA TABLE     SET POINTER 
TSRC2 STA TBLPT       TO NEXT ENTRY 
      LDA TBLPT,I   TABLE ENTRY AND 
      AND .+7         CURRENT SYMBOL
      CPA SLENG         OF SAME LENGTH? 
      JMP TSRC6     YES 
TSRC3 ADA .+3       NO, UPDATE
      ARS             TABLE 
      ADA TBLPT         POINTER 
      ISZ COUNT     MORE ENTRIES? 
      JMP TSRC2     YES 
TSRC4 JSB GETCR     NO, FETCH NEXT CHARACTER
      JMP TSR10     NONE FOUND
      LDB SLENG     SYMBOL ALREADY
      CPB MAXCR       OF MAXIMUM LENGTH?
      JMP TSR10     YES 
      SLB,RSS       NO, EVEN-NUMBERED CHARACTER?
      JMP TSRC5     NO
      IOR SBPTR,I   YES, FILL LOWER HALF
      STA SBPTR,I     OF LAST WORD OF SYMBOL
      JMP TSRC1 
TSRC5 JSB SBPUD     ADVANCE SYMBOL POINTER
      ALF,ALF       STORE CHARACTER IN
      JMP *-4         UPPER HALF OF WORD
TSRC6 LDB TBLPT     SET POINTER TO
      STB TSPTR       SYMBOL IN TABLE 
      LDB SMBGN     SET (B) TO
      JMP *+4         INPUT SYMBOL
TSRC7 CPB SBPTR     ALL OF SYMBOL MATCHED?
      JMP TSRC8     YES 
      INB           NO, ADVANCE 
      ISZ TSPTR       POINTERS
      LDA TSPTR,I   COMPARE NEXT
      CPA 1,I         WORD OF SYMBOLS 
      JMP TSRC7     EQUAL 
      LDA SLENG     UNEQUAL, TRY
      JMP TSRC3       NEXT TABLE SYMBOL 
TSRC8 LDA TBLPT,I   LOAD, ISOLATE 
      AND OPMSK       AND STORE 
      STA SMBGN,I       OPERATOR CODE 
      ISZ TBSRH     SET EXIT TO (P+2) 
TSRC9 LDB SMBGN     CORRECT SYNTAX
      STB SBPTR       BUFFER POINTER
      JMP TBSRH,I 
TSR10 LDA TEMP+3    RESTORE BUFFER
      STA BADDR       POINTER 
      JMP TSRC9 
**                    **
***  FETCH A LETTER  ***
**                    **
* 
*  EXITS TO (P+1) IF NEXT CHARACTER NOT A LETTER. 
*  OTHERWISE STORES IT IN TEMP+1, STORES FOLLOWING
*  CHARACTER IN TEMP+2, AND EXITS TO (P+2) WITH 
*  SECOND CHARACTER IN (B). 
* qq
#LTR  JSB GETCR     FIRST 
      NOP             CHARACTER 
      JSB LETCK         A LETTER? 
      JMP LTR,I     NO, EXIT WITH CHARACTER IN (A)
      ISZ LTR       YES, SET RETURN ADDRESS TO (P+2)
      STA TEMP+1    SAVE CHARACTER
      JSB GETCR     SAVE
      NOP             SECOND
      STA TEMP+2        CHARACTER 
      JMP LTR,I 
      SKP 
**                           ** 
***  STORE AN OPERAND NAME  *** 
**                           ** 
* 
*  OPERANDS ARE STORED AS 9-BIT QUANTITIES.  BITS 8-4 
*  HOLD A LETTER (1-32 OCTAL FOR A-Z).  BITS 3-0 INDICATE 
*  THE TYPE OF OPERAND:  0 FOR A STRING, 1 AND 2 FOR
*  SINGLY AND DOUBLY SUBSCRIPTED VARIABLES, 3 FOR A 
*  SUBSCRIPTED VARIABLE WITH DIMENSIONALITY NOT DEFINED 
*  LOCALLY, 4 FOR A SINGLE-LETTER SIMPLE VARIABLE, 5-16 
*  OCTAL FOR A LETTER-DIGIT SINGLE VARIABLE, AND 17 OCTAL 
*  FOR A PROGRAMMER-DEFINED FUNCTION. 
* 
#STOP ADA D100      LETTER = ASCII CODE - 100 OCTAL 
      ADB D53       DIGIT = ASCII CODE - 53 OCTAL 
      ALF           COMPLETE
      IOR 1           OPERAND 
      IOR SBPTR,I   MERGE OPERATOR
      STA SBPTR,I     AND OPERAND 
      JSB SBPUD     SET POINTER TO
      JMP STROP,I     FRESH WORD
**                                          **
***  CHECK FOR SINGLE-CHARACTER OPERATORS  ***
**                                          **
* 
*  ENTER WITH CHARACTER IN (A) AND NUMBER OF ACCEPTABLE 
*  OPERATORS IN (B) IN 2'S COMPLEMENT.  (P+1)+2 POINTS
*  TO THE LIST OF ACCEPTABLE OPERATORS.  ON A MATCH 
*  EXIT TO (P+3) AFTER RECORDING THE OPERATOR CODE, 
*  WHICH REMAINS IN (A).  ON NO MATCH EXIT TO (P+2) 
*  WITH THE CHARACTER IN (A). 
* 
#SYCK STB COUNT     SAVE COUNT OF POSSIBLE MATCHES
      ALF,ALF       POSITION
      IOR .+32        CHARACTER 
      LDB SYMCK,I   LOAD
      ISZ SYMCK       STARTING
SYMC1 ADB .+2           TABLE ENTRY 
      CPA 1,I       MATCH?
      JMP SYMC2     YES 
      ISZ COUNT     NO, POSSIBILITIES LEFT? 
      JMP SYMC1     YES 
      ALF,ALF       NO, 
      AND B177        RESTORE 
      JMP SYMCK,I       CHARACTER 
SYMC2 ADB .-1       FETCH 
      LDA 1,I         AND 
      AND OPMSK         STORE 
      STA SBPTR,I         OPERATOR
      ISZ SYMCK             CODE
      JMP SYMCK,I 
