
Spec_Trig_Prog_Fire    IDNT             ; title Specific Trigger Programming

      SECTION  Sect_Spec_Trig_Prog_Fire,4,C     ; Declare a noncommon code
                                                ; section. Align to longword.

***************************************************************************
*   Specific Trigger Program Fire                    Rev.  23-SEPT-1991   *
*                                                                         *
*   This routine is used with the January 1991 COMINT PROM's to build     *
*   the event to event dynamic part of the of the Specific Trigger        *
*   Programming Information that is used in building the Jet Lists (i.e.  *
*   D0 Note Items 4895...4910).  To build this event to event dynamic     *
*   data the event to event static Specific Trigger Programming           *
*   Information (i.e. D0 Note 967 Items 4861...4892 the lists of which    *
*   Specific Triggers are Programmed to use which Reference Sets) is      *
*   multiplied by the list of Specific Triggers that Fired for this       *
*   event (D0 Note 967 Items 499...452).                                  *
*                                                                         *
*     Registers used in this routine:                                     *
*                                                                         *
*   A1   Pointer to the lists of Spec Trigs that use a Ref Set and Fired. *
*                                                                         *
*   D1   Temporary storage of the Specific Triggers Fired for this event. *
*   D2   Temporary work register.                                         *
*   D3   Temporary work register.                                         *
*                                                                         *
***************************************************************************

***************************************************************************
*                                                                         *
*   Build a list of Specific Triggers that Fired for this event in D1.    *
*   Specific Trigger 0 is in the LSB and Specific Trigger 31 is in the    *
*   MSB.   A "1" in this data register implies that the associated        *
*   Specific Trigger has fired for this event.  Store this list of Spec   *
*   Trig's Fired at location TrgsFired and leave it in reg D1 on exiting. *
*                                                                         *
*   Recall how the Spec Trig's Fired information is stored in VME memory  *
*   with VMX Address line MDA01 inverted:                                 *
*                                                                         *
*    VME       3     2 2     1 1                                          *
*    Addrs     1     4 3     6 5     8 7     0       Bits in a long word  *
*    -----     -     - -     - -     - -     -                            *
*             ---------------------------------                           *
*    300380   |       |       |       |       |                           *
*             ---------------------------------                           *
*    300384   |       | 2nd B |       | 1st B |      Bytes of Specific    *
*             ---------------------------------      Triggers Fired Data  *
*    300388   |       | 4th B |       | 3rd B |      in VME Memory.       *
*             ---------------------------------                           *
*    30038C   |       |       |       |       |                           *
*             ---------------------------------                           *
*                                                                         *
***************************************************************************

Begin_Spec_Trig_Prog_Fire    CLR.L  D1    ; Clear the data registers that will
                             CLR.L  D2    ;   used in this program section.
                             CLR.L  D3    ;

        MOVEA.L  #BAPrgFire,A1       ; Load the base address for the
                                     ;  lists of Specific Trigs that were
                                     ;  programmed to use a given Ref Set
                                     ;  and that Fired on this event.


                                     ; Build the List of Spec Triggers Fired.
                                     ; TrgFire is the symbol for the addrss of
                                     ; the long word that contains 2nd and 1st
                                     ; bytes of the raw Spec Trig Fired data.

        Move.L   TrgFire+4,D2        ; Get Spec Trigs Fired 4th and 3rd bytes.
        Move.L   D2,D1               ;
        LSR.L    #8,D1               ;
        Move.B   D2,D1               ;
        LSL.L    #8,D1               ; D1 now looks like:
                                     ;
                                     ;     3     2 2     1 1
                                     ;     1     4 3     6 5     8 7     0
                                     ;    ---------------------------------
                                     ;    | junk  | 4th B | 3rd B |  junk |
                                     ;    ---------------------------------
                                     ;
        Move.L   TrgFire,D2          ; Get Spec Trigs Fired 2nd and 1st bytes.
        Swap     D2                  ;
        Move.B   D2,D1               ;
        Swap     D2                  ;
        LSL.L    #8,D1               ;
        Move.B   D2,D1               ; D1 now looks like:
                                     ;
                                     ;     3     2 2     1 1
                                     ;     1     4 3     6 5     8 7     0
                                     ;    ---------------------------------
                                     ;    | 4th B | 3rd B | 2nd B | 1st B |
                                     ;    ---------------------------------
                                     ;

        Move.L   D1,TrgsFired        ; Store the list of Specific Triggers
                                     ; Fired in location TrgsFired and
                                     ; leave it in reg D1 when routine exits.

***************************************************************************
*                                                                         *
*   Build a list of Specific Triggers that were programmed to use EM      *
*   Reference Set 0  AND  that Fired for this event.  Store this in the   *
*   event to event dynamic part of the Specific Trigger Programming       *
*   section of the L1 Data Block  (D0 Note 967 Items 4895...4896).        *
*                                                                         *
*   Recall the format of the Spec Trig Programming information as stored  *
*   in VME memory with VMX line MDA01 inverted.   EMRefPrg0 is the        *
*   symbol for the address of the first long word of information about    *
*   which Specific Triggers depend on EM Ref Set 0.                       *
*                                                                         *
*                                                                         *
*    VME       3     2 2     1 1                                          *
*    Addrs     1     4 3     6 5     8 7     0       Bits in a long word  *
*    -----     -     - -     - -     - -     -                            *
*             ---------------------------------                           *
*    301FB8   |       | 2nd B |       | 1st B |      Bytes of Specific    *
*             ---------------------------------      Trigger Programming  *
*    301FBB   |       | 4th B |       | 3rd B |      information.         *
*             ---------------------------------      Example for          *
*                                                    EM Reference Set 0   *
***************************************************************************

        Move.L   EMRef0Prg+4,D3      ; Bytes 4 and 3 loaded into D3.
        Move.L   D3,D2               ; Bytes 4 and 3 moved into D2.
        LSR.L    #8,D2               ; Shift byte 4 one byte to the right.
        Move.B   D3,D2               ; Byte 3 moved into D2 again.
        LSL.L    #8,D2               ; Bytes 4 and 3 are now in proper order.
        Move.L   EMRef0Prg,D3        ; Bytes 2 and 1 loaded into D3.
        Swap     D3                  ; Byte 2 is now the LSByte in D3.
        Move.B   D3,D2               ; Byte 2 moved into D2.
        Swap     D3                  ; Byte 1 is now the LSByte in D3.
        LSL.L    #8,D2               ; Shift bytes 4, 3, and 2 to the left.
        Move.B   D3,D2               ; Byte 1 moved into D2.  Bytes 4, 3, 2,
                                     ; and 1 are now in D2 in proper order.

        AND.L    D1,D2               ; AND the Programming and Fired data.
        MOVE.L   D2,(A1)+            ; Store it on the list.

***************************************************************************
*                                                                         *
*   Build a list of Specific Triggers that were programmed to use EM      *
*   Reference Set 1  AND  that Fired for this event.  Store this in the   *
*   event to event dynamic part of the Specific Trigger Programming       *
*   section of the L1 Data Block  (D0 Note 967 Items 4897...4898).        *
*                                                                         *
***************************************************************************


        Move.L   EMRef1Prg+4,D3      ; Bytes 4 and 3 loaded into D3.
        Move.L   D3,D2               ; Bytes 4 and 3 moved into D2.
        LSR.L    #8,D2               ; Shift byte 4 one byte to the right.
        Move.B   D3,D2               ; Byte 3 moved into D2 again.
        LSL.L    #8,D2               ; Bytes 4 and 3 are now in proper order.
        Move.L   EMRef1Prg,D3        ; Bytes 2 and 1 loaded into D3.
        Swap     D3                  ; Byte 2 is now the LSByte in D3.
        Move.B   D3,D2               ; Byte 2 moved into D2.
        Swap     D3                  ; Byte 1 is now the LSByte in D3.
        LSL.L    #8,D2               ; Shift bytes 4, 3, and 2 to the left.
        Move.B   D3,D2               ; Byte 1 moved into D2.  Bytes 4, 3, 2,
                                     ; and 1 are now in D2 in proper order.

        AND.L    D1,D2               ; AND the Programming and Fired data.
        MOVE.L   D2,(A1)+            ; Store it on the list.

***************************************************************************
*                                                                         *
*   Build a list of Specific Triggers that were programmed to use EM      *
*   Reference Set 2  AND  that Fired for this event.  Store this in the   *
*   event to event dynamic part of the Specific Trigger Programming       *
*   section of the L1 Data Block  (D0 Note 967 Items 4899...4900).        *
*                                                                         *
***************************************************************************


        Move.L   EMRef2Prg+4,D3      ; Bytes 4 and 3 loaded into D3.
        Move.L   D3,D2               ; Bytes 4 and 3 moved into D2.
        LSR.L    #8,D2               ; Shift byte 4 one byte to the right.
        Move.B   D3,D2               ; Byte 3 moved into D2 again.
        LSL.L    #8,D2               ; Bytes 4 and 3 are now in proper order.
        Move.L   EMRef2Prg,D3        ; Bytes 2 and 1 loaded into D3.
        Swap     D3                  ; Byte 2 is now the LSByte in D3.
        Move.B   D3,D2               ; Byte 2 moved into D2.
        Swap     D3                  ; Byte 1 is now the LSByte in D3.
        LSL.L    #8,D2               ; Shift bytes 4, 3, and 2 to the left.
        Move.B   D3,D2               ; Byte 1 moved into D2.  Bytes 4, 3, 2,
                                     ; and 1 are now in D2 in proper order.

        AND.L    D1,D2               ; AND the Programming and Fired data.
        MOVE.L   D2,(A1)+            ; Store it on the list.

***************************************************************************
*                                                                         *
*   Build a list of Specific Triggers that were programmed to use EM      *
*   Reference Set 3  AND  that Fired for this event.  Store this in the   *
*   event to event dynamic part of the Specific Trigger Programming       *
*   section of the L1 Data Block  (D0 Note 967 Items 4901...4902).        *
*                                                                         *
***************************************************************************

        Move.L   EMRef3Prg+4,D3      ; Bytes 4 and 3 loaded into D3.
        Move.L   D3,D2               ; Bytes 4 and 3 moved into D2.
        LSR.L    #8,D2               ; Shift byte 4 one byte to the right.
        Move.B   D3,D2               ; Byte 3 moved into D2 again.
        LSL.L    #8,D2               ; Bytes 4 and 3 are now in proper order.
        Move.L   EMRef3Prg,D3        ; Bytes 2 and 1 loaded into D3.
        Swap     D3                  ; Byte 2 is now the LSByte in D3.
        Move.B   D3,D2               ; Byte 2 moved into D2.
        Swap     D3                  ; Byte 1 is now the LSByte in D3.
        LSL.L    #8,D2               ; Shift bytes 4, 3, and 2 to the left.
        Move.B   D3,D2               ; Byte 1 moved into D2.  Bytes 4, 3, 2,
                                     ; and 1 are now in D2 in proper order.

        AND.L    D1,D2               ; AND the Programming and Fired data.
        MOVE.L   D2,(A1)+            ; Store it on the list.

***************************************************************************
*                                                                         *
*   Build a list of Specific Triggers that were programmed to use TEt     *
*   Reference Set 0  AND  that Fired for this event.  Store this in the   *
*   event to event dynamic part of the Specific Trigger Programming       *
*   section of the L1 Data Block  (D0 Note 967 Items 4903...4904).        *
*                                                                         *
***************************************************************************

        Move.L   TEtRef0Prg+4,D3     ; Bytes 4 and 3 loaded into D3.
        Move.L   D3,D2               ; Bytes 4 and 3 moved into D2.
        LSR.L    #8,D2               ; Shift byte 4 one byte to the right.
        Move.B   D3,D2               ; Byte 3 moved into D2 again.
        LSL.L    #8,D2               ; Bytes 4 and 3 are now in proper order.
        Move.L   TEtRef0Prg,D3       ; Bytes 2 and 1 loaded into D3.
        Swap     D3                  ; Byte 2 is now the LSByte in D3.
        Move.B   D3,D2               ; Byte 2 moved into D2.
        Swap     D3                  ; Byte 1 is now the LSByte in D3.
        LSL.L    #8,D2               ; Shift bytes 4, 3, and 2 to the left.
        Move.B   D3,D2               ; Byte 1 moved into D2.  Bytes 4, 3, 2,
                                     ; and 1 are now in D2 in proper order.

        AND.L    D1,D2               ; AND the Programming and Fired data.
        MOVE.L   D2,(A1)+            ; Store it on the list.

***************************************************************************
*                                                                         *
*   Build a list of Specific Triggers that were programmed to use TEt     *
*   Reference Set 1  AND  that Fired for this event.  Store this in the   *
*   event to event dynamic part of the Specific Trigger Programming       *
*   section of the L1 Data Block  (D0 Note 967 Items 4905...4906).        *
*                                                                         *
***************************************************************************

        Move.L   TEtRef1Prg+4,D3     ; Bytes 4 and 3 loaded into D3.
        Move.L   D3,D2               ; Bytes 4 and 3 moved into D2.
        LSR.L    #8,D2               ; Shift byte 4 one byte to the right.
        Move.B   D3,D2               ; Byte 3 moved into D2 again.
        LSL.L    #8,D2               ; Bytes 4 and 3 are now in proper order.
        Move.L   TEtRef1Prg,D3       ; Bytes 2 and 1 loaded into D3.
        Swap     D3                  ; Byte 2 is now the LSByte in D3.
        Move.B   D3,D2               ; Byte 2 moved into D2.
        Swap     D3                  ; Byte 1 is now the LSByte in D3.
        LSL.L    #8,D2               ; Shift bytes 4, 3, and 2 to the left.
        Move.B   D3,D2               ; Byte 1 moved into D2.  Bytes 4, 3, 2,
                                     ; and 1 are now in D2 in proper order.

        AND.L    D1,D2               ; AND the Programming and Fired data.
        MOVE.L   D2,(A1)+            ; Store it on the list.

***************************************************************************
*                                                                         *
*   Build a list of Specific Triggers that were programmed to use TEt     *
*   Reference Set 2  AND  that Fired for this event.  Store this in the   *
*   event to event dynamic part of the Specific Trigger Programming       *
*   section of the L1 Data Block  (D0 Note 967 Items 4907...4908).        *
*                                                                         *
***************************************************************************

        Move.L   TEtRef2Prg+4,D3     ; Bytes 4 and 3 loaded into D3.
        Move.L   D3,D2               ; Bytes 4 and 3 moved into D2.
        LSR.L    #8,D2               ; Shift byte 4 one byte to the right.
        Move.B   D3,D2               ; Byte 3 moved into D2 again.
        LSL.L    #8,D2               ; Bytes 4 and 3 are now in proper order.
        Move.L   TEtRef2Prg,D3       ; Bytes 2 and 1 loaded into D3.
        Swap     D3                  ; Byte 2 is now the LSByte in D3.
        Move.B   D3,D2               ; Byte 2 moved into D2.
        Swap     D3                  ; Byte 1 is now the LSByte in D3.
        LSL.L    #8,D2               ; Shift bytes 4, 3, and 2 to the left.
        Move.B   D3,D2               ; Byte 1 moved into D2.  Bytes 4, 3, 2,
                                     ; and 1 are now in D2 in proper order.

        AND.L    D1,D2               ; AND the Programming and Fired data.
        MOVE.L   D2,(A1)+            ; Store it on the list.

***************************************************************************
*                                                                         *
*   Build a list of Specific Triggers that were programmed to use TEt     *
*   Reference Set 3  AND  that Fired for this event.  Store this in the   *
*   event to event dynamic part of the Specific Trigger Programming       *
*   section of the L1 Data Block  (D0 Note 967 Items 4909...4910).        *
*                                                                         *
***************************************************************************


        Move.L   TEtRef3Prg+4,D3     ; Bytes 4 and 3 loaded into D3.
        Move.L   D3,D2               ; Bytes 4 and 3 moved into D2.
        LSR.L    #8,D2               ; Shift byte 4 one byte to the right.
        Move.B   D3,D2               ; Byte 3 moved into D2 again.
        LSL.L    #8,D2               ; Bytes 4 and 3 are now in proper order.
        Move.L   TEtRef3Prg,D3       ; Bytes 2 and 1 loaded into D3.
        Swap     D3                  ; Byte 2 is now the LSByte in D3.
        Move.B   D3,D2               ; Byte 2 moved into D2.
        Swap     D3                  ; Byte 1 is now the LSByte in D3.
        LSL.L    #8,D2               ; Shift bytes 4, 3, and 2 to the left.
        Move.B   D3,D2               ; Byte 1 moved into D2.  Bytes 4, 3, 2,
                                     ; and 1 are now in D2 in proper order.

        AND.L    D1,D2               ; AND the Programming and Fired data.
        MOVE.L   D2,(A1)+            ; Store it on the list.

    RTS


***************************************************************************
*                                                                         *
*   Define the constants that are used in this Program Section.           *
*                                                                         *
*   Export the following symbols to other program modules:                *
*     Begin_Spec_Trig_Prog_Fire   this is the label for the entry         *
*                                 point for this routine.                 *
*     BAPrgFire  this is the Base Address of this lists of Specific       *
*                Triggers that were programmed to us a given Ref Set      *
*                AND that fired on this event.                            *
*                                                                         *
*   Import the following symbols from the Main_Symbols program module:    *
*     TrgFire    this is the VME base address in the raw data block for   *
*                the list of Specific Triggers that fired on this event.  *
*     TrgsFired  this is the storage location for the Spec Trig's         *
*                Fired list long word.                                    *
*     EMRef0Prg    VME Base Address for the list of                       *
*                    Specific Trigs that use EM Ref Set 0                 *
*     EMRef1Prg    VME Base Address for the list of                       *
*                    Specific Trigs that use EM Ref Set 1                 *
*     EMRef2Prg    VME Base Address for the list of                       *
*                    Specific Trigs that use EM Ref Set 2                 *
*     EMRef3Prg    VME Base Address for the list of                       *
*                    Specific Trigs that use EM Ref Set 3                 *
*                                                                         *
*     TEtRef0Prg    VME Base Address for the list of                      *
*                     Specific Trigs that use TEt Ref Set 0               *
*     TEtRef1Prg    VME Base Address for the list of                      *
*                     Specific Trigs that use TEt Ref Set 1               *
*     TEtRef2Prg    VME Base Address for the list of                      *
*                     Specific Trigs that use TEt Ref Set 2               *
*     TEtRef3Prg    VME Base Address for the list of                      *
*                     Specific Trigs that use TEt Ref Set 3               *
*                                                                         *
*     BAPrgFire    VME Base Address for the lists of Specific             *
*                  Triggers that were both Programmed to use a            *
*                  given Ref Set AND that fired on this event.            *
*                                                                         *
***************************************************************************

       XDEF  Begin_Spec_Trig_Prog_Fire                   ; Symbols that will
                                                         ; be referenced
                                                         ; externally to this
                                                         ; Program Module.

       XREF   TrgFire,TrgsFired                          ; Symbols that are
       XREF   EMRef0Prg,EMRef1Prg,EMRef2Prg,EMRef3Prg    ; referenced in this
       XREF   TEtRef0Prg,TEtRef1Prg                      ; module but defined
       XREF   TEtRef2Prg,TEtRef3Prg                      ; in another module.
       XREF   BAPrgFire

       END

