@HDG,P    TEST
@FOR,IS   TEST,TEST
      INTEGER DBANK(78),CM(35),MM(35)
      EQUIVALENCE (DBANK(1),CTBE),(DBANK(2),CNFTR),(DBANK(3),RULE)
      EQUIVALENCE (DBANK(4),DVEC),(DBANK(5),NRULES),(DBANK(9),CM)
      EQUIVALENCE (DBANK(44),MM)
      INTEGER CTBE/O377777777777/,DVEC/1/,NRULES/35/,CNFTR
      DATA CM/O1,O2,O4,O10,O20,O40,O100,O200,O400,O1000,O2000,O4000,
     1        O10000,O20000,O40000,O100000,O200000,O400000,O1000000,
     2        O2000000,O4000000,O10000000,O20000000,O40000000,
     3        O100000000,O200000000,O400000000,O1000000000,O2000000000,
     4        O4000000000,O10000000000,O20000000000,O40000000000,
     5        O100000000000,O200000000000/
      DO 1 I=1,NRULES
    1 MM(I)=CM(I)
      DO 4 I=1,NRULES
      DVEC=CM(I)
      CALL DETABX (DBANK)
    3 IF (CNFTR.EQ.0) GO TO 4
      CALL DETABA (DBANK)
      GO TO 3
    4 WRITE (6,6) DVEC,RULE
    6 FORMAT (' DVEC=',O12,', EXECUTE RULE',I3)
      END
@HDG,P    DETAB
@ASM,IS   DETAB,DETAB
.
.         DECISION TABLE ANALYSIS ROUTINE.
.         ROUTINE CAN HANDLE INDIVIDUAL DECISION TABLES HAVING UP
.         TO 36 CONDITIONS AND ANY NUMBER OF RULES.  THE RULE-MASK
.         TECHNIQUE OF EVALUATION IS USED.
.
.         CALLING SEQUENCES:
.
.         LMJ       X11,DETABX
.         +         DBANK     DATA BANK ADDRESS -- SEE BELOW.
.         +         WK$BX     FORTRAN WALK-BACK.
.         RETURNS HERE
.
.         OR
.
.         LA,U      A0,DBANK  DATA BANK ADDRESS -- SEE BELOW.
.         LMJ       X11,DETABY
.
.         IN FORTRAN:
.
.         CALL DETABX (DBANK)
.
/.
.         DATA BANK FORMAT:
.
.         CTBE                1-WORD BIT MAP DEFINING CONDITIONS TO
.                             BE EVALUATED.  SET A 1 IN THE BIT
.                             POSITION(S) CORRESPONDING TO ANY
.                             CONDITION(S) THAT MUST BE EVALUATED.
.
.         CNFTR               1-WORD BIT MAP DEFINING CONDITIONS
.                             NECESSARY FOR THIS RULE.  THIS VALUE
.                             IS SET BY THIS ROUTINE (SEE BELOW).
.
.         RULE                THIS IS THE RULE THIS ROUTINE HAS
.                             SELECTED IF CNFTR IS ZERO, OR THE RULE
.                             THIS ROUTINE IS WORKING ON IF CNFTR
.                             IS NOT ZERO.  DO NOT CHANGE THIS VALUE.
.
.         DVEC                THIS IS THE DATA VECTOR USED FOR DECISION
.                             MAKING.  SET A 1 IN THE BIT POSITIONS
.                             CORRESPONDING TO ANY CONDITIONS THAT ARE
.                             TRUE, AND A ZERO IN THE BIT POSITIONS
.                             CORRESPONDING TO ANY CONDITIONS THAT ARE
.                             FALSE OR HAVE NOT BEEN EVALUATED.
.
.         NRULES              THIS IS THE NUMBER OF RULES IN THE
.                             DECISION TABLE.
.
.         RES1-RES3           THESE 3 WORDS ARE RESERVED FOR INTERNAL
.                             USE BY THIS ROUTINE AND MUST NOT BE
.                             TAMPERED WITH.
.
.         CM                  NRULES WORDS LONG, EACH WORD CORRESPONDING
.                             TO A RULE IN THE DECISION TABLE, AND EACH
.                             BIT IN A PARTICULAR WORD CORRESPONDING TO
.                             A CONDITION.  SET A 1 IN THE BIT
.                             POSITIONS CORRESPONDING TO ANY CONDITIONS
.                             WHICH MUST BE TRUE, AND A ZERO IN THE BIT
.                             POSITIONS CORRESPONDING TO ANY CONDITIONS
.                             THAT MUST BE FALSE.  CONDITIONS THAT DO
.                             NOT MATTER MAY HAVE EITHER VALUE.
.
.         MM                  NRULES WORDS LONG, EACH WORD CORRESPONDING
.                             TO A RULE IN THE DECISION TABLE, AND EACH
.                             BIT IN A PARTICULAR WORD CORRESPONDING TO
.                             A CONDITION.  SET A 1 IN THE BIT
.                             POSITIONS CORRESPONDING TO ANY CONDITIONS
.                             WHICH MUST BE TAKEN INTO CONSIDERATION,
.                             AND A ZERO IN THE BIT POSITIONS
.                             CORRESPONDING TO ANY CONDITIONS WHICH MUST
.                             NOT BE TAKEN INTO CONSIDERATION.
.
.
.         SO DBANK IS 2*NRULES+8 WORDS LONG.
/.
.         UPON RETURN FROM DETAB, IF CNFTR IS NON-ZERO, THE INDICATED
.         CONDITIONS MUST BE EVALUATED, AND DETAB MUST BE RE-ENTERED.
.
.         IF ANY CONDITIONS OTHER THAN THOSE INDICATED AS NECESSARY IN
.         CNFTR ARE EVALUATED, THE CORRESPONDING BIT IN CNFTR SHOULD BE
.         SET TO A 1 TO PREVENT RE-EVALUATION.  IF IT BECOMES
.         NECESSARY TO FORCE RE-EVALUATION OF A PARTICULAR CONDITION,
.         PLACE A 1 IN THE CORRESPONDING BIT POSITION OF CTBE, AND A
.         ZERO IN THE CORRESPONDING BIT POSITION OF CNFTR.  CTBE IS A
.         DYNAMIC INDICATOR USED BY THIS ROUNINE, AND CONSEQUENTLY IT'S
.         CONTENTS DURING AND AFTER EXECUTION ARE UNPREDICTABLE.  IT
.         SHOULD BE INITIALIZED BEFORE ENTRY TO DETABX OR DETABY
.         (WITH ALL 1 BITS), BUT NOT BEFORE RE-ENTRY TO DETABA OR
.         DETABB.
.
.         TO RE-ENTER DETAB, USE ONE OF THE FOLLOWING CALLING SEQUENCES:
.         LMJ       X11,DETABA
.         +         DBANK     DATA BANK ADDRESS
.         +         WK$BX     FORTRAN WALK-BACK
.
.         OR
.
.         LA,U      A0,DBANK  DATA BANK ADDRESS
.         LMJ       X11,DETABB
.
.         IN FORTRAN:
.
.         CALL DETABA(DBANK)
.
.         IF CNFTR IS ZERO, THE RULE NUMBER IN RULE IS SATISFIED, AND
.         THE CORRESPONDING ACTIONS SHOULD BE PERFORMED, OR IF RULE IS
.         ALSO ZERO THE ACTIONS ASSOCIATED WITH THE ELSE RULE SHOULD
.         BE PERFORMED.  IT IS THE USER'S RESPONSIBILITY TO KEEP TRACK
.         OF THE ACTIONS ASSOCIATED WITH EACH RULE.  A BIT MAP IS
.         SUGGESTED.
.
.         ALL TEMPORARY STORAGE NECESSARY FOR DETAB IS CONTAINED IN
.         DBANK, AND CONSEQUENTLY DETAB IS RE-ENTRANT AND MAY BE USED
.         TO EVALUATE CONDITIONS.
.
.         REGISTERS USED: X11, A0-A5, R1, R2.  NONE ARE SAVED.
/.
          AXR$
DBANK     EQU       A0
CTBE      EQUF      0,DBANK
CNFTR     EQUF      1,DBANK
RULE      EQUF      2,DBANK
DVEC      EQUF      3,DBANK
NRULES    EQUF      4,DBANK
SA12      EQUF      5,DBANK
SR1       EQUF      7,DBANK
CMADD     EQUF      8,DBANK
CM        EQU       A1
MM        EQU       A2
/.
DETABX*   LA        DBANK,0,X11       . GET DATA BANK ADDRESS
          AX,U      X11,2             . FIX X11 FOR RETURN
DETABY*   LA,U      CM,CMADD          . GET CM ADDRESS
          AU        CM,NRULES         . COMPUTE MM ADDRESS
          LXI,U     CM,1              . FIX CM
          LXI,U     MM,1              . AND MM INCREMENTERS
          LR        R1,NRULES         . SETUP LOOP COUNTER
          SZ        RULE              . INITIALIZE RULE NUMBER
          JGD       R1,LOOP           . FIX LOOP COUNTER
.
.         DO DECISION TABLE ANALYSIS
.
LOOP      LA        A3,RULE
          AA,U      A3,1
          SA        A3,RULE           . UPDATE RULE NUMBER
          LA        A3,CTBE           . GET CTBE
          AND       A3,0,MM           . COMPUTE CNFTR
          TN        A4
          JZ        A4,NOEXT          . A4=0 MEANS NO EXTERNAL EVAL.
          SA        A4,CNFTR          . GIVE USER CNFTR
          DS        CM,SA12           . SAVE CM AND MM ADDRESSES
          SR        R1,SR1            . SAVE LOOP COUNTER
          J         0,X11             . RETURN TO USER
DETABA*   LA        DBANK,0,X11       . RETRIVE DBANK ADDRESS
          AX,U      X11,2             . FIX INDEX FOR EXIT
DETABB*   DL        CM,SA12           . RETRIEVE CM AND MM ADDRESSES
          LR        R1,SR1            . RETRIEVE LOOP COUNTER
          LNA       A3,CNFTR
          LR        R2,A3
          MLU       A3,CTBE
          SA        A4,CTBE           . UPDATE CTBE
NOEXT     LA        A3,DVEC           . GET DECISION VECTOR
          XOR       A3,0,*CM          . XOR WITH CV AND UPDATE CM ADDR
          AND       A4,0,*MM          . AND WITH MV AND UPDATE MM ADDR
          SZ        CNFTR             . CLEAR CNFTR IN CASE RULE OK
          TN        A5
          JZ        A5,0,X11          . EXIT IF RULE SATISFIED
          JGD       R1,LOOP           . GO TEST ANOTHER RULE
          SZ        RULE              . INDICATE ELSE RULE
          J         0,X11             . EXIT
          END
@FOR,IL T,T
      INTEGER DETAB(13),DV,SVN
      DATA DETAB/0,0,5,4,2,5,1,2,7,3,7,5,6/,SVN/7/
      DV=0
    1 DETAB(1)=SVN
      CALL DETABX (DETAB,DV)
    2 IF (DETAB (1).EQ.0) GO TO 3
      CALL DETAB1
      GO TO 2
    3 WRITE (6,60) DV,DETAB(2)
      DV=DV+1
      IF (DV.LE.7) GO TO 1
      STOP
   60 FORMAT (' DV=',O2,' EXECUTE RULE',I2)
      END
@ASM,IS  DETAB,DETAB
       AXR$
.
.      DECISION TABLE EVALUATION ROUTINE.
.
.      CALLING SEQURNCE:
.      LMJ     X11,DETABX
.      +       DETAB              . DECISION TABLE ADDRESS.
.      +       DV                 . DECISION VECTOR ADDRESS.
.      +       DUMMY WORD  (IN FORTRAN WILL BE WALK-BACK PACKET ADDRESS).
.
.      IN FORTRAN:
.      CALL DETABX (DETAB,DV)
.
.      DETAB FORMAT:
.      CTBE                       . 1-WORD BIT MAP DEFINING CONDITIONS
.                                 . REMAINING TO BE EVALUATED.
.      RULE                       . CURRENT RULE NUMBER.
.      NR                         . NUMBER OF RULES.
.      CM                         . CONDITION MATRIX - NR WORDS LONG.
.      MM                         . MASK MATRIX - NR WORDS LONG.
.      SO DETAB IS 2*NR+3 WORDS LONG.
.
.      ON ENTRY, SET CTBE TO ALL 1'S TO INDICATE THAT ALL CONDITIONS
.      HAVE YET TO BE EVALUATED, OR IF SOME CONDITIONS HAVE BEEN
.      EVALUATED, SET THE CORRESPONDING BITS OF CTBE TO ZERO.
.
.      ON EXIT, IF CTBE IS NON-ZERO, EVALUATE THE INDICATED CONDITIONS
.      AND CALL DETAB1.  DO NOT CHANGE RULE.  IF ANY CONDITIONS ARE EVALUATED
.      OTHER THAN THOSE INDICATED IN CTBE, INSERT A 1 IN THE CORRESPONDING
.      POSITION OF CTBE.  THIS IS NOT NECESSARY, BUT COULD SPEED UP EXECUTION.
.      ALSO NOTE THAT ASSEMBLY LANGUAGE CALLS TO DETAB1 MUST BE FOLLOWED
.      BY A DUMMY WORD.  (FORTRAN WILL SUPPLY WALK-BACK PACKET ADDRESS).
.
.      CAUTION -- DETABX IS NOT RECURSIVE, SO IT MAY NOT BE USED TO
.      EVALUATE CONDITIONS.
.
.      IF CTBE IS ZERO, EXECUTE THE ACTIONS CORRESPONDING TO THE
.      RULE-NUMBER IN RULE.
.
.      IF BOTH CTBE AND RULE ARE ZERO, NO RULES WERE SATISFIED AND
.      THE ACTIONS CORRESPONDING TO THE ELSE RULE SHOULD BE EXECUTED.
.
.      IT IS THE USER'S RESPONSIBILITY TO KEEP TRACK OF WHICH ACTIONS
.      ARE TO BE EXECUTED FOR EACH RULE.  A BIT MAP IS SUGGESTED.
.
.      IT IS RECOMMENDED THAT THE USER ACCUMULATE STATISTICS ON RULE EXECUTION
.      FREQUENCY, AND ARRANGE THE DECISION TABLE SO THAT MOST FREQUENTLY
.      EXECUTED RULES ARE TESTED BEFORE LESS FREQUENTLY EXECUTED RULES.
.
.      REGISTERS USED:  A0-A5 AND R1.  NONE ARE RESTORED.
/
.
.      EQUATES.
.
DETAB  EQU     A0                 . DECISION TABLE ADDRESS.
CM     EQU     A1                 . CONDITION MATRIX ADDRESS.
MM     EQU     A2                 . MASK MATRIX ADDRESS.
LCTBE  EQUF    0,DETAB            . LOCAL CTBE ADDRESS (CURRENT RULE).
RULE   EQUF    1,DETAB            . RULE NUMBER.
.
DETABX*
       LA      A0,1,X11           . GET DECISION VECTOR ADDRESS.
       SA      A0,DVA             . SAVE DECISION VECTOR ADDRESS.
       LA      DETAB,0,X11        . GET DETAB ADDRESS.
       LA,U    CM,3,DETAB         . COMPUTE CM ADDRESS.
       LA      MM,2,DETAB
       AA,U    MM,0,CM            . COMPUTE MM ADDRESS.
       LXI,U   CM,1
       LXI,U   MM,1               . SETUP INCREMENTERS.
       LR      R1,2,DETAB         . GET NR.
       JGD     R1,$+1             . SETUP LOOP COUNT.
       SZ      RULE               . SET NUMBER OF RULES TO ZERO.
       LA      A3,LCTBE           . GET INITIAL CTBE.
       SA      A3,CTBE            . SAVE AS GLOBAL CTBE.
       AX,U    X11,2              . FIX X11 FOR EXIT.
.
.      DECISION TABLE ANALYSIS
.
LOOP   LA      A3,RULE            . GET RULE NUMBER.
       AA,U    A3,1               . INCREMENT RULE NUMBER
       SA      A3,RULE            . SAVE NEW RULE NUMBER.
       LA      A3,CTBE            . GET CTBE.
       AND     A3,0,MM            . COMPUTE NEW LOCAL CTBE.
       JZ      A4,NOEXT           . IF ZERO, NO EXTERNAL EVALUATION NEEDED.
       SA      A4,LCTBE           . SAVE LOCAL CTBE.
       DS      A0,SA01
       SA      A2,SA2
       SR      R1,SR1             . SAVE REGISTERS.
       J       1,X11              . EXIT FOR EXTERNAL EVALUATION.
DETAB1*
       DL      A0,SA01
       LA      A2,SA2
       LR      R1,SR1             . RESTORE REGISTERS.
       LNA     A3,LCTBE           . GET COMPLEMENT OF OLD LOCAL CTBE.
       AND     A3,CTBE            . UPDATE GLOBAL CTBE.
       SA      A4,CTBE            . STORE NEW GLOBAL CTBE.
NOEXT  LA      A3,*DVA            . GET DECISION VECTOR.
       XOR     A3,0,*CM           . XOR WITH CV AND UPDATE CM ADDRESS.
       AND     A4,0,*MM           . AND WITH MV AND UPDATE MM ADDRESS.
       SZ      LCTBE              . CLEAR LOCAL CTBE IN CASE RULE SATISFIED.
       JZ      A5,1,X11           . EXIT IF RULE SATISFIED.
       JGD     R1,LOOP            . GO TEST ANOTHER RULE.
       SZ      RULE               . ALL RULES TESTED. INDICATE ELSE RULE.
       J       1,X11              . EXIT.
.
.      INTERMEDIATE STORAGE.
.
$(1)
CTBE   RES     1                  . GLOBAL CTBE.
DVA    RES     1                  . DECISION VECTOR ADDRESS.
SA01   RES     2                  . SAVE A0/A1
SA2    RES     1                  . SAVE A2
SR1    RES     1                  . SAVE R1.
       END
@HDG,P    DETAB
@ASM,IS   DETAB,DETAB
.
.         DECISION TABLE ANALYSIS ROUTINE.
.         THIS ROUTINE CAN HANDLE INDIVIDUAL DECISION TABLES HAVING
.         UP TO 35 CONDITIONS AND ANY NUMBER OF RULES.  THIS ROUTINE
.         WILL RUN IN EITHER REGISTER SET, AND IS RE-ENTRANT AND
.         RECURSIVE (WITH CARE).  THE RULE-MASK TECHNIQUE OF EVALUATION
.         IS USED.  DO NOT USE THE SIGN BIT.
.
.         CALLING SEQUENCES:
.         LA        A1,(DETAB)
.         LA        A0,(SCRATCH)
.         LMJ       X11,DETABX
.
.         DECISION TABLE FORMAT:
.
.         NRULES    THIS IS THE NUMBER OF RULES IN THE
.                   DECISION TABLE.
.
.         CM        NRULES WORDS LONG, EACH WORD CORRESPONDING TO A
.                   RULE IN THE DECISION TABLE, AND EACH BIT IN A
.                   PARTICULAR WORD CORRESPONDING TO A CONDITION.  SET
.                   A 1 IN THE BIT POSITIONS CORRESPONDING TO ANY
.                   CONDITIONS WHICH MUST BE TRUE IF THIS RULE IS TO BE
.                   SATISFIED, AND A ZERO IN THE BIT POSITION
.                   CORRESPONDING TO ANY CONDITIONS THAT MUST BE FALSE.
.                   CONDITIONS THAT DO NOT MATTER MAY HAVE THE
.                   CORRESPONDING BIT SET TO EITHER VALUE.
.
.         MM        NRULES WORDS LONG, EACH WORD CORRESPONDING TO A RULE
.                   IN THE DECISION TABLE, AND EACH BIT IN A PARTICULAR
.                   WORD CORRESPONDING TO A CONDITION.  SET A 1 IN THE
.                   BIT POSITIONS CORRESPONDING TO ANY CONDITIONS THAT
.                   MUST BE TAKEN INTO CONSIDERATION, AND A ZERO IN THE
.                   BIT POSITIONS CORRESPONDING TO ANY CONDITIONS THAT
.                   MUST NOT BE TAKEN INTO CONSIDERATION.
.
.         SCRATCH FORMAT:
.
.         DVEC      THIS IS THE DATA VECTOR USED FOR DECISION MAKING.
.                   SET A 1 IN THE BIT POSITION CORRESPONDING TO ANY
.                   CONDITIONS THAT ARE TRUE, AND A ZERO IN THE BIT
.                   POSITIONS CORRESPONDING TO ANY CONDITIONS THAT ARE
.                   FALSE OR HAVE NOT BEEN EVALUATED.
.
.         CTBE      1-WORD BIT MAP DEFINING CONDITIONS REMAINING TO BE
.                   EVALUATED.  SET A 1 IN THE BIT POSITION(S)
.                   CORRESPONDING TO ANY CONDITIONS THAT MUST BE
.                   EVALUATED.  (NORMALLY INITIALIZED TO 0377777777777).
.
.         CNTETR    1-WORD BIT MAP DEFINING CONDITIONS NECESSARY TO
.                   EVALUATE THIS RULE.  THE VALUE OF CNTETR IS SET BY
.                   THIS ROUTINE.  (SEE BELOW).
.
.         RULE      THIS IS THE RULE THIS ROUTINE HAS SELECTED IF CNTETR
.                   IS ZERO, OR THE RULE THIS ROUTINE IS WORKING ON
.                   IF CNTETR IS NON-ZERO.  DON'T TAMPER WITH THIS CELL.
.
.         RES1-RES3 SCRATCH STORAGE RESERVED FOR INTERNAL USE BY THIS
.                   ROUTINE.  DON'T TAMPER WITH THESE CELLS.
/.
.         UPON RETURNING FROM DETABX, CNTETR WILL BE SET TO ZERO IF A
.         RULE IS SATISFIED.  IN THAT CASE A0 WILL CONTAIN THE SELECTED
.         RULE NUMBER.  IF CNTETR IS NON-ZERO, THE INDICATED CONDITIONS
.         MUST BE EVALUATED, AND DETAB RE-ENTERED VIA DETABY (SEE BELOW).
.
.         IF ANY CONDITIONS OTHER THAN THOSE INDICATED AS NECESSARY IN
.         CNTETR ARE EVALUATED, THE CORRESPONDING BIT SHOULD BE SET TO
.         1 TO INHIBIT RE-EVALUATION.  IF IT BECOMES NECESSARY TO FORCE
.         RE-EVALUATION OF A PARTICULAR CONDITION, SET A 1 IN THE
.         CORRESPONDING BIT POSITION OF CTBE AND A ZERO IN THE
.         CORRESPONDING BIT POSITION OF CNTETR.  CTBE IS A DYNAMIC
.         INDICATOR USED BY THIS ROUTINE, AND CONSEQUENTLY IT'S
.         CONTENTS DURING AND AFTER EXECUTION ARE UNPREDICTABLE.  IT
.         SHOULD BE INITIALIZED (NORMALLY WITH 0377777777777) PRIOR TO
.         ENTRY VIA DETABX, BUT NOT PRIOR TO RE-ENTRY VIA DETABY.
.
.         TO RE-ENTER DETAB VIA DETABY:
.
.         LA        A0,(SCRATCH)
.         LMJ       X11,DETABY
.
.         IF CNTETR IS ZERO, THE RULE NUMBER IN RULE IS SATISFIED, AND
.         THE CORRESPONDING ACTIONS SHOULD BE PERFORMED.  RULE NUMBER
.         ZERO IS THE ELSE RULE.  IT IS THE USER'S RESPONSIBILITY TO
.         KEEP TRACK OF THE ACTIONS TO BE PERFORMED FOR EACH RULE.
.
.         REGISTERS USED: X11, A0-A5, R2.  NONE ARE SAVED.
.
/.
          EQT
SCRATCH   EQU       A0                . APPEARS ONLY IN A-FIELD.
DVEC      EQUF      0,SCRATCH
CTBE      EQUF      1,SCRATCH
CNTETR    EQUF      2,SCRATCH
RULE      EQUF      3,SCRATCH
LAST      EQUF      4,SCRATCH
SAVE      EQUF      5,SCRATCH
CM        EQUF      A1
MM        EQUF      A2
.                                     . $H
DETABX*   LA        A2,0,A1           . $P GET NRULES
          SA        A2,LAST           . $P SAVE NRULES
          AU        CM,0,CM           . $P COMPUTE CM AND MM ADDRESSES
          LXI,U     CM,1              . $N A1=CM-1, A2=MM-1
          LXI,U     MM,1              . $P FIX CM AND MM INCREMENTERS
          SZ        RULE              . $P INITIALIZE RULE NUMBER
.
.         DO DECISION TABLE ANALYSIS
.
LOOP      LA        A3,RULE           . $P GET RULE NUMBER
          TLE       A3,LAST           . $T ALL DONE
          J         MORE              . $J MORE
          SZ        RULE              . $P CLEAR RULE NUMBER
          J         EXIT              . $J EXIT
MORE      AA,U      A3,1              . $P UPDATE RULE NUMBER
          AA,U      A3,1              . $N
          SA        A3,RULE           . $N
          LA        A3,CTBE           . $P GET CTBE
          AND       A3,0,MM           . $P COMPUTE CNTETR
          JZ        A4,NOEXT          . $T EXTERNAL EVALUATION NEEDED
                                      . $J NOEXT
          SA        A4,CNTETR         . $P GIVE USER CNTETR
          DS        CM,SAVE           . $P SAVE CM AND MM ADDRESSES
          J         0,X11             . $E
DETABY*   DL        CM,SAVE           . $PH RESTORE CM AND MM ADDRESSES
          LNA       A3,CNTETR         . $N
          SA        A3,CNTETR         . $N
          LR        R2,CNTETR         . $P GET -CNTETR IN R2
          MLU       A3,CTBE           . $N
          SA        A4,CTBE           . $P UPDATE CTBE
NOEXT     LA        A3,DVEC           . $P GET DATA VECTOR
          XOR       A3,1,*CM          . $P XOR WITH CV AND UPDATE CM ADD
          AND       A4,1,*MM          . $P AND WITH MV AND UPDATE MM ADD
          SZ        CNTETR            . $P CLEAR CNTETR IN CASE RULE OK
          JNZ       A5,LOOP           . $T RULE SATISFIED
                                      . $J LOOP
EXIT      LA        A0,RULE           . $P GET RULE NUMBER
          J         0,X11             . $E
          END
