
Move_Data  IDNT                         ; title Data Mover for Block Builder.

        SECTION  Sect_Move_Data,4,C     ; Declare a noncommon code section.

***************************************************************************
*     Data Mover and Blocker                        Rev. 18-APR-1992      *
*                                                                         *
*   This routine is used with the  APRIL1992 COMINT PROM's  to load       *
*   a "Zero Energy Responce" into the sections of the L1 Data Block       *
*   for the sections of the Calorimeter Trigger which do not exist        *
*   in hardware  (e.g. |eta| = 9:20).                                     *
*                                                                         *
*   This routine also "zero's" the areas in the CHTCR "Mask of Jet        *
*   Patterns" that corespond to sections of eta that are not yet          *
*   installed  (e.g. |eta| = 9:20).                                       *
*                                                                         *
*                                                                         *
*     Registers used in this routine:                                     *
*                                                                         *
*   A1    Address pointer for to CTFE data, and used in zero CHTCR data.  *
*   A2    Address pointer for to CTFE data, and used in zero CHTCR data.  *
*   A3    Address pointer for to CTFE data, and used in zero CHTCR data.  *
*   A4    Address pointer for to CTFE data, and used in zero CHTCR data.  *
*                                                                         *
*   D1    Loop Counter for the number of Longwords being "zeroed = 8".    *
*   D2    Used to hold the "Zero Energy Response" i.e. 8.                 *
*   D3    Used in loop control.                                           *
*                                                                         *
***************************************************************************

***************************************************************************
*                                                                         *
*     Initialization Section for the Data Mover.                          *
*                                                                         *
*     Setup the constants used in the "Zero" CTFE data section.           *
*       StrZeroEta  is the first eta index that should be "zeroed" 1:20   *
*       EndZeroEta  is the last eta index that needs to be "zeroed 1:20   *
*         StrZeroEta must be less then EndZeroEta                         *
*         EndZeroEta  is typically 20                                     *
*       SecLength is the number of longwords that need to be "zeroed".    *
*                                                                         *
*    Recall the organization of the CTFE data in the Data Block.  First   *
*    there is the Positive Eta EM data,  then the Negative Eta EM data,   *
*    then the Positive HD data, then the Negative Eta HD data.            *
*                                                                         *
*    For each eta sign, and for each data type there are 320 Items        *
*    in Note 967 which implies 160 LongWords for these 20 eta's.  Thus,   *
*    there are 8 Longwords per eta per eta sign per energy type, or       *
*    there are 32 Bytes per eta per eta sign per energy type.             *
*                                                                         *
*    Thus the number of longwords to zero is:                             *
*                                                                         *
*                 SecLength = ( EndZeroEta - StrZeroEta + 1 )  *  8       *
*                                                                         *
*    and the first longword address to zero is equal to                   *
*                                                                         *
*                 BAEnergyTypeSign  +  (( StrZeroEta - 1 ) * 8 * 4 )      *
*                                                                         *
*                                                                         *
*   Note:  All symbols used in this routine are defined in Main_Symbols.  *
*                                                                         *
****************************************************************************


Begin_Move_Data      MOVE.L  #$08080808,D2      ; Load Zero Energy Response
                                                ; into register D2.

***************************************************************************
*                                                                         *
*   "Zero" the Current Beam Crossing CTFE data for the selected eta's.    *
*                                                                         *
***************************************************************************

    MOVEA.L  #StrZeroEMPos,A1          ; First LongWord to "Zero" in the
                                       ;   Positive eta EM data in reg A1.
    MOVEA.L  #StrZeroEMNeg,A2          ; First LongWord to "Zero" in the
                                       ;   Negative eta EM data in reg A2.
    MOVEA.L  #StrZeroHDPos,A3          ; First LongWord to "Zero" in the
                                       ;   Positive eta HD data in reg A3.
    MOVEA.L  #StrZeroHDNeg,A4          ; First LongWord to "Zero" in the
                                       ;   Negative eta HD data in reg A4.

    MOVE.L   #SecLength,D3             ; Number of longwords to be "zeroed".

    FOR.L  D1 = #1 TO D3  DO.S         ; Loop over Current data to be Zeroed.

      MOVE.L   D2,(A1)+                ; "Zero" the Current Positive Eta EM.
      MOVE.L   D2,(A2)+                ; "Zero" the Current Negative Eta EM.
      MOVE.L   D2,(A3)+                ; "Zero" the Current Positive Eta HD.
      MOVE.L   D2,(A4)+                ; "Zero" the Current Negative Eta HD.

    ENDF                               ; End of the Current CTFE data loop.


***************************************************************************
*                                                                         *
*   "Zero" the Previous Beam Crossing CTFE data for the selected eta's.   *
*                                                                         *
***************************************************************************

    MOVEA.L  #StrZeroEMPos+DifCurPrev,A1    ; First LongWord to "Zero" in the
                                            ;  Positive eta EM data in reg A1.
    MOVEA.L  #StrZeroEMNeg+DifCurPrev,A2    ; First LongWord to "Zero" in the
                                            ;  Negative eta EM data in reg A2.
    MOVEA.L  #StrZeroHDPos+DifCurPrev,A3    ; First LongWord to "Zero" in the
                                            ;  Positive eta HD data in reg A3.
    MOVEA.L  #StrZeroHDNeg+DifCurPrev,A4    ; First LongWord to "Zero" in the
                                            ;  Negative eta HD data in reg A4.

    MOVE.L   #SecLength,D3             ; Number of longwords to be "zeroed".

    FOR.L  D1 = #1 TO D3  DO.S         ; Loop over Previous data to be Zeroed.

      MOVE.L   D2,(A1)+                ; "Zero" the Previous Positive Eta EM.
      MOVE.L   D2,(A2)+                ; "Zero" the Previous Negative Eta EM.
      MOVE.L   D2,(A3)+                ; "Zero" the Previous Positive Eta HD.
      MOVE.L   D2,(A4)+                ; "Zero" the Previous Negative Eta HD.

    ENDF                               ; End of the Previous CTFE data loop.




***************************************************************************
*                                                                         *
*   Now "zero" the sections of the CHTCR EM Jet Mask that correspond to   *
*   sections of eta that are not yet installed.                           *
*                                                                         *
***************************************************************************

    MOVEA.L  #BAEMM0+EndEta,A1     ; Base Address plus offset to the first
                                   ; location to zero (that is not installed).
                                   ; EM Ref Set 0 positive eta's.
    MOVEA.L  #BAEMM1+EndEta,A2     ; EM Ref Set 1 positive eta's.
    MOVEA.L  #BAEMM2+EndEta,A3     ; EM Ref Set 2 positive eta's.
    MOVEA.L  #BAEMM3+EndEta,A4     ; EM Ref Set 3 positive eta's.

    MOVE.L   #76,D3                ; End count for loop into register D3.

    FOR.L  D1 = #EndEta TO D3  BY #4  DO.S
       CLR.L  (A1)+
       CLR.L  (A2)+
       CLR.L  (A3)+
       CLR.L  (A4)+
    ENDF

    MOVEA.L  #BAEMM0+EndEta+OffPosNeg,A1     ; Now negative eta's Ref Set 0.
    MOVEA.L  #BAEMM1+EndEta+OffPosNeg,A2     ; Now negative eta's Ref Set 1.
    MOVEA.L  #BAEMM2+EndEta+OffPosNeg,A3     ; Now negative eta's Ref Set 2.
    MOVEA.L  #BAEMM3+EndEta+OffPosNeg,A4     ; Now negative eta's Ref Set 3.

    MOVE.L   #156,D3                  ; End count for loop into register D3.

    FOR.L  D1 = #EndNegEta TO D3  BY #4  DO.S
       CLR.L  (A1)+
       CLR.L  (A2)+
       CLR.L  (A3)+
       CLR.L  (A4)+
    ENDF


***************************************************************************
*                                                                         *
*   Now "zero" the sections of the CHTCR Total Et Jet Mask that           *
*   correspond to sections of eta that are not yet installed.             *
*                                                                         *
***************************************************************************

    MOVEA.L  #BATEtM0+EndEta,A1    ; Base Address plus offset to the first
                                   ; location to zero (that is not installed).
                                   ; Total Et Ref Set 0 positive eta's.
    MOVEA.L  #BATEtM1+EndEta,A2    ; Total Et Ref Set 1 positive eta's.
    MOVEA.L  #BATEtM2+EndEta,A3    ; Total Et Ref Set 2 positive eta's.
    MOVEA.L  #BATEtM3+EndEta,A4    ; Total Et Ref Set 3 positive eta's.

    MOVE.L   #76,D3                ; End count for loop into register D3.

    FOR.L  D1 = #EndEta TO D3  BY #4  DO.S
       CLR.L  (A1)+
       CLR.L  (A2)+
       CLR.L  (A3)+
       CLR.L  (A4)+
    ENDF

    MOVEA.L  #BATEtM0+EndEta+OffPosNeg,A1    ; Now negative eta's Ref Set 0.
    MOVEA.L  #BATEtM1+EndEta+OffPosNeg,A2    ; Now negative eta's Ref Set 1.
    MOVEA.L  #BATEtM2+EndEta+OffPosNeg,A3    ; Now negative eta's Ref Set 2.
    MOVEA.L  #BATEtM3+EndEta+OffPosNeg,A4    ; Now negative eta's Ref Set 3.

    MOVE.L   #156,D3                  ; End count for loop into register D3.

    FOR.L  D1 = #EndNegEta TO D3  BY #4  DO.S
       CLR.L  (A1)+
       CLR.L  (A2)+
       CLR.L  (A3)+
       CLR.L  (A4)+
    ENDF


    RTS

***************************************************************************
*                                                                         *
*   Constants Section  for Move_Data                                      *
*                                                                         *
*   Export the following symbols to other program modules:                *
*     Begin_Move_Data   This is the label for the entry point             *
*                       for this routine.                                 *
*                                                                         *
*   Import the following symbols from the Main_Symbols program module:    *
*                                                                         *
*                                                                         *
*                                                                         *
*     BAEMM0    Base Address of EM Ref Set 0 CHTCR Mask of Jet Patterns.  *
*     BAEMM1    Base Address of EM Ref Set 1 CHTCR Mask of Jet Patterns.  *
*     BAEMM2    Base Address of EM Ref Set 2 CHTCR Mask of Jet Patterns.  *
*     BAEMM3    Base Address of EM Ref Set 3 CHTCR Mask of Jet Patterns.  *
*                                                                         *
*     BATEtM0   Base Address of Total ET Ref Set 0 Mask of Jet Patterns.  *
*     BATEtM1   Base Address of Total ET Ref Set 1 Mask of Jet Patterns.  *
*     BATEtM2   Base Address of Total ET Ref Set 2 Mask of Jet Patterns.  *
*     BATEtM3   Base Address of Total ET Ref Set 3 Mask of Jet Patterns.  *
*                                                                         *
***************************************************************************

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

           ;  Symbols that are referenced in this module
           ;  but defined in another module.

           XREF   StrZeroEta,EndZeroEta,SecLength,DifCurPrev
           XREF   StrZeroEMPos,StrZeroEMNeg,StrZeroHDPos,StrZeroHDNeg
           XREF   EndEta,OffPosNeg,EndNegEta
           XREF   BAEMM0,BAEMM1,BAEMM2,BAEMM3
           XREF   BATEtM0,BATEtM1,BATEtM2,BATEtM3

        END

