TITLE 'PERFORM A TERMINAL I/O OPERATION FOR A UTS' TER00010 *********************************************************************** TER00020 * * TER00030 * MODULE NAME = ICATS TERMINAL I/O DO-ER * TER00040 * * TER00050 * FUNCTION = DO A TERMINAL I/O OPERATION ON BEHALF OF A UTS * TER00060 * MACHINE FOR ONE OF HIS DIALED TERMINALS. * TER00070 * * TER00080 * ENTRY POINTS = TERMIO * TER00090 * * TER00100 * LINKAGE = BALR R14,R15 FROM ICATS MAINLINE. * TER00110 * * TER00120 * REGISTER CONTENTS UPON ENTRY = * TER00130 * R2 = POINTS TO THE ICATS COMMON DATA AREA, AS ALWAYS. * TER00140 * R4 = POINTS TO THE UTS CONTROL BLOCK FOR THIS UTS. * TER00150 * R14 = RETURN ADDRESS BACK TO ICATS MAINLINE * TER00160 * R15 = ENTRY POINT TO THIS MODULE * TER00170 * * TER00180 * REGISTER USAGE = * TER00190 * R0-R1 = USED TO PASS PARAMETERS TO SUBROUTINES. * TER00200 * R2 = USED TO ADDRESS THE ICATS COMMON DATA AREA. * TER00210 * R3 = USED TO ADDRESS THE TERMINAL CONTROL BLOCK. * TER00220 * R4 = USED TO ADDRESS THE UTS CONTROL BLOCK. * TER00230 * R5 = USED TO ADDRESS THE OUTPUT BUFFER. * TER00240 * R11 = MY BASE REGISTER * TER00250 * R14 = MY RETURN ADDRESS WHEN I CALL SOMEBODY * TER00260 * R15 = SUBROUTINE ADDRESS * TER00270 * * TER00280 * * TER00290 * MODULE LOGIC: * TER00300 * 1) LOCATE THE CORRECT TERMINAL CONTROL BLOCK. * TER00310 * 2) MAKE SURE IT'S PLUGGED IN TO THIS UTS. * TER00320 * IF NOT, REPORT AN ERROR BY FAKING THE I/O OPERATION * TER00330 * BY INDICATING UNIT CHECK IN THE CSW UNIT STATUS * TER00340 * AND INTERVENTION REQUIRED IN THE SENSE BYTE. THIS * TER00350 * IS HOW A REAL TERMINAL WOULD REACT IF NOT THERE. * TER00360 * 3) CHECK THE CCW OP CODE. IF THIS ISN'T A READ MODIFIED * TER00370 * OPERATION, GO TO 4). ELSE, SEE IF THE DATA IN THIS * TER00380 * TERMINAL CONTROL BLOCK'S BUFFER IS VALID. IF NOT, * TER00390 * GO TO 4). ELSE, WE'LL HANDLE THE READ MODIFIED HERE. * TER00400 * A) APPEND THE READ MODIFIED DATA TO THE END OF THE * TER00410 * REPLY CONTROL BLOCK. * TER00420 * B) SET THE RETURN CODE = 0, THE SENSE BYTE = 0, * TER00430 * THE UNIT AND CHANNEL STATUS = CE & DE, * TER00440 * AND SET THE LENGTH TO HOWEVER MUCH DATA WE'VE GOT. * TER00450 * D) GO TO 5). * TER00460 * 4) HANDLE THIS NON-READ-MODIFIED CCW. * TER00470 * A) IF THIS IS A WRITE OPERATION (CCW OP CODE = * TER00480 * B'XXXX XX01') THEN GO GET THE DATA WE'RE TO WRITE * TER00490 * TO THE TERMINAL WITH, FROM THE UTS MACHINE. THIS * TER00500 * IS A SEPARATE SIO THAN THE ONE USED TO GET THE * TER00510 * REQUEST CONTROL BLOCK. PUT THE DATA RIGHT AFTER * TER00520 * THE REQUEST CONTROL BLOCK. * TER00530 * B) ADJUST THE CCW DATA ADDRESS TO POINT TO RIGHT AFTER * TER00540 * THE REQUEST CONTROL BLOCK. IF THIS IS A WRITE, * TER00550 * THAT'S WHERE THE DATA IS. IF THIS IS A READ, THAT'S * TER00560 * WHERE I WANT THE DATA TO BE READ IN TO. * TER00570 * C) DO THE TERMINAL I/O. * TER00580 * D) PUT THE RETURN CODE, SENSE, AND UNIT AND CHANNEL * TER00590 * STATUS IN THE REPLY CONTROL BLOCK. * TER00600 * E) IF THIS WAS A WRITE OPERATION, SET THE LENGTH = 0. * TER00610 * ELSE, MAKE THE LENGTH = HOWEVER MUCH DATA I READ. * TER00620 * 5) GIVE A REPLY TO THE UTS MACHINE TELLING WHAT HAPPENED. * TER00630 * * TER00640 * NORMAL EXIT = * TER00650 * R15 = 0 * TER00660 * * TER00670 * EXTERNAL REFERENCES = NONE * TER00680 * * TER00690 * MACROS = ICDATA = ICATS COMMON DATA AREA * TER00700 * ETTE = ENTER TRACE TABLE ENTRY SUBROUTINE * TER00710 * * TER00720 * CHANGE ACTIVITY * TER00730 * DATE NAME REASON FOR CHANGE * TER00740 * 06/22/83 RICK JASPER INITIAL PROGRAM CREATION * TER00750 * * TER00760 *********************************************************************** TER00770 PRINT GEN,NODATA TER00780 TERMIO CSECT TER00790 USING ICDATA,R2 ADDRESS ICATS COMMON DATA AREA TER00800 USING CBTERM,R3 USE R3 TO ADDRESS TERM CONTROL BLOCK TER00810 USING CBUTS,R4 USE R4 TO ADDRESS UTS CONTROL BLOCK TER00820 USING *,R15 USE R15 FOR BASE REG NEXT INSTRUCTION ONLY TER00830 STM R0,R14,REGSAVE SAVE CALLER'S REGISTERS TER00840 DROP R15 TER00850 USING TERMIO,R11 R11 WILL BE BASE REGISTER TER00860 LR R11,R15 ESTABLISH BASE REGISTER TER00870 * TER00880 * TERMIO COMMANDS CAN ONLY COME FROM A UTS MACHINE TER00890 TM FLAGB,UTSCMD DID THIS COMMAND COME FROM A UTS ?? TER00900 BO CON50 YES IT DID. GOOD. CONTINUE ON. TER00910 L R15,AREJECT GO TO REJECT-THIS-COMMAND ROUTINE TER00920 BALR R14,R15 TER00930 B TERMBYE TER00940 CON50 DS 0H TER00950 * PUT AN ENTRY INTO THE TRACE TABLE IF TRACE MODE IS ON. TER00960 TM FLAGC,TRACEMOD THE FACT WE SAW AN INTERRUPT TER00970 BNO SKIPTTE DO ONLY IF TRACE MODE IS ON. TER00980 L R1,PARM2 PUT 1ST HALF OF CCW IN TTE TER00990 L R15,ACONEHEX TER01000 BALR R14,R15 TER01010 STCM R0,B'1111',TTECCWA TER01020 STCM R1,B'1111',TTECCWA+4 TER01030 L R1,PARM2+4 PUT 2ND HALF OF CCW IN TTE TER01040 L R15,ACONEHEX TER01050 BALR R14,R15 TER01060 STCM R0,B'1111',TTECCWB TER01070 STCM R1,B'1111',TTECCWB+4 TER01080 ETTE IOTTE TER01090 SKIPTTE DS 0H TER01100 MVI TERMFLAG,X'00' INITIALIZE MY LOCAL FLAG TER01110 L R5,ABUFFER SET UP TO ADDRESS THE OUTPUT BUFFER. TER01120 MVC 0(128,R5),PARM0 SET UP THE REPLY CONTROL BLOCK. TER01130 * LOCATE THE CORRECT TERMINAL CONTROL BLOCK. TER01140 L R3,TERM1ST GET ADDRESS OF FIRST TERMINAL CB TER01150 LTR R3,R3 IF NO TERMINAL CONTROL BLOCKS, TER01160 BZ ERROR1 ABORT WITH AN ERROR. TER01170 CON55 CLC CBTERMEA,PARM0 IS THIS THE CORRECT TERM CB ?? TER01180 BE GOTIT YEP, CONTINUE ON. TER01190 L R3,CBTERMFP ELSE GET NEXT TERMINAL CB. TER01200 LTR R3,R3 TER01210 BNZ CON55 TER01220 ERROR1 DS 0H COULD NOT FIND A TERM CB FOR THIS TERMINAL. TER01230 * GIVE THE UTS AN ERROR BY SIMULATING UNIT CHECK AND INTERVENTION TER01240 * REQUIRED IN THE SENSE. THIS IS HOW A REAL TERMINAL WOULD RESPOND TER01250 MVC 122(6,R5),=X'00400E000000' IF NOT CONNECTED. TER01260 LA R10,0 RETURN CODE = 0 TER01270 B GIVE2UTS TER01280 GOTIT DS 0H GOT THE TERM CB FOR THIS TERMINAL. TER01290 TM CBTERMFA,PLUGGED IS THIS TERMINAL PLUGGED IN ?? TER01300 BNO ERROR1 ERROR IF NOT. TER01310 C R4,CBTERMUP PLUGGED IN TO THIS UTS ?? TER01320 BNE ERROR1 ERROR IF NOT. TER01330 * THIS TERMINAL IS PLUGGED IN TO THIS UTS. EVERYTHING'S COOL SO TER01340 * FAR. IS THIS A READ MODIFIED CCW ?? IF SO, WE CAN PROBABLY TER01350 * HANDLE IT WITHOUT DOING ANY REAL I/O. TER01360 CLI PARM2,X'06' PARM2 = CCW. X'06' = READ MODIFIED. TER01370 BNE CON100 NOT READ MODIFIED. DO THE REAL I/O. TER01380 TM CBTERMFA,DATAVALD IS THE READ MODIFIED BUFFER VALID ?? TER01390 BNO CON100 NOPE, WE'LL HAVE TO DO THE REAL I/O. TER01400 * THIS IS A READ MODIFIED THAT WE CAN FAKE, SINCE WE HAVE ALREADY TER01410 * DONE ONE (WHEN THE AYNCHROUNOUS TERMINAL INTERRUPT CAME IN, IN TER01420 * THE DOTERM MODULE). MOVE THE READ MODIFIED DATA TER01430 MVC 128(100,R5),CBTERMRM IN PLACE AFTER THE REPLY CB. TER01440 MVC 122(4,R5),=X'00000C00' CLEAR OUT END OF REPLY CB. TER01450 MVC 126(2,R5),CBTERMDC MOVE IN LENGTH OF READ DATA TER01460 LA R10,0 SET RETURN CODE = 0 TER01470 B GIVE2UTS TER01480 CON100 DS 0H TER01490 * WE'RE GOING TO HAVE TO DO THE REAL I/O OPERATION TO THIS TERMINAL TER01500 * (IT'S NOT A READ MODIFIED CCW OR, IF IT IS, THEN THE DATA IN THIS TER01510 * TERMINAL'S CONTROL BLOCK BUFFER IS NOT VALID). TER01520 * SEE IF THIS IS A WRITE CCW OR NOT. IF IT IS, THEN WE'VE GOT TO TER01530 * FIRST GO GET THE DATA FROM THE UTS TO WRITE TO THE TERMINAL. TER01540 TM PARM2,X'01' ALL WRITE CCW OP CODES HAVE BIT 7 TER01550 BNO CON300 TURNED ON AND BIT 6 TURNED OFF. TER01560 TM PARM2,X'02' I.E. B'XXXX XX01' TER01570 BO CON300 TER01580 OI TERMFLAG,WRITECCW REMEMBER THIS IS A WRITE CCW TER01590 * GO GET THE TERMINAL WRITE DATA FROM THE UTS. TER01600 SR R0,R0 GET CCW BYTE COUNT IN R0 TER01610 ICM R0,B'0111',PARM2+5 TER01620 LA R1,128(R5) PUT DATA AFTER REPLY CONTROL BLOCK TER01630 L R15,AREADUTS TER01640 BALR R14,R15 GO GET THE DATA TER01650 LTR R15,R15 READ WENT OK, DIDN'T IT ?? TER01660 BNZ TERMBYE ABORT IF UTS DIED - WILL RETURN TO TER01670 * ICATS MAINLINE TER01680 CON300 DS 0H TER01690 * NOW SET UP TO DO THE REAL I/O. TER01700 LA R6,128(R5) PUT THE DATA ADDRESS IN THE CCW TER01710 STCM R6,B'0111',PARM2+1 TER01720 LA R1,PARM2 GET THE CCW ADDRESS IN R1 TER01730 L R15,ATERMIO TER01740 BALR R14,R15 DO THE REQUESTED I/O TO THE TERMINAL TER01750 CH R15,=H'8' IS THE TERMINAL STILL THERE ?? TER01760 BE ERROR1 IF NOT, FAKE A UNIT CHECK. TER01770 MVI 122(R5),X'00' TER01780 MVC 123(1,R5),CBTERMSN MOVE SENSE BYTE IN PLACE TER01790 MVC 124(2,R5),CBTERMCS+4 MOVE CSW STATUS IN PLACE TER01800 MVC 126(2,R5),=X'0000' CLEAR DATA LENGTH TER01810 TM TERMFLAG,WRITECCW IF THIS WAS A WRITE CCW, THEN TER01820 BO CON350 THERE'S NO DATA TO BE GIVEN TO THE TER01830 STH R0,126(R5) UTS. ELSE REMEMBER DATA LENGTH. TER01840 B CON355 THERE'S NO DATA TO BE GIVEN TO THE TER01850 CON350 DS 0H TER01860 LA R10,0 RETURN CODE = 0 TER01870 CON355 DS 0H TER01880 LA R10,0 RETURN CODE = 0 TER01890 GIVE2UTS DS 0H TER01900 * GIVE A REPLY TO THE UTS MACHINE TELLING WHAT HAPPENED. TER01910 * PUT THE RETURN CODE NOW SITTING IN R10 IN THE REPLY CONTROL BLOCK. TER01920 * | | | | | | | | | TER01930 * | | | | | | | | | TER01940 * | | | | | | | | | TER01950 * |---------------------------------------------------------------| TER01960 * | RETURN | EXTRA | SENSE | UNIT |CHANNEL| # OF DATA | TER01970 * | CODE | X'00' | DATA | STATUS|STATUS |BYTES FOLLOWING| TER01980 * |---------------------------------------------------------------| TER01990 STH R10,120(R5) PUT RETURN CODE IN REPLY CB TER02000 LA R0,128 REPLY CONTROL BLOCK = 128 BYTES BIG TER02010 AH R0,126(R5) PLUS NUMBER OF DATA BYTES FOLLOWING TER02020 LR R1,R5 START OF REPLY CONTROL BLOCK TER02030 L R15,AWRITUTS TER02040 BALR R14,R15 GO GIVE THE REPLY TO THE UTS MACHINE TER02050 TERMBYE EQU * IGNORE ANY ERRORS TER02060 LM R0,R14,REGSAVE RESTORE CALLER'S REGISTERS TER02070 BR R14 TER02080 EJECT TER02090 REGSAVE DS 15F READ ROUTINE SAVE AREA TER02100 TERMFLAG DC X'00' STATUS FLAG FOR TERMINAL I/O ROUTINE TER02110 WRITECCW EQU X'80' 1 = THIS IS A WRITE CCW TER02120 * TER02130 IOTTE DC AL1(IOTTEQU) TER02140 DC C'DOING TERMINAL I/O. CCW = ' TER02150 TTECCWA DS CL8 TER02160 DC C' ' TER02170 TTECCWB DS CL8 TER02180 DC C'.' TER02190 IOTTEQU EQU *-IOTTE-1 TER02200 * TER02210 LTORG TER02220 ICDATA TER02230 END TER02240