SCRIO TITLE 'Execute CCW for a 3270 Display' 00001000 SCRIO CSECT 00002000 SPACE 00003000 *---------------------------------------------------------------------* 00004000 * * 00005000 * SCRIO executes a CCW for a 3270 display. At entry, R1 -> CCW and * 00006000 * R2 contains the device address. The high-order byte of R2 * 00007000 * contains the flag bits defined for FLAGS. R15 contains the * 00008000 * entry address and R13 points to a standard save area. * 00009000 * When SCRIO returns, the condition code and R15 are set to in- * 00010000 * dicate success or failure. A sense byte or 0 is returned in * 00011000 * the high-order byte of R0. The residual count or 0 is returned * 00012000 * in the remainder of R0. * 00013000 * * 00014000 * SCRIO disables interrupts and runs with the system key. * 00015000 * SCRIO is re-entrant. DMSFREE, DMSFRET, and DMSKEY are called * 00016000 * via SVC 203. For a CMS console, CONWAIT is called via SVC 202. * 00017000 * * 00018000 *---------------------------------------------------------------------* 00019000 SPACE 00020000 PRINT NOGEN 00021000 STM R14,R12,12(R13) SAVE REGISTERS 00022000 LR R12,R15 SET-UP ADDRESSING 00023000 USING SCRIO,R12 00024000 USING NUCON,0 00025000 LR R3,R1 SAVE CCW ADDRESS IN R3 00026000 LA R0,WORKDBLW GET WORK AREA DOUBLEWORD COUNT 00027000 DMSFREE DWORDS=(0),TYPE=USER,ERR=STGERR,MSG=NO 00028000 B GOTFREE 00029000 SPACE 00030000 STGERR LA R15,104 ERROR CODE 104 FOR NO STORAGE 00031000 SR R0,R0 NO SENSE OR RESIDUAL COUNT 00032000 L R14,12(R13) RESTORE OTHER REGISTERS 00033000 LM R1,R12,24(R13) 00034000 LTR R15,R15 SET CC FROM R15 00035000 BR R14 RETURN 00036000 SPACE 00037000 GOTFREE LR R9,R1 SET-UP WORK AREA 00038000 USING WORKAREA,R9 R9 RESERVED FOR THIS 00039000 STM R0,R1,WORKFRET SAVE INFO FOR FRET 00040000 LA R1,SAVEAREA CHAIN SAVE AREAS 00041000 ST R13,SAVEAREA+4 00042000 ST R1,8(R13) 00043000 LA R13,SAVEAREA NOW READY FOR SUBROUTINE CALLS 00044000 MVI SBYTE,0 SENSE BYTE IS 0 00045000 XC RESCOUNT(4),RESCOUNT RESIDUAL COUNT IS 0 00046000 XC RTNCODE(4),RTNCODE RETURN CODE IS 0 00047000 ST R3,CCWADDR SAVE CCW ADDRESS 00048000 STCM R2,B'1000',FLAGS SAVE FLAGS 00049000 STH R2,DEVADDR SAVE DEVICE ADDRESS 00050000 DMSKEY NUCLEUS GET SYSTEM KEY 00051000 SSM =X'00' DISABLE INTERRUPTS 00052000 TM FLAGS,CMSCON IF CMS CONSOLE, FINISH I/O 00053000 BZ SCRADDR 00054000 LH R2,NUMPNDWR ANY PENDING WRITES? 00055000 LTR R2,R2 IF NOT, SKIP CALLING CONWAIT 00056000 BZ SCRADDR 00057000 SSM =X'FF' ENABLE INTERRUPTS 00058000 LA R1,=CL8'CONWAIT' CLEAR PENDING CMS CONSOLE I/O 00059000 SVC 202 00060000 DC AL4(1) IGNORE ERRORS 00061000 SSM =X'00' SET NO INTERRUPTION 00062000 SCRADDR LH R2,DEVADDR DISPLAY ADDRESS CUU 00063000 L R1,CCWADDR R1 -> CCW 00064000 WAITDISP EQU * 00065000 TIO 0(R2) RESET ALL PENDING INTERRUPTIONS 00066000 BC 6,WAITDISP AND LOOP IF SOME MORE 00067000 BC 1,RESETSCR ERROR IF DISPLAY NOT OPERATIONAL 00068000 * 00069000 * ISSUE DIAGNOSE 00070000 * 00071000 DIAG EQU * 00072000 DIAG R1,R2,X'58' ISSUE DIAGNOSE 00073000 BC 8,TIO1 ALL OK: GO WAIT FOR END OF I/O 00074000 BC 2,DIAG BUSY: REISSUE DIAGNOSE 00075000 BC 4,CHKCSW GO LOOK AT CSW 00076000 BC 1,RESETSCR ERROR IF DISPLAY NOT OPERATIONAL 00077000 * 00078000 * WAIT FOR THE END OF THE INPUT/OUTPUT AND CHECK CSW 00079000 * 00080000 TIO1 EQU * 00081000 TIO 0(R2) WAIT FOR THE END OF INPUT/OUTPUT 00082000 BC 8,CHKCSW OK: GO ON 00083000 BC 2,TIO1 BUSY: KEEP LOOPING 00084000 BC 1,RESETSCR ERROR IF DISPLAY NOT OPERATIONAL 00085000 TM CSW+4,X'B0' CSW STORED + ATTN CTLUNIT END BUSY 00086000 BNZ TIO1 YES THEN HANDLE AS BUSY 00087000 CHKCSW EQU * 00088000 CLI CSW+5,X'00' SOME PROBLEM WITH THE CHANNEL ? 00089000 BNE RESETSCR YES NOTHING WE CAN DO 00090000 LH R0,CSW+6 GET RESIDUAL COUNT 00091000 ST R0,RESCOUNT SAVE TO RETURN 00092000 CLI CSW+4,X'0C' DID WE GET CE+DE ? 00093000 BE GOTCEDE YES- WE ARE FINISHED 00094000 CLI CSW+4,X'08' DID WE GET CE ONLY ? 00095000 BE TIO2 YES GO WAIT FOR DE 00096000 TM FLAGS,CMSCON IS THIS THE CMS CONSOLE? 00097000 BZ NOTCP NO, SKIP CHECK FOR CP ERROR 00098000 CLI CSW+4,X'8E' IS THIS ERROR CODE '8E' FROM CP ? 00099000 BE CPERR YES, INDICATE IT TO CALLER 00100000 NOTCP TM CSW+4,X'02' UNIT CHECK ? 00101000 BO SENSE YES GO DO A SENSE 00102000 TM CSW+4,X'B0' ATTN OR CTL UNIT END OR BUSY ? 00103000 BNZ DIAG IF YES REISSUE THE DIAGNOSE 00104000 TM CSW+4,X'0C' DID WE GET AT LEAST CE OR DE ? 00105000 BZ DIAG NO REISSUE THE DIAGNOSE 00106000 TIO2 EQU * 00107000 TIO 0(R2) WAIT FOR DE 00108000 BC 2,TIO2 BUSY KEEP LOOPING 00109000 BC 1,RESETSCR ERROR IF DISPLAY NOT OPERATIONAL 00110000 * 00111000 * ALL OK EXIT 00112000 * 00113000 GOTCEDE EQU * 00114000 B SCRRTN KEEP RETURN CODE 0 00115000 SPACE 00116000 * 00117000 * ERRORS 00118000 * 00119000 CPERR EQU * ERROR X'8E' FROM CP 00120000 MVI RTNCODE+3,X'8E' RETURN ERROR TO CALLER 00121000 B SCRRTN 00122000 SPACE 00123000 SCRERR EQU * 00124000 MVI RTNCODE+3,4 STANDARD ERROR RC 00125000 MVC RTNCODE+1(2),X'40' ALSO STATUS BYTES FROM CSW 00126000 B SCRRTN 00127000 SPACE 00128000 SENSE EQU * GET SENSE DATA CP HAS FOR US 00129000 TM FLAGS,NOSENSE SENSE SUPPRESSED? 00130000 BO SCRERR YES, THEN JUST RETURN ERROR 00131000 * BUILD CCW, CALL OURSELVES 00132000 LA R1,SBYTE STORE BUFFER ADDRESS IN CCW 00133000 ST R1,SENSECCW 00134000 MVI SENSECCW,X'04' SENSE COMMAND 00135000 MVC SENSECCW+4(4),=F'1' COUNT = 1 00136000 MVI SENSECCW+4,X'20' SILI 00137000 LA R1,SENSECCW R1 -> SENSE CCW 00138000 LH R2,DEVADDR R2 = DEVICE ADDRESS 00139000 ICM R2,B'1000',=AL1(NOSENSE) AVOID LOOPING 00140000 LA R15,SCRIO MAKE RECURSIVE CALL 00141000 BALR R14,R15 READ SENSE BYTE 00142000 * (IGNORE ERRORS) 00143000 RESETSCR TM FLAGS,CMSCON CMS CONSOLE? 00144000 BZ RESETERR NO, JUST RETURN ERROR 00145000 LH R2,DEVADDR GET DISPLAY ADDRESS CUU 00146000 DIAG R2,R3,X'24' IS IT STILL THERE 00147000 BC 2,GOTCEDE EXIT IF DISCONNECTED 00148000 RESETERR MVI RTNCODE+3,8 SENSE BYTE ERROR CODE 00149000 MVC RTNCODE+1(2),X'40' ALSO STATUS BYTES FROM CSW 00150000 SPACE 00151000 SCRRTN EQU * GET DATA FROM WORKAREA TO RETURN 00152000 DMSKEY RESET RESTORE CALLER'S KEY 00153000 L R2,RTNCODE RETURN CODE IN R2 00154000 L R3,RESCOUNT RESIDUAL COUNT IN R3 00155000 ICM R3,B'1000',SBYTE PLUS SENSE BYTE 00156000 L R13,4(R13) RESTORE R13 FROM SAVE AREA 00157000 LM R0,R1,WORKFRET RETURN WORK AREA STORAGE 00158000 DMSFRET DWORDS=(0),LOC=(1) 00159000 DROP R9 DON'T USE WORK AREA NOW! 00160000 L R14,12(R13) RESTORE RETURN ADDRESS 00161000 LR R15,R2 RETURN ADDRESS INTO R15 00162000 LR R0,R3 SENSE AND RESIDUAL COUNT INTO R0 00163000 LM R1,R12,24(R13) RESTORE OTHER REGISTERS 00164000 LTR R15,R15 SET CONDITION CODE FOR CALLER 00165000 BR R14 RETURN TO CALLER 00166000 SPACE 00167000 LTORG 00168000 EJECT 00169000 * WORK AREA IN FREE STORAGE 00170000 SPACE 00171000 WORKAREA DSECT 00172000 WORKFRET DS 1D R0, R1 TO FREE WORK AREA 00173000 SAVEAREA DS 12D SAVE AREA FOR CALLED ROUTINES 00174000 SENSECCW DS 1D SENSE CCW BUILT HERE 00175000 RTNCODE DS 1F RETURN CODE 00176000 RESCOUNT DS 1F RESIDUAL COUNT 00177000 DEVADDR DS 1H DEVICE ADDRESS 00178000 CCWADDR DS 1A CCW ADDRESS 00179000 SBYTE DS 1X SENSE BYTE 00180000 FLAGS DS 1X FLAGS FROM CALLER 00181000 CMSCON EQU X'01' I/O IS TO CMS CONSOLE 00182000 NOSENSE EQU X'02' DON'T DO SENSE IF ERROR 00183000 WORKSIZE EQU *-WORKAREA SIZE IN BYTES 00184000 WORKDBLW EQU (WORKSIZE+7)/8 SIZE IN DOUBLEWORDS 00185000 NUCON 00186000 REGEQU 00187000 END 00188000