TITLE  'ICATS OWN SIO ROUTINE'                                 MYI00010
*********************************************************************** MYI00020
*                                                                     * MYI00030
*  MODULE NAME =  MYIORTN = MY OWN I/O ROUTINE                        * MYI00040
*                                                                     * MYI00050
*  FUNCTION =  DO MY OWN SIO'S AS A SUBSTITUTE FOR DIAGNOSE X'0020'.  * MYI00060
*                                                                     * MYI00070
*  ENTRY POINTS =  MYIORTN                                            * MYI00080
*                                                                     * MYI00090
*  LINKAGE =  BALR R14,R15 FROM THE ICATS I/O ROUTINE (READUTS).      * MYI00100
*                 LH    R8,CBUTSVAD     <-------   NOTE THESE TWO     * MYI00110
*                 LA    R9,CCW          <-------   IRREGULARITIES     * MYI00120
*                 L     R15,=V(MYIORTN)                               * MYI00130
*                 BALR  R14,R15                                       * MYI00140
*                                                                     * MYI00150
*  REGISTER CONTENTS UPON ENTRY =                                     * MYI00160
*     R8  = CONTAINS THE DEVICE ADDRESS TO DO THE SIO TO.             * MYI00170
*     R9  = CONTAINS THE ADDRESS OF THE CCW TO EXECUTE.               * MYI00180
*     R2  = POINTS TO THE ICATS COMMON DATA AREA AS ALWAYS.           * MYI00190
*     R14 = RETURN ADDRESS BACK TO CALLER.                            * MYI00200
*     R15 = ADDRESS OF THIS SUBROUTINE (USED FOR BASE REG).           * MYI00210
*                                                                     * MYI00220
*  REGISTER CONTENTS UPON EXIT =                                      * MYI00230
*     R15 = 0                                                         * MYI00240
*                                                                     * MYI00250
*  REGISTER USAGE:                                                    * MYI00260
*     R0  = FREE                                                      * MYI00270
*     R14 = RETURN ADDRESS FOR WHEN I CALL SUBROUTINES                * MYI00280
*     R15 = SUBROUTINE ADDRESS                                        * MYI00290
*                                                                     * MYI00300
*  MODULE LOGIC =                                                     * MYI00310
*      I)  XXXXXX                                                     * MYI00320
*          1)  XXXXXX                                                 * MYI00330
*              A)  XXXXXX                                             * MYI00340
*              B)  XXXXXX                                             * MYI00350
*              C)  XXXXXX                                             * MYI00360
*                                                                     * MYI00370
*  NORMAL EXIT =                                                      * MYI00380
*      R15 = 0                                                        * MYI00390
*                                                                     * MYI00400
*  EXTERNAL REFERENCES = NONE                                         * MYI00410
*                                                                     * MYI00420
*  CONTROL BLOCKS =  ICDATA   (ICATS COMMON DATA AREA)                * MYI00430
*                                                                     * MYI00440
*  NON-STANDARD MACROS (FOUND IN ICATS MACLIB)                        * MYI00450
*            ICDATA = ICATS COMMON DATA AREA DSECT.                   * MYI00460
*                                                                     * MYI00470
*  CHANGE ACTIVITY                                                    * MYI00480
*    DATE        NAME       REASON FOR CHANGE                         * MYI00490
*  04/27/83  RICK JASPER    INITIAL PROGRAM CREATION                  * MYI00500
*                                                                     * MYI00510
*********************************************************************** MYI00520
         EJECT                                                          MYI00530
         PRINT   GEN,NODATA                                             MYI00540
MYIORTN  CSECT                                                          MYI00550
         USING ICDATA,R2            ADDRESS ICATS COMMON DATA AREA      MYI00560
         USING MYIORTN,R15    USE R15 FOR NEXT INSTRUCTION ONLY         MYI00570
         STM   R2,R14,HEXREGS   SAVE CALLERS REGISTERS                  MYI00580
         DROP  R15                                                      MYI00590
         USING MYIORTN,R11       USE R11 FOR THIS ROUTINE'S BASE REG    MYI00600
         LR    R11,R15           SWITCH BASE REGISTER TO R11            MYI00610
*                                                                       MYI00620
         MVI   MYFLAG,X'00'    RESET FLAGS                              MYI00630
         SSM   DISABSSM     DISABLE INTERRUPTS                          MYI00640
         SR    R10,R10               INITIALIZE RETURN CODE             MYI00650
REDOTIO1 TIO   0(R8)                                                    MYI00660
         BC    8,REDOSIO          DEVICE IS FREE                        MYI00670
         BC    4,TIO1CSW          CSW STORED                            MYI00680
         BC    2,REDOTIO          BUSY                                  MYI00690
NODEVICE LA    R10,1              DEVICE NOT THERE - RETURN CODE = 16   MYI00700
         B     SIOBYE                                                   MYI00710
TIO1CSW  TM    68,X'02'           SEE IF UNIT CHECK IS POSTED IN CSW    MYI00720
         BNO   REDOTIO1           CONTINUE LOOPING IF NOT               MYI00730
         LA    R10,SENSE0              PUT SENSE BYTE IN SENSE0         MYI00740
         STCM  R10,B'0111',MYSNSCCW+1                                   MYI00750
         MVC   72(4),=A(MYSNSCCW)      SET UP CAW TO DO A SENSE         MYI00760
         SIO   0(R8)                                                    MYI00770
SNSWAIT1 TIO   0(R8)                   WAIT AROUND UNTIL IT'S DONE      MYI00780
         BC    7,SNSWAIT1                                               MYI00790
         TM    MYFLAG,UNITCHCK         ONLY GO THROUGH THIS CODE ONCE   MYI00800
         BO    CON100                                                   MYI00810
         LA    R10,13             RETURN CODE = 4 = UNIT CHECK          MYI00820
         LA    R10,13             RETURN CODE = 4 = UNIT CHECK          MYI00830
         B     SIOBYE             SENSE0 CONTAINS THE SENSE BYTE        MYI00840
CON100   OI    MYFLAG,UNITCHCK    DON'T COME THIS WAY AGAIN             MYI00850
         MVI   SENSE0,X'00'       CLEAR SENSE BYTE & RETRY SIO          MYI00860
         B     REDOTIO1                                                 MYI00870
*                                                                       MYI00880
         SPKA  0(0)         PSW KEY MUST BE 0 TO PUT CAW IN PLACE       MYI00890
         ST    R9,72(R0)             STORE CHANNEL ADDRESS WORD         MYI00900
REDOSIO  SIO   0(R8)                                                    MYI00910
         BC    8,WAIT4END        SIO TOOK O.K.                          MYI00920
         BC    2,REDOTIO1        BUSY - WAIT FOR FREE AGAIN             MYI00930
         BC    1,NODEVICE        DEVICE NOT THERE                       MYI00940
*    CSW STORED ON THE SIO INSTRUCTION.  WHAT DOES IT SAY ??            MYI00950
         TM    68,X'02'          UNIT CHECK ON ??                       MYI00960
         BNO   CON200                                                   MYI00970
         LA    R10,SENSE0              PUT SENSE BYTE IN SENSE0         MYI00980
         STCM  R10,B'0111',MYSNSCCW+1                                   MYI00990
         MVC   72(4),=A(MYSNSCCW)      SET UP CAW TO DO A SENSE         MYI01000
         SIO   0(R8)                                                    MYI01010
SNSWAIT2 TIO   0(R8)                   WAIT AROUND UNTIL IT'S DONE      MYI01020
         BC    7,SNSWAIT2                                               MYI01030
         LA    R10,4                                                    MYI01040
         B     SIOBYE                                                   MYI01050
CON200   DS    0H                                                       MYI01060
         TM    69,X'40'          INCORRECT LENGTH ??                    MYI01070
         BNO   CON210                                                   MYI01080
         LA    R10,8                                                    MYI01090
         B     SIOBYE                                                   MYI01100
CON210   DS    0H                                                       MYI01110
         LA    R10,12            MISCELLANEOUS ERRORS.                  MYI01120
         B     SIOBYE                                                   MYI01130
*                                                                       MYI01140
WAIT4END TIO   0(R8)                                                    MYI01150
         BC    8,IOFINIS         SIO TOOK O.K.                          MYI01160
         BC    2,WAIT4END        BUSY - WAIT FOR END                    MYI01170
         BC    1,NODEVICE        DEVICE NOT THERE                       MYI01180
*    CSW STORED ON THE TIO INSTRUCTION.  STACK STATUS UNLESS BUSY OR    MYI01190
                                                                        MYI01200
                                                                        MYI01210
                                                                        MYI01220
                                                                        MYI01230
                                                                        MYI01240
                                                                        MYI01250
                                                                        MYI01260
MYIOEND  DS    0H                                                       MYI01270
         MVC   120(8,R0),CMSIONEW                                       MYI01280
         LM    R2,R14,HEXREGS                                           MYI01290
         SPKA  X'E0'          SET PSW KEY BACK TO NORMAL                MYI01300
         BR    R14            BYE                                       MYI01310
         DS    0D                                                       MYI01320
MYSNSCCW DC    X'0400000020000001'      ADDRESS WILL BE FILLED IN LATER MYI01330
MYNEWPSW DC    X'0004000000'     ENABLED WAIT STATE PSW POINTING        MYI01340
         DC    AL3(IOBACK)       BACK TO THIS ROUTINE                   MYI01350
MYWAITPS DC    X'FF06000000'     ENABLED WAIT STATE PSW POINTING        MYI01360
         DC    AL3(IOBACK)       BACK TO THIS ROUTINE                   MYI01370
HEXREGS  DS    13F                                                      MYI01380
DISABSSM DC    X'00'                                                    MYI01390
ENABSSM  DC    X'FF'                                                    MYI01400
MYFLAG   DC    X'FF'                                                    MYI01410
UNITCHCK   EQU   X'80'                                                  MYI01420
         LTORG                                                          MYI01430
         ICDATA                                                         MYI01440
         END                                                            MYI01450