
Error_Checking   IDNT                    ; Title of  Program Module

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

***************************************************************************
*                                                                         *
*   Signal Finished Processing                         Rev. 26-MAR-1993   *
*                                                                         *
***************************************************************************

***************************************************************************
*                                                                         *
*  Error Checking Section.                                                *
*                                                                         *
*  This routine will verify that the following is correct:                *
*                                                                         *
*    Verify that the Spec Trig's Fired List read near the begining of     *
*    the COMINT PROM's matches the Spec Trig's Fired List read at the     *
*    end of the COMINT PROM's.  Note also that the main routine           *
*    Spec-Trig_Fire_1  which makes the Trig list in location TrigsFired   *
*    uses the 1st hardware copy of the Spec Trig's Fired information      *
*    where as the Error Checking routine is using the 3rd hardware copy   *
*    of the Spec Trig's Fired information.  Thus this checks both that    *
*    the hardware list of Spec Trig's Fired has not been overwritten and  *
*    that the 1st and 3rd hardware copies of this list are the same.      *
*                                                                         *
*    Verify that the Beam Crossing Number read near the begining of the   *
*    COMINT PROM's is equal to the Beam Crossing Number read at the end   *
*    of the COMNT PROM's.  Make this test on the low order 16 bits of     *
*    the Beam Crossing Numbers.                                           *
*                                                                         *
*    Verify that the Current Beam Crossing Number is equal to 1 more      *
*    than the Previous Beam Crossing Number.   Make this test on the      *
*    low order 32 bits of the Beam Crossing Numbers.                      *
*                                                                         *
*                                                                         *
*  Control of the Trouble Warning Bits                                    *
*     none                                                                *
*                                                                         *
*  Control of the State Bits                                              *
*     none                                                                *
*                                                                         *
***************************************************************************


***************************************************************************
*                                                                         *
*   This is the section to verify that the List of Spec Trig's Fired      *
*   is still intacted when read at the very end of the COMINT PROM's.     *
*                                                                         *
*   Build the List of Spec Trig's Fired based on the reads of the IMLRO   *
*   hardware near the very end of the COMINT PROM's.  Note that at the    *
*   end of the COMINT PROM's they are reading the 3rd hardware copy of    *
*   the Spec Trig's Fired.  This list will be compared to the list built  *
*   by the Spec_Trig_Fired routine which is based on IMLRO reads of the   *
*   1st hardware copy of Spec Trig's Fired near the very begining of the  *
*   COMINT PROM's.                                                        *
*                                                                         *
*   Build a list of Specific Triggers that Fired for this event in D1.    *
*                                                                         *
*   See the routine  SPEC_TRIG_PROG_FIRE_1.SRC  for full details.         *
*                                                                         *
*   Recall how the Spec Trig's Fired information which is read near the   *
*   very end of the COMINT PROM's is stored in VME memory. This is a      *
*   read of the 3rd hardware copy of Spec Trig's Fired.                   *
*                                                                         *
*    VME       3     2 2     1 1                                          *
*    Addrs     1     4 3     6 5     8 7     0       Bits in a long word  *
*    -----     -     - -     - -     - -     -                            *
*             ---------------------------------                           *
*    302A50   |       |       |       |       |                           *
*             ---------------------------------                           *
*    302A54   |       | 2nd B |       | 1st B |      Bytes of Specific    *
*             ---------------------------------      Triggers Fired Data  *
*    302A58   |       | 4th B |       | 3rd B |      in VME Memory.       *
*             ---------------------------------                           *
*    302A5C   |       |       |       |       |                           *
*             ---------------------------------                           *
*                                                                         *
***************************************************************************

                                     ; Now build the List of Spec Trig's Fired
                                     ; using the data read from addresses
                                     ; 5417:5420  of  March_1993_CBus_0.ASF

Begin_Error_Checking   Move.L  EC_SpTrgFr+4,D2    ; Get the Error Check
                                                  ; Spec Trigs Fired
        Move.L   D2,D1                            ; 4th and 3rd bytes.
        LSR.L    #8,D1               ;
        Move.B   D2,D1               ;
        LSL.L    #8,D1               ;
        Move.L   EC_SpTrgFr,D2       ; Get the Error Check
        Swap     D2                  ; Spec Trigs Fired 2nd and 1st bytes.
        Move.B   D2,D1               ;
        Swap     D2                  ;
        LSL.L    #8,D1               ;
        Move.B   D2,D1               ; D1 now has the List of Spec Trig's
                                     ;   Fired based on data from COMINT
                                     ;   PROM Addresses  5417:5420.  These
                                     ;   are a read of the 3rd hardware copy.

        Move.L   TrgsFired,D0        ; Move the List of Spec Trig's Fired
                                     ;   build from reads near the start
                                     ;   of the COMINT PROM's into reg D0.
                                     ;   This list is based on the 1st
                                     ;   hardware copy of this information.

        IF.L  D0 <NE> D1  THEN.S     ; Test to see if the two versions of the
                                     ;   Spec Trig's Fired List are equal.
           PEA.L  SpTrgFrLs_Err      ;   If NOT then, send out
           JSR    ChrWrtOut          ;   the message "TF".

        ENDI                         ;


***************************************************************************
*                                                                         *
*   This is the section that verifies that the Beam Crossing Number       *
*   that is read at the very end of the COMINT PROM's is the same value   *
*   as the Beam Crossing Number that is read early in the COMINT PROM's.  *
*   The 2 low order bytes will be checked.  This is good for a little     *
*   over 200 msec.                                                        *
*                                                                         *
***************************************************************************

          CLR.L   D0                     ;
          CLR.L   D1                     ;

          Move.B  DB_BX_Num_2B,D0        ; Get the 2nd byte of the Data
                                         ;   Block Beam Crossing Number
          LSL.L   #8,D0                  ; and Shift it up 8 bits.
          Move.B  DB_BX_Num_1B,D0        ; Get the 1st byte of the Data
                                         ;   Block Beam Crossing Number

          Move.B  EC_BX_Num_2B,D1        ; Get the 2nd byte of the Error
                                         ;   Check Beam Crossing Number
          LSL.L   #8,D1                  ; and Shift it up 8 bits.
          Move.B  EC_BX_Num_1B,D1        ; Get the 1st byte of the Error
                                         ;   Check Beam Crossing Number

          IF.L  D0 <NE> D1  THEN.S       ; Test to see if the two versions of
                                         ; the Beam Crossing Number are equal.
             PEA.L  BX_Num_Err           ; If NOT then, send out the
             JSR    ChrWRTOut            ; message "BX".

          ENDI                           ;


***************************************************************************
*                                                                         *
*    Verify that the Current Beam Crossing Number is equal to 1 more      *
*    than the Previous Beam Crossing Number.   Make this test on the      *
*    low order 32 bits of the Beam Crossing Numbers.                      *
*                                                                         *
***************************************************************************

          CLR.L   D0                     ;
          CLR.L   D1                     ;

          Move.B  DB_BX_Num_4B,D0        ; 4th byte of the Current BX Num.
          LSL.L   #8,D0                  ;   and Shift it up 8 bits.
          Move.B  DB_BX_Num_3B,D0        ; 3rd byte of the Current BX Num.
          LSL.L   #8,D0                  ;   and Shift it up 8 bits.
          Move.B  DB_BX_Num_2B,D0        ; 2nd byte of the Current BX Num.
          LSL.L   #8,D0                  ;   and Shift it up 8 bits.
          Move.B  DB_BX_Num_1B,D0        ; 1st byte of the Current BX Num.

          Move.B  Pr_BX_Num_4B,D1        ; 4th byte of the Previous BX Num.
          LSL.L   #8,D1                  ;   and Shift it up 8 bits.
          Move.B  Pr_BX_Num_3B,D1        ; 3rd byte of the Previous BX Num.
          LSL.L   #8,D1                  ;   and Shift it up 8 bits.
          Move.B  Pr_BX_Num_2B,D1        ; 2nd byte of the Previous BX Num.
          LSL.L   #8,D1                  ;   and Shift it up 8 bits.
          Move.B  Pr_BX_Num_1B,D1        ; 1st byte of the Previous BX Num.

          Add.L   #1,D1                  ; Add 1 to the Previous BX Number.

          IF.L  D0 <NE> D1  THEN.S       ; Test if the Current BX Num and 1
                                         ;   plus the Previous BX Num are
             PEA.L  CP_BX_Err            ;   equal.  If not then, send out
             JSR    ChrWRTOut            ;   the message "CP".

          ENDI                           ;


          RTS                            ; Return to the calling routine.


*************************************************************************
*  Define Constants:                                                    *
*                                                                       *
*  Data used to send messages to the VTC console terminal screen.       *
*                                                                       *
*************************************************************************

                 ALIGN    4                   ; Align to Longword Address.
BX_Num_Err       DC.B     4,$0D,$0A,'BX'

                 ALIGN    4                   ; Align to Longword Address.
CP_BX_Err        DC.B     4,$0D,$0A,'CP'

                 ALIGN    4                   ; Align to Longword Address.
SpTrgFrLs_Err    DC.B     4,$0D,$0A,'TF'

                 ALIGN    4                   ; Align to Longword Address.
TransInfo5       DS.L     1


*************************************************************************
*  Define Constants:                 External References                *
*                                                                       *
*************************************************************************

       XDEF   Begin_Error_Checking                  ; Export this symbol
                                                    ; to other modules.

       XREF   TrgsFired                             ; Symbols referenced
       XREF   EC_SpTrgFr                            ; in this program
       XREF   EC_BX_Num_1B                          ; module but defined
       XREF   EC_BX_Num_2B                          ; in another module
       XREF   DB_BX_Num_1B                          ; Main_Symbols.Include
       XREF   DB_BX_Num_2B
       XREF   DB_BX_Num_3B
       XREF   DB_BX_Num_4B
       XREF   Pr_BX_Num_1B
       XREF   Pr_BX_Num_2B
       XREF   Pr_BX_Num_3B
       XREF   Pr_BX_Num_4B
       XREF   ChrWrtOut

       END

