
Get_CD_Pulser     IDNT                    ; Title Get Central Detector Pulser.

        SECTION  Sect_Get_CD_Pulser,4,C       ; Declare a noncommon code
                                              ; section. Align to Longwords.

***************************************************************************
*                                                                         *
*  Get the Pulser Programming Data for the Central Detector.              *
*                                                                         *
*                                                       Rev.  1-OCT-1991  *
***************************************************************************

***************************************************************************
*  Cyclic Section Subroutine    Get the CENTRAL Pulser Programming Data   *
*                                                                         *
*  Before trying to read the Central Detector Pulser Programming Data     *
*  via the Vertical Interconnect:  clear the error flag that records if   *
*  there has been a Bus Error while trying to read the Calorimeter Pulser *
*  Programming Data,  and change the Bus Error Vector to point to our     *
*  own Bus Error exception handler.   This routing starts at CDBErExHd.   *
***************************************************************************

Begin_Get_CD_Pulser   CLR.L  GetCentPulsEr   ; Clear the error flag that shows
                                             ; if there has been a Bus Error
                                             ; while reading Central Detector
                                             ; Pulser Programming Data.

       Move.L  #CDBErExHd,$00000008          ; Point the Bus Error vector
                                             ; to the bus error while trying
                                             ; to read Central Detector Pulser
                                             ; Programming Data exception
                                             ; handler.

***************************************************************************
*  Get the CENTRAL Detector Pulser Programming Data via port 3 on the     *
*  Vertical Interconnect master module.                                   *
*                                                                         *
*  There are:  5 VTX pulsers,  3 CDC pulsers,  6 FDC pulsers,  and 4 TRD  *
*  pulsers.  This is a total of 18 longwords of Central Pulser Data.      *
*                                                                         *
*  The base address in the MVME-214 module where this routine should      *
*  start storing data has been passed to this routine in register A0.     *
***************************************************************************

       Move.L   CenDetPPBA+$44,D0          ; Get  VTX_PLS111  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$38,D0          ; Get  VTX_PLS112  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$80,D0          ; Get  VTX_PLS120  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$84,D0          ; Get  VTX_PLS121  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$78,D0          ; Get  VTX_PLS122  Pulser
       Move.L   D0,(A0)+                   ; Programming Data


       Move.L   CenDetPPBA+$48,D0          ; Get  CDC_PLS100  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$40,D0          ; Get  CDC_PLS110  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$88,D0          ; Get  CDC_PLS130  Pulser
       Move.L   D0,(A0)+                   ; Programming Data


       Move.L   CenDetPPBA+$58,D0          ; Get  FDC_PLS080  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$5C,D0          ; Get  FDC_PLS081  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$20,D0          ; Get  FDC_PLS082  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$98,D0          ; Get  FDC_PLS150  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$9C,D0          ; Get  FDC_PLS151  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$60,D0          ; Get  FDC_PLS152  Pulser
       Move.L   D0,(A0)+                   ; Programming Data


       Move.L   CenDetPPBA+$4C,D0          ; Get  TRD_PLS101  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$30,D0          ; Get  TRD_PLS102  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$8C,D0          ; Get  TRD_PLS131  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

       Move.L   CenDetPPBA+$70,D0          ; Get  TRD_PLS132  Pulser
       Move.L   D0,(A0)+                   ; Programming Data

*****************************************************************************
*  Cyclic Section Subroutine   Get CENTRAL Detector Pulser Programming Data *
*                                                                           *
*  We are finished using the Vertical Interconnect so Restore the           *
*  normal 133A Bug Bus Error Vector.                                        *
*****************************************************************************

       Move.L  #$FFF149E2,$00000008          ; Restore normal 133A Bug
                                             ;  Bus Error vector.

***************************************************************************
*  Cyclic Section Subroutine         Get the CD Pulser Programming Data   *
*                                                                         *
*  Return from this subroutine call.                                      *
***************************************************************************

       RTS


***************************************************************************
*  CENTRAL Detector Read Pulser Data Bus Error Exception Handler          *
*                                                                         *
*  Mask the rerun bit in the Special Status Word and then load FFFFFFFF   *
*  as the data "read" from the Central Detector Pulser and set the        *
*  error while reading Central Detector Pulser Programming Data Error     *
*  flag, and then return.                                                 *
***************************************************************************

           Align   4                       ; Align to long words.

CDBErExHd  MOVE.W  (SP)+,D0                ; pull the Status Register
           MOVE.L  (SP)+,D1                ; pull the Program Counter
           MOVE.W  (SP)+,D2                ; pull the Format - Vector Offset
           MOVE.W  (SP)+,D3                ; pull the Internal Register
           MOVE.W  (SP)+,D4                ; pull the Special Status Register

           ANDI.W  #$FEFF,D4               ; Mask the rerun bus cycle bit

           MOVE.W  D4,-(SP)                ; push the Special Status Register
           MOVE.W  D3,-(SP)                ; push the Internal Register
           MOVE.W  D2,-(SP)                ; push the Format - Vector Offset
           MOVE.L  D1,-(SP)                ; push the Program Counter
           MOVE.W  D0,-(SP)                ; push the Status Register

           MOVE.L  #$FFFFFFFF,D0           ; Load FFFFFFFF as the data "read"
                                           ; from the Central Detector Pulser.

           MOVE.L  #$000000FF,GetCentPulsEr   ; Set the read Central Detector
                                              ; Pulser Data error flag to
                                              ; indicate a Bus Error.
           RTE


***************************************************************************
*   Constants Section for  Get Central Detector Pulser                    *
*                                                                         *
*  This section defines the base address for reading the Central          *
*  Detector Pulser Programming Data, and the Base Address where the       *
*  Pulser Programming Data is stored in the MVME-214 while it is waiting  *
*  waiting to be readout by the VBD.                                      *
*  In addition the externally defined and the externally referenced       *
*  symbols are declared.                                                  *
***************************************************************************

CenDetPPBA   EQU   $13193800            ; Base Address for reading the Central
                                        ; Detector Pulser Programming Data.

             XDEF   Begin_Get_CD_Pulser            ; Export this symbol
                                                   ; to other modules.

             XREF   GetCentPulsEr                  ; Import this symbol
                                                   ; which is defined in the
                                                   ; Main_Symbols.Include file.

             END

