
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.  11-APRIL-1991   *
*                                                                         *
*   This routine is used with the January 1991 COMINT PROM's to move      *
*   the CTFE eta 1...8 data into full length areas for DMA by the VBD.    *
*                                                                         *
*     Registers used in this routine:                                     *
*                                                                         *
*   A1    Address Pointer for the Source of data to be moved.             *
*   A2    Address Pointer to the Destination of the data being moved.     *
*                                                                         *
*   D1    Loop Counter for the number of Longwords being moved.           *
*                                                                         *
***************************************************************************

***************************************************************************
*                                                                         *
*     Initialization Section for the Data Mover.                          *
*                                                                         *
***************************************************************************

Begin_Move_Data   CLR.L   D1                 ; Clear Data Register 1.


***************************************************************************
*                                                                         *
*   Move the Current Beam Crossing CTFE EM data for eta's  +1...+8        *
*                                                                         *
***************************************************************************

    MOVEA.L  #BASEMP,A1      ; Base Address for the Source of
                             ;   Positive eta EM data.
    MOVEA.L  #BADEMP,A2      ; Base Address for the Destination
                             ;   of Positive eta EM data.

    FOR.B D1 = #1 TO #SecLength DO.S   ; Loop over all EM data to be moved.
      MOVE.L (A1)+,(A2)+               ; Move Data from Source to Destination.
    ENDF                               ; End of the Pos eta EM data move.

***************************************************************************
*                                                                         *
*   Move the Current Beam Crossing CTFE EM data for eta's  -1...-8        *
*                                                                         *
***************************************************************************

    MOVEA.L  #BASEMN,A1      ; Base Address for the Source of
                             ;   Negative eta EM data.
    MOVEA.L  #BADEMN,A2      ; Base Address for the Destination
                             ;   of Negative eta EM data.

    FOR.B D1 = #1 TO #SecLength DO.S   ; Loop over all EM data to be moved.
      MOVE.L (A1)+,(A2)+               ; Move Data from Source to Destination.
    ENDF                               ; End of the Neg eta EM data move.

***************************************************************************
*                                                                         *
*   Move the Current Beam Crossing CTFE HD data for eta's  +1...+8        *
*                                                                         *
***************************************************************************

    MOVEA.L  #BASHDP,A1      ; Base Address for the Source of
                             ;   Positive eta HD data.
    MOVEA.L  #BADHDP,A2      ; Base Address for the Destination
                             ;   of Positive eta HD data.

    FOR.B D1 = #1 TO #SecLength DO.S   ; Loop over all HD data to be moved.
      MOVE.L (A1)+,(A2)+               ; Move Data from Source to Destination.
    ENDF                               ; End of the Pos eta HD data move.

***************************************************************************
*                                                                         *
*   Move the Current Beam Crossing CTFE HD data for eta's  -1...-8        *
*                                                                         *
***************************************************************************

    MOVEA.L  #BASHDN,A1      ; Base Address for the Source of
                             ;   Negative eta HD data.
    MOVEA.L  #BADHDN,A2      ; Base Address for the Destination
                             ;   of Negative eta HD data.

    FOR.B D1 = #1 TO #SecLength DO.S   ; Loop over all HD data to be moved.
      MOVE.L (A1)+,(A2)+               ; Move Data from Source to Destination.
    ENDF                               ; End of the Neg eta HD data move.

***************************************************************************
*                                                                         *
*   Move the Previous Beam Crossing CTFE EM data for eta's  +1...+8       *
*                                                                         *
***************************************************************************

    MOVEA.L  #BASEMP,A1      ; Base Address for the Source of
                             ;   Positive eta EM data.
    ADDA.L   #DifSACP,A1               ; Add the difference in Source
                                       ;   Addresses between the Current
                                       ;   and Previous Beam Crossing data.

    MOVEA.L  #BADEMP,A2      ; Base Address for the Destination
                             ;   of Positive eta EM data.
    ADDA.L   #DifDACP,A2               ; Add the difference in Destination
                                       ;   Addresses between the Current
                                       ;   and Previous Beam Crossing data.

    FOR.B D1 = #1 TO #SecLength DO.S   ; Loop over all EM data to be moved.
      MOVE.L (A1)+,(A2)+               ; Move Data from Source to Destination.
    ENDF                               ; End of the Pos eta EM data move.

***************************************************************************
*                                                                         *
*   Move the Previous Beam Crossing CTFE EM data for eta's  -1...-8       *
*                                                                         *
***************************************************************************

    MOVEA.L  #BASEMN,A1      ; Base Address for the Source of
                             ;   Negative eta EM data.
    ADDA.L   #DifSACP,A1               ; Add the difference in Source
                                       ;   Addresses between the Current
                                       ;   and Previous Beam Crossing data.

    MOVEA.L  #BADEMN,A2      ; Base Address for the Destination
                             ;   of Negative eta EM data.
    ADDA.L   #DifDACP,A2               ; Add the difference in Destination
                                       ;   Addresses between the Current
                                       ;   and Previous Beam Crossing data.

    FOR.B D1 = #1 TO #SecLength DO.S   ; Loop over all EM data to be moved.
      MOVE.L (A1)+,(A2)+               ; Move Data from Source to Destination.
    ENDF                               ; End of the Neg eta EM data move.

***************************************************************************
*                                                                         *
*   Move the Previous Beam Crossing CTFE HD data for eta's  +1...+8       *
*                                                                         *
***************************************************************************

    MOVEA.L  #BASHDP,A1      ; Base Address for the Source of
                             ;   Positive eta HD data.
    ADDA.L   #DifSACP,A1               ; Add the difference in Source
                                       ;   Addresses between the Current
                                       ;   and Previous Beam Crossing data.

    MOVEA.L  #BADHDP,A2      ; Base Address for the Destination
                             ;   of Positive eta HD data.
    ADDA.L   #DifDACP,A2               ; Add the difference in Destination
                                       ;   Addresses between the Current
                                       ;   and Previous Beam Crossing data.

    FOR.B D1 = #1 TO #SecLength DO.S   ; Loop over all HD data to be moved.
      MOVE.L (A1)+,(A2)+               ; Move Data from Source to Destination.
    ENDF                               ; End of the Pos eta HD data move.

***************************************************************************
*                                                                         *
*   Move the Previous Beam Crossing CTFE HD data for eta's  -1...-8       *
*                                                                         *
***************************************************************************

    MOVEA.L  #BASHDN,A1      ; Base Address for the Source of
                             ;   Negative eta HD data.
    ADDA.L   #DifSACP,A1               ; Add the difference in Source
                                       ;   Addresses between the Current
                                       ;   and Previous Beam Crossing data.

    MOVEA.L  #BADHDN,A2      ; Base Address for the Destination
                             ;   of Negative eta HD data.
    ADDA.L   #DifDACP,A2               ; Add the difference in Destination
                                       ;   Addresses between the Current
                                       ;   and Previous Beam Crossing data.

    FOR.B D1 = #1 TO #SecLength DO.S   ; Loop over all HD data to be moved.
      MOVE.L (A1)+,(A2)+               ; Move Data from Source to Destination.
    ENDF                               ; End of the Neg eta HD data move.


    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:    *
*                                                                         *
*     BASEMP    Base Address of Source of positive eta EM Et data.        *
*     BADEMP    Base Address of Destination of positive eta EM Et data.   *
*     BASEMN    Base Address of Source of negative eta EM Et data.        *
*     BADEMN    Base Address of Destination of negative eta EM Et data.   *
*                                                                         *
*     BASHDP    Base Address of Source of positive eta HD Et data.        *
*     BADHDP    Base Address of Destination of positive eta HD Et data.   *
*     BASHDN    Base Address of Source of negative eta HD Et data.        *
*     BADHDN    Base Address of Destination of negative eta HD Et data.   *
*                                                                         *
***************************************************************************

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

           XREF   BASEMP,BADEMP,BASEMN,BADEMN   ; Symbols that are
           XREF   BASHDP,BADHDP,BASHDN,BADHDN   ; referenced in this
                                                ; module but defined
                                                ; in another module.


SecLength  EQU    32   ; Count of the number of items to move in each section.
                       ; 32 covers 4 absolute Trigger Tower Eta Index unites.

DifSACP   EQU    $00001000   ; Difference in Source Addresses (i.e. raw data
                             ;   block from COMINT)  between the Current and
                             ;   the Previous Beam Crossing data.

DifDACP   EQU    $00001000   ; Difference in Destination Addresses (i.e. D0
                             ;   Note 967 Data Block)  between the Current
                             ;   and the Previous Beam Crossing data.

        END

