         DEF      INITRCVR
INITRCVR EQU      %
         DEF      SUACNT,SUATIME,SUACUN
         DEF      RCVDISC,SAVEREGS
         DEF      RCVRAD
         DEF      RCVRDSZ
         DEF      RCVSIZE
         REF      CSEI%PATH%RECOV,CSED%PATH
         REF      DCT1
         REF      DCTSIZ,DCT3
         REF      CIT1,DCT1P,DCT2,DCT4,FORCEIO,INTSIM,IOQ2
         REF      IOQ3,IOQ4,IOQ5,IOQ7,M5,TB:FLGS,M7
         DEF      OCNDD
         DEF      CNDD
         DEF      LLNDD
         DEF      SYSVERS
         DEF      RCVCODE
         REF      RT:RCVR
         DEF      TRAPSAVE
         DEF      BOOTSBAND
         DEF      RESTRTIO
         DEF      RCVSTART
         REF      M:SWAPD
         SREF     SB:STATE          MP SLAVE STATE
         SREF     SYSTRT            SLAVE SYS START
         SREF     NSCPU             #SLAVES
         SREF     SB:RCVR           MASTER RCVR FLAG
         SREF     SB:RCVA           SLAVE ACK RCVR FLAG
         SREF     T:SIDLER          SLAVE RTN FOR SUA
         REF      24BM15,TEMP
         SREF     COCFLAG
         DEF      SAVEREGS1
         DEF      TRAPPSD,SCR61,ABORT
         DEF      SEEK4000
R0       EQU      0
R1       EQU      1
R2       EQU      2
R3       EQU      3
R4       EQU      4
R5       EQU      5
R6       EQU      6
R7       EQU      7
SR1      EQU      8
SR2      EQU      9
SR3      EQU      10
SR4      EQU      11
D1       EQU      12
D2       EQU      13
D3       EQU      14
D4       EQU      15
S69PROC  SET      1
         SYSTEM   UTS
TRAPSAVE DATA     ,                 SAVE .40 & .46 IN RECOVERY
TRAPPSD  DATA     ,                 PSD OF TRAP
REDDWD   GEN,8,24 3,BA(RCVDISC)
         GEN,8,24 X'2E',4
         GEN,8,24 2,X'4000'*4
RCVSIZE  DATA     0
DISC     EQU      %
RCVDISC  DATA     0
RCVRDSZ  DATA     0
RCVRAD DATA 0
OCNDD DATA 1
LLNDD DATA 2
CNDD DATA 3
SYSVERS RES 1
         BOUND    8
RCVPSD   :PSD     RES,(IA,RECOVER0),INH  PSD TO ENTER RECOVERY
OPRECPSD :PSD     RES,(IA,OPRECENT),INH  PSD FOR OPERATOR REC ENTRY
BOOTSBAND RES     1
RCVSTART DATA 0,0
RCVCODE  DATA     0                 CRASH CODE & SUBCODE
         BOUND    8
TIO%STATUS  DATA  0,0
         DATA     0                 SEEK OF X'4000' FOR SUA FILE
SEEK4000 DATA     0                 SEEK OF X'4000' FOR RECOVER
SEEK     DATA     0                 SEEK TO PUT X'4000'-X'7FFF'
SEEK1    DATA     0                 SEEK TO CROSS CYCL.
         BOUND    8
DUMPCOM  GEN,8,24 3,BA(SEEK)
         GEN,8,24 X'2A',4
         GEN,8,24 1,4*X'4000'
         GEN,8,24 8,0
COMMPACK GEN,8,24   X'03',BA(SEEK1) SEEK TO NEXT CYLINDER
         GEN,8,24   X'2A',4
         GEN,8,24   X'08',0         TIC BACK INTO COMMRAD
         GEN,8,24   0,0
SAVEREGS RES      16                REGS AT TIME OF ENTRY TO RECOVERY
SAVEREGS1 RES     16                REGISTER BLOCK ONE AT TIME OF CRASH
SUACNT   DATA     0                 COUNT OF SUA'S SINCE LAST CRASH
SUATIME  DATA     0,0,0,0           TIME OF SUA'S
SUACUN   DATA     0                 USER NUMBER OF SUA'S
BLOCK1   GEN,28,4 COCFLAG,0         BLK 1 COC SYS; BLK 0 NON COC SYS
MPBRANCH B        SYSTRT            SLAVE SYS STARTLOOP
MPBRANCH2 B       T:SIDLER          SLAVE RTN FOR SUA
         PAGE
         REF      C:TIC,C:TINC
         DEF      RECOVER0
         DEF      RCVPSD
         DEF      OPRECPSD
         REF      Y004,T:ABORTM
         REF      S:CUN
         REF      JX:CMAP
         REF      J:JIT
         REF      UX:JIT
         REF      CORED
         REF      SMUIS
         REF      M9
         REF      MING,J:TELFLGS
*
*
*  SPECIAL ENTRY FROM OPERATOR RECOVERY XPSD.
*  PROCEDURE IS SIMILAR TO XDELTA ENTRY PROCEDURE.
*
*  SWAP SAVED (IF ANY) RCVPSD AND SAVED OPERATOR RECOVERY
*  PSD TO:
*     1  SAVE RCVPSD IN CASE OF OPERATOR RECOVERY AFTER HANG IN RECOVERY
*     2  SIMPLIFY HANDLING OF PSD'S DURING RECOVERY AND ANALYSIS.
*
OPRECENT EQU      %
         STM,0    SAVEREGS          S/ALL REGS
         LRP      Y004              GO TO REG BLK ZERO
         LD,0     OPRECPSD          L/SAVED OP REC PSD
         LD,2     RCVPSD            L/LAST SAVED RCVPSD
         STD,0    RCVPSD            S/OP REC PSD IN RCVPSD
         STD,2    OPRECPSD          S/PREVIOUS RCVPSD IN OPRECPSD
         LI,13    CSEI%PATH%RECOV   SET FLAG FOR FAULT HANDLERS
         STS,13   CSED%PATH
         LI,13    -1**16+1          L/-1 REC CODE, 1 SUBCODE
         B        RCV41             B
*
*
*  ENTER FROM RCVPSD WITH INHIBITS ON, MAP OFF, AND CC = 0
RECOVER0 EQU      %
         LRP      BLOCK1            GO TO REGISTER BLOCK ONE
         STM,R0   SAVEREGS1         SAVE REGISTER BLOCK ONE
         LRP      Y004              GO TO REGISTER BLOCK ZERO
         STM,R0   SAVEREGS          SAVE REGISTER BLOCK ZERO
         LI,13    CSEI%PATH%RECOV   SET FLAG FOR FAULT HANDLERS
         STS,13   CSED%PATH
         LI,1     NSCPU             MP SYSTEM
         BEZ      NOMP              NO,SKIP THIS
         LW,14    MPBRANCH          STORE SLAVE BRANCH
         STW,14   SYSTRT            IN SYSTRT
         LI,14    -1
         STW,14   SB:RCVR           SET MASTER RCVR FLAG
RESTRT   LI,1     NSCPU             SET UP FOR ACK LOOP
GETN     MTB,0    SB:RCVA,1         SLAVE ACKED
         BNEZ     %+3               YES
         MTB,0    SB:STATE,1        WAS IT STOPPED
         BNEZ     RESTRT            NO,GO CHECK EM ALL AGIN
         BDR,1    GETN              YES, CHECKED ALL?
NOMP     EQU      %                 YEP
         LI,14    X'1FFFF'          L/WORD ADDRESS MASK
         AND,14   RCVPSD            & XPSD ADR + 1
         LI,13    X'30001'          L/SCREECH CODE FOR BAD SCREECHES
         CI,14    15                C/XPSD ADR + 1 W/15
         BG       %+2               BG; SCREECH CODE NOT IN REGS
         AI,14    SAVEREGS          +ADDR OF SAVEREGS; CODE IN REGS
         LH,1     RCVPSD            L/LH OF WD 0 OF STORED PSD
         CI,1     X'40'             CHECK MAP BIT
         BAZ      RCV60             B/RESET; NO MAPPING PROBLEMS
         CI,14    X'8000'           C/XPSD ADR + 1 W/.8000
         BL       RCV60             BL; XPSD IN ROOT
         LW,5     14                L/XPSD ADR + 1
         SLS,5    -9                SHIFT; G/VIRTUAL PAGE #
         LW,2     S:CUN             L/CURRENT USER #
         CI,2     SMUIS             C/CUR USER # W/MAX
         BG       RCV41             BG; ILLEGAL USER #; SCREECH 03-01
         LOAD,2   UX:JIT,2          L/PHYSICAL PAGE # OF USER'S JIT
         SLS,2    9                 SHIFT; GET WORD ADR OF JIT
         AI,2     JX:CMAP-J:JIT     +WORD DISP FROM JIT TO CMAP
         CW,2     CORED             C/ADR W/# OF WORDS OF PHYS CORE
         BGE      RCV42             BGE; UX:JIT PROBABLY BAD; SCR 03-02
         LOAD,2   *2,5              L/PHYSICAL PAGE # OF XPSD ADR + 1
         SLS,2    9                 SHIFT; GET WD ADDR OF PHYSICAL PAGE
         CW,2     CORED             C/ADR W/# OF WDS OF PHYS CORE
         BGE      RCV43             BGE; JX:CMAP PROBABLY BAD; SCR 03-03
         AND,14   M9                &(XPSD ADR + 1) W/.1FF
         AW,14    2                 G/PHYS WD ADR OF XPSD + 1
RCV60    LI,D2    X'F00FF'
         AND,D2   *D3               GET SCREECHCODE,SUBCODE
         BNEZ     RCV41             BNEZ
         LW,13    SAVEREGS+15       L/SCREECH CODES FROM SAVEREGS+15
         CI,13    -1**16            SEE IF LH OF R15 IS NON-ZERO
         BANZ     %+2               BANZ; R15 HAS CODE & SUBCODE
         SLS,13   16                SHIFT; R15 HAD ONLY SCREECH CODE
RCV41    STW,13   RCVCODE           S/SCREECH CODE AND SUBCODE
         LI,D1    X'300'
         LI,D2    X'300'
         AND,D1   *D3               SCREECH,SUA,DUMP
         BEZ      RCV1              SCREECH
         STS,D1   RCVCODE           SAVE SCREECH,SUA,DUMP FOR ANLZ
         CI,D1    X'200'
         BE       DUMP              DUMP
         BG       RCV1              ERROR-NO SUCH TYPE CRASH
         LH,D4    RCVCODE           SUA-SCREECHCODE
         DEF      DUMPFILE,SUABTFLE,MPPSEEK,SUARTN
         REF      T:GJOBSTRT
         REF      Y07,MB:SDI,DCT5
         REF      DCT6
         SREF     CO:INTFL
         LI,R0    0                 TEST R0 IN NON COC SYSTEM
         MTH,0    CO:INTFL          COC INTERRUPTS DISABLED
         BNEZ     RCV1              YES-CRASH
         LD,R2    TRAPPSD           TRAP PSD
         LI,R1    #CODES            NUMBER OF SUA CODES
         CB,D4    SCODES,R1         SUA CODE
         BE       KRD5              YES
         BDR,R1   %-2
         LD,R2    RCVPSD            RECOVER PSD
KRD5     CW,R3    Y07               INHIBITED
         BANZ     RCV1              YES-CRASH
         CW,R2    Y004              MAPPED
         BAZ      RCV1              NO-CRASH
*
*   S I N G L E     U S E R    A B O R T
*
MAPED    LPSD,0   MAPMAP            GO MAPED
         LW,R1    Y004
         CW,R1    J:TELFLGS         THIS USER SUA'ED BEFORE
         BANZ     RCV1              YES-CRASH
         STS,R1   J:TELFLGS         NO-SET SUA'ED
         LW,12    S:CUN
         CI,D1    MING
         BLE      RCV1              CRASH IF SYSTEM GHOST
         MTW,0    DUMPFILE          DUMP FILE BUSY
         BNEZ     RCV1              YES-CRASH
DUMP     EQU      %
         MTW,0    DUMPFILE          DUMP FILE BUSY
         BNEZ     DUMPRTN           YES-CANT DUMP RETURN TO CALLER
         LI,R7    1                 INDEX TO SAVE DCTX
         LB,R1    MB:SDI            DCTX OF SWAPPER
         BAL,SR4  STOPIO            STOP IO ON THIS DEVICE
         CB,R1    MB:SDI            DID ANOTHER DEVICE ON THE CHANNEL GET ET STO
         BE       %+2               NO
         STB,R1   SAVEDCTX,R7       YES SAVE ITS DCTX
         LH,R1    SUABTFLE          DCTX OF DUMP DEVICE
         BAL,SR4  STOPIO            STOP IO ON THIS DEVICE
         CH,R1    SUABTFLE          DID ANOTHER DEVICE ON THIS CHANNEL GET STOPE
         BE       KRD4              NO
         CB,R1    SAVEDCTX,R7       DEVICE ALL REDEADY REMEMBERED
         BE       KRD4              YES
         LI,R7    2                 INDEX TO SAVE DCTX
         STB,R1   SAVEDCTX,R7       SAVE DCTX
KRD4     EQU      %
UNMAP1   LPSD,0   UNMAPPSD          GO UNMAPED
         :HIO,0   *M:SWAPD          HALT I/O ON SYSTEMM DEVICE
         LH,R1    SUABTFLE          DCTX OF DUMP DEVICE
         LH,R0    DCT1,R1           DEVICE ADDRESS OF DUMP DEVICE
         :HIO,0   *0                HALT I/O ON DUMP DEVICE
         LW,R6    C:TIC             TIME SINCE LAST CRASH
         SW,R6    C:TINC
         AI,R6    30                ADD TIME OF THIS QUANTUM
         LI,R1    3
         AND,R1   SUACNT            CIRCULAR BUFFER
         MTW,1    SUACNT            COUNT THIS SUA
         STW,R6   SUATIME,R1        SAVE TIME OF THIS SUA
         LW,R6    S:CUN
         STB,R6   SUACUN,R1         SAVE USER NUMBER OF THIS SUA
         LI,R6    -1                RECOVERY'S START ADDRESS-1 (S U A)
         B        KRD2
SUARTN   EQU      %                 RETURN FROM RECOVERY
         LW,1     MPPSEEK           SEEK OF MONITOR UNDER RECOVERY
         XW,1     RCVDISC           SET TO READ THAT
         LI,0     DA(REDDWD)
         :SIO,R0  *M:SWAPD          READ BACK MONITOR PROCEDURE
KRD3A    LI,R6    256
         BDR,R6   %                 DELAY
         :TIO,R0  *M:SWAPD          TEST I/O UNTIL FINISHED
         BCS,12   KRD3A
         STW,1    RCVDISC           RESTORE RCVDISC
         LB,R1    MB:SDI            DCTX OF SYSTEM SWAPPER
         BAL,SR4  RESTRTIO          YES-RESTART THE IO
         CH,R1    SUABTFLE          SWAP AND DUMP DEVICE SAME
         BE       KRD3              YES-THIS ALL THE IO NEEDED TO RESTARRT
         LH,R1    SUABTFLE          DCTX OF DUMP DEVICE
         BAL,SR4  RESTRTIO          YES-RESTART THE IO
KRD3     EQU      %
         LI,R7    2
         LB,R1    SAVEDCTX,R7       DCTX SAVED
         BEZ      %+4               NO
         STB,R7   SAVEDCTX          SAVE R7
         BAL,SR4  RESTRTIO          START IO
         LB,R7    SAVEDCTX          RESTORE R7
         BDR,R7   %-5
         LB,R1    MB:SDI            DCTX OF SWAPPER
         BAL,R2   FORCEIO           GO-START IO
         LH,R1    SUABTFLE          DCTX OF DUMP DEVICE
         BAL,R2   FORCEIO           GO-START IO
         LI,R7    2
         LB,R1    SAVEDCTX,R7       DCTX SAVED
         BEZ      %+4               NO
         STB,R7   SAVEDCTX          SAVE R7
         BAL,R2   FORCEIO           GO START IO
         LB,R7    SAVEDCTX          RESTORE R7
         BDR,R7   %-5
         STW,R7   SAVEDCTX          ZERO SAVEDCTX
         LD,R0    TXCRVGST
         BAL,SR3  T:GJOBSTRT        GO-START RECOVER GHOST
         LW,R7    RCVCODE           SCREECH CODE INFO
         CI,R7    X'200'            DUMP
         BAZ      KRD6              NO-SUA
DUMPRTN  MTW,1    RCVPSD            RETURN TO XPSD+2
         LCI      0
         LM,R0    SAVEREGS          RESTORE REG BLOCK0
         LPSD,8   RCVPSD            RETURN TO XPSD+2
KRD6     EQU      %
         LI,15    NSCPU             MP SYSTEM
         BEZ      KRD61             NO
         LW,15    MPBRANCH2         SET UP SIDLER BRANCH
         STW,15   SYSTRT            IN SLAVE SYSTRT
         LI,15    0
         STW,15   SB:RCVR           ZERO RCVR MASTER FLAG
         STW,15   SB:RCVA           ZERO RCVR SLAVEFLAG
KRD61    EQU      %
         LI,D3    X'7F'             SUA CODE
         LH,D4    RCVCODE           CRASH CODE AS SUB-CODE
         STB,D4   D3
         LPSD,0   RTNPSD            GO-TO T:ABORTM
RCV1     EQU      %
*
*                 ALLOW REAL-TIME SYSTEMS TO SUPPLY THEIR OWN
*                 RECOVERY ROUTINE
*
         BAL,11   RT:RCVR
*
*
* BRANCH AROUND ADAM CODE (PATCH WITH NOP IF DESIRED)
*
         B        NOADAM
*
*
         LI,1     0                 TURN OFF ADAM
         RD,1     X'2FF0'           SO THAT ANLZ
         SLS,1    -12               WILL FIND MEANINGFUL
         CI,1     X'F'              DATA AND WONT BE
         BNE      %+3               CONFUSED BY RECOVERY
         LI,1     0
         WD,1     X'2FF1'
NOADAM   EQU      %
         LI,R6    0                 CRASH RECOVERY ENTRY
         LPSD,1   PDFPSD            CLEAR PDF FLAG
PDFOFF   LI,R1    DCTSIZ            HALT ALL SYSGEN DEVICES
KRD7     LC       DCT3,R1           DEVICE PARTITIONED OUT
         BCS,2    KRD8              YES-DO NOT HALT
         LH,R2    DCT1,R1           DEVICE ADDRESS
         :HIO,0   *R2               HALT THE DEVICE
KRD8     BDR,R1   KRD7              LOOK AT ALL SYSGENED DEVICES
         AIO,0    0
         BCR,8    %-1               ACKNOWLEDGE EVERY INTERRUPT
KRD2     EQU      %
         LW,R2    SEEK4000,R6
         STW,R2   SEEK              SEEK TO PUT CORE AT X'4000'
         LI,R3    X'F0000'
         STS,R2   SEEK1             CYLINDER NUMBER
         LB,R1    MB:SDI            DCT OF SYSTEM SWAP
         CI,R6    0                 SUA
         BE       %+2               NO
         LH,R1    SUABTFLE          YES-GET DCT OF SUA FILE
         LH,R1    DCT1,R1           DEVICE ADDRESS
         LI,R0    DA(DUMPCOM)       DUMP COMM LIST
         LI,R2    500000
         BDR,R2   %                 DELAY FOR PACK ARM
KRD1     :SIO,0   *R1               DUMP X'4000'-X'7FFF'
KRD1A    LI,R2    35
         BDR,R2   %                 DELAY
         :TIO,R4  *R1
         BCS,12   KRD1A             DELAY UNTILL DONE
         STD,R4   TIO%STATUS        SAVE TIO STATUS
         AI,R5    1023
         AND,R5   =X'FFFFFC00'      ROUND UP TO SECTOR
         LI,R4    X'FFFF'
         XW,R4    R5
         STS,R4   TIO%STATUS+1
         LH,R5    TIO%STATUS+1      STATUS BITS
         :TDV,R3  *R1               GET TDV STATUS
         LC       R3                SECTOR UNAVAILABLE
         BCR,2    %+3               NO-
         CI,R5    X'800'
         BANZ     UNEND             UNUSUAL END-CYL CROSSING
         LI,0     DA(REDDWD)
         :SIO,0   *M:SWAPD
KRD2A    LI,1     35
         BDR,1    %                 DELAY
         :TIO,0   *M:SWAPD
         BCS,12   KRD2A
         B        *RCVSTART+1,R6
MPPSEEK  DATA     0
         BOUND    8
TXCRVGST TEXTC    'RVGHOST'
MAPMAP   :PSD     MAP,(IA,MAPED+1),INH
UNMPSD   :PSD     (IA,UNMPSD1+1),INH
UNMAPPSD :PSD     (IA,UNMAP1+1),INH
RTNPSD   :PSD     MAP,(IA,T:ABORTM),(WK,1)
PDFPSD   :PSD     (IA,PDFOFF),INH
         BOUND    4
DUMPFILE DATA     0                 Z DUMP FILE FREE,NZ DUMP FILE BUSY
         DATA,2   0,0               NUMBER OF CORE PAGES,NUMBER OF JITS
SAVEDCTX DATA     0                 SAVE DCTX OF DEVICES STOPED FOR SUA
SUABTFLE DATA     0                 FIRST DISC ADDRESS OF DUMP FILE
         DATA     0                 GRANULE SIZE OF DUMP FILE
RCV43    AI,13    1                 +1 TO RECOVERY SUBCODE (03-03)
RCV42    AI,13    1                 +1 TO RECOVERY SUBCODE (03-02)
         B        RCV41             B
SCODES   DATA,1   0,X'61',X'79',X'7E'
#CODES   EQU      BA(%)-BA(SCODES)-1
         BOUND    4
         PAGE
STOPIO   EQU      %                 DCTX IN R1
         LB,R3    DCT2,R1           CITX
         LB,R4    CIT1,R3           IOQX
         BEZ      *SR4              NO QUEUE CHAIN-RETURN
STOPIO3  LC       IOQ3,R4           REQUEST BUSY
         BCR,8    STOPIO2           NO
         LB,R2    IOQ7,R4           DCTX OF BUSY DEVICE
         LC       DCT5,R2           DEVICE BUSY
         BCR,8    STOPIO2           NO
         BCR,1    STOPIO2           NO DATA TRANSFERING
         LH,R6    DCT1,R2           DEVICE ADDRESS
         CH,R6    DCT1P,R2          DATA TRANSFERING ON PRIMARY CHANNEL
         BNE      STOPIO2           NO-DO NOT STOP IO
         LB,R5    DCT4,R2           TYPE INDEX
         LB,R5    TB:FLGS,R5
         CI,R5    X'C0'             ROTATING DEVICE
         BGE      STOPIO1           YES-HALT THE IO
         LI,R2    X'2000'           LOOP COUNTER
STOPIO4  LI,R5    1000
         BDR,R5   %                 DELAY
         :TIO,R5  *R6               TIO TO GET STATUS
         LC       R5                INTERRUPT PENDING FOR TAPE
         BCS,8    *SR4              YES-RETURN CHANNEL QUIET
         BDR,R2   STOPIO4           LOOP
         B        *SR4              GIVE UP ON DELAY FOR TAPE
STOPIO1  :HIO,0   *R6               HALT I/O ON ROTATING DEVICE
         LW,R1    R2                DCTX OF HALTED DEVICE
         B        *SR4              RETURN
STOPIO2  LB,R4    IOQ2,R4           CHAIN DOWN THE QUEUE
         BNEZ     STOPIO3
         B        *SR4              RETURN END OF CHAIN
         PAGE
RESTRTIO EQU      %
         LC       DCT5,R1           DEVICE BUSY
         BCR,X'E' *SR4              NO-NOTHING TO RESTART
         BCR,8    %+2
         BAL,R5   INTSIM            GO-SET DEVICE IN CLEANUP-PENDING STATE
         LB,R2    DCT5,R1
         AND,R2   M5
         STB,R2   DCT5,R1           CLEAN UP DCT5 FOR RESTART
         LB,R2    DCT6,R1           IOQX
         LB,R3    IOQ3,R2
         AND,R3   M7
         STB,R3   IOQ3,R2           CLEAR THE BUSY BIT FROM IOQ3
         LB,R3    IOQ4,R2
         STB,R3   IOQ5,R2           SET FUNCTION CODE
         B        *SR4              RETURN
         PAGE
UNEND    MTH,1    SEEK1             INC CURRENT CYLINDER NUMBER
         LI,R3    X'FFFF'
         LI,R2    X'FFFF'
         AND,R2   TIO%STATUS
         STS,R2   COMMPACK+2        DA(COMMRAD) ADDRESS
         SLS,R2   1                 ADDRESS OF COMMRAD ENTRY
         LI,R5    X'FFFF'
         LI,R4    X'FFFF'
         AND,R4   TIO%STATUS+1      REMAINGING BYTE COUNT
         BNEZ     %+2
         LI,R4    X'10000'          REMAING BYTE COUNT
         CI,R4    X'400'            ODD NUMBER OF SECTORS/CYLINDER
         BAZ      %+2               NO
         AI,R4    X'400'            YES-RE-WRITE THE LAST SECTOR
         INT,R3   1,R2              STARTING BYTE COUNT FROM COMMRAD
         CI,R3    0
         BNE      %+2
         LI,R3    X'10000'          STARTING BYTE COUNT
         STS,R4   1,R2              NEW BYTE COUNT
         SW,R3    R4
         AWM,R3   0,R2              INC MEMORY ADDRESS BY AMOUNT WRITTEN
         LI,R0    DA(COMMPACK)
         B        KRD1
         PAGE
SCR61    EQU      %
         STS,R6   SCR61E+1          TRAP CELL AS SUB CODE
         LI,1     SAVEREGS+15       L/ADR OF LAST REG IN SAVEREGS
         CB,6     =X'42'**24        C/TRAP TYPE W/X'42'
         BE       %+2               BE; GET REGS FROM SAVEREGS
         LW,1     TSTACK            L/TOP OF STACK ADR; REGS FROM TSTACK
         LCI      0                 L/CC'S OF 0 FOR LM
         LM,0     -15,1             L/REGS (AT TIME OF TRAP)
SCR61E   SUA      X'61'             SUA X'61'
         PAGE
ABORT    EQU      %
*                                   THIS CODE PRESERVES THE LAST
*                                   16 INSTRUCTIONS EXECUTED IN THE
*                                   LAST  16 WORDS OF THE MONITOR JIT
*
         DISABLE
         STS,R6   SCR7EE+1          TRAP CELL AS SUB CODE
         STW,0    TEMP              SAVE R0
         LW,1     TSTACK            L/TOP OF STACK ADDRESS
         LCI      0                 L/CC'S OF 0 FOR LM
         LM,R0    *24BM15,R1        L/REGS (AT TIME OF TRAP)
         STM,0    SAVEREGS          S/REGS IN SAVEREGS
UNMPSD1  LPSD,0   UNMPSD            GO UNMAPED
         LI,1     X'1FFFF'
         AND,1    TEMP              G/TRAP ADR
         CI,1     15                C/ADR W/15; SEE IF IN REGS
         BLE      NOPUT
         CI,1     X'8000'
         BGE      NOPUT             OCCURED IN MAPPED AREA
         LCI      0
         LM,R0    *24BM15,R1        PRECEEDING LOCS
         STM,0    J:JIT+X'1FF'-15
NOPUT    EQU      %
         LCI      0                 L/CC'S OF 0 FOR LM
         LM,0     SAVEREGS          L/REGS FROM SAVEREGS
SCR7EE   SUA      X'7E'             SUA X'7E'
         END

