TITLE  'ICATS FAKE-A-UTS-INTERRUPT ROUTINE'                    FAK00010
*********************************************************************** FAK00020
*                                                                     * FAK00030
*  MODULE NAME =  FAKIT                                               * FAK00040
*                                                                     * FAK00050
*  FUNCTION =  SIMULATE AN ATTENTION INTERRUPT FOR THE SPECIFIED      * FAK00060
*              UTS.  I/O FOR THIS UTS REQUEST WON'T REALLY BE DONE,   * FAK00070
*              RATHER IT WILL BE SIMULATED FROM AND TO CMS FILES.     * FAK00080
*              THE FORMAT OF THE COMMAND IS                           * FAK00090
*                  FAKIT  <UTS-VIRTUAL-ADDRESS>                       * FAK00100
*              IF THE UTS-VIRTUAL-ADDRESS IS LEFT OFF, THEN IT        * FAK00110
*              DEFAULTS TO THE FIRST UTS IN THE UTSCB CHAIN.          * FAK00120
*              FAKIT IS NOT VALID FROM A UTS MACHINE.                 * FAK00130
*                                                                     * FAK00140
*  ENTRY POINTS =  FAKIT                                              * FAK00150
*                                                                     * FAK00160
*  LINKAGE =  BALR R14,R15 FROM ICATS MAINLINE.                       * FAK00170
*                                                                     * FAK00180
*  REGISTER CONTENTS UPON ENTRY =                                     * FAK00190
*      R2  = POINTS TO THE ICATS COMMON DATA AREA, AS ALWAYS.         * FAK00200
*      R14 = RETURN ADDRESS BACK TO ICATS MAINLINE                    * FAK00210
*      R15 = ENTRY POINT TO THIS MODULE                               * FAK00220
*                                                                     * FAK00230
*  REGISTER USAGE =                                                   * FAK00240
*      R0-R1 = USED TO PASS PARAMETERS TO SUBROUTINES.                * FAK00250
*      R2 =  USED TO ADDRESS THE ICATS COMMON DATA AREA.              * FAK00260
*      R3 =  FREE                                                     * FAK00270
*      R4 =  USED TO ADDRESS THE UTS CONTROL BLOCKS.                  * FAK00280
*      R5-R10 = FREE                                                  * FAK00290
*      R11 = MY BASE REGISTER                                         * FAK00300
*      R14 = MY RETURN ADDRESS WHEN I CALL SOMEBODY                   * FAK00310
*      R15 = SUBROUTINE ADDRESS                                       * FAK00320
*                                                                     * FAK00330
*                                                                     * FAK00340
*  MODULE LOGIC:                                                      * FAK00350
*      1)  SEE WHERE THIS COMMAND CAME FROM.  REJECT THIS             * FAK00360
*          COMMAND IF IT CAME FROM A UTS MACHINE.                     * FAK00370
*      2)  ELSE GO AHEAD AND SIMULATE AN INTERRUPT.                   * FAK00380
*                                                                     * FAK00390
*  NORMAL EXIT =                                                      * FAK00400
*      R15 = 0                                                        * FAK00410
*                                                                     * FAK00420
*  EXTERNAL REFERENCES = NONE                                         * FAK00430
*                                                                     * FAK00440
*  MACROS =  ICDATA = ICATS COMMON DATA AREA                          * FAK00450
*            ETTE   = ENTER TRACE TABLE ENTRY SUBROUTINE              * FAK00460
*                                                                     * FAK00470
*  CHANGE ACTIVITY                                                    * FAK00480
*    DATE        NAME       REASON FOR CHANGE                         * FAK00490
*  04/19/83  RICK JASPER    BROKEN AWAY FROM ICATS MAINLINE INTO      * FAK00500
*                           SEPARATE SUBROUTINE                       * FAK00510
*                                                                     * FAK00520
*********************************************************************** FAK00530
         PRINT   GEN,NODATA                                             FAK00540
FAKIT    CSECT                                                          FAK00550
         USING ICDATA,R2            ADDRESS ICATS COMMON DATA AREA      FAK00560
         USING CBUTS,R4             ADDRESS UTS CONTROL BLOCK           FAK00570
         USING *,R15              USE R15 FOR NEXT INSTRUCTION ONLY     FAK00580
         STM   R0,R14,FAKEREGS    SAVE ALL THE REGISTERS                FAK00590
         DROP  R15                                                      FAK00600
         USING FAKIT,R11          SWITCH BASE REGISTER TO R11           FAK00610
         LR    R11,R15                                                  FAK00620
         TM    FLAGB,UTSCMD       DID THIS COMMAND COME FROM A UTS ??   FAK00630
         BNO   FAKECONA           DON'T REJECT IT IF NOT.               FAK00640
         L     R15,AREJECT        GO TO REJECT-THIS-COMMAND ROUTINE     FAK00650
         BALR  R14,R15                                                  FAK00660
         B     FAKEBYE                                                  FAK00670
FAKECONA DS    0H                                                       FAK00680
         CLC   PARM2,=CL8' '          DID HE WANT THE DEFAULT UTS ??    FAK00690
         BNE   FAKECONB               NOPE, GO CONVERT REAL ADDRESS.    FAK00700
         L     R4,CBFIRST        GET ADDRESS OF FIRST UTSCB             FAK00710
         LTR   R4,R4             IS IT NULL ??  SHOULDN'T BE.           FAK00720
         BNZ   FAKECOND          NOPE, GOOD.  GO SET INTERRUPT BIT ON.  FAK00730
FAKENONE LA    R1,NONEMSG                                               FAK00740
         B     FAKEMSG                                                  FAK00750
*                                                                       FAK00760
FAKECONB DS    0H                                                       FAK00770
         LA    R1,PARM2          CONVERT UTS ADDRESS TO HEX             FAK00780
         L     R15,ACONHEX                                              FAK00790
         BALR  R14,R15                                                  FAK00800
         LTR   R15,R15           DID THE CONVERSION GO OK ??            FAK00810
         BNZ   FAKEERR1          NOPE, ERROR THEN.                      FAK00820
*  GO FIND THIS UTS MACHINE'S CONROL BLOCK IN THE UTSCB CHAIN           FAK00830
*     R0 = THE REQUESTED UTS MACHINE'S VIRTUAL ADDRESS IN HEX           FAK00840
         L     R4,CBFIRST        GET ADDRESS OF FIRST UTSCB             FAK00850
         LTR   R4,R4             ARE THERE ANY UTS'S ??                 FAK00860
         BZ    FAKENONE          ERROR IF THERE'S NO UTSCB'S            FAK00870
FAKELOOP CH    R0,CBUTSVAD       IS THIS THE UTS TO BE FAKED ??         FAK00880
         BE    FAKECOND          YEP, GO FAKE AN INTERRUPT FROM HIM.    FAK00890
         L     R4,CBUTSFP        GET POINTER TO NEXT UTSCB.             FAK00900
         LTR   R4,R4             ARE WE AT THE END OF THE CHAIN ??      FAK00910
         BNE   FAKELOOP          NOPE, GO CHECK THIS UTSCB              FAK00920
         LA    R1,NOMSG                                                 FAK00930
FAKEMSG  DS    0H                                                       FAK00940
*     GIVE THE REQUESTOR THE ERROR MESSAGE THAT R1 IS POINTING TO       FAK00950
         L     R15,AMESSAGE                                             FAK00960
         BALR  R14,R15                                                  FAK00970
         B     FAKEBYE           GOODBYE                                FAK00980
*                                                                       FAK00990
*     NOW R4 IS POINTING TO THE CORRECT UTSCB.                          FAK01000
*     TURN ON THE I-NEED-SERVICING FLAG FOR THIS UTS &                  FAK01010
*     TURN ON THE A-UTS-NEEDS-SERVICING FLAG.                           FAK01020
FAKECOND DS    0H                                                       FAK01030
         OI    CBUTSFGA,INTISIN                                         FAK01040
         OI    FLAGA,UTSINT                                             FAK01050
         OI    FLAGC,FAKEINT                                            FAK01060
FAKEBYE  DS    0H                                                       FAK01070
         LM    R0,R14,FAKEREGS                                          FAK01080
         SR    R15,R15                RETURN CODE = 0                   FAK01090
         BR    R14                    BYE                               FAK01100
FAKEERR1 DS    0H                                                       FAK01110
         LA    R1,INVMSG                                                FAK01120
         B     FAKEMSG                                                  FAK01130
FAKEREGS DS   15F                                                       FAK01140
*                                                                       FAK01150
NONEMSG  DC    AL1(NONEMSGE)                                            FAK01160
         DC    C'SORRY, BUT THERE ARE NO UTS''S TO TURN ON'             FAK01170
NONEMSGE EQU   *-NONEMSG-1                                              FAK01180
*                                                                       FAK01190
INVMSG   DC    AL1(INVMSGE)                                             FAK01200
         DC    C'INVALID ADDRESS GIVEN'                                 FAK01210
INVMSGE  EQU   *-INVMSG-1                                               FAK01220
*                                                                       FAK01230
NOMSG    DC    AL1(NOMSGE)                                              FAK01240
         DC    C'THERE''S NO UTS MACHINE AT THAT ADDRESS'               FAK01250
NOMSGE   EQU   *-NOMSG-1                                                FAK01260
         LTORG                                                          FAK01270
         ICDATA                                                         FAK01280
         END                                                            FAK01290