               JOB  VOBJ.S 03/26/22 06:46:42                               -2402
               CTL       6611  *6=16,000C;6=16,000T;1=OBJDECK;,1=MODADD
     *   1         2         3         4         5         6         7         8
     *78901234567890123456789012345678901234567890123456789012345678901234567890
     * label   | op | OPERATION                                         |xxxxxxx
     *------------------------------------------------------------------
     * VOBJ -- VERIFY OBJECT DECK SEQUENCE.
     *         THIS PROGRAM READS AN OBJECT DECK AND VERIFIES THAT
     *         SEQUENCE NUMBERS (IN CARD COLUMNS 72-75) START AT 0001
     *         AND CONTINUE IN ORDINAL SEQUENCE
     * JACK GHISELLI, 2022-03-24
     *------------------------------------------------------------------  
               ORG  87
     X1        DCW  @000@              * INDEX REGISTER 1
               ORG  92
     X2        DCW  @000@              * INDEX REGISTER 2
               ORG  97
     X3        DCW  @000@              * INDEX REGISTER 3        
     * CARD AREA
               ORG  1
               DS   71                 * OBJ CARD TEXT
     CDSEQ     DS   4                  * OBJ CARD SEQ #
     CDPGM     DS   5                  * OBJ CARD PGM ID
     * PRINT AREA
               ORG  201
     PRCARD    DS   80
               DS   1
     PRX1      DS   5
     PRSEQ     DS   4
               DS   1
     PRX2      DS   30
     * BEGIN ACTUAL CODE 
               ORG  333               
     * IN-MEMORY STRING WITH PROGRAM ID AND REVISION
     PGMID     DCW  @VOBJ REV  1.0 GENERATED 03/25/2022@
     * BEGIN EXECUTION
     START     CC   1
               MLC  PGMID,234          * THIS PROGRAM ID
               W                       * PRINT IT
               CS   299                * CLEAR PRINT AREA
               W                       * BLANK LINE
 
     HALT      H    111,111            * WAIT FOR OPERATOR TO HIT START
               MLC  &SAV,X1            * START OF SAVE AREA
               MLC  ZERO,SEQ           * ZERO CARD COUNTER
               CS   332
               CS
               CS   80
               SW   1,201
               BSS  RD2,B              * SS B MEANS READ SUSPECT DECK
     ***********************************
     * READ, CHECK, AND STORE KNOWN-GOOD DECK 
     ***********************************
     RD1       MLC  ZERO,SEQKG         * NO STORED KD DECK YET
               MLC  ZERO,SEQSV
               MLC  @READING KNOWN-GOOD CARD DECK@,228
               B    PTH                * PRINT HEADING    
     RD1A      B    READC              * READ A CARD
               B    RD1K               * BRANCH IF NO MORE CARDS
               A    ONE,SEQ            * COUNT CARDS READ
               MZ   @ @,SEQ            * CLEAR ZONE ON LOW-ORDER
               MLC  80,PRCARD          * MOVE CARD IMAGE TO PRINT
               SW   0&X1               * SET WM IN SAVE AREA
               MLC  80,79&X1           * SAVE CARD
               A    ONE,SEQSV          * COUNT CARDS SAVED
               MZ   @ @,SEQSV          * CLEAR ZONE ON LOW-ORDER

               C    CDSEQ,SEQ          * IS OBJ DECK SEQ # CORRECT
               BU   RD1C               * BAD SEQ #
     RD1B      MLC  MSG1,PRX1
               MLC  SEQ,PRSEQ
               W                       * PRINT THE CARD
               CS   332
               CS
               SW   201
               C    SVMAX,SEQSV        * IS SAVE AREA FULL
               BE   RD1D               * YES      
               MA   K80,X1             * BUMP SAVE POINTER   
               B    RD1A
     RD1C      MLC  MSG2,PRX2          * BAD SEQUENCE #
               B    RD1B
     RD1D      B    READC              * READ EXTRA CARDS
               B    RD1K               * BRANCH IF NO MORE CARDS
               A    ONE,SEQ            * COUNT CARDS READ
               MZ   @ @,SEQ            * CLEAR ZONE ON LOW-ORDER          
               MLC  80,PRCARD
               MLC  MSG1,PRX1
               MLC  SEQ,PRSEQ
               MLC  @IGNORED.  BEYOND CAPACITY@,PRX2-5
               W
               CS   332
               CS
               SW   201
               B    RD1D
     
     RD1K      MLC  SEQSV,SEQKG        * SAVE NO. OF KG CARDS
               CC   1
               B    HALT
     ***********************************
     * READ AND VERIFY SUSPECT DECK
     ***********************************   
     RD2       MLC  @READING SUSPECT CARD DECK@,225
               B    PTH                * PRINT HEADING
               C    SEQKG,ZERO         * Q. ANY SAVED KD DECK YET
               BE   RD2J               * NO
               MLC  &SAV,X1            * START OF SAVE AREA
               MLC  ZERO,SEQ           * INIT COUNT OF INPUT CARDS
               MLC  ZERO,SEQSV
     RD2A      B    READC              * READ A CARD
               B    RD2F               * BRANCH IF LAST CARD
               A    ONE,SEQ            * COUNT INPUT CARDS
               MZ   @ @,SEQ            * CLEAR ZONE ON LOW-ORDER
               MLC  80,PRCARD          * MOVE CARD TO PRINT AREA
               MLC  MSG1,PRX1 
               MLC  SEQ,PRSEQ
               A    ONE,SEQSV          * COUNT CARDS SAVED
               MZ   @ @,SEQSV          * CLEAR ZONE ON LOW-ORDER   
               C    80,79&X1           * DOES INPUT CARD MATCH SAVED CARD
               BU   RD2C               * NO, BAD
     
     RD2B      W                       * PRINT THE SUSPECT-DECK CARD         
               CS   332  
               CS
               SW   201          
     
               C    SEQKG,SEQSV        * Q. END OF KNOWN-GOOD DECK
               BE   RD2D               * YES, FLUSH ANY EXTRA SUSPECT CARDS     
     
               MA   K80,X1             * BUMP SAVE POINTER    
               B    RD2A
 
     RD2C      MLC  @ERROR -- CARD MISMATCH@,PRX2-5
               B    RD2B
     
     * SHOW EXTRA CARDS AT END OF SUSPECT DECK
     RD2D      B    READC              * READ A CARD
               B    RD2F               * BRANCH IF END OF SUS DECK
               A    ONE,SEQ            * COUNT CARDS READ
               MZ   @ @,ONE
               MLC  80,PRCARD
               MLC  MSG1,PRX1
               MLC  SEQ,PRSEQ
               MLC  @ERROR -- EXTRA CARD AT END@,PRX2-4
               W                       * PRINT THE SUSPECT-DECK CARD         
               CS   332
               CS   
               SW   201
               B    RD2D
     * SHOW KG CARDS MISSING FROM SUSPECT DECK
     RD2F      C    SEQKG,SEQSV        * Q. END OF KG DECK
               BE   RD2K               * YES
   
               A    ONE,SEQSV          * COUNT CARDS READ
               MZ   @ @,ONE
               MLC  79&X1,PRCARD
               MLC  MSG1,PRX1
               MLC  SEQSV,PRSEQ
               MLC  @ERROR -- CARD MISSING@,PRX2-8
               W
               CS   332
               CS
               SW   201
     
               A    ONE,SEQ
               MZ   @ @,SEQ
               C    SEQ,SVMAX
               BE   RD2K
               MA   K80,X1             * BUMP SAVE AREA POINTER
               B    RD2F
     RD2J      MLC  @ERROR -- NO KG DECK YET@,223
               W
     RD2K      CC   1
               B    HALT
     
     * SUBROUTINE
     * PRINT HEADING AT BEGINNING OF READING A DECK
     PTH       SBR  PTHX+3
               W
               CS   332
               CS
               SW   201
               W
               MLC  MSGH2,PRCARD       * FIRST HEADER LINE
               W
               MLC  MSGH3,PRCARD       * SECOND HEADER LINE
               MLC  280,270            * PROPAGATING MOVE
               W
               CS   299
               SW   201
               W
     PTHX      B    000
     
     * SUBROUTINE
     * READ A CARD AND CHECK FOR LAST CARD
     * RETURN IS +0 IF EOF, +4 IF ACTUALLY READ A CARD
     * FOR ROPE, SS G ALLOWS EOF VIA CARD WITH * IN COL1
     READC     SBR  READCX+3
               R                       * READ A CARD
               BLC  READCX             * BRANCH IF EOF
               BSS  READC3,G           * SS G ON FOR ROPE
               B    READC9
     READC3    BCE  READCX,001,*       * FOR ROPE, * IN COL 1 IS EOF
     READC9    MA   @004@,READCX+3     * EXIT IF GOT A CARD
     READCX    B    0
          
               NOP                               * INSURE WORD MARK
     
     MSGH      DCW  @         1         2         3         4@
     MSGH2     DC   @         5         6         7         8@
     MSGH3     DCW  @1234567890@
     MSG1      DCW  @CARD#@
     MSG2      DCW  @OUT OF SEQUENCE               @
     MSG3      DCW  @LAST CARD.  ALL CARDS OK.     @ 
     MSG5      DCW  @ERROR -- MISMATCH@
     ZERO      DCW  @0000@
     ONE       DCW  @0001@
     SEQ       DCW  @0000@
     SEQSV     DCW  @0000@
     SEQKG     DCW  @0000@     
     SVMAX     DCW  @0150@             * MAX # OF CARDS TO SAVE
     K80       DCW  @080@              * LENGTH OF ONE CARD
               LTORG *
               ORG  2000
     SAV       DS   1                  * SAVE AREA  150 X 80 = 12K
               END  START
