
      HED STATEMENT EXECUTION PROCESSORS
* 
***                         **
**  EXECUTE <LET STATEMENT>  ** 
***                         **
* 
ELET  CLA,INA       ALLOW STRING CONSTANT 
      STA EOL         IN FORMULA
      JSB FORMX     EVALUATE
      JMP XEC1        FORMULA 
* 
***                        ** 
**  EXECUTE <IF STATEMENT>  **
***                        ** 
* 
EIF1  ISZ TEMP1     EVALUATE
      JSB VLFIL       FILE REQUEST
      ISZ FBASE     TRANSFER
      ISZ TEMP1       EOF LABEL 
      LDB TEMP1,I       TO
      STB FBASE,I         FILE TABLE
      JMP XEC1
EIF   DLD TEMP1,I   EOF 
      CPB ENDOP 
      SSA             OPERATOR? 
      CLA,INA,RSS   NO
      JMP EIF1      YES 
      STA EOL       ALLOW STRING CONSTANT 
      JSB FETCH     EVALUATE DECISION FORMULA 
      SZA,RSS       RESULTANT 'TRUE' ?
      JMP XEC1      NO
* 
***                           **
**  EXECUTE <GO TO STATEMENT>  ** 
***                           **
* 
EGOTO CLB,RSS       SET FLAG TO 'GOTO' MODE 
* 
***                           **
**  EXECUTE <GOSUB STATEMENT>  ** 
***                           **
* 
EGOSB CCB           SET FLAG TO 
      STB GTMP        'GOSUB' MODE
      LDB TEMP1     COMPUTE SIMPLE BRANCH 
      INB             'ADDRESS' ADDRESS 
      LDA TEMP1,I   SIMPLE
      AND OPDMK       BRANCH
      CPA INTFL         STATEMENT?
      JMP EGOS1     YES 
      JSB FETCH     NO, COMPUTE 
      JSB SBFIX       BRANCH INDEX
      JMP XEC1      UNSUITABLE RESULT 
      ADB TEMP1     COMPUTE 
      INB             'ADDRESS' 
      LDA 1             ADDRESS 
      CMA           WITHIN
      ADA PRGCT       STATEMENT 
      SSA               RANGE?
      JMP XEC1      NO
EGOS1 LDB 1,I       YES, LOAD BRANCH ADDRESS
      ISZ GTMP      <GOTO STATEMENT> ?
      JMP XEC1B     YES                          [B]
      LDA PRGCT     NO, STACK 
      ISZ RTNST       RETURN
      STA RTNST,I       ADDRESS 
      LDA RTNST     NESTING 
      ADA .-10        10
      CPA RTRNQ         DEEP? 
      JSB RERRS+15,I  YES 
      JMP XEC1B     NO                           [B]
* 
***                         **
**  EXECUTE <FOR STATEMENT>  ** 
***                         **
* 
EFOR0 CPB FORST     TOP ENTRY?
      JMP EFOR7     YES                          [B]
      STA EFN0      NO, SAVE (A)
      STB DEST      SET DESTINATION ADDRESS 
      LDB FORST     COMPUTE MOVE
      ADB .+6         TERMINATION ADDRESS 
      LDA DEST      COMPUTE 
      ADA .+6         SOURCE ADDRESS
      JSB MOVER     DELETE FOR-TABLE ENTRY
      LDA EFN0      RETRIEVE (A)
      JMP EFOR5 
EFOR  LDA TEMP1,I   EXTRACT 
      AND B777        AND SAVE THE
      STA FVT           FOR-VARIABLE
      ALS           COMPUTE 
      ADA SYMTB       ADDRESS 
      ADA .-1           OF ITS
      LDA 0,I             VALUE 
      LDB FORST     LOAD POINTER TO FOR-STACK 
EFOR1 CPB FORQ      AT BOTTOM OF FOR-STACK? 
      JMP EFOR2     YES 
      CPA 1,I       NO, ENTRY FOR THIS FOR-VARIABLE?
      JMP EFOR0     YES 
      ADB .-6       NO, CHECK 
      JMP EFOR1       LOWER ENTRY 
EFOR2 LDB FORST     MOVE TO SPACE 
      ADB .+6         FOR ENTRY 
      JSB SETPT     RESET EXECUTION POINTERS
EFOR5 STA FORST,I   SAVE ADDRESS OF VALUE IN ENTRY
EFOR7 JSB FORMX     INITIALIZE FOR-VARIABLE      [B]
      LDA FORST     SAVE POINTERS TO
      INA             ENTRY FOR 
      STA EFN0          LIMIT VALUE 
      ADA .+2             AND 
      STA EFN1              STEP SIZE 
      ADA .+2       SAVE ADDRESS OF 
      LDB PRGCT       FOLLOWING STATEMENT 
      STB 0,I           IN ENTRY
      JSB FETCH     COMPUTE AND SAVE
      DST EFN0,I      LIMIT VALUE 
      LDA TEMP1     IMPLICIT
      CPA PRGCT       STEP SIZE?
      JMP EFOR6     YES 
      JSB FETCH     NO, COMPUTE STEP SIZE 
EFOR3 DST EFN1,I      AND SAVE VALUE
      CLB           SET SIGN FLAG 
      SSA             TO -1 FOR 
      CCB               NEGATIVE STEP SIZE, 
      STB EFN2            0 FOR POSITIVE STEP SIZE
      ISZ PRGCT     LOAD
      LDB PRGCT       TYPE WORD OF
EFOR4 INB               STATEMENT FOLLOWING 
      LDA 1,I             THE <FOR STATEMENT> 
      STA EFN3      SAVE IT 
      ADB .-1       COMPUTE POINTER 
      ADB 1,I         TO ITS SUCCESSOR
      AND OPMSK     <NEXT 
      CPA NXTOP       STATEMENT> ?
      RSS           YES 
      JMP EFOR4     NO
      XOR EFN3      SAME
      CPA FVT         FOR-VARIABLE? 
      RSS           YES 
      JMP EFOR4     NO
      ADB .-1       SET PROGRAM COUNTER 
      STB PRGCT       PAST <NEXT STATEMENT> 
      LDB FORST,I   LOAD
      DLD 1,I         INITIAL VALUE OF
      JMP ENEX3         FOR-VARIABLE
EFOR6 LDA HALF      LOAD
      LDB .+2         DEFAULT 
      JMP EFOR3         OF 1.0
* 
***                          ** 
**  EXECUTE <NEXT STATEMENT>  **
***                          ** 
* 
ENEXT LDA TEMP1,I   EXTRACT 
      AND B777        FOR-VARIABLE
      ALS           COMPUTE 
      ADA SYMTB       ADDRESS 
      ADA .-1           OF ITS
      LDA 0,I             VALUE 
      LDB FORST     LOAD POINTER TO FOR-STACK 
ENEX1 CPB FORQ      BOTTOM OF STACK?
      JMP XEC1      YES, IGNORE STATEMENT 
      CPA 1,I       NO, MATCHING ENTRY? 
      JMP ENEX2     YES 
      ADB .-6       NO,CHECK
      JMP ENEX1       LOWER ENTRY 
ENEX2 STA EFN1      SAVE FOR-VARIABLE VALUE ADDRESS 
      CPB FORST     TOP ENTRY OF FOR-STACK? 
      JMP ENEX0     YES                          [B]
      JSB SETPT     NO, RESET 
      LDB FORST       EXECUTION POINTERS
ENEX0 INB           SAVE ADDRESS                 [B]
      STB EFN0        OF LIMIT VALUE
      ADB .+2 
      LDA .-2       SET SIGN FLAG TO SAY
      STA EFN2        POSITIVE STEP SIZE
      DLD 1,I       LOAD STEP SIZE
      SSA           POSITIVE? 
      ISZ EFN2      NO, RESET SIGN FLAG 
      JSB .FAD      ADD STEP SIZE 
      DEF EFN1,I      TO VALUE OF FOR-VARIABLE
      DST EFN1,I    SAVE NEW VALUE
ENEX3 JSB .FSB      SUBTRACT
      DEF EFN0,I      LIMIT VALUE 
      ISZ EFN2      IF STEP SIZE POSITIVE,
      ELA             INVERT SIGN OF RESULT 
      SSA           LIMIT VALUE EXCEEDED? 
      JMP ENEX4     YES 
      LDA FORST     NO, LOAD ADDRESS
      ADA .+5         OF STATEMENT
      LDB 0,I           FOLLOWING THE 
      JMP XEC1B           <FOR STATEMENT>        [B]
ENEX4 LDB FORST     REMOVE
      ADB .-6         ENTRY FROM
      JSB SETPT         FOR-STACK 
      JMP XEC1      SKIP PAST <NEXT STATEMENT>
* 
***                            ** 
**  EXECUTE <RETURN STATEMENT>  **
***                            ** 
* 
ERTRN LDA RTNST     RETURN STACK
      CPA RTRNQ       EMPTY?
      JSB RERRS+16,I  YES 
      LDB 0,I       NO, POP 
      ADA .-1         RETURN ADDRESS
      STA RTNST         FROM STACK
      JMP XEC1B                                  [B]
* 
***                           **
**  EXECUTE <INPUT STATEMENT>  ** 
***                           **
* 
EINPT CLA           TURN OFF
      STA MCNT        MATRIX INPUT COUNTER
EINP1 STA INITF     SAVE ADDRESS FLAG 
      CLA           REQUEST 
      STA SYNTQ       FIRST 
ENP1A JSB INCAL         INPUT RECORD             [B]
EINP2 ISZ IFCNT     COUNT INPUT QUANTITY
      CCA           MATRIX
      CPA INITF       INPUT?
      JMP EINP3     YES 
      JSB FORMX     NO, EVALUATE NEXT ADDRESS 
      LDB OPDST,I   IS IT A 
      SSB             STRING VARIABLE?
      JMP EIN13     YES 
      LDA OPDST     NO, 
      ADA .-2         UNSTACK 
      STA OPDST         ADDRESS 
      STB SBPTR     SAVE DESTINATION ADDRESS
EINP3 CLA           SET SIGN
      STA SIGN        TO POSITIVE 
      STA INTMP     FLAG REQUEST FOR NUMBER 
      JMP EINP4 
ENP3A STB SIGN      RESET SIGN TO POSITIVE       [B]
ENP3B JSB INCAL                                  [B]
      ISZ IFCNT     FETCH 
EINP4 JSB GETCR       FIRST 
      JMP ENP3B         CHARACTER                [B]
      CCB           TURN OFF
      STB SERR        OVER/UNDERFLOW FLAG 
      CPA .+45      '-' ? 
      JMP EIN11     YES 
      CLB,INB       NO
      CPA .+43      '+' ? 
      JMP EIN11     YES 
EINP5 JSB NUMCK     NO, NUMBER? 
      JMP EINP7     NO
      JMP EINP8     BAD EXPONENT
EINP6 LDB .+40B     TURN ON 
      STB BLANK       BLANK SUPPRESSION 
      ISZ MCNT      MATRIX COMPLETED? 
      RSS           NO
      JMP MIOEN,I   YES 
EINP0 LDB TEMP1     <INPUT STATEMENT> 
      CPB PRGCT       SATISFIED?
      JMP EIN12     YES 
      ISZ SERR      DID OVER/UNDERFLOW OCCUR? 
      JMP EINP9     YES 
      CPA .+15B     NO, END OF INPUT RECORD?
      JMP ENP1A     YES                          [B]
      CPA .+54B     NO, COMMA NEXT? 
      JMP EIN10     YES 
EINP9 JSB WERRS,I   NO
      LDB IFCNT     OUTPUT NEXT 
      INB             ITEM
      JSB OUTIN         NUMBER
      LDA .+15B     OUTPUT
      JSB OUTCR       CARRIAGE RETURN 
      JMP ENP1A                                  [B]
EIN10 JSB GETCR     END OF INPUT RECORD?
      JMP EINP9     YES 
      JSB BCKSP     NO
      JMP EINP2 
EINP7 CPA .+42B     " ? 
      JMP EINP8     YES 
      CPB SIGN      NO, SIGN FOUND? 
      JMP EINP4     NO, IGNORE CHARACTER
EINP8 JSB WERRS,I   YES 
      LDB IFCNT     OUTPUT
      JSB OUTIN       ITEM NUMBER 
      LDA .+15B     OUTPUT
      JSB OUTCR       CARRIAGE RETURN 
      CLB           NUMBER
      CPB INTMP       REQUESTED?
      JMP ENP3A     YES                          [B]
      JMP EIN14     NO
EIN11 STB SIGN      SAVE SIGN 
      JSB GETCR 
      JMP EINP8     OUT-OF-DATA ERROR 
      JMP EINP5 
EIN12 CPA .+15B     END OF RECORD?
      CLA,RSS       YES 
      JSB WERRS+7,I NO
      STA CHRCT     ZERO CHARACTER COUNT
      LDA .+12B     OUTPUT A
      JSB OUTCR       LINE FEED 
      JMP XEC1
EIN13 CMB           EXTRACT 
      LDA 1,I         PHYSICAL
      ALF,ALF           LENGTH OF 
      AND B377            DESTINATION STRING
      CMA           SET IT AS END 
      ADA TMPST,I     OF UNSPECIFIED
      STA TPRME         DESTINATION STRING
      CCA           PREPARE 
      JSB PSTR        DESTINATION STRING
      LDB TNULL     SAVE LENGTH 
     STB INTMP       ALLOWANCE
      JMP EIN17                                  [B]
EIN14 JSB INCAL 
      ISZ IFCNT     FETCH 
EIN17 JSB GETCR       FIRST                      [B]
      JMP EIN14         CHARACTER                [B]
      CCB           TURN OFF
      STB SERR        OVER/UNDERFLOW FLAG 
      CPA .+42B     " ? 
      RSS           YES 
      JSB BCKSP     NO, STRING BEGINS HERE
      CLB           TURN OFF
      STB BLANK       BLANK SUPPRESSION 
      LDA FINCA     POINT TO INPUT BUFFER 
      JSB TRSTR     TRANSFER STRING 
      CLB           ALL REQUESTED 
      CPB TNULL       CHARACTERS TRANSFERRED? 
      JMP EIN21     YES 
      CPB PS1       NO, TRANSFER LENGTH SPECIFIED?
      JMP EIN20     NO
      STA INTMP     YES, SAVE (A) 
      CCA           FINISH
      STA TPRME 
      ADA TNULL       TRANSFER
      STA TNULL 
      LDA FSCHA         WITH BLANKS 
      JSB TRSTR 
      LDA INTMP     RESTORE (A) 
EIN18 CPA .+15B     TRANSFER ENDED BY END-OF-INPUT? 
      JMP EINP6     YES 
EIN19 JSB GETCR     NO, WAS A " 
      NOP           EXIT WITH 
      JMP EINP6       NEXT CHARACTER
EIN20 LDB TEMP6,I   SET LOGICAL 
      ADB TNULL       TO ACTUAL 
      STB TEMP6,I       STRING LENGTH 
      JMP EIN18 
EIN21 CPB PS1       LENGTH OF TRANSFER SPECIFIED? 
      JMP EIN15     NO
EIN16 JSB GETCR     YES 
      JMP EINP6     IMPLIED CLOSING QUOTE 
      CPA .+42B     " ? 
      JMP EIN19     YES 
      JMP EIN16     NO, LOOK FOR " OR END-OF-INPUT
EIN15 JSB GETCR     END-OF-INPUT NEXT?
      JMP EINP6     YES 
      CPA .+42B     NO, CLOSING " ? 
      JMP EIN19     YES 
      LDA INTMP     NO, DESTINATION STRING EXCEEDED 
      STA TNULL     RESTORE 
      LDA SBPTR       DESTINATION STRING
      STA TEMP5         PARAMETERS
      LDA .+40B     SET TO
      STA BLANK       SKIP BLANKS 
      JMP EINP8 
* 
***                          ** 
**  EXECUTE <READ STATEMENT>  **
***                          ** 
* 
EREAD JSB VLFIL     LOOK FOR FILE REQUEST 
      JMP EREA1     FILE REQUEST FOUND
EREA0 JSB FORMX     EVALUATE DESTINATION ADDRESS [B]
      LDA OPDST,I   STRING
      SSA             VARIABLE? 
      JMP EREA2     YES 
      STA SBPTR     NO, SAVE AND
      LDA OPDST       UNSTACK 
      ADA .-2           DESTINATION 
      STA OPDST           ADDRESS 
      CLB,INB       FETCH 
      JSB FDATA       NUMBER
      DST SBPTR,I   STORE NUMBER
EREA1 LDA TEMP1     END OF
      CPA PRGCT       STATEMENT?
      JMP XEC1      YES 
      JMP EREA0     NO                           [B]
EREA2 LDB .+2       PREPARE 
      JSB FDATA       SOURCE STRING 
      CCA           PREPARE 
      JSB PSTR        DESTINATION STRING
      LDA FSCHA 
      JSB TRSTR     TRANSFER STRING 
      JMP EREA1 
* 
***                           **
**  EXECUTE <PRINT STATEMENT>  ** 
***                           **
* 
EPRIN CLA,INA       FLAG AS 'PRINT' 
      JSB EPRUS     CHECK FOR USING STATEMENT 
      CLA           FLAG AS 
      STA FFLG        NON-FORMATTED 
      JSB VLFIL     VALIDATE FILE REQUEST 
      JMP EPR13 
      JMP EPR2A     NO FILE REQUEST FOUND        [B]
EPRI1 LDA FILE#     FILE
      SSA,RSS         MODE? 
      JMP EPRI2     YES 
      CLA           NO, EXECUTE COMMA 
      CPA EOL         UNLESS PRECEDED BY
      JSB EDELM         A 'TAB' (EOL = 1) 
EPRI2 CCA,RSS       TURN OFF 'END-OF-LINE' FLAG 
EPR2A CLA           TURN ON                      [B]
      STA EOL         'END-OF-LINE' FLAG
EPRI3 LDA TEMP1,I   EXTRACT 
      AND OPDMK       NEXT OPERAND
      SZA           NULL? 
      JMP EPRI5     NO, BEGINS FORMULA
EPR3A ISZ TEMP1     YES                          [B]
EPRI4 LDB TEMP1     STATEMENT 
      CPB PRGCT       FINISHED? 
      JMP EPR12     YES 
      LDA TEMP1,I   NO, EXTRACT 
      AND OPMSK       NEXT OPERATOR 
      CPA B2000     COMMA?
      JMP EPRI1     YES 
      CPA B3000     NO, SEMICOLON?
      JMP EPRI2     YES 
      CPA B1000     NO, " ? 
      JMP EPRI8     YES 
      CPA ENDOP     NO, 'END' ? 
      JMP EPR11     YES 
      SZA,RSS       NO, NULL? 
      JMP EPRI3     YES 
      CCA           NO, MUST BE FORMULA 
      ADA TEMP1     RESET TO PRIOR
      STA TEMP1       NULL OPERAND
EPRI5 CCA           TURN OFF
      STA EOL         'TAB' FLAG
      JSB FORMX     EVALUATE FORMULA
      LDB OPDST,I   IS IT A 
      SSB             STRING VARIABLE?
      JMP EPR8A     YES                          [B]
      JSB OPCHK     NO, UNSTACK VALUE ADDRESS 
      LDA FILE#     TO BE WRITTEN 
      SSA,RSS         ON A FILE?
      JMP EPRI7     YES 
      ISZ EOL       NO, A 'TAB' ? 
      JMP EPRI4     YES (EOL = 1 NOW) 
      DLD 1,I       NO, OUTPUT
      JSB ENOUT       A NUMBER
      JMP EPRI4 
EPRI7 STB SBPTR     SAVE VALUE ADDRESS
      LDB .-2       WRITE NUMBER
EPR7A JSB FILST       ON FILE                    [B]
      JMP EPRI4 
EPRI8 JSB STSTR     STACK STRING CONSTANT 
EPR8A LDA .-2       PREPARE                      [B]
      JSB PSTR        PRINT 
      STA TEMP4         STRING
      STB TPRME 
      LDB .-3       PRESET TO WRITE ON FILE 
      LDA FILE#     TO BE WRITTEN 
      SSA,RSS         ON A FILE?
      JMP EPR7A     YES                          [B]
      CLA           NO, TURN ON 
      STA EOL         'END-OF-LINE' FLAG
      LDA TNULL     ENOUGH
      CMA,INA         SPACE 
      ADA CHRCT         ON
      ADA M74             CURRENT 
      SSA,RSS               LINE? 
      JSB OUTLN     NO
      JMP EPR10     YES 
EPRI9 JSB FSCH      FETCH 
      LDA .+40B       CHARACTER 
      CPA .+16B     PSUEDO LINE FEED? 
      LDA .+12B     YES 
      CPA .+17B     PSUEDO CARRIAGE RETURN? 
      RSS           YES 
      JMP EPR9A     NO                           [B]
      LDA .+23B     OUTPUT X-OFF AND             [B]
      JSB OUTCR                                  [B]
      LDA .+15B       CARRIAGE RETURN            [B]
EPR9A JSB OUTCR                                  [B]
EPR10 ISZ TNULL     MORE STRING?
      JMP EPRI9     YES 
      JMP EPRI4     NO
EPR11 STA EORFL     FILE
      JSB GTTYP 
      CPA .+3         FULL? 
      JMP EPR3A     YES                          [B]
      CCB           NO, WRITE 
      JMP EPR7A       END-OF-FILE                [B]
EPR12 ISZ EOL       'END-OF-LINE' FLAG SET? 
      JSB OUTLN     YES 
      JMP XEC1      NO
EPR13 ADB .-8       SET BUFFER
      LDA B,I         DIR-
      IOR BIT15         TY
      STA B,I             BIT 
      LDB TEMP1     NULL
      CPB PRGCT       PRINT?
      JMP XEC1      YES 
      JMP EPRI2     NO
