
      HED DIREC TABLE 
* 
**
***     DIREC TABLE 
**
* 
*   DIREC IS A 560 WORD RESIDENT TABLE WHICH CONTAINS INFORMATION 
*   ABOUT THE DIRECTORY.  THE TABLE HAS 80 ENTRIES, ONE FOR EACH
*   POSSIBLE DIRECTORY TRACK.  EACH ENTRY IS SEVEN WORDS LONG AND 
*   HAS THE FOLLOWING STRUCTURE:
* 
*          1) LENGTH IN -WORDS
*          2) SAME AS FIRST 
*          3)   FOUR WORDS OF 
*          4)     DIRECTORY 
*          5)       TRACK 
*          6) DISC
*          7)   ADDRESS 
* 
      SPC 1 
      ORG 30000B
DIREC BSS 560 
      SPC 1 
DIREL EQU *-7       => START OF LAST ENTRY
DIREU EQU *         => FIRST LOCATION BEYOND TABLE
      HED DISC DRIVER DRIVER
*   THIS ROUTINE CALLS THE REAL DISC DRIVER AND WAITS FOR THE 
*   TRANSFER TO BE SUCCESSFULLY COMPLETED.  THE CALLING SEQUENCE
*   TO THIS DRIVER IS AS FOLLOWS: 
* 
*         JSB DISCZ,I 
* 
*         A REGISTER - MUST CONTAIN THE ADDRESS OF A DOUBLE 
*                      WORD CONTAINING THE DISC ADDRESS (BLOCK
*                      NUMBER) OF THE FIRST RECORD OF THE TRANSFER. 
* 
*         B REGISTER - BITS 14:0 - CORE ADDRESS AT WHICH THE
*                                  TRANSFER IS TO BEGIN.
*                      BIT 15    - TRANSFER CODE
*                                  1 - DISC READ
*                                  0 - DISC WRITE 
* 
*         MWORD      - MUST CONTAIN THE NEGATIVE NUMBER OF WORDS
*                      TO BE TRANSFERRED. 
* 
*         MBUSY      - SET TO -1 BY THE DISC DRIVER WHILE IT IS BUSY
      SPC 2 
ZDISC NOP 
      STA STDAP     SAVE POINTER
      JSB DISCA,I   CALL DISC DRIVER
      HLT DEATH+30B DRIVER BUSY 
      HLT DEATH+31B DISC NOT PRESENT
      LDA MBUSY     WAIT FOR
      SSA             COMPLETION
      JMP *-2 
      SZA,RSS       IF NO ERRORS, ADVANCE 
      ISZ ZDISC       RETURN ADDRESS
      JMP ZDISC,I 
      HED DLOOK ROUTINES
* 
**
***    DLOOK
**
* 
*   DLOOK SEARCHES THE DIRECTORY FOR A PARTICULAR ENTRY.  THE 
*   DESIRED ENTRY IS DEFINED BY LTEMP(0:3). 
* 
*       ENTRY IS FOUND: 
*          THE APPROPRIATE DIRECTORY TRACK IS IN CORE 
*          (LTEMP+4) = POINTER TO DIREC ENTRY 
*          (LTEMP+5) = DIRECTORY MEMORY ADDRESS OF ENTRY
*          DLOOK RETURNS TO P+1 
* 
*       ENTRY IS NOT FOUND: 
*          (LTEPM+4) = POINT AT THE LAST ENTRY
*          (LTEMP+5) =   LESS THAN THE GIVEN ENTRY
*          DLOOK RETURNS TO P+2 
      SPC 1 
DLOOK NOP 
      LDB DIRDL     SET LTEMP+4 TO POINT AT 
DLOK1 STB LTEMP+4     LAST DIRECTORY TRACK
      LDA B,I       TEST FOR
      SZA             EMPTY TRACK 
      JMP DLOK3     NOT EMPTY 
DLOK2 LDB LTEMP+4   BUMP BACK TO
      ADB .-7         NEXT TRACK
      JMP DLOK1 
      SPC 1 
DLOK3 INB           COMPARE THE FIRST 
      LDA DLTEM       ENTRY ON THIS TRACK 
      JSB DIRCM         TO THE DESIRED ENTRY
      JMP DLOK2     NOT ON THIS TRACK 
      NOP           FOUND THE 
      LDA LTEMP+4,I   RIGHT TRACK 
      CMA,INA       SET UP INITIAL
      ADA LIBD        POINTER FOR 
      ADA .-12          TRACK SCAN
      STA LTEMP+5 
      LDA LTEMP+4   GET DIRECTORY DISC
      ADA .+5         ADDRESS POINTER 
      CPA DIRWD     IS THIS TRACK ALREADY IN CORE?
      JMP DLOK4     YES 
      LDA DIRWD     NO - CHECK FOR ANY TRACK IN CORE
      SZA,RSS 
      JMP DLOKB     NONE, SO JUST READ IN NEW TRACK 
      LDB LIBD      YES, WRITE PREVIOUS 
      JSB DISCZ,I     TRACK OUT TO DISC 
      JSB SLVAG,I   DISC ERROR
      SPC 1 
DLOKB LDA LTEMP+4,I SET UP DIRECTORY TRACK
      STA MWORD       TRANSFER LENGTH 
      LDA LTEMP+4   SET UP POINTER TO 
      ADA .+5         DISC ADDRESS
      LDB LIBDI 
      JSB DISCZ,I   READ IN DIRECTORY TRACK 
      JSB SICKP,I 
      SPC 1 
* NOW SEARCH DIRECTORY FOR DESIRED ENTRY. A BINARY SEARCH IS USED,
* WITH LTEMP(14:15) USED AS POINTERS TO THE FIRST AND LAST OF ALL 
* UNTESTED ENTRIES. 
* 
DLOK4 LDA LIBD      SET POINTER TO BEGINNING OF 
      STA LTEMP+14   DIRECTORY. 
      LDA DLTEM     TEST LAST ENTRY IN TRACK. 
      LDB LTEMP+5 
      JSB DIRCM 
      JMP DLOK5     LAST ENTRY TOO BIG--START CHOP. 
      ISZ DLOOK     TOO SMALL--IT'S THE ONE.
      JMP DLOOK,I   LAST ENTRY IS IT. 
* 
DLOK5 LDA LTEMP+5   SET END POINTER.
      STA LTEMP+15
      LDA LTEMP+14  COMPUTE DIFFERENCE BETWEEN FIRST
DLOK6 CMA,INA        AND LAST ENTRIES.
      ADA LTEMP+15
      ARS           DIVIDE BY TWO.
      CLB           ROUND TO A
      DIV .+12        MULTIPLE
      MPY .+12          OF TWELVE 
      ADA LTEMP+14  GET ADDRESS OF MIDDLE ENTRY.
      STA LTEMP+5   SET INTO RESULT LOCATION. 
      LDB DLTEM     SETUP FOR JSB DIRCM.
      CPA LTEMP+14  TEST FOR ONLY 2 ENTRIES LEFT. 
      JMP DLOK8     THERE ARE--WE'VE GOT THE RESULT.
* 
      JSB DIRCM     TEST MIDWAY ENTRY.
      JMP DLOK7     TOO SMALL--GO RESET LTEMP(14).
      JMP DLOK5     TOO BIG--GO RESET LTEMP(15).
      JMP DLOOK,I   EQUAL--RETURN.
* 
DLOK7 LDA LTEMP+5   RESET LTEMP(14).
      STA LTEMP+14
      JMP DLOK6 
* 
DLOK8 CPA LIBD      IF LTEMP(14)<>LTEMP, WE KNOW
      JSB DIRCM      IT'S LESS, SO WE SKIP TEST.
      ISZ DLOOK     LESS THAN ENTRY.
      NOP 
      JMP DLOOK,I   EQUAL TO ENTRY. 
      SKP 
* 
* DIRCM COMPARES THE 4 WORD ENTRIES POINTED TO BY A AND B.
* BIT 15 IS NOT USED. IT RETURNS AS FOLLOWS:
*     P+1: A<B
*     P+2: A>B
*     P+3 A=B 
DIRCM NOP 
      STA DIRC2 
      LDA .-4       SET COUNTER.
      STA DIRC1 
      STB DIRC5 
DIRC3 LDA DIRC5,I   SUBTRACT WORD FROM B
      ELA,CLE,ERA 
      CMA,INA       FROM WORD FROM A. 
      LDB DIRC2,I 
      ELB,CLE,ERB 
      ADA 1 
      SZA           TEST FOR EQUAL. 
      JMP DIRC4     NOT EQUAL-GO RETURN.
      ISZ DIRC5     BUMP
      ISZ DIRC2      POINTERS.
      ISZ DIRC1     TEST FOR FINISHED.
      JMP DIRC3 
      ISZ DIRCM     DOUBLE ISZ FOR EQUAL. 
DIRC4 SSA,RSS 
      ISZ DIRCM     ONE ISZ IF A>B
      JMP DIRCM,I    NONE IF A<B. 
      SPC 2 
DIRDL DEF DIREL 
DIRC1 BSS 1 
DIRC2 BSS 1 
DIRC5 BSS 1 
      SKP 
* 
**
***   GET MESSAGE BUFFER
**
* 
*  THIS ROUTINE IS USED TO GET A MESSAGE BUFFER FOR THE DISC
*  DRIVER.  THE LINK TO IT IS PASSED IN THE LINKAGE AREA, AND 
*  IS STORED ON BASE PAGE BEFORE THE SYSTEM IS STARTED UP.
*     PRIOR TO THAT TIME, THE LOADER USES ITS OWN VERSION.
* 
GMQB  NOP 
      LDA MSQCT     CHECK FOR MESSAGE BUFFERS ALL 
      CPA .+5         BEING USED
      JMP GMQB,I    NO SKIP SEZ NO BUFFER 
      ISZ MSQCT     INCREMENT COUNT 
      LDA MSQP3     LOAD CURRENT POINTER
      LDB MSQP3     ADVANCE POINTER FOR 
      ADB .+MESLN     NEXT MESSAGE
      CPB MSQND     CHECK FOR END OF QUEUE
      LDB MSQBG       IF END, START OVER
      STB MSQP3 
      ISZ GMQB      ADVANCE TO BUFFER PRESENT RETURN
      JMP GMQB,I    RETURN
      HED STATEMENT SYNTAX PROCESSORS 
      ORG 31701B
.105  DEC 105 
TAPEA DEF TAPER 
SER7A DEF SERR7 
LW200 ABS -10240-USER+200 
*                              *
**  CLEAN UP FOR NEW PROGRAM  **
*                              *
CLNUP CLF 0 
      LDA CFLAG     SET 
      CMA             PROGRAM 
      AND MAIN,I        MODE TO 
      STA MAIN,I          'UNCOMPILED'
      STF 0 
      LDB PBUFF     INSURE CORRECT
      STB SPROG       START-OF--PROGRAM SETTING 
      CLB           INITIALIZE
      STB OFLAG       ERROR FLAG                 [B]
      STB SYMTB 
      JMP SYNT1 
**                                **
***  DELETE A PROGRAM STATEMENT  ***
**                                **
* 
*  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 
* 
* ******************************* 
****                           ***
***  CHECK SYNTAX OF STATEMENT  *** 
****                           ***
* ******************************* 
* 
*  PBPTR POINTS TO THE LAST WORD +1 OF THE PREVIOUS PROGRAM AND 
*  THUS ALSO POINTS TO THE FIRST WORD OF AVAILABLE USER SPACE,
*  WHERE THE NEW STATEMENT WILL BE TRANSLATED.  WHEN AN ERROR 
*  OCCURS UNDER 'TAPE' MODE, THE USER'S TERR BIT IN THE FIRST WORD
*  OF HIS TTY TABLE IS SET AND HIS COPY OF ERRCT IS BUMPED. IF AN 
*  OUT-OF-STORAGE ERROR OCCURS IN 'TAPE' MODE, SYMTB IS SET TO 1
*  AND ALL SUBSEQUENT PROGRAM MATERIAL IS REJECTED.  IF UPON ENTRY
*  THE PRIOR PROGRAM IS NULL, ALL FLAGS ARE SET TO NULL; IF THE 
*  PRIOR PROGRAM IS NOT NULL, IT IS PLACED IN 'SOURCE' MODE. SYNTAX 
*  WILL REJECT ADDITIONAL STATEMENTS IF FEWER THAN 200 WORDS OF 
*  USER SPACE ARE AVAILABLE BUT WILL ACCEPT STATEMENT DELETIONS IF
*  IN 'KEY' MODE. 
* 
SYNTX LDB PBPTR     NULL
      CPB PBUFF       PROGRAM?
      JMP CLNUP     YES 
      LDA TERR      NO, ERROR 
      AND MAIN,I      FLAG
      SZA,RSS           SET?
      JMP SYNT1     NO
      CLA           YES, ERRORS 
      CPA ERRCT       IMBEDDED IN CODE? 
      JMP TAPEA,I   NO,FINISH ABORTED ERROR CLEANUP 
SYNT1 JSB SINIT     YES, PREPARE PROGRAM
      JSB DCMPL       FOR SYNTAX
      CLB           SET LINE NUMBER 
      STB PBPTR,I     TO ZERO 
      LDA PBPTR     SET SYNTAX POINTER TO FIRST 
      STA SBPTR       AVAILABLE WORD OF USER SPACE
      STA SBUFA     SAVE POINTER TO SYNTAX BUFFER 
      ADA .105        AND TO
      STA SSTAK         SYNTAX STACK
      STA SYNTQ 
      INB           DOES 'OUT OF STORAGE' 
      CPB OFLAG       ERROR EXIST?               [B]
      JMP SER7A,I   YES 
      JSB GETCR     NO, EMPTY RECORD? 
      JMP ACC5A,I   YES 
      JSB BCKSP     NO
*                               * 
**  DETERMINE SEQUENCE NUMBER  ** 
*                               * 
* 
*  A RECORD CONSISTING ONLY OF A SEQUENCE NUMBER WILL CAUSE THE 
*  DELETION OF A PREVIOUSLY ACCEPTED STATEMENT REFERENCED BY THAT 
*  SEQUENCE NUMBER. 
* 
      JSB BLDIN     RECORD
      STB SBPTR,I     SEQUENCE
      ISZ SBPTR         NUMBER
      CPA .+15B     NULL STATEMENT? 
      JMP DELST     YES 
      ISZ SBPTR     NO, SKIP STATEMENT LENGTH WORD
      STA SBPTR,I   SAVE FIRST CHARACTER
      LDA PBPTR     ACCEPTABLE AMOUNT 
      ADA LW200       OF USER SPACE 
      SSA,RSS           REMAINING?
      JSB SERRS,I   NO
*                              *
**  DETERMINE STATEMENT TYPE  **
*                              *
      LDA .+7       SET MAXIMUM 
      STA MAXCR       SYMBOL LENGTH 
      LDA STTYP     STATEMENT-TYPE NAMES
      LDB .-25      -(NUMBER OF STATEMENT TYPES)
      JSB TBSRH     FIND STATEMENT TYPE 
      LDA LETOP     NO, ASSUME 'IMPLIED' LET
      LDB .-9       DISALLOW
      STB MSFLG       MULTIPLE STORE
      LDB .+3       SET MAXCR TO MOST 
      STB MAXCR       COMMON VALUE
      CLB           TURN OFF
      STB PFLAG       'PARAMETER' MODE
      LSR 9         RIGHT JUSTIFY OPERATOR CODE 
      STA SFLAG     TURN OFF STRING AND STORE MODES 
      STA DFLAG     TURN ON 'SUBSCRIPT' MODE
      ADA STBAS     BRANCH TO 
      JMP 0,I         SYNTAX ROUTINE
* 
***                        ** 
**  <LET STATEMENT> SYNTAX  **
***                        ** 
* 
LET0  LDA LETOP     FAKE
      STA SBPTR,I     A 
      JSB BCKSP         'LET' 
LETS  LDB SBPTR     ENABLE A
      STB SFLAG       STRING VARIABLE 
      ISZ MSFLG     TURN ON 'MULTIPLE STORE' MODE 
      JSB FSC       ANALYZE FORMULA 
      ISZ SFLAG     STRING VARIABLE FOUND?
      JMP LET1      NO
      JSB SYMCK     YES, (B) IS LEFT AT -1
      DEF ASSOP-1   DEMAND ASSIGNMENT OPERATOR
      JSB SERRS+3,I NOT FOUND 
      JSB RSTOP     RECORD A STRING OPERAND 
      JMP EOST      DEMAND END OF STATEMENT 
LET1  ISZ SFLAG     DID A STORE OCCUR?
      JSB SERRS+3,I NO
**                                **
***  CHECK FOR END OF STATEMENT  ***
**                                **
EOST  CPA .+15B     END OF STATEMENT? 
      JMP ACCSA,I   YES 
      JSB SERRS+4,I NO
* 
***                        ** 
**  <DIM STATEMENT> SYNTAX  **
***                        ** 
* 
DIMS  CLA           FLAG AS DIM STATEMENT 
* 
***                        ** 
**  <COM STATEMENT> SYNTAX  **
***                        ** 
* 
COMS  STA CDFLG     FLAG AS COM STATEMENT 
      STB DFLAG     TURN ON 'DIM' MODE ( (B)=0 )
      LDA SBPTR     ENABLE STRING 
      STA SFLAG       VARIABLE
      JSB VAROP     SEEK VARIABLE OPERAND 
      JSB SERRS+5,I IMPROPER SUBSCRIPT
COMS0 JMP COMS1     ARRAY OR STRING FOUND 
      CLB           SIMPLE VARIABLE 
      CPB CDFLG     'DIM'?
      JSB SERRS+5,I  YES--ERROR 
COMS1 CPA .+15B     NO, CARRIAGE RETURN FOLLOWS?
      JMP ACCSA,I   YES 
      CCB           NO
      JSB SYMCK     COMMA?
      DEF COMMA-1 
      JSB SERRS+6,I NO
      JMP COMS+2    YES 
* 
***                        ** 
**  <DEF STATEMENT> SYNTAX  **
***                        ** 
* 
DEFS  JSB LTR       FIRST TWO 
      JSB SERRS+7,I 
      ALF,ALF         CHARACTERS
      IOR TEMP+1
      CPA FN            'FN' ?
      RSS           YES 
      JSB SERRS+7,I NO
      JSB LTR       FOLLOWED BY A LETTER? 
      JSB SERRS+7,I NO
      LDA TEMP+1    YES,
      LDB .58         RECORD
      JSB STROP         FUNCTION
      LDA TEMP+2    RETRIEVE FOLLOWING CHARACTER
      JSB LPCK      DEMAND LEFT PARENTHESIS 
      IOR FLGBT     SET FLAG FOR
      STA SBPTR,I     FORMAL PARAMETER
      JSB VAROP     DEMAND A SIMPLE VARIABLE
      NOP           NONE
      JSB SERRS+8,I   FOUND 
      JSB RPCK      DEMAND A RIGHT PARENTHESIS
      CCB           ASSIGNMENT
      JSB SYMCK       OPERATOR
      DEF ASSOP-1       NEXT? 
      JSB SERRS+3,I NO
      LDA .-2       YES,
      ADA SBPTR       ISOLATE 
      LDA 0,I           AND SAVE
      AND B777            FORMAL
      STA PFLAG             PARAMETER 
      JSB FSC       FETCH DEFINING FORMULA
      JSB SBPUD     RECORD END-OF-FORMULA OPERATOR
      JMP EOST      DEMAND END OF STATEMENT 
* 
***                          ** 
**  <IMAGE STATEMENT> SYNTAX  **
***                          ** 
* 
IMAGS LDB SBPTR     SAVE CURRENT
      STB ARYAD       BUFFER POINTER
      CLB 
      LDA .+15B     SET DELIMETER 
      JSB CHRST     RECORD STRING CONSTANT
      NOP 
      LDA TEMP+1    LENGTH
      ADA M73 
      SSA,RSS            >72? 
      JSB SERRS+31,I  YES 
      LDA ARYAD,I   NO, 
      ADA TEMP+1      RECORD
      STA ARYAD,I       LENGTH
      JMP ACCSA,I 
* 
***                                             **
**  <GOTO STATEMENT> & <GOSUB STATEMENT> SYNTAX  ** 
***                                             **
* 
GOTOS LDA SBP       SAVE
      LDB MAIN
      INB             BUFFER
      IOR 1,I 
      JSB S14SC,I       POINTER 
      CCA           SET INTCK MODE TO 
      STA GFLAG       'EXIT ON ERROR' 
      JSB PRGIN     SEEK SEQUENCE NUMBER
      JMP GOTO3     FOUND 
      CCB           NOT FOUND 
GOTO1 ADB SBPTR     BACK UP 
      STB SBPTR       SYNTAX POINTER
      LDA SBPTR,I   ERASE 
      AND OPMSK       'INTEGER FOLLOWS' 
      STA SBPTR,I       FLAG
      LDA RBP       RESTORE 
      LDB MAIN
      INB             BUFFER
      IOR 1,I 
      JSB S14SC,I       POINTER 
      JSB FSC       SEEK FORMULA
      CPA .+15B     END-OF-RECORD?
      JSB SERRS+9,I YES 
      ALF,ALF       NO, DO
      STA TEMP+1      NEXT
      JSB GETCR         TWO 
      JSB SERRS+9,I       CHARACTERS
      IOR TEMP+1            FORM
      CPA OF                  'OF' ?
      RSS           YES 
      JSB SERRS+9,I NO
      LDA OFOP      RECORD
      STA SBPTR,I     'OF' AND
      JSB SBPUD         ADVANCE POINTER 
GOTO2 JSB BLDIN     DEMAND A SEQUENCE NUMBER
      STB SBPTR,I   RECORD IT 
      JSB SBPUD 
      CPA .+44      COMMA NEXT? 
      JMP GOTO2     YES 
      JMP EOST      NO, DEMAND END OF STATEMENT 
GOTO3 CPA .+15B     END OF STATEMENT? 
      JMP GOTO4     YES 
      STA GFLAG     NO, RE-ENABLE BAD INTEGER ERROR 
      LDB .-2 
      JMP GOTO1 
GOTO4 LDA FBP       FREE
      LDB MAIN
      INB             SAVED 
      IOR 1,I 
      JSB S14SC,I       BUFFER SPACE
      JMP ACCSA,I   ACCEPT STATEMENT
* 
***                       **
**  <IF STATEMENT> SYNTAX  ** 
***                       **
* 
IFS   ISZ SBPTR     FETCH NEXT
      JSB GETCR       CHARACTER 
      JSB SERRS+31,I  NONE FOUND
      STA SBPTR,I   FOUND, SAVE IT
      LDA AEND      LOOK
      CCB             FOR 
      JSB TBSRH         'END' 
      JMP IF0       NOT FOUND 
      JSB FILRF     FOUND, GET FILE REFERENCE 
      JSB SERRS+32,I  NONE FOUND
      JMP IF1+1     FOUND 
IF0   JSB BCKSP     RESTORE 
      CCB             TO
      ADB SBPTR         ENTRY 
      STB SBPTR           STATUS
      STB SFLAG     ENABLE STRING VARIABLE
      JSB FSC       SEEK DECISION FORMULA 
      ISZ SFLAG     STRING VARIABLE FOUND?
      JMP IF1+1     NO
      STA TEMP+1    YES, SAVE NEXT CHARACTER
      LDB .-3       MAXCR = 3 FROM FSC
      STA SBPTR,I   MULTICHARACTER
      LDA MCREL       RELATIONAL
      JSB TBSRH         OPERATOR? 
      RSS           NO
      JMP IF1       YES 
      LDA TEMP+1    RETRIEVE CHARACTER
      LDB .-4       SINGLE CHARACTER
      JSB SYMCK       RELATIONAL
      DEF RELOS-1       OPERATOR? 
      JSB SERRS+16,I  NO
IF1   JSB RSTOP     YES, RECORD A STRING OPERAND
      STA SBPTR,I   SAVE NEXT CHARACTER 
      ISZ MAXCR     BUMP LIMIT TO FOUR CHARACTERS 
      LDA ATHEN     LOOK
      CCB             FOR 
      JSB TBSRH         'THEN'
      JSB SERRS+10,I  NOT FOUND 
      JSB PRGIN     DEMAND A SEQUENCE NUMBER
      JMP EOST      DEMAND END OF STATEMENT 
* 
***                        ** 
**  <FOR STATEMENT> SYNTAX  **
***                        ** 
* 
FORS  JSB VAROP     SEEK A SIMPLE VARIABLE
      NOP           NONE
      JSB SERRS+8,I   FOUND 
      CCB           DEMAND AN 
      JSB SYMCK       ASSIGNMENT
      DEF ASSOP-1       OPERATOR
      JSB SERRS+3,I NOT FOUND 
      JSB FSC       RECORD INITIALIZATION FORMULA 
      ALF,ALF       DO
      STA TEMP+1      NEXT
      JSB GETCR         TWO 
      JSB SERRS+11,I      CHARACTERS
      IOR TEMP+1            FORM
      CPA TO                  'TO' ?
      RSS           YES 
      JSB SERRS+11,I  NO
      LDA TOOP      RECORD
      STA SBPTR,I     'TO'
      JSB FSC       RECORD LIMIT FORMULA
      CPA .+15B     END OF STATEMENT? 
      JMP ACCSA,I   YES 
      STA SBPTR,I   NO, IS NEXT 
      ISZ MAXCR 
      LDA ASTEP       SYMBOL
      CCB 
      JSB TBSRH         'STEP' ?
      JSB SERRS+12,I  NO
      JSB FSC       YES, RECORD STEP SIZE 
      JMP EOST      DEMAND END OF STATEMENT 
* 
***                         **
**  <NEXT STATEMENT> SYNTAX  ** 
***                         **
* 
NEXTS JSB VAROP     SEEK SIMPLE VARIABLE
      NOP           NOT 
      JSB SERRS+8,I   FOUND 
      JMP EOST      DEMAND END OF STATEMENT 
* 
***                                      ** 
**  <RETURN STATEMENT>, <END STATEMENT>,  **
**    AND <STOP STATEMENT> SYNTAX         **
***                                      ** 
* 
ENDS  ISZ SBPTR     RECORD NULL OPERAND 
      JSB GETCR     END OF STATEMENT? 
      JMP ACCSA,I   YES 
      JSB SERRS+4,I NO
* 
***                         **
**  <DATA STATEMENT> SYNTAX  ** 
***                         **
* 
DATAS JSB SBPUD 
      CLA           INITIALIZE
      STA SIGN        SIGN
      JSB GETCR     REQUEST A CHARACTER 
      JSB SERRS+13,I  END-OF-INPUT CONDITION
      CLB,INB 
      CPA .+43      '+' ? 
      JMP DATA4     YES 
      CCB           NO
      CPA .+45      '-' ? 
      JMP DATA4     YES 
DATA1 JSB NUMCK     NO, NUMBER? 
      JMP DATA3     NO
      JSB SERRS+14,I  BAD EXPONENT
      LDB .-3       NUMBER, 
      ADB SBPTR       MARK
      LDA 1,I           PREVIOUS
      IOR FLGBT           OPERATOR AS 
      STA 1,I               'NUMBER FOLLOWS'
      LDA TEMP+1    RETRIEVE FOLLOWING CHARACTER
DATA2 CCB           COMMA 
      JSB SYMCK 
      DEF COMMA-1     NEXT? 
      JMP EOST      NO, DEMAND END OF STATEMENT 
      JMP DATAS     YES 
DATA3 CPB SIGN      SIGN FOUND? ( (B) = 0 ) 
      RSS           NO
      JSB SERRS+15,I  YES 
      JSB GETST     DEMAND A STRING CONSTANT
      JMP DATA2 
DATA4 STB SIGN      RECORD SIGN 
      JSB GETCR 
      JSB SERRS+15,I  END-OF-INPUT CONDITION
      JMP DATA1 
* 
***                         **
**  <READ STATEMENT> SYNTAX  ** 
***                         **
* 
READS JSB RECRF     READ FROM FILE? 
      JMP READ2     NO                           [B]
      CPA .+15B     YES, PSUEDO-RESTORE?
      RSS           MAYBE                        [B]
      JMP READ1     NO                           [B]
READ0 ISZ FILRF                                  [B]
      JSB SERRS+6,I NO - ERROR                   [B]
      JMP ACCSA,I   YES                          [B]
READ1 CPA B73       ';' ?                        [B]
      JMP INPTS     YES 
      JSB SERRS+6,I NO
READ2 JSB BCKSP                                  [B]
      SKP 
* 
***                          ** 
**  <INPUT STATEMENT> SYNTAX  **
***                          ** 
* 
INPTS LDB SBPTR     ENABLE STRING 
      STB SFLAG       VARIABLE
      JSB VAROP     SEEK VARIABLE OPERAND 
      JSB SERRS+17,I  NONE FOUND
      NOP 
      CCB 
      JSB SYMCK     COMMA?
      DEF COMMA-1 
      JMP EOST      NO, DEMAND END OF STATEMENT 
      JMP INPTS     YES 
* 
***                          ** 
**  <PRINT STATEMENT> SYNTAX  **
***                          ** 
* 
PRINS JSB SBPUD     ADVANCE SYNTAX BUFFER POINTER 
      JSB GETCR     FETCH NEXT CHARACTER
      JMP ACCSA,I   NONE FOUND
      JSB USTCK     CHECK FOR USING STATEMENT 
      JMP PRN01     NONE FOUND
      CPA .+15B     END OF STATEMENT? 
      JMP ACCSA,I   YES 
      CCB           NO, 
      JSB SYMCK       SEMI-COLON
      DEF SEMI-1        FOLLOWS?
      JSB SERRS+34,I NO 
PRN10 JSB SBPUD     ADVANCE SYNTAX BUFFER POINTER 
      JSB GETCR     FETCH NEXT CHARACTER
      JSB SERRS+6,I NONE FOUND
      STA SBPTR,I   SAVE CHARACTER
      JSB PFSRH     SEARCH FOR PRINT FUNCTION 
      JMP PRN11     FOUND 
      STB SFLAG     ENABLE STRING VARIABLE
      JSB FSC       LOOK FOR FORMULA
PRN11 CPA .+15B     CARRIAGE RETURN FOLLOWS?
      JMP ACCSA,I   YES 
      CCB           NO, 
      JSB SYMCK       COMMA?
      DEF COMMA-1 
      JSB SERRS+6,I NO, ERROR 
      JMP PRN10     YES 
PRN01 JSB RECRF     WRITE ONTO FILE?
      JMP PRIN0-1   NO
      CPA .+15B     YES, NULL WRITE?             [B]
      JMP READ0     YES                          [B]
      CCB           NO, SET                      [B]
      STB FILRF       'FILE' FLAG                [B]
      CPA B73       NO, ';' ? 
      JMP PRIN0     YES 
      JSB SERRS+6,I NO
      JSB BCKSP 
PRIN0 JSB SBPUD     ADVANCE SYNTAX BUFFER POINTER 
      JSB GETCR     MORE STATEMENT? 
      JMP PRIN7     NO
      CCB           YES, ENABLE 
      STB PFLAG       FORMULA AND TAB 
      CPA .+42B     " ? 
      RSS           YES 
      JMP PRIN3     NO
PRIN1 JSB GETST     RECORD A STRING CONSTANT
      CPA .+15B     END OF STATEMENT? 
      JMP ACCSA,I   YES 
      CCB           NO
      STB PFLAG 
PRIN2 CPA .+42B     " ? 
      JMP PRIN1     YES 
      LDB .-2       NO
      JSB SYMCK     COMMA OR
      DEF COMMA-1     SEMICOLON?
      CLB,RSS       NO
      JMP PRIN0     YES 
      STB SBPTR,I   ZERO NEXT WORD
      JSB SBPUD 
PRIN3 ISZ PFLAG     FORMULA OR TAB PERMITTED? 
      JSB SERRS+6,I NO
      STA SBPTR,I   YES 
      CCB           'FILE'
      ISZ FILRF       MODE? 
      JMP PRIN4     NO
      STB FILRF     YES, SET FLAG AGAIN 
      LDA AEND
      JSB TBSRH     'END' ? 
      JMP PRIN5     NO
      JSB SBPUD     YES 
      JSB GETCR     FETCH NEXT
      JMP ACCSA,I     CHARACTER 
      JMP PRIN2 
PRIN4 JSB PFSRH     SEARCH FOR PRINT FUNCTION 
      JMP PRIN6     FOUND 
      JMP PRIN8     NOT FOUND 
PRIN5 JSB BCKSP     BACKUP
      CCB             TO POINT
      ADB SBPTR         FOLLOWING 
      STB SBPTR           LAST OPERATOR 
PRIN8 STB SFLAG     ENABLE STRING VARIABLE
      JSB FSC       RECORD FORMULA
PRIN6 CPA .+15B     END OF STATEMENT? 
      JMP ACCSA,I   YES 
      JMP PRIN2     NO
PRIN7 ISZ FILRF     'FILE' MODE?
      JMP ACCSA,I   NO
      JSB SERRS+2,I   YES 
* 
