
      HED COMPILATION AND DECOMPILATION 
      ORG 36000B
.5000 DEC 5000                                   [B]
A.10  DEF .+10
APTR2 DEF SYMT7 
APTR1 DEF SYMT6 
DONEA DEF EXIT3 
CSVRT DEF CSAV2 
MATOP OCT 67000 
* 
* **************************
****                       ** 
***  'COMPILE' THE PROGRAM  **
****                       ** 
* **************************
* 
* 
*  SYMTB=0 IMPLIES THE PROGRAM IS IN 'SOURCE': ALL OPERANDS ARE IN
*  SYMBOLIC FORM.  SYMTB#0 AND SPTR=0 IMPLIES THE PROGRAM IS 'SEMI- 
*  COMPILED': VARIABLE OPERANDS ARE POINTERS TO A SYMBOL TABLE AND
*  STATEMENT REFERENCES ARE REPLACED BY ABSOLUTE POINTERS.
*  SYMTB = SPTR IMPLIES THE PROGRAM IS 'COMPILED': THE SYMBOL TABLE 
*  ENTRIES CONTAIN POINTERS TO A VALUE TABLE OR IN THE CASE OF
*  FUNCTIONS TO THE DEFINING FORMULA, AND A TABLE IS BUILT
*  CONTAINING INFORMATION FOR EACH FILE IN THE PROGRAM.  BEFORE 
*  BUILDING THE SYMBOL TABLE, THE INTERPRETER'S PROGRAM COUNTER 
*  IS SET TO THE STATEMENT REFERENCED BY THE 'RUN' COMMAND (THE 
*  LOWEST NUMBERED STATEMENT IS THE DEFAULT CHOICE).
* 
CMPLE LDB PBUFF     NULL
      CPB PBPTR       PROGRAM?
      JMP DONEA,I   YES 
      CLB,INB       INITIALIZE
      STB PRGCT       PROGRAM COUNTER 
      JSB SINIT     SIMPLE
      JSB GETCR       'RUN' ? 
      JMP CMP15     YES 
      JSB BCKSP     NO
      JSB BLDIN     DEMAND AN INTEGER 
      STB PRGCT     SAVE STARTING STATEMENT NUMBER
      CPA .+15B     END OF RECORD?
      RSS           YES 
      JSB RERRS+12,I  NO
CMP15 CLF 0 
      LDA MAIN,I    DON'T 
      IOR UNABT       ALLOW 
      STA MAIN,I        ABORTS
      STF 0 
      LDB PBUFF 
      CPB SPROG     NO, COM STORAGE ALLOCATED?
      JSB ALCOM     NO--DO IT 
      LDA SYMTB     GET SYMBOL TABLE POINTER
      SZA,RSS       IS PROGRAM COMPILED ? 
      LDA PBPTR     NO, USE PBPTR 
      LDB PRGCT     GET STARTING STATEMENT NUMBER 
      JSB FNDPS     SEEK REFERENCED STATEMENT 
      JMP DONEA,I   NOT WITHIN PROGRAM
      NOP           SET 
      STB PRGCT       PROGRAM COUNTER 
CMP14 LDA MAIN      TELL 2114 
      INA 
      LDA 0,I           THAT USER 
      IOR UIR 
      JSB S14LP,I       IS RUNNING
CMPL0 LDA SYMTB     PROGRAM 
      SZA,RSS         UNCOMPILED? 
      JMP CMP00     YES 
      CPA SPTR      NO, COMPILED? 
      RSS           YES 
      JMP CMP16     NO, MUST BE SEMI-COMPILED 
      LDB ASINP 
      SZB,RSS       ASSIGN STATEMENT SEEN?
      JMP VALUE     NO
      JSB RSTPT     YES, FAKE SEMI-COMPILED PROGRAM 
      LDA SYMTB 
      STA SPTR
      JMP CMP18 
CMP16 EQU * 
      STA SPTR
      JMP CMP17 
CMP00 STA FILTB 
      CLF 0 
      LDA CFLAG     SET 
      LDB MLINK+1 
      ADB .-?LINK     PROGRAM MODE
      IOR 1,I 
      STA 1,I           TO 'COMPILED' 
      STF 0 
      SKP 
**                            **
***  BUILD THE SYMBOL TABLE  ***
**                            **
* 
*  THE PROGRAM IS EXAMINED STATEMENT BY STATEMENT.  ALL 
*  VARIABLE OPERANDS ARE REPLACED BY POINTERS (RELATIVE 
*  TO THE START OF THE SYMBOL TABLE) TO TWO WORD ENTRIES. 
*  SYMBOL TABLE ENTRIES KEEP THE SYMBOL IN THE FIRST WORD 
*  AND INFORMATION IN THE SECOND.  FOR FUNCTIONS THE
*  SECOND WORD CONTAINS A POINTER TO THE DEFINING FORMULA 
*  (0 BEFORE FINDING THE <DEF STATEMENT>).  FOR SIMPLE
*  VARIABLES THE SECOND WORD IS USED TO FORM A LINKED LIST
*  OF UNMATCHED FOR-VARIABLES (OTHERWISE IT IS 0) WITH
*  FLINK POINTING TO THE INNERMOST NESTED FOR-VARIABLE. 
*  IF THE SIMPLE VARIABLE APPEARS IN A <COM STATEMENT>
*  THE SECOND WORD IS SET TO -1. FOR ARRAY AND STRING 
*  VARIABLES THE SECOND WORD IS 0 UNLESS THE VARIABLE 
*  APPEARS IN A <DIM STATEMENT>, IN WHICH CASE IT 
*  POINTS TO THE DIMENSIONS IN THE CODE, OR IT APPEARS
*  IN A <COM STATEMENT>, IN WHICH CASE IT IS THE
*  NEGATION OF A POINTER TO THE DIMENSIONS. 
*  PROGRAM INTEGERS ARE REPLACED BY A POINTER TO THE
*  STATEMENT THEY REFERENCE.  ON EXIT TO VALUE OR DCMPL,
*  SPTR POINTS TO THE FIRST WORD NOT PROCESSED. 
* 
      LDB PBPTR     CREATE POINTER
      STB SYMTB       TO SYMBOL TABLE 
* 
* COUNT NUMBER OF STATEMENTS IN PROGRAM 
* 
      CLA,INA       INITIALIZE STATEMENT COUNTER
      LDB SPROG 
CMP01 INB           MOVE TO 
      ADB 1,I         NEXT
      ADB .-1           STATEMENT 
      CPB PBPTR     DONE? 
      JMP CMP02     YES 
      INA           NO--BUMP COUNTER
      JMP CMP01 
CMP02 CLB           DIVIDE # OF STATEMENTS
      DIV .+32        INTO 32 PARTS 
      CMB           SET B=-1-# OF OVERSIZE GROUPS,
      SZA,RSS         BUT IF <32 STATEMENTS USE -#
      INB 
      INA           SET A TO SIZE OF LARGER GROUP 
      STA STCT1     SET COUNTER 
      STB STCT2 
      LDB ERSCA     SET POINTER TO TABLE
      STB NUMPT 
      SKP 
* 
* BUILD A TABLE OF 64 WORDS. THE FIRST 32 CONTAIN THE SEQUENCE
* NUMBERS OF STATEMNTS WHICH DIVIDE THE PROGRAM INTO 32 ALMOST
* EQUAL PARTS. THE SECOND 32 WORDS ARE THE ABSOLUTE ADDRESSES 
* OF THESE STATEMENTS 
* 
      LDA SPROG 
CMP03 ADB .+32
      STA 1,I       SET ABSOLUTE ADDRESS INTO TABLE 
      LDB 0,I       SET SEQUENCE # INTO TABLE 
      STB NUMPT,I 
      ISZ NUMPT     BUMP POINTERS 
      ISZ STCT2     TEST FOR ANY MORE 
      CLB,RSS         OVERSIZE GROUPS 
      CCB           COMPUTE SIZE OF NEXT GROUP
      ADB STCT1 
      STB STCT1 
      CMB 
      STB STCT3 
      LDB NUMPT     TEST FOR DONE 
      CPB ERS32 
      JMP CMP04 
      ISZ STCT3     COMPUTE FIRST STATEMENT 
      INA,RSS         IN NEXT GROUP 
      JMP CMP03 
      ADA 0,I 
      ADA .-1 
      JMP *-5 
* 
CMP04 CLA,INA 
      STA FLINK     SET FOR-QUEUE TO EMPTY
      JSB PRNST     INITIALIZE
      DEF CMP11       COMPILATION 
      SEZ,RSS       WAS FLAG BIT SET? 
      JMP CMPL3     NO
*                                  *
**  PROCESS NON-VARIABLE OPERAND  **
*                                  *
      ADA .-4       PROGRAM 
      SSA,RSS         INTEGER?
      JMP PRNS2     NO, MUST BE A PARAMETER 
CMPL1 ISZ SPTR      YES, MOVE 
      LDB SPTR        TO NEXT WORD
      CPB NSPTR     STATEMENT FINISHED? 
      JMP CMP11     YES 
      LDB ERSCA     BEGIN SEARCH FOR REFERNECED STMT
CMP05 LDA 1,I       FIRST STATEMENT =>SOUGHT STATE.?
      CMA 
      ADA SPTR,I
      SSA,INA 
      JMP CMP06     FOUND ONE 
      INB 
      CPB ERS32     TEST FOR DONE 
      RSS 
      JMP CMP05 
      ADB .+31
      LDA SYMTB     STATEMENT IS IN LAST GROUP
      JMP CMP07 
CMP06 ADB .+32      B=> FIRST STATEMNT IN GROUP 
      SZA,RSS       TEST FOR FOUND
      JMP CMP09 
      CPB ERS32     TEST FOR NOT THERE
      JMP CMPL2     ERROR 
      LDA 1,I       SET A=> FIRST WORD BEYOND GROUP 
      ADB .-1 
CMP07 LDB 1,I 
      STA STCT1     SAVE END TEST 
      LDA SPTR,I    GET SEQUENCE NUMBER 
CMP08 INB           BUMP STATEMENT POINTER
      ADB 1,I 
      ADB .-1 
      CPB STCT1     TEST FOR DONE 
      JMP CMPL2     LABEL NOT FOUND--ERROR
      CPA 1,I       TEST FOR FOUND
      JMP CML91                                  [B]
      JMP CMP08 
CMP09 LDB 1,I 
CML91 STB SPTR,I    FOUND, REPLACE INT WITH ABS. ADD
      ISZ INFST     IN 'USING' STATEMENT? 
      JMP CMPL1     NO
      JMP PRNS2     YES 
CMPL2 JSB DCMPL     DECOMPILE 
      JSB RERRS,I   NON-EXISTENT STATEMENT NUMBER 
*                              *
**  PROCESS VARIABLE OPERAND  **
*                              *
CMPL3 STA STMP1     SAVE SYMBOL 
      AND .+17B 
      CPA .+17B     FUNCTION? 
      JMP CMPL6     YES 
      SZA,RSS       NO, STRING VARIABLE?
      JMP CML82     YES                          [B]
      ADA .-4       NO, 
      SSA             ARRAY?
      JMP CMPL9     YES 
      JSB SSYMT     NO, COMPILE 
      ISZ SPTR        SIMPLE VARIABLE 
      CPB COMOP     'COM'?
      JMP CMP41     YES 
      CPB FOROP     NO, FOR-VARIABLE OF 'FOR'?
      JMP CMPL4     YES 
      CPB NXTOP     NO, FOR-VARIABLE OF 'NEXT' ?
      RSS           YES 
      JMP PRN21     NO                           [B]
      LDB FLINK 
      SSB           MAKE
      CMB,INB         POSITIVE
      CPB STMP2     MATCH LATEST <FOR STATEMENT> ?
      JMP *+3       YES 
      JSB DCMPL     NO, DECOMPILE 
      JSB RERRS+1,I NEXT NOT PRECEDED BY PROPER FOR 
      LDB FLINK 
      LDA STMP2,I   REMOVE
      STA FLINK       VARIABLE
      SSB           WAS VARIABLE IN COMMON? 
      CCB,RSS       NO
      CLB           NO
      STB STMP2,I   RESET AS SIMPLE VARIABLE
      JMP PRN21                                  [B]
CMPL4 LDA STMP2,I   LOAD SECOND WORD OF TABLE ENTRY 
      SZA           ALREADY IN FOR-QUEUE? 
      INA,SZA,RSS   COMMON VARIABLE 
      JMP CMPL5 
      JSB DCMPL     DECOMPILE 
      JSB RERRS+2,I NESTED "FOR'S" WITH SAME VARIABLE 
CMPL5 LDB STMP2 
      LDA STMP2,I   WAS VARIABLE
      SSA             IN COMMON?
      CMB,INB       YES 
      LDA FLINK     ADD 
      STA STMP2,I     TO
      STB FLINK         FOR-QUEUE 
      ISZ STYPE     DESTROY STATEMENT TYPE
      JMP PRN21                                  [B]
CMP41 LDA STMP2 
      LDB A,I       GET POINTER 
      SZB           ALREADY IN COMMON?
      JMP CML10                                  [B]
      CCB           FLAG VARIABLE AS
      STB A,I         CONTAINED IN COMMON 
      JMP PRN21                                  [B]
CMPL6 JSB SSYMT     COMPILE FUNCTION NAME 
      CPB DEFOP     FUNCTION DEFINITION?
      RSS           YES 
      JMP PRNS2     NO
      LDB STMP2,I   PREVIOUSLY
      SZB             DEFINED?
      JMP CMPL8     YES 
      LDA STMP2     NO
      ISZ STYPE     DESTROY STATEMENT TYPE
CMPL7 LDB SPTR      ADVANCE 
      ADB .+3         PROGRAM 
      STB SPTR          POINTER 
      STB 0,I       SAVE
      JMP PRN21       POINTER                    [B]
CMPL8 ISZ SPTR
      JSB DCMPL     DECOMPILE 
      JSB RERRS+3,I FUNCTION DEFINED TWICE
CML82 JSB SSYMT     COMPILE STRING VARIABLE      [B]
      ISZ STMP1     SET TO 'SINGLY SUBSCRIPTED' 
      RSS           PROCESS POSSIBLE DECLARATION
CMPL9 JSB ASYMT     COMPILE ARRAY VARIABLE
      CCE           SET 'COM' FLAG
      CPB COMOP     'COM'?
      JMP CMP91     YES 
      CPB DIMOP     NO, 'DIM'?
      CLE,RSS       YES--SET 'DIM' FLAG 
      JMP PRNS2 
CMP91 LDB STMP2,I   WAS VARIABLE
      SZB             PREVIOUSLY DIMENSIONED? 
      JMP CMP10     YES 
      LDB SPTR      NO, SAVE POINTER
      ADB .+2         TO DIMENSIONS 
      SEZ           DIMENSIONED IN 'COM' ?
      CMB,INB       YES--FLAG IT
      STB STMP2,I   NO
      LDB SPTR      RESTORE 
      ADB .+2         POINTER 
      LDA STMP1     RETRIEVE SYMBOL 
CMP92 SLA,RSS       ADVANCE                      [B]
      ADB .+2         POINTER 
      ADB .+2           PAST
      STB SPTR            ONE OR TWO
      JMP PRN22                                  [B]
CMP10 ISZ SPTR
CML10 JSB DCMPL     DECOMPILE                    [B]
      JSB RERRS+4,I VARIABLE DEFINED TWICE
*                              *
**  PROCESS END OF STATEMENT  **
*                              *
CMP11 CPB SYMTB     END OF PROGRAM? 
      RSS           YES 
      JMP PRNS1     NO
      STB SPTR      INSURE CORRECT SETTING FOR SPTR 
      LDA STYPE     LAST STATEMENT
      CPA ENDOP       AN 'END' ?
      JMP CMP12     YES 
      JSB DCMPL     NO, DECOMPILE 
      JSB RERRS+5,I MISSING 'END' 
CMP12 CLA,INA 
      CPA FLINK     ALL FORS MATCHED? 
      JMP CMP17     YES                          [B]
      JSB DCMPL     DECOMPILE 
      JSB RERRS+6,I 'FOR' WITHOUT 'NEXT'
CMP17 EQU * 
      CLA 
      STA VLFLG     MUST RUN VALUE. 
      LDB PBPTR     SET POINTER TO
      STB FILTB       END OF SYMBOL TABLE.
      LDA MLINK+1   IS CSAVE
      ADA .+?STAT-?LINK 
      LDA 0,I           RUNNING 
      CPA .+5+CSAV-COM2 
      JMP CSVRT,I   YES--EXIT TO IT 
* 
*  FILCT = -5 AT THIS POINT UNLESS THE PROGRAM CONTAINS A 
*  <FILES STATEMENT>.  THE CALL TO SCHLB,I LEAVES VALTB = 
*  FILTB+7*(NUMBER OF FILES REQUESTED).  IF NO <FILES STATEMENT>
*  APPEARS, VALTB = FILTB.
* 
CMP18 EQU * 
      LDA FILCT     ANY <FILES
      CPA .-5         STATEMENTS>?
      JMP CMP13     NO
      JSB SCHLB,I   REQUEST FILE TABLE
      DEF FILIB 
      JSB RERRS+13,I  BAD FORMAT OR ILLEGAL NAME
      JSB RERRS+14,I  MISSING OR PROTECTED FILE 
      JSB RERRS+10,I  OUT OF STORAGE
      JMP VALU0     SUCCESSFUL REQUEST           [B]
CMP13 LDB FILTB     SET VALUE TABLE 
      STB VALTB       POINTER.
      JMP VALU0                                  [B]
      SKP 
**                                      **
***  DECOMPILE ALL OR PART OF PROGRAM  ***
**                                      **
* 
*  IF CFLAG[I] = 0 PROGRAM IS IN SOURCE, EXIT IMMEDIATELY;
*  ELSE SET CFLAG[I] = 0 AND DECOMPILE PROGRAM.  SPTR POINTS
*  INITIALLY TO LAST WORD+1 OF COMPILED PROGRAM.  ABSOLUTE
*  ADDRESSES ARE REPLACED BY THE SEQUENCE NUMBERS TO WHICH
*  THEY POINT.  VARIABLE OPERAND POINTERS ARE REPLACED BY 
*  THEIR SYMBOL.  PBPTR IS SET TO LAST WORD+1 OF PROGRAM. 
* 
#DCMP LDA CFLAG     PROGRAM 
      LDB MLINK+1 
      ADB .-?LINK 
      AND 1,I         COMPILED? 
      SZA,RSS 
      JMP DCMP4     NO
      CLF 0         YES 
      XOR 1,I       SET PROGRAM MODE
      STA 1,I         TO 'UNCOMPILED' 
      STF 0 
      LDA PBPTR     NULL
      CPA PBUFF       PROGRAM?
      JMP DCMP7     YES                          [B]
      LDA SPTR      SPTR=0 TO FLAG
      SZA,RSS         SEMI-COMPILED ? 
      LDA SYMTB     YES--RESET IT TO CORRECT VALUE
      STA SPTR      SET TERMINATION 
      STA FILTB       ADDRESS 
      JSB PRNST     INITIALIZE
      DEF PRNS1       DECOMPILATION 
      CLB,SEZ,RSS   WAS FLAG BIT SET? 
      JMP DCMP2     NO
*                                  *
**  PROCESS NON-VARIABLE OPERAND  **
*                                  *
      ADA .-4       PROGRAM 
      SSA,RSS         INTEGER?
      JMP PRNS2     NO
DCMP1 ISZ SPTR      YES, MOVE TO
      LDB SPTR        NEXT WORD 
      CPB FILTB     DONE? 
      JMP DCMP3     YES 
      CPB NSPTR     NO, STATEMENT DONE? 
      JMP PRNS0     YES                          [B]
      LDA SPTR,I    NO, REPLACE 
      LDA 0,I         ABSOLUTE ADDRESS
      STA SPTR,I        WITH SEQUENCE NUMBER
      ISZ INFST     IN <USING STATEMENT>? 
      JMP DCMP1     NO
      JMP PRNS2     YES 
*                              *
**  PROCESS VARIABLE OPERAND  **
*                              *
DCMP2 ADA .-1       COMPUTE 
      RRR 15          SYMBOL TABLE
      ADB SYMTB         ADDRESS 
      LDA SPTR,I    EXTRACT 
      AND OPMSK       OPERATOR
      IOR 1,I       REPLACE OPERATOR- 
      STA SPTR,I      OPERAND PAIR IN CODE
      LDB STYPE 
      CPB DIMOP     'DIM' ? 
      JMP DCMP6     YES 
      CPB COMOP     NO, 'COM'?
      RSS           YES 
      JMP PRNS2     NO
DCMP6 LDB SPTR
      INB 
      CPB FILTB     DONE? 
      JMP DCMP3     YES 
      INB           NO
      AND .+17B     STRING
      ADA .-4       SIMPLE
      SSA,RSS         VARIABLE? 
      JMP PRNS2     YES 
      ADA .+4       NO, STRING
      SZA,RSS         VARIABLE? 
      INA           YES, SET TO SINGLE SUBSCRIPT MODE 
      JMP CMP92                                  [B]
DCMP3 LDA SYMTB     SET ACTIVE USER AREA POINTER
      STA PBPTR       TO LAST WORD+1 OF PROGRAM 
DCMP7 CLA           ZERO                         [B]
      STA SYMTB       POINTER 
DCMP4 STA DCLC1,I   BLOCK CLOCK 
      LDB PBUFF 
      CPB SPROG     COMMON ALLOCATED? 
      JMP DCMP5     NO
      CPB PBPTR     YES, NULL PROGRAM?
      JMP DCMP5     YES 
      STB DEST      NO
     LDA SPROG     SET UP 
      STB SPROG       POINTERS
      LDB PBPTR         FOR MOVE
      JSB MOVER     REMOVE COMMON AREA
      LDB DEST      RESET END-OF- 
      STB PBPTR       PROGRAM POINTER 
DCMP5 JSB ABCK,I    ABORT ATTEMPT DURING COMPILE? 
      JMP DCMPL,I 
      SKP 
**                                       ** 
***  PROCESS NEXT STATEMENT OF PROGRAM  *** 
**                                       ** 
* 
*  USED BY CMPLE AND DCMPL TO SCAN THROUGH THE PROGRAM. 
*  A 'JSB PRNST' INITIALIZES THE SCAN: (P+1) IS A POINTER 
*  TO THE CODE FOR HANDLING THE END-OF-STATEMENT CONDITION; 
*  .LNUM HOLDS THE SEQUENCE NUMBER OF THE STATEMENT BEING 
*  PROCESSED; SPTR POINTS TO THE WORD OF THE PROGRAM BEING
*  PROCESSED.  PRNST HANDLES <REM STATEMENT>, <DATA STATEMENT>, 
*  STRING CONSTANTS, NULL OPERANDS, NUMERICAL CONSTANTS, AND
*  <FILES STATEMENT>.  OTHER CASES EXIT TO (P+2).  PRNST IS 
*  RE-ENTERED DIRECTLY, LEAVING THE INITIALIZED EXIT ADDRESSES
*  UNCHANGED THROUGHOUT PROCESSING OF THE PROGRAM.
* 
#PNST LDA PRNST,I   SET POINTER TO
      STA STEND       END-OF-STATEMENT
      ISZ PRNST         PROCESSING ROUTINE
      LDA DFILT     INITIALIZE POINTER TO 
      STA FILPT       <FILES STATEMENT> TABLE 
      CLA           INITIALIZE
      STA COMSN       COM FLAG
      STA USESN         AND USING FLAG
      LDA .-5       INITIALIZE <FILES 
      STA FILCT       STATEMENT> COUNTER
      LDB SPROG     INITIAL PROGRAM POINTER 
PRNS1 STB SPTR      SET PROGRAM POINTER TO STATEMENT
PRNS0 LDA SPTR,I    SAVE STATEMENT               [B]
      STA .LNUM       SEQUENCE NUMBER 
      ISZ SPTR      COMPUTE 
      ADB SPTR,I      LENGTH
      STB NSPTR     SAVE POINTER TO NEXT STATEMENT
      ISZ SPTR      EXTRACT 
      LDA SPTR,I      STATEMENT 
      AND OPMSK         TYPE
      STA STYPE     SAVE IT 
      CPA COMOP     'COM' ? 
      JMP *+3       YES 
      STB COMSN     NO--CLEAR COM FLAG. 
      JMP PRNS4 
      LDB COMSN     NON-COM 
      SZB,RSS         STATEMENT SEEN? 
      JMP PRN21     NO                           [B]
      LDB SPTR      YES, RESET
      ADB .-2         STATEMENT 
      STB SPTR         POINTER
      JSB DCMPL     ERROR 
      JSB RERRS+42,I  'COM' OUT OF ORDER
PRNS4 CPA REMOP     'REM' ? 
      JMP PRN22     YES                          [B]
      CPA DATOP     NO, DATA? 
      JMP PRN22     YES                          [B]
      CPA IMGOP     NO, IMAGE?
      JMP PRN22     YES                          [B]
      CPA FILOP     NO, <FILES STATEMENT> ? 
      RSS           YES 
      JMP PRNS5     NO
      LDB SPTR
      ADB .-2 
      ISZ FILCT     TOO MANY <FILES STATEMENTS>?
      JMP *+4       NO
      STB SPTR      YES--RESET STATEMENT POINTER
      JSB DCMPL 
      JSB RERRS+34,I EXTRA <FILES STATEMENT>
      INB 
      STB FILPT,I   SAVE POINTER TO <FILES STATEMENT
      ISZ FILPT 
      LDB NSPTR     SKIP OVER REST
      JMP PRN22       OF STATEMENT               [B]
PRNS5 LDB SPTR
      CPA MATOP     'MAT' STATEMENT?
      INB,RSS       YES, BUMP TO NEXT WORD
      JMP *+3       NO
      LDA B,I       EXTRACT 
      AND OPMSK       OPERATOR
      CPA PRTOP     'PRINT' STATEMENT?
      INB,RSS       YES, BUMP TO NEXT WORD
      JMP PRNS6     NO
      LDA 1,I       EXTRACT 
      AND OPMSK       OPERATOR
      CPA USEOP     'USING' STATEMENT?
      CCA,RSS       YES, SET (A)
      RSS           NO
      STA USESN     SET 'USING SEEN' FLAG 
PRNS6 STA INFST     SET INTEGER FOLLOWS FLAG
      RSS 
*                                    *
**  PROCESS NEXT WORD OF STATEMENT  **
*                                    *
PRNS2 ISZ SPTR      MOVE TO 
PRN21 LDB SPTR        NEXT WORD                  [B]
PRN22 CPB FILTB     DECOMPILE FINISHED?          [B]
      JMP DCMP3     YES 
      CPB NSPTR     NO, STATEMENT FINISHED? 
      JMP STEND,I   YES 
      LDA SPTR,I    NO, ISOLATE 
      AND OPMSK       OPERATOR
      CPA B1000     " ? 
      JMP PRNS3     YES 
      XOR SPTR,I    NO, GET OPERAND 
      SZA,RSS       NULL OPERAND? 
      JMP PRNS2     YES 
      RAL,CLE,ERA   NO, PUT FLAG BIT IN (E) 
      SZA,RSS       NUMBER? 
      JMP CMPL7     YES 
      JMP PRNST,I   NO
PRNS3 XOR SPTR,I    EXTRACT LENGTH
      ADA .+3       COMPUTE 
      ARS             POINTER 
      ADA SPTR          TO CLOSING
      STA SPTR            QUOTE 
      JMP PRN21                                  [B]
**                        **
***  'COMPILE' A SYMBOL  ***
**                        **
* 
*  ENTER WITH A SYMBOLIC NAME IN STMP1 AND SEARCH THE 
*  SYMBOL TABLE FOR A MATCHING ENTRY.  IF NO ENTRY IS 
*  FOUND, APPEND A NEW TWO WORD ENTRY WITH THE SYMBOL 
*  IN THE FIRST WORD AND 0 IN THE SECOND.  THE SYMBOL IN
*  THE PROGRAM IS REPLACED WITH THE ORDINAL NUMBER OF 
*  ITS SYMBOL TABLE ENTRY.  EXIT WITH THE NEW PROGRAM 
*  WORD IN (A), A POINTER TO THE SECOND WORD OF THE 
*  TABLE ENTRY IN STMP2, AND THE STATEMENT TYPE IN (B). 
* 
#SSYM LDA .+4       INSURE SPACE
      JSB CUSP        FOR NEW ENTRY 
      LDA STMP1     RETRIEVE SYMBOL 
      LDB SYMTB 
SYMT1 CPB PBPTR     SYMBOL TABLE EXHAUSTED? 
      JMP SYMT3     YES 
      CPA 1,I       NO, IS NEXT SYMBOL A MATCH? 
      JMP SYMT5     YES 
      ADB .+2       NO, MOVE
      JMP SYMT1       TO NEXT ENTRY 
*                                   * 
**  HANDLE UNMATCHED ARRAY SYMBOL  ** 
*                                   * 
SYMT2 CPA STMP1     "DON'T KNOW" SYMBOL?
      RSS           YES 
      JMP SYMT3     NO, MAKE NORMAL TABLE ENTRY 
      ISZ PBPTR     ALLOCATE SPACE
      ISZ PBPTR       FOR NEW ENTRY 
      LDA STMP2     WAS A SINGLE OR DOUBLE
      INA,SZA         SUBSCRIPTED ENTRY FOUND?
      JMP SYMT4     YES, INCLUDE POINTER IN ENTRY 
      STA 1,I       NO, SAVE SPACE FOR LATER ENTRY
      ADB .+2         WITH NUMBER OF DIMENSIONS 
*                              *
**  CREATE A NEW TABLE ENTRY  **
*                              *
SYMT3 ISZ PBPTR     ALLOCATE SPACE
      ISZ PBPTR       FOR NEW ENTRY 
      CLA           INITIALIZE
SYMT4 INB             SECOND
      STA 1,I           WORD
      ADB .-1       PUT SYMBOL
      LDA STMP1       IN FIRST
      STA 1,I           WORD
*                            *
**  'COMPILE' PROGRAM WORD  **
*                            *
SYMT5 INB           COMPUTE 
      STB STMP2 
      CMB             RELATIVE
      ADB SYMTB 
      CMB,INB           ADDRESS 
      BRS 
      LDA SPTR,I    REPLACE SYMBOL
      AND OPMSK       IN PROGRAM
      IOR 1             WITH RELATIVE 
      STA SPTR,I          ADDRESS 
      LDB STYPE     LOAD STATEMENT TYPE 
      JMP SSYMT,I 
      SKP 
