1 ;_TITLE  TAPEIO: general purpose tape I/O routine  ;     1 ;_ARGS   TYPE        VARIABLE   I/O   DESCRIPTION  ; I ;        I*4         OPCODE      I    operation code (value 1 through 13)  ; I ;        I*4         LUN         I    logical unit number of tape device  - ;                                     (LUN>0)  ; K ;      CHARACTER     DEVICE      I    string variable containing tape drive 1 ;                                     device name  ; H ;       I*4          PARAM       I    operation code dependent parameter ; K ;       buffer       IBUF        I    buffer for tape read/write operations  ; L ;       I*4          NBYTES      I    number of bytes to transferred in I/O / ;                                     operation  ; M ;       I*4          IERROR      I    error code and error handling parameter  ; 7 ;       I*4          IEFN        I    event flag number  ; = ;_DESC  TAPEIO is a general purpose tape input/ouput routine. A ;       It performs a variety of tape operations; read and write  D ;       tape records, skip records and files in forward and backwardE ;       direction, set density/parity of tape, write tape end-of-file B ;       marks, and rewind the tape. This routine is similar to the? ;       routine on RSX-11M with the same name and function. The F ;       differences between the RSX-11 and VMS versions are indicated  ;       below. ; 9 ; Call Statements: (calling sequence dependent on OPCODE)  ; A ;    CALL TAPEIO(OPCODE,LUN,DEVICE,PARAM,IERROR)  - for OPCODE= 6 H ;    CALL TAPEIO(OPCODE,LUN,IERROR)               - for OPCODE= 1,2,3,17G ;    CALL TAPEIO(OPCODE,LUN,PARAM,IERROR)         - for OPCODE= 4,5,7,8 J ;    CALL TAPEIO(OPCODE,LUN,IBUF,NBYTES,IERROR)   - for OPCODE= 9,10,11,12B ;    CALL TAPEIO(OPCODE,LUN,NBYTES,IERROR)        - for OPCODE= 13E ;    CALL TAPEIO(OPCODE,LUN,IEFN,IBUF,NBYTES,IERROR)for OPCODE= 14,15 B ;    CALL TAPEIO(OPCODE,LUN,IEFN,NBYTES,IERROR)   - for OPCODE= 16 ; I ;    The OPCODE parameter specifies the type of operation to be performed G ;    by TAPEIO.  The number of parameters passed to TAPEIO is dependent B ;    on the OPCODE.  OPCODEs are between 1 and 13 and take on the  ;    following meanings: ;      ;    OPCODE = ;      1  - Rewind the tape and take the tape drive off-line. + ;           (parameters: OPCODE,LUN,IERROR) 1 ;      2  - Write an end-of-file mark on the tape + ;           (parameters: OPCODE,LUN,IERROR) < ;      3  - Rewind the tape and leave the tape drive on-line+ ;           (parameters: OPCODE,LUN,IERROR) B ;      4  - Space forward the number of records specified by PARAM1 ;           (parameters: OPCODE,LUN,PARAM,IERROR) C ;      5  - Space backward the number of records specified by PARAM 1 ;           (parameters: OPCODE,LUN,PARAM,IERROR) A ;      6  - Initialize the tape drive and set density and parity  E ;           specified by PARAM. This must be the first call to TAPEIO 8 ;           (parameters: OPCODE,LUN,DEVICE,PARAM,IERROR)L ;      7  - Space forward the number of end-of-file marks specified by PARAM1 ;           (parameters: OPCODE,LUN,PARAM,IERROR) M ;      8  - Space backward the number of end-of-file marks specified by PARAM 1 ;           (parameters: OPCODE,LUN,PARAM,IERROR) G ;      9  - Read a physical record from tape in the buffer IBUF for the B ;           maximum number of bytes specified by NBYTES. Wait for B ;           completion of I/O operation before returning to caller7 ;           (parameters: OPCODE,LUN,IBUF,NBYTES,IERROR) H ;     10  - Write a physical record to tape from the buffer IBUF for theG ;           number of bytes specified by NBYTES. Wait for completion of 9 ;           the I/O operation before returning to caller. 7 ;           (parameters: OPCODE,LUN,IBUF,NBYTES,IERROR)  ; O ;  ****** Warning, TAPEIO opcodes > 10 are not meant to be used by the ******** O ;  ****** novice programmer because of the difficulty in using         ******** O ;  ****** multiple buffering I/O strategies. Use at your own risk.     ********  ; E ;     11  - Read a physical record from tape into the buffer IBUF for @ ;           the number of bytes specified by NBYTES. Do not wait> ;           for completion of I/O operation, return to callingC ;           routine after I/O is initiated. This call performs same B ;           operation as OPCODE 9, but allows for double bufferingB ;           to occur. This call used in conjunction with OPCODE 137 ;           (parameters: OPCODE,LUN,IBUF,NBYTES,IERROR) E ;     12  - Write a physical record to tape from the buffer IBUF for  D ;           the number of bytes specified by NBYTES. Do not wait forB ;           completion of I/O operation, return to calling routine= ;           after I/O is initiated.  This call performs same  C ;           operation as OPCODE 10, but allows for double buffering C ;           to occur.  This call used in conjunction with OPCODE 13 7 ;           (parameters: OPCODE,LUN,IBUF,NBYTES,IERROR) A ;     13  - Wait for any pending TAPEIO I/O operation to complete @ ;           before returning to the calling program. This OPCODEB ;           used in conjunction with OPCODEs 11,12. This call willD ;           allow coordination of  double buffering tape operations.> ;           When using OPCODEs 11,12, it is mandatory to call C ;           TAPEIO with OPCODE 13 before another tape I/O operation ( ;           can be initiated.           2 ;           (parameters: OPCODE,LUN,NBYTES,IERROR)D ;     14  - This option exactly like OPCODE = 11 but a logical event, ;           flag (IEFN) is passed to TAPEIO.< ;           (parameters: OPCODE,LUN,IEFN,IBUF,NBYTES,IERROR)D ;     15  - This option exactly like OPCODE = 12 but a logical event, ;           flag (IEFN) is passed to TAPEIO.< ;           (parameters: OPCODE,LUN,IEFN,IBUF,NBYTES,IERROR)C ;     16  - This option exactly like OPCODE = 13 but a logical even , ;           flag (IEFN) is passed to TAPEIO.0 ;           (parameters: OPCODE,LUN,IEFN,IERROR)G ;     17  - This option will cancel any pending I/O requests associated 9 ;           with the logical unit number specified by LUN + ;           (parameters: OPCODE,LUN,IERROR)  ; ? ;     The LUN specifies the logical unit number associated with @ ;     a tape device. The logical unit number (LUN) is connected B ;     to the tape device (DEVICE) with the OPCODE=6 call and must # ;     be the first call to TAPEIO.   ; G ;     The DEVICE parameter specifies the tape device to be connected to K ;     the logical unit number LUN. This parameter used only in association  @ ;     with OPCODE=6. This parameter must be declared a CHARACTERA ;     variable in a FORTRAN program. Examples of device names are F ;     'MT:', 'MT0:', 'MTA0:'. The character variable should not exceedH ;     eight characters in length. DEVICE can also be an assigned logical ;     device.  ; H ;     The PARAM parameter definition is dependent on the operation code.E ;     For OPCODE=6, PARAM specifies the desired density/parity of the C ;     tape drive.  (density/parity of tape can be set only when the E ;     tape is positioned at load point). PARAM takes on the following  ;     definition for OPCODE=6. ;      ;     for OPCODE=6: ; ;     PARAM =  3 - set density/parity to 800BPI, odd parity < ;     PARAM =  9 - set density/parity to 1600BPI, odd parity< ;     PARAM = 10 - set density/parity to 6250BPI, odd parity7 ;     PARAM = 11 - set density/parity to system DEFAULT C ;     (note all other values of PARAM are regected at this time by  ? ;     TAPEIO. These are the current limits of the tape device.)  ;     C ;     For OPCODEs=4,5,7,8, the PARAM parameter specifies the number G ;     of records or files to skip in the forward or backward direction. A ;     This number, although INTEGER*4, can not exceed 65534, the  " ;     current system limit on VAX. ; J ;     The IBUF parameter can be any dimensioned variable (LOGICAL,INTEGER,F ;     REAL) and is the buffer for transfer of data between the programH ;     and the tape drive. This buffer is used only for reading data from8 ;     tape (OPCODE=9,11) or writing data (OPCODE=10,12). ; C ;     The NBYTES parameter specifies the number of bytes transfered F ;     between the program and the tape drive. This parameter used onlyB ;     for reading data (OPCODE=9,11), writing data (OPCODE=10,12),E ;     and waiting for the end of a read or write request (OPCODE=13). B ;     (Note that this variable specifies the BYTE count and not a D ;     WORD count as in the RSX-11M version of TAPEIO).  When writingF ;     data to tape (OPCODE=10,12), this parameter specifies the amountJ ;     of data to write. When reading data from tape (OPCODE=9,11), NBYTES @ ;     takes on a slightly different meaning. NBYTES specifies toE ;     TAPEIO the size of the read buffer  (i.e. the maximum number of F ;     bytes which can read by TAPEIO). When reading data with OPCODE=9? ;     the returned value of NBYTES will be the actual number of A ;     bytes read from tape. (Note that this procedure is slightly C ;     different from the RSX-11M version of TAPEIO, NBYTES=1 option @ ;     no longer recognized by TAPEIO). When reading records withH ;     OPCODE=12, the number of bytes acutally read by TAPEIO is returnedA ;     in NBYTES with the OPCODE=13 call. NBYTES also is a flag to ? ;     indicate tape parity errors and end-of-file encounters on I ;     tape read operations. If NBYTES=1 on a return from a read operation D ;     then TAPEIO has encountered an end-of-file mark.  If NBYTES=-1A ;     on return from a read operation, then TAPEIO encountered a  7 ;     tape parity error. All other values returned from A ;     TAPEIO on read operations will be the acutal record length.  ; F ;     The IEFN parameter specifies an event flag number (between 0-31)A ;     to be associated with an I/O request. This option only used D ;     for OPCODES = 14,15,16. These options used to perform multiple5 ;     and simultaneous I/O requests on a tape device.  ; A ;     The IERROR parameter specifies the error handling procedure A ;     for TAPEIO. Three possible error handling conditions can be * ;     specified for TAPEIO as shown below: ; G ;     IERROR = 0 - If a severe error is encountered, TAPEIO will write  G ;                  an error message and abort the job. If a minor error D ;                  exists such as a tape parity error TAPEIO writes = ;                  an error message and continues processing.  ; A ;     IERROR = 1 - If a severe  error is encountered, TAPEIO will D ;                  write an error message and return the error code H ;                  to the calling program through the IERROR parameter. = ;                  There is no program termination by TAPEIO.  ; D ;     IERROR = 2 - If a severe error is encountered, TAPEIO will notC ;                  write an error message or terminate the program, F ;                  but the error code will be returned to the calling 8 ;                  program through the IERROR parameter. ;   G ;     Shown below is a list of the possible error codes returned to the G ;     calling program by TAPEIO. Note that all returned error codes are D ;     negative numbers. The calling program has only to check for a K ;     return error code of less than 0 to determine if the TAPEIO operation ? ;     was successful.  The value of IERROR remains unchanged if ' ;     the I/O operation was successful.  ; 9 ;     -1    Invalid number of arguments passed (OPCODE=1) ; ;     -2    Undefined logical unit number passed (OPCODE=1) < ;     -3    Error on rewind(offline) $QIO request (OPCODE=1)9 ;     -4    Invalid number of arguments passed (OPCODE=2) ; ;     -5    Undefined logical unit number passed (OPCODE=2) 6 ;     -6    Error on write EOF $QIO request (OPCODE=2)9 ;     -7    Invalid number of arguments passed (OPCODE=3) ; ;     -8    Undefined logical unit number passed (OPCODE=3) 2 ;     -9    Error on rewind(on-line) $QIO request 9 ;     -10   Invalid number of arguments passed (OPCODE=4) ; ;     -11   Undefined logical unit number passed (OPCODE=4) B ;     -12   Error on space-forward-records $QIO request (OPCODE=4)9 ;     -13   Invalid number of arguments passed (OPCODE=5) ; ;     -14   Undefined logical unit number passed (OPCODE=5) C ;     -15   Error on space-backward-records $QIO request (OPCODE=5) 9 ;     -16   Invalid number of arguments passed (OPCODE=6) / ;     -17   Error in $GETJPI request (OPCODE=6) / ;     -18   Error in $GETDVI request (OPCODE=6) 7 ;     -19   Device name is not a tape device (OPCODE=6) > ;     -20   Tape drive allocated to another process (OPCODE=6)@ ;     -21   Can not allocate tape drive, $ALLOC error (OPCODE=6)/ ;     -22   Tape not mounted FOREIGN (OPCODE=6) = ;     -23   Device name less than 1 character long (OPCODE=6) > ;     -24   Device name greater than 128 characters (OPCODE=6)< ;     -25   Tape can not be mounted, $MOUNT error (OPCODE=6)@ ;     -26   Logical unit number passed is less than 1 (OPCODE=6)> ;     -27   Can not deassign channel, $DASSGN error (OPCODE=6)< ;     -28   Too many open tape devices maximum 10 (OPCODE=6)< ;     -29   Can not assign channel, $ASSIGN error (OPCODE=6)> ;     -30   Invalid density/parity parameter passed (OPCODE=6)? ;     -31   Error in set density/parity $QIO request (OPCODE=6) 9 ;     -32   Invalid number of arguments passed (OPCODE=7) ; ;     -33   Undefined logical unit number passed (OPCODE=7) @ ;     -34   Error in space-forward-files $QIO request (OPCDOE=7)9 ;     -35   Invalid number of arguments passed (OPCODE=8) ; ;     -36   Undefined logical unit number passed (OPCODE=8) A ;     -37   Error in space-backward-files $QIO request (OPCODE=8) 9 ;     -38   Invalid number of arguments passed (OPCODE=9) ; ;     -39   Undefined logical unit number passed (OPCODE=9) 2 ;     -40   Invalid record count passed (OPCODE=9)1 ;     -41   Error in read $QIO request (OPCODE=9) : ;     -42   Invalid number of arguments passed (OPCODE=10)< ;     -43   Undefined logical unit number passed (OPCODE=10)3 ;     -44   Invalid record count passed (OPCODE=10) 3 ;     -45   Error in write $QIO request (OPCODE=10)  ;     -46   (not used) ;     -47   (not used)L ;     -48   Record Count=1 option no longer supported(consult documentation); ;     -49   Invalid number of arguements passed (OPCODE=11) < ;     -50   Undefined logical unit number passed (OPCODE=11)3 ;     -51   Illegal record count passed (OPCODE=11) < ;     -52   Error in read (no wait) $QIO request (OPCODE=11)N ;     -53   Record Count=1 option no longer supported (counsult documentation): ;     -54   Invalid number of arguments passed (OPCODE=12)< ;     -55   Undefined logical unit number passed (OPCODE=12)3 ;     -56   Illegal record count passed (OPCODE=12) = ;     -57   Error in write (no wait) $QIO request (OPCODE=12) : ;     -58   Invalid number of arguments passed (OPCODE=13)< ;     -59   Undefined logical unit number passed (OPCODE=13)0 ;     -60   Error in $WAITFR request (OPCODE=13)6 ;     -61   Error in previous $QIO request (OPCODE=13): ;     -64   Invalid number of arguments passed (OPCODE=14)< ;     -65   Undefined logical unit number passed (OPCODE=14)3 ;     -66   Invalid record count passed (OPCODE=14) < ;     -67   Error in read (no wait) $QIO request (OPCODE=14)L ;     -68   Record Count=1 option no longer supported (consult documentaion)8 ;     -69   Invalid event flag number passed (OPCODE=14): ;     -70   Invalid number of arguments passed (OPCODE=15)< ;     -71   Undefined logical unit number passed (OPCODE=15)3 ;     -72   Invalid record count passed (OPCODE=15) = ;     -73   Error in write (no wait) $QIO request (OPCODE=15) 8 ;     -74   Invalid event flag number passed (OPCODE=15): ;     -75   Invalid number of arguments passed (OPCODE=16)< ;     -76   Undefined logical unit number passed (OPCODE=16)0 ;     -77   Error in $WAITFR request (OPCODE=16)8 ;     -78   Invalid event flag number passed (OPCODE=16)6 ;     -79   Error in previous $QIO request (OPCODE=16)F ;     -85   Error in $CANCEL request after EOF encountered (OPCODE=16): ;     -82   Invalid number of arguments passed (OPCODE=17)< ;     -83   Undefined logical unit number passed (OPCODE=17)0 ;     -84   Error in $CANCEL request (OPCODE=17) ; E ;_HIST  01Feb84  Eric M. Eliason  U.S.G.S. Flagstaff Original Verison @ ;       26Nov86  Joni L. Bauers   updated documentation         B ;                                                                 : ;_END                                                     O ;******************************************************************************            .PAGE            .TITLE   TAPEIO %           .IDENT   /VERSION:1-FEB-84/ 3           $MTDEF			;definde Magtape dependent codes )           $DVIDEF			;define $GETDVI codes -           $DCDEF			;define more $GETDVI codes .           $DEVDEF			;define more $GETDVI codes.           $IODEF			;defion $QIO function codes/           $SSDEF			;define system message codes )           $JPIDEF			;define $GETJPI codess<           $MNTDEF                       ;define $MOUNT codes           ERR_0 = 00           ERR_1 = 01           ERR_2 = 02           ERR_3 = 03           ERR_4 = 04           ERR_5 = 05           ERR_6 = 06           ERR_7 = 07           ERR_8 = 08           ERR_9 = 09           ERR_10 = 10i           ERR_11 = 11            ERR_12 = 12            ERR_13 = 13c           ERR_14 = 14r           ERR_15 = 15            ERR_16 = 16p           ERR_17 = 17p           ERR_18 = 18            ERR_19 = 19a           ERR_20 = 20i           ERR_21 = 21t           ERR_22 = 22            ERR_23 = 23            ERR_24 = 24e           ERR_25 = 25d           ERR_26 = 26a           ERR_27 = 27            ERR_28 = 28a           ERR_29 = 29t           ERR_30 = 30C           ERR_31 = 31E           ERR_32 = 32o           ERR_33 = 33            ERR_34 = 34R           ERR_35 = 35P           ERR_36 = 36L           ERR_37 = 37A           ERR_38 = 38            ERR_39 = 39C           ERR_40 = 40B           ERR_41 = 41o           ERR_42 = 42            ERR_43 = 43U           ERR_44 = 44            ERR_45 = 45C           ERR_46 = 46E           ERR_47 = 47o           ERR_48 = 48C           ERR_49 = 49E           ERR_50 = 50o           ERR_51 = 51T           ERR_52 = 52c           ERR_53 = 53t           ERR_54 = 54            ERR_55 = 55e           ERR_56 = 56t           ERR_57 = 57            ERR_58 = 58C           ERR_59 = 591           ERR_60 = 60            ERR_61 = 61            ERR_62 = 62            ERR_63 = 63            ERR_64 = 64            ERR_65 = 65            ERR_66 = 66,           ERR_67 = 67r           ERR_68 = 68            ERR_69 = 69            ERR_70 = 70U           ERR_71 = 71            ERR_72 = 72v           ERR_73 = 73e           ERR_74 = 74r           ERR_75 = 75            ERR_76 = 76r           ERR_77 = 77            ERR_78 = 78            ERR_79 = 79C           ERR_80 = 80            ERR_81 = 81a           ERR_82 = 82s           ERR_83 = 83            ERR_84 = 84O           ERR_85 = 85            .PAGEt: 			;******************************************************3 			;Entry point for TAPEIO begins here, better saveo 			;all registers R3-R11 			;/ 			;Test OPCODE parameter. If OPCODE is outsidep6 			;the range of 1 to 17, then it will be necessary to- 			;write an error message and abort the job.A: 			;******************************************************#           .PSECT   TAPEIO,NOWRT,EXE =           .ENTRY   TAPEIO,^M<R2,R3,R4,R5,R6,R7,R8,R9,R10,R11>a9           MOVL     @4(AP),R3		;R3=OPCODE passed to TAPEIO @           BLEQ     BAD_OP		;if less than 0, we have a bad opcode6           CMPL     R3,#17		;is opcode greater than 17?:           BGTR     BAD_OP		;if greater than 17, bad opcode9           DECL     R3			;subtract 1 for offset addressinge?           ASHL     #2,R3,R3		;mulitply by 4 for word addressingY>           JMP      @L^OP_ADDR(R3)	;branch to appropriate logic9 			;*****************************************************U. 			;Bad option code passed to routine, need to, 			;write an error message and abort the job9 			;*****************************************************d< BAD_OP:   MOVl     #ERR_0,ERR_NUM	;set error message addressF           JMP      TAPEIO_ABORT		;write a error message and abort job.8 			;****************************************************/ 			;table of trasfer addresses for option codesN 			;passed to TAPEIO. 8 			;**************************************************** OP_ADDR:  .ADDRESS OP1           .ADDRESS OP2           .ADDRESS OP3           .ADDRESS OP4           .ADDRESS OP5           .ADDRESS OP6           .ADDRESS OP7           .ADDRESS OP8           .ADDRESS OP9           .ADDRESS OP10U           .ADDRESS OP11            .ADDRESS OP12l           .ADDRESS OP13b           .ADDRESS OP14            .ADDRESS OP15p           .ADDRESS OP16            .ADDRESS OP17p           .PAGErO ;******************************************************************************p ;o" ; OP1 - process operation code - 1. ;       rewind the tape drive, and go off line ; O ;******************************************************************************m? OP1:      CMPW     (AP),#3		;are there three parameters passed?pB           BNEQ     OP1_ERR1		;branch if there are not 3 parameters2           MOVL     @12(AP),ERROR	;store error code:           MOVL     #12,OFFSET		;store offset of error code=           PUSHL    @8(AP)		;push logical unit number on stack.A           CALLS    #1,LINK		;link logical unit number and channel H           CMPL     R0,#-1               ;did LINK find a channel number?N           BEQL     OP1_ERR2             ;branch if no channel for logical unitN           MOVL     R0,CHANNEL           ;store channel number for $QIO request: 			;******************************************************* 			;issue $QIO request to rewind the tape : 			;******************************************************.           $QIOW_S  EFN=#1,-		;use event flag 11                    CHAN=CHANNEL,-	;channel numberIL                    FUNC=#IO$_REWINDOFF!IO$M_NOWAIT,- ;rewind and go off line)                    IOSB=IOSTATUS        ;e9           CMPL     R0,#SS$_NORMAL	;was request sucessful?OD           BNEQ     OP1_ERR4             ;branch if not normal endingD           CMPW     IOSTATUS,#SS$_NORMAL ;was I/O reqest successfull?A           BNEQ     OP1_ERR3             ;branch if not successfulfA           JMP      ALL_DONE             ;all done, return to userT9 			;*****************************************************p2 			;incorrect number of arguments passed to tapeio9 			;*****************************************************p; OP1_ERR1: MOVL     #ERR_1,ERR_NUM       ;move error message /           JMP      TAPEIO_ABORT		;abort the jobo: 			;******************************************************0 			;improper logical unit number given to tapeio: 			;******************************************************5 OP1_ERR2: MOVL     #ERR_2,ERR_NUM	;move error messaged;           JMP      TAPEIO_ERROR		;go write an error messagei: 			;****************************************************** 			;problem with $QIO requesto: 			;****************************************************** OP1_ERR3: MOVZWL   IOSTATUS,R0; OP1_ERR4: MOVL     #ERR_3,ERR_NUM       ;move error messagehB           JMP      TAPEIO_SYSTEM        ;go write an error message           .PAGEiO ;******************************************************************************y ;r" ; OP2 - process operation code - 2! ;       write an end-of-tape mark0O ;****************************************************************************** ? OP2:      CMPW     (AP),#3		;are there three parameters passed?tM           BNEQ     OP2_ERR1             ;branch if there are not 3 parameters :           MOVL     @12(AP),ERROR        ;store error code C           MOVL     #12,OFFSET           ;store offset of error code =           PUSHL    @8(AP)		;push logical unit number on stacknA           CALLS    #1,LINK		;link logical unit number and channeleH           CMPL     R0,#-1               ;did LINK find a channel number?C           BEQL     OP2_ERR2		;branch if no channel for logical unitbN           MOVL     R0,CHANNEL           ;store channel number for $QIO request: 			;******************************************************3 			;issue $QIO request to write an end of file mark : 			;******************************************************.           $QIOW_S  EFN=#1,-		;use event flag 11                    CHAN=CHANNEL,-	;channel numberOA                    FUNC=#IO$_WRITEOF,-	;write an end of file markn)                    IOSB=IOSTATUS        ; 9           CMPL     R0,#SS$_NORMAL	;was request sucessful? D           BNEQ     OP2_ERR4             ;branch if not normal endingD           CMPW     IOSTATUS,#SS$_NORMAL ;was I/O reqest successfull?A           BNEQ     OP2_ERR3             ;branch if not successfulDA           JMP      ALL_DONE             ;all done, return to userE: 			;******************************************************3 			;incorrect number of parameters passed to tapeiod: 			;******************************************************> OP2_ERR1: MOVL     #ERR_4,ERR_NUM       ;move address of error?           JMP      TAPEIO_ABORT         ;write an error messagef: 			;******************************************************0 			;invalid logical unit number passed to tapeio: 			;******************************************************= OP2_ERR2: MOVL     #ERR_5,ERR_NUM      ;move address of error3>           JMP      TAPEIO_ERROR        ;write an error message: 			;****************************************************** 			;error in $QIO request : 			;****************************************************** OP2_ERR3: MOVZWL   IOSTATUS,R0= OP2_ERR4: MOVL     #ERR_6,ERR_NUM      ;move address of errord>           JMP      TAPEIO_SYSTEM       ;write an error message           .PAGEeO ;******************************************************************************e ; " ; OP3 - process operation code - 3( ;       rewind the tape and stay on-line ;tO ;******************************************************************************f? OP3:      CMPW     (AP),#3		;are there three parameters passed?eM           BNEQ     OP3_ERR1             ;branch if there are not 3 parameters :           MOVL     @12(AP),ERROR        ;store error code C           MOVL     #12,OFFSET           ;store offset of error code-=           PUSHL    @8(AP)		;push logical unit number on stack A           CALLS    #1,LINK		;link logical unit number and channel H           CMPL     R0,#-1               ;did LINK find a channel number?N           BEQL     OP3_ERR2             ;branch if no channel for logical unitN           MOVL     R0,CHANNEL           ;store channel number for $QIO request: 			;******************************************************* 			;issue $QIO request to rewind the tape : 			;******************************************************.           $QIOW_S  EFN=#1,-		;use event flag 11                    CHAN=CHANNEL,-	;channel number K                    FUNC=#IO$_REWIND!IO$M_NOWAIT,- ;rewind and stay on- lineb)                    IOSB=IOSTATUS        ;a9           CMPL     R0,#SS$_NORMAL	;was request sucessful?eD           BNEQ     OP3_ERR4             ;branch if not normal endingD           CMPW     IOSTATUS,#SS$_NORMAL ;was I/O reqest successfull?A           BNEQ     OP3_ERR3             ;branch if not successful A           JMP      ALL_DONE             ;all done, return to usere: 			;******************************************************2 			;incorrect number of arguments passed to tapeio: 			;******************************************************! OP3_ERR1: MOVL     #ERR_7,ERR_NUM            JMP      TAPEIO_ABORTm: 			;******************************************************0 			;invalid logical unit number passed to tapeio: 			;******************************************************( OP3_ERR2: MOVL     #ERR_8,ERR_NUM                  JMP      TAPEIO_ERRORe: 			;****************************************************** 			;error in $QIO call: 			;****************************************************** OP3_ERR3: MOVZWL   IOSTATUS,R0! OP3_ERR4: MOVL     #ERR_9,ERR_NUM             JMP      TAPEIO_SYSTEM           .PAGE O ;******************************************************************************a ;r" ; OP4 - process operation code - 48 ;       Space forward a given number of physical records ; O ;******************************************************************************e> OP4:      CMPW     (AP),#4		;are there four parameters passed?M           BNEQ     OP4_ERR1             ;branch if there are not 4 parametersP:           MOVL     @16(AP),ERROR        ;store error code C           MOVL     #16,OFFSET           ;store offset of error code =           PUSHL    @8(AP)		;push logical unit number on stack A           CALLS    #1,LINK		;link logical unit number and channelaH           CMPL     R0,#-1               ;did LINK find a channel number?N           BEQL     OP4_ERR2             ;branch if no channel for logical unitN           MOVL     R0,CHANNEL           ;store channel number for $QIO request: 			;******************************************************/ 			;issue $QIO request to space forward records : 			;******************************************************F           MOVL     @12(AP),FIB		;move number of records to skip to FIB           $QIOW_S -   .                    EFN=#1,-		;use event flag 11                    CHAN=CHANNEL,-	;channel numberP*                    FUNC=#IO$_SKIPRECORD,-;$                    IOSB=IOSTATUS,-	;B                    P1=@FIB		;specify the number of records to skip9           CMPL     R0,#SS$_NORMAL	;was request sucessful? D           BNEQ     OP4_ERR4             ;branch if not normal endingD           CMPW     IOSTATUS,#SS$_NORMAL ;was I/O reqest successfull?A           BNEQ     OP4_ERR3             ;branch if not successful A           JMP      ALL_DONE             ;all done, return to userm: 			;******************************************************2 			;incorrect number of arguments passed to tapeio: 			;******************************************************" OP4_ERR1: MOVL     #ERR_10,ERR_NUM           JMP      TAPEIO_ABORTO: 			;******************************************************0 			;invalid logical unit number passed to tapeio: 			;******************************************************) OP4_ERR2: MOVL     #ERR_11,ERR_NUM       r           JMP      TAPEIO_ERROR : 			;****************************************************** 			;possible error in $QIO callm: 			;****************************************************** OP4_ERR3: MOVZWL   IOSTATUS,R0" OP4_ERR4: MOVL     #ERR_12,ERR_NUM            JMP      TAPEIO_SYSTEM           .PAGEnO ;******************************************************************************a ; " ; OP5 - process operation code - 59 ;       Space backward a given number of physical records  ;oO ;******************************************************************************O> OP5:      CMPW     (AP),#4		;are there four parameters passed?M           BNEQ     OP5_ERR1             ;branch if there are not 4 parameters :           MOVL     @16(AP),ERROR        ;store error code C           MOVL     #16,OFFSET           ;store offset of error codeu=           PUSHL    @8(AP)		;push logical unit number on stackmA           CALLS    #1,LINK		;link logical unit number and channelCH           CMPL     R0,#-1               ;did LINK find a channel number?N           BEQL     OP5_ERR2             ;branch if no channel for logical unitN           MOVL     R0,CHANNEL           ;store channel number for $QIO request: 			;******************************************************0 			;issue $QIO request to space backward records: 			;******************************************************F           MOVL     @12(AP),FIB		;R3=number of of records to space back@           MNEGL    FIB,FIB		;make it negative for backward space.           $QIOW_S  EFN=#1,-		;use event flag 11                    CHAN=CHANNEL,-	;channel numberr*                    FUNC=#IO$_SKIPRECORD,-;)                    IOSB=IOSTATUS,-      ;EB                    P1=@FIB		;specify the number of records to skip9           CMPL     R0,#SS$_NORMAL	;was request sucessful?ED           BNEQ     OP5_ERR4             ;branch if not normal endingD           CMPW     IOSTATUS,#SS$_NORMAL ;was I/O reqest successfull?A           BNEQ     OP5_ERR3             ;branch if not successfulEA           JMP      ALL_DONE             ;all done, return to user : 			;******************************************************2 			;incorrect number of arguments passed to tapeio: 			;******************************************************" OP5_ERR1: MOVL     #ERR_13,ERR_NUM           JMP      TAPEIO_ABORT*: 			;******************************************************0 			;invalid logical unit number passed to tapeio: 			;******************************************************) OP5_ERR2: MOVL     #ERR_14,ERR_NUM       	           JMP      TAPEIO_ERROR : 			;****************************************************** 			;error in $QIO call: 			;****************************************************** OP5_ERR3: MOVZWL   IOSTATUS,R0" OP5_ERR4: MOVL     #ERR_15,ERR_NUM            JMP      TAPEIO_SYSTEM           .PAGE O ;******************************************************************************  ;_" ; OP6 - process operation code - 6H ;       Initialize the tape drive, allocate tape drive if not allocated,F ;       set density/parity of tape, mount tape foreign if not mounted,; ;       and assighn a logical unit number to the tape drive  ; O ;******************************************************************************1: 			;******************************************************2 			;incorrect number of arguments passed to tapeio: 			;******************************************************" OP6_ERR1: MOVL     #ERR_16,ERR_NUM           JMP      TAPEIO_ABORTa: 			;****************************************************** 			;error in $GETJPI request: 			;******************************************************" OP6_ERR2: MOVL     #ERR_17,ERR_NUM            JMP      TAPEIO_SYSTEM: 			;****************************************************** 			;error in $GETDVI request: 			;******************************************************" OP6_ERR3: MOVL     #ERR_18,ERR_NUM            JMP      TAPEIO_SYSTEM: 			;******************************************************' 			;device argument is not a tape driveR: 			;******************************************************" OP6_ERR4: MOVL     #ERR_19,ERR_NUM           JMP      TAPEIO_ERRORt: 			;******************************************************# 			;Branch here to process option 6 : 			;******************************************************C OP6:      CMPW     (AP),#5		;are there 5 arguments passed to TAPEIO N           BNEQ     OP6_ERR1             ;if not 5, then write an error message:           MOVL     @20(AP),ERROR        ;store error code C           MOVL     #20,OFFSET           ;store offset of error code : 			;******************************************************4 			;Check to see if the device specified by the user 			;has the following features: # 			; 1) is the device a tape devices0 			; 2) is the tape device allocated to the user6 			; 3) if not allocated to user, can it be allocated?# 			; 4) is the tape mounted foreign*. 			; 5) if not can the tape be mounted foreign 			; 			;$GETJPI - get PID of user18 			;****************************************************           $GETJPI_S -7>                    EFN=#1,-		;get the users PID so that it canI                    ITMLST=JPI_ITEM	;be compared with the Tape drive owner G           BLBC     R0,OP6_ERR2		;branch to system service error requestR: 			;******************************************************/ 			;$GETDVI - get device PID, device class, andD 			;device characteristics: 			;******************************************************           $GETDVI_S -G:                    EFN=#1,-		;get various device functionsE                    ITMLST=DVI_ITEM,-	;is tape allocated, get tape PID3A                    DEVNAM=@12(AP)	;owner, is tape mounted foreignAG           BLBC     R0,OP6_ERR3		;branch to system service error request*  9 			;*****************************************************,/ 			;is the device a tape drive?, if not end jobe9 			;******************************************************L           CMPL     DVI_DEV,#DC$_TAPE    ;is device specified by user a tape?A           BNEQ     OP6_ERR4		;if not a tape drive, then abort job*O                         ;******************************************************s. 			;is the tape drive allocated to someone, if/ 			;DVI_PID=0000000, then tape is not allocated*5 			;if tape not allocated, go allocate the tape drive : 			;******************************************************6           TSTL     DVI_PID		;does anyone own the tape?:           BEQL     OP6_1		;if not allocated, then allocate: 			;******************************************************2 			;tape is allocated but is tape allocated to our0 			;processes. if tape allocated to someone else" 			;then go write an error message: 			;******************************************************N           CMPL     DVI_PID,JPI_PID      ;does owner have tape drive allocated?H           BEQL     OP6_2                ;check to see if tape is mountedB           JMP      OP6_ERR5		;somebody else owns tape, write error: 			;******************************************************6 			;tape drive is not allocated to this user, allocate 			;the tape drive: 			;******************************************************6 OP6_1:    $ALLOC_S DEVNAM=@12(AP)	;allocate the device>           BLBC     R0,OP6_ERR6		;test for system service errorB           JMP      OP6_4                ;go mount the tape foreign: 			;******************************************************/ 			;somebody else has the tape device allocatedn: 			;******************************************************" OP6_ERR5: MOVL     #ERR_20,ERR_NUM           JMP      TAPEIO_ERROR*: 			;******************************************************9 			;can not allocate the tape, error in $ALLOCATE request*: 			;******************************************************" OP6_ERR6: MOVL     #ERR_21,ERR_NUM            JMP      TAPEIO_SYSTEM: 			;******************************************************7 			;tape is mounted by user, but is not mounted foreign : 			;******************************************************" OP6_ERR7: MOVL     #ERR_22,ERR_NUM           JMP      TAPEIO_ERROR : 			;******************************************************2 			;device name is less than 1 character in length: 			;******************************************************" OP6_ERR8: MOVL     #ERR_23,ERR_NUM           JMP      TAPEIO_ERROR*: 			;******************************************************4 			;is tape mounted, if not, then mount tape foregin: 			;******************************************************8 OP6_2:    BITL     #DEV$M_MNT,DVI_CHR   ;is tape mounted0           BEQL     OP6_4		;branch if not mountedA OP6_3:    BITL     #DEV$M_FOR,DVI_CHR	;do nothing if tape foreigneD           BEQL     OP6_ERR7             ;if not foreign, write errorD           JMP      OP6_5                ;branch around mount request: 			;******************************************************, 			;device name is greater than 8 characters: 			;******************************************************" OP6_ERR9:  MOVL    #ERR_24,ERR_NUM            JMP     TAPEIO_ERROR : 			;******************************************************5 			;tape can not be mounted, error in $ASSIGN requesta: 			;******************************************************" OP6_ER10:  MOVL    #ERR_25,ERR_NUM             JMP     TAPEIO_SYSTEM: 			;******************************************************0 			;illegal logical unit number passed to tapeio: 			;******************************************************" OP6_ER11: MOVL     #ERR_26,ERR_NUM           JMP      TAPEIO_ERRORb9 			;*****************************************************2 			;mount the tape foreign9 			;*****************************************************fM OP6_4:    MOVL     12(AP),R3            ;R3=address of device name descriptorcF           MOVW     (R3),R4              ;R4=length of character stringM           BLEQ     OP6_ERR8             ;if string length .LT. 0, write error C           CMPW     R4,#128		;if string length .GT. 128, write error )           BGTR     OP6_ERR9             ;aI           MOVL     4(R3),R5             ;R5=address of device name string*L           MOVC3    R4,(R5),MNT_DEV      ;move device name to mount item list8 			;**************************************************** 			;issue $MOUNT system servicel8 			;****************************************************6           $MOUNT_S ITMLST=MNT_ITEM     ;mount the tapeA           BLBC     R0,OP6_ER10             ;test for system errorM  9 			;*****************************************************Q1 			;check to see if the logical unit number giveni2 			;to TAPEIO already exists. Call subroutine LINK7 			;to determine if it exists. The returned value in R0 / 			;is the corresponding channel number for the 2 			;logical unit number. If there is not a logical6 			;unit number in current table then a -1 is returned3 			;in R0, the value returned in R1 is the index tod- 			;the logical unit number and channel table*: 			;******************************************************@ OP6_5:    MOVL     @8(AP),R2		;R2=logical unit number for device?           BLEQ     OP6_ER11		;if logical unit <= 0, write error*9           PUSHL    R2			;put logical unit number on stacko>           CALLS    #1,LINK		;call LINK for channel number (R0)>           CMPL     R0,#-1		;if R0=-1, then no assigned channel8           BEQL     OP6_6		;branch,  channel not assignedN                         ;*****************************************************1 			;deassign the current channel associtated with*3 			;the logical unit number in R3 and then reassignP 			;a new channel number: 			;******************************************************,           MOVL     R0,R3		;R3=channel number4           MOVL     R1,R4		;R4=index to LOG_TAB table           $DASSGN_S -*>                    CHAN=R3		;deassign the current logical unit<           BLBC     R0,OP6_ER12		;if problems, write an error8           DECL     R4			;calulate and offset for channel6           ASHL     #3,R4,R4             ;multiply by 4>           ADDL     #4,R4                ;offset not calculatedE           JMP      OP6_7                ;branch to assign the channele: 			;******************************************************6 			;error in $DASSGN request, can not deassign channel: 			;******************************************************" OP6_ER12: MOVL     #ERR_27,ERR_NUM            JMP      TAPEIO_SYSTEM8 			;****************************************************, 			;current logical unit number not in table 			;make a new entry8 			;****************************************************D OP6_6:    INCL     LOG_NUM              ;make another entry in tableC           CMPL     LOG_NUM,LOG_MAX      ;are there too many entries*C           BGTR     OP6_ER13             ;branch if too many entries,9           MOVL     LOG_NUM,R4           ;R4=current indexa>           DECL     R4                   ;subtract 1 for offsetA           ASHL     #3,R4,R4             ;multiply by 8 for offset J           MOVL     @8(AP),L^LOG_TAB(R4) ;move logical unit number to table2           ADDL     #4,R4                ;and add 49 			;*****************************************************s& 			;now assign a channel to the device9 			;*****************************************************  OP6_7:   $ASSIGN_S -H                    DEVNAM=@12(AP), -    ;device name to get a channel toA                    CHAN=L^LOG_TAB(R4)   ;place to put the channel <           BLBC     R0,OP6_ER14		;branch if there is an errorA           MOVL     L^LOG_TAB(R4),CHANNEL;move to the channel word : 			;******************************************************6 			;at this point in the routine every thing is set up* 			;for $QIO operations on the tape drive.1 			;I.E. the tape drive is allocated to the user, 1 			;the tape is mounted foreign, and a channel is* 			;assigned to the tape drive3 			;The next step is to set the desired density and*0 			;parity of the tape drive which was requested0 			;by the user.  Obtain from the parameter list?                         ;the desired density of the tape drive.*9 			;Current options available are: 800,1600, and 6250 bpi*9 			;***************************************************** I           CLRL     FIB                  ;clear the file information block*+           CLRL     FIB+4		;clear both words*E           MOVL     @16(AP),R5           ;R5=param code from user callsG           CMPL     R5,#3                ;is the desired density 800bpi?t=           BEQL     SET800		;branch if 800bpi wanted by callere:           CMPL     R5,#9		;is the desired density 1600bpi?K           BEQL     SET1600              ;branch if 1600bpi wanted by caller H           CMPL     R5,#10               ;is the desired density 6250bpi?K           BEQL     SET6250              ;branch if 6250bpi wanted by caller N           CMPL     R5,#11               ;is default density desired by caller?J           BEQL     SETDEF               ;branch if default densidy desiredJ           JMP      OP6_ER15             ;bad parameter passed, write error: 			;******************************************************  			;too many open tapeio devices: 			;******************************************************" OP6_ER13: MOVL     #ERR_28,ERR_NUM           JMP      TAPEIO_ERRORs: 			;******************************************************$ 			;another error in $ASSIGN request: 			;******************************************************" OP6_ER14: MOVL     #ERR_29,ERR_NUM            JMP      TAPEIO_SYSTEM: 			;******************************************************0 			;set the correct bits for the desired density9 			;*****************************************************rD SET800:   MOVW     #<MT$K_NRZI_800*^X100>+<MT$K_NORMAL11*^X10>,FIB+4(           JMP      SETDEN               C SET1600:  MOVW     #<MT$K_PE_1600*^X100>+<MT$K_NORMAL11*^X10>,FIB+4*           JMP      SETDEN		*D SET6250:  MOVW     #<MT$K_GCR_6250*^X100>+<MT$K_NORMAL11*^X10>,FIB+4(           JMP      SETDEN               C SETDEF:   MOVW     #<MT$K_DEFAULT*^X100>+<MT$K_NORMAL11*^X10>,FIB+4R(           JMP      SETDEN               : 			;******************************************************2 			;issue $QIO request for setting density, parity: 			;******************************************************- SETDEN:   $QIOW_S  EFN=#1,-   		;event flag 1*1                    CHAN=CHANNEL,-	;channel number	>                    FUNC=#IO$_SETMODE,-	;set tape mode function@                    IOSB=IOSTATUS,-	;i/o status block information9                    P1=FIB		;give the tape characteristicsT6           CMPL     R0,#SS$_NORMAL	;valid $QIO request?;           BNEQ     OP6_ER17             ;branch if problemsr4           CMPW     IOSTATUS,#SS$_NORMAL	;did it work/           BNEQ     OP6_ER16		;branch if failure*A           JMP      ALL_DONE             ;all done, return to user : 			;******************************************************5 			;illegal density/parity parameter passed to tapeiot: 			;******************************************************" OP6_ER15:  MOVL    #ERR_30,ERR_NUM            JMP     TAPEIO_ERRORs: 			;******************************************************5 			;error in $QIO request, can not set density/parityI: 			;****************************************************** OP6_ER16: MOVZWL   IOSTATUS,R0" OP6_ER17: MOVL     #ERR_31,ERR_NUM            JMP      TAPEIO_SYSTEM           .PAGE O ;******************************************************************************o ;Q" ; OP7 - process operation code - 72 ;       Space forward a given number of tape files ;eO ;*******************************************************************************> OP7:      CMPW     (AP),#4		;are there four parameters passed?M           BNEQ     OP7_ERR1             ;branch if there are not 4 parameterse:           MOVL     @16(AP),ERROR        ;store error code C           MOVL     #16,OFFSET           ;store offset of error code$=           PUSHL    @8(AP)		;push logical unit number on stack A           CALLS    #1,LINK		;link logical unit number and channel H           CMPL     R0,#-1               ;did LINK find a channel number?N           BEQL     OP7_ERR2             ;branch if no channel for logical unitN           MOVL     R0,CHANNEL           ;store channel number for $QIO request: 			;******************************************************- 			;issue $QIO request to space forward files*: 			;******************************************************=           MOVL     @12(AP),FIB		;move number of file to space*           $QIOW_S -*.                    EFN=#1,-		;use event flag 11                    CHAN=CHANNEL,-	;channel number*?                    FUNC=#IO$_SKIPFILE,-	;rewind and go off line $                    IOSB=IOSTATUS,-	;B                    P1=@FIB		;specify the number of records to skip9           CMPL     R0,#SS$_NORMAL	;was request sucessful? D           BNEQ     OP7_ERR4             ;branch if not normal endingD           CMPW     IOSTATUS,#SS$_NORMAL ;was I/O reqest successfull?A           BNEQ     OP7_ERR3             ;branch if not successfulRA           JMP      ALL_DONE             ;all done, return to user*: 			;******************************************************2 			;incorrect number of arguments passed to tapeio: 			;******************************************************" OP7_ERR1: MOVL     #ERR_32,ERR_NUM           JMP      TAPEIO_ABORTi: 			;******************************************************0 			;illegal logical unit number passed to tapeio: 			;******************************************************" OP7_ERR2: MOVL     #ERR_33,ERR_NUM           JMP      TAPEIO_ERRORu: 			;****************************************************** 			;error in $QIO request*: 			;****************************************************** OP7_ERR3: MOVZWL   IOSTATUS,R0" OP7_ERR4: MOVL     #ERR_34,ERR_NUM            JMP      TAPEIO_SYSTEM           .PAGE*O ;******************************************************************************M ; " ; OP8 - process operation code - 83 ;       Space backward a given number of tape files* ;	O ;*******************************************************************************> OP8:      CMPW     (AP),#4		;are there four parameters passed?M           BNEQ     OP8_ERR1             ;branch if there are not 4 parametersi:           MOVL     @16(AP),ERROR        ;store error code C           MOVL     #16,OFFSET           ;store offset of error code =           PUSHL    @8(AP)		;push logical unit number on stack*A           CALLS    #1,LINK		;link logical unit number and channel H           CMPL     R0,#-1               ;did LINK find a channel number?N           BEQL     OP8_ERR2             ;branch if no channel for logical unitN           MOVL     R0,CHANNEL           ;store channel number for $QIO request: 			;******************************************************0 			;issue $QIO request to space backward records: 			;******************************************************G           MOVL     @12(AP),FIB		;FIB=number of of records to space backe@           MNEGL    FIB,FIB		;make it negative for backward space.           $QIOW_S  EFN=#1,-		;use event flag 11                    CHAN=CHANNEL,-	;channel numbert?                    FUNC=#IO$_SKIPFILE,-	;rewind and go off linef$                    IOSB=IOSTATUS,-	;B                    P1=@FIB		;specify the number of records to skip9           CMPL     R0,#SS$_NORMAL	;was request sucessful? D           BNEQ     OP8_ERR4             ;branch if not normal endingD           CMPW     IOSTATUS,#SS$_NORMAL ;was I/O reqest successfull?A           BNEQ     OP8_ERR3             ;branch if not successful*A           JMP      ALL_DONE             ;all done, return to usera: 			;******************************************************2 			;incorrect number of arguments passed to tapeio: 			;******************************************************" OP8_ERR1: MOVL     #ERR_35,ERR_NUM           JMP      TAPEIO_ABORTt: 			;******************************************************0 			;illegal logical unit number passed to tapeio: 			;******************************************************" OP8_ERR2: MOVL     #ERR_36,ERR_NUM           JMP      TAPEIO_ERRORe: 			;****************************************************** 			;error in $QIO request : 			;****************************************************** OP8_ERR3: MOVZWL   IOSTATUS,R0" OP8_ERR4: MOVL     #ERR_37,ERR_NUM            JMP      TAPEIO_SYSTEM           .PAGE*O ;******************************************************************************s ;o" ; OP9 - process operation code - 9( ;       Read a physical record from tape ;eO ;*******************************************************************************: 			;******************************************************2 			;incorrect number of arguments passed to tapeio: 			;******************************************************" OP9_ERR1: MOVL     #ERR_38,ERR_NUM           JMP      TAPEIO_ABORT;8 			;**************************************************** 			;entry point for opcode 98 			;****************************************************> OP9:      CMPW     (AP),#5		;are there five parameters passed?M           BNEQ     OP9_ERR1             ;branch if there are not 4 parametersu:           MOVL     @20(AP),ERROR        ;store error code C           MOVL     #20,OFFSET           ;store offset of error code*=           PUSHL    @8(AP)		;push logical unit number on stack;A           CALLS    #1,LINK		;link logical unit number and channel*H           CMPL     R0,#-1               ;did LINK find a channel number?N           BEQL     OP9_ERR2             ;branch if no channel for logical unitN           MOVL     R0,CHANNEL           ;store channel number for $QIO request: 			;******************************************************0 			;issue $QIO request to read a physical record: 			;******************************************************D           MOVL     @16(AP),R3           ;R3=length of record to read>           BLEQ     OP9_ERR3		;if count<1 then we have an errorF           CMPL     R3,#1                ;does user want entire record?H           BNEQ     OP9_1                ;if not 1, then user knows count@           JMP      OP9_ERR6		;count=1 option no longer supported. OP9_1:    $QIOW_S  EFN=#1,-		;use event flag 11                    CHAN=CHANNEL,-	;channel number*?                    FUNC=#IO$_READLBLK,-	;rewind and go off line $                    IOSB=IOSTATUS,-	;3                    P1=@12(AP),-		;address of buffermD                    P2=R3                ;number of bytes to transferA           CMPW     IOSTATUS,#SS$_DATAOVERUN	;data overruns are ok /           BEQL     DATA_OK		;if overrun then ok*8           CMPL     R0,#SS$_NORMAL	;error in $QIO request-           BNEQ     OP9_ERR5		;branch if error*?           CMPW     IOSTATUS,#SS$_NORMAL	;successful completion? H           BNEQ     OP9_ERR4             ;if not normal, find out problemG DATA_OK:  MOVZWL   IOSTATUS+2,@16(AP)	;upper half of the 1st iosb word  E                                         ;contains the transfer count.eA           JMP      ALL_DONE             ;all done, return to usert: 			;******************************************************0 			;illegal logical unit number passed to tapeio: 			;******************************************************! OP9_ERR2: MOVL    #ERR_39,ERR_NUMR           JMP      TAPEIO_ERRORR: 			;******************************************************' 			;illegal count code passed to tapeioi: 			;******************************************************" OP9_ERR3: MOVL     #ERR_40,ERR_NUM           JMP      TAPEIO_ERRORP: 			;****************************************************** 			;error in $QIO requeste. 			;permitted errors on a read request include2 			;encountering an end of file (SS$_ENDOFFILE) or 			;a parity error (SS$_PARITY)N 			;2 			;first, check if an end of file was encountered: 			;****************************************************** OP9_ERR4: MOVZWL   IOSTATUS,R0$ OP9_ERR5: CMPL     R0,#SS$_ENDOFFILE           BNEQ     CK_PARTY 8 			;**************************************************** 			;end fo file encountered 8 			;****************************************************=           MOVL     #ERR_46,ERR_NUM      ;set end of file flag C           MOVL     #1,@16(AP)		;set record count to 1 (end of file) E OP9_WRT:  CMPL     ERROR,#1             ;should a message be written? M           BGTR     OP9_NO               ;if .gt. 1, don't write error messagemB           PUSHAL   CONTINUE             ;set up for call to ERRMES)           PUSHAL   ERR_NUM              ;s*           PUSHAL   ROUTIN               ; )           PUSHAL   ERRFIL               ;U4           CALLS    #4,G^ERRMES          ;call errmes9 OP9_NO:   JMP      ALL_DONE             ;return to caller	: 			;******************************************************* 			;check if a parity error was encounterd: 			;******************************************************? CK_PARTY: CMPL     R0,#SS$_PARITY        ;is it a parity error?eC           BNEQ     NO_GOOD              ;better write error messageh>           MOVL     #-1,@16(AP)          ;set parity error flag3           MOVL     #ERR_47,ERR_NUM      ;set error tH           JMP      OP9_WRT              ;see if error message for output: 			;******************************************************3 			;some error other than parity or eof encountered : 			;******************************************************! NO_GOOD:  MOVAL    ERR_41,ERR_NUMl            JMP      TAPEIO_SYSTEM: 			;******************************************************0 			;count=1 option no longer supported in TAPEIO 			;better let user know: 			;******************************************************" OP9_ERR6: MOVL     #ERR_48,ERR_NUM           JMP      TAPEIO_ABORT;           .PAGEeO ;******************************************************************************P ;	$ ; OP10 - process operation code - 10( ;        Write a physical record to tape ; O ;****************************************************************************** > OP10:     CMPW     (AP),#5		;are there five parameters passed?M           BNEQ     OP10_ER1             ;branch if there are not 4 parametersr:           MOVL     @20(AP),ERROR        ;store error code C           MOVL     #20,OFFSET           ;store offset of error codel=           PUSHL    @8(AP)		;push logical unit number on stackcA           CALLS    #1,LINK		;link logical unit number and channelhH           CMPL     R0,#-1               ;did LINK find a channel number?N           BEQL     OP10_ER2             ;branch if no channel for logical unitN           MOVL     R0,CHANNEL           ;store channel number for $QIO request: 			;******************************************************1 			;issue $QIO request to write a physical recorde: 			;******************************************************E           MOVL     @16(AP),R3           ;R3=length of record to write ?           BLEQ     OP10_ER3		;if count<=1 then we have an errorM1           CMPL     R3,#65534		;is number too big?R9           BGTR     OP10_ER3		;branch if number is too big :           BLBC     R3,OP10_1A           ;is the number odd8           INCL     R3			;if odd, then add 1 to make even OP10_1A:.           $QIOW_S  EFN=#1,-		;use event flag 11                    CHAN=CHANNEL,-	;channel number ?                    FUNC=#IO$_WRITELBLK,-;rewind and go off line $                    IOSB=IOSTATUS,-	;3                    P1=@12(AP),-		;address of buffersD                    P2=R3                ;number of bytes to transfer8           CMPL     R0,#SS$_NORMAL       ;was request ok?8           BNEQ     OP10_ER5             ;branch if errorE           CMPW     IOSTATUS,#SS$_NORMAL ;was i/o request satisfactory >           BNEQ     OP10_ER4             ;branch if i/o problemA           JMP      ALL_DONE             ;all done, return to user*: 			;******************************************************2 			;incorrect number of arguments passed to tapeio: 			;******************************************************" OP10_ER1: MOVL     #ERR_42,ERR_NUM           JMP      TAPEIO_ABORTd: 			;******************************************************0 			;illegal logical unit number passed to tapeio: 			;******************************************************" OP10_ER2: MOVL     #ERR_43,ERR_NUM           JMP      TAPEIO_ERRORd: 			;******************************************************' 			;illegal count code passed to tapeio*: 			;******************************************************" OP10_ER3: MOVL     #ERR_44,ERR_NUM           JMP      TAPEIO_ERROR : 			;****************************************************** 			;error in $QIO request : 			;****************************************************** OP10_ER4: MOVZWL   IOSTATUS,R0" OP10_ER5: MOVL     #ERR_45,ERR_NUM            JMP      TAPEIO_SYSTEM           .PAGERM ;****************************************************************************  ;a$ ; OP11 - process operation code - 11H ;        Read a phsyical record from tape and do not wait for completion ;        of I/O request L ;***************************************************************************> OP11:     CMPW     (AP),#5		;are there five parameters passed?B           BNEQ     OP11_ER1		;branch if there are not 4 parameters:           MOVL     @20(AP),ERROR        ;store error code C           MOVL     #20,OFFSET           ;store offset of error code =           PUSHL    @8(AP)		;push logical unit number on stack*A           CALLS    #1,LINK		;link logical unit number and channel H           CMPL     R0,#-1               ;did LINK find a channel number?C           BEQL     OP11_ER2		;branch if no channel for logical unit*N           MOVL     R0,CHANNEL           ;store channel number for $QIO request: 			;******************************************************0 			;issue $QIO request to read a physical record: 			;******************************************************D           MOVL     @16(AP),R3           ;R3=length of record to read>           BLEQ     OP11_ER3		;if count<1 then we have an error           CMPL     R3,#1           BEQL     OP11_ER5<.           $QIO_S   EFN=#1,-		;use event flag 11                    CHAN=CHANNEL,-	;channel number+?                    FUNC=#IO$_READLBLK,-	;rewind and go off line $                    IOSB=IOSTATUS,-	;3                    P1=@12(AP),-		;address of buffer 5                    P2=R3		;number of bytes to transer*8           CMPL     R0,#SS$_NORMAL	;error in $QIO request-           BNEQ     OP11_ER4		;branch if error*A           JMP      ALL_DONE             ;all done, return to usere: 			;******************************************************2 			;incorrect number of arguments passed to tapeio: 			;******************************************************" OP11_ER1: MOVL     #ERR_49,ERR_NUM           JMP      TAPEIO_ABORTr: 			;******************************************************0 			;illegal logical unit number passed to tapeio: 			;******************************************************" OP11_ER2: MOVL     #ERR_50,ERR_NUM           JMP      TAPEIO_ERROR : 			;******************************************************' 			;illegal count code passed to tapeio*: 			;******************************************************" OP11_ER3: MOVL     #ERR_51,ERR_NUM           JMP      TAPEIO_ERROR*9 			;***************************************************** % 			;Error with $QIO (no wait) request*9 			;*****************************************************u" OP11_ER4: MOVL     #ERR_52,ERR_NUM            JMP      TAPEIO_SYSTEM9 			;*****************************************************_* 			;Count=1 option not supported by tapeio9 			;******************************************************" OP11_ER5: MOVL     #ERR_53,ERR_NUM           JMP      TAPEIO_ERRORP           .PAGEtO ;******************************************************************************* ;*$ ; OP12 - process operation code - 12D ;        Write a physical record to tape (do not wait for completion= ;        of I/O operation before returning to calling programbO ;******************************************************************************o> OP12:     CMPW     (AP),#5		;are there five parameters passed?M           BNEQ     OP12_ER1             ;branch if there are not 4 parameterst:           MOVL     @20(AP),ERROR        ;store error code C           MOVL     #20,OFFSET           ;store offset of error codea=           PUSHL    @8(AP)		;push logical unit number on stackcA           CALLS    #1,LINK		;link logical unit number and channel H           CMPL     R0,#-1               ;did LINK find a channel number?N           BEQL     OP12_ER2             ;branch if no channel for logical unitN           MOVL     R0,CHANNEL           ;store channel number for $QIO request: 			;******************************************************1 			;issue $QIO request to write a physical record1: 			;******************************************************E           MOVL     @16(AP),R3           ;R3=length of record to write ?           BLEQ     OP12_ER3		;if count<=1 then we have an errore1           CMPL     R3,#65534		;is number too big?S9           BGTR     OP12_ER3		;branch if number is too bigE:           BLBC     R3,OP12_1A           ;is the number odd8           INCL     R3			;if odd, then add 1 to make even OP12_1A:.           $QIO_S   EFN=#1,-		;use event flag 11                    CHAN=CHANNEL,-	;channel numberl?                    FUNC=#IO$_WRITELBLK,-;rewind and go off line*$                    IOSB=IOSTATUS,-	;3                    P1=@12(AP),-		;address of buffer*D                    P2=R3                ;number of bytes to transfer8           CMPL     R0,#SS$_NORMAL       ;was request ok?8           BNEQ     OP12_ER4             ;branch if errorA           JMP      ALL_DONE             ;all done, return to user*: 			;******************************************************2 			;incorrect number of arguments passed to tapeio: 			;******************************************************" OP12_ER1: MOVL     #ERR_54,ERR_NUM           JMP      TAPEIO_ABORT : 			;******************************************************0 			;illegal logical unit number passed to tapeio: 			;******************************************************" OP12_ER2: MOVL     #ERR_55,ERR_NUM           JMP      TAPEIO_ERROR8: 			;******************************************************' 			;illegal count code passed to tapeio*: 			;******************************************************" OP12_ER3: MOVL     #ERR_56,ERR_NUM           JMP      TAPEIO_ERRORR: 			;****************************************************** 			;error in $QIO request : 			;******************************************************" OP12_ER4: MOVL     #ERR_57,ERR_NUM            JMP      TAPEIO_SYSTEM           .PAGErO ;******************************************************************************  ; $ ; OP13 - process operation code - 13E ;        Wait for current tape operation to complete before returningbF ;        to caller. This routine used in conjuction with OPCODEs 11,12; ;        for coordinating double buffer tape I/O operations*O ;******************************************************************************a; OP13:     CMPW     (AP),#4		;Are there 4 parameters passed?*B           BNEQ     OP13_ER1		;error and branch if not 3 parameters2           MOVL     @16(AP),ERROR	;store error code;           MOVL     #16,OFFSET		;Store offset of return codes8           PUSHL    @8(AP)		;logical unit number on stack7           CALLS    #1,LINK		;get channel number for LUN :           CMPL     R0,#-1		;did Link find a channel number<           BEQL     OP13_ER2		;Error and branch if no channel8 			;****************************************************1 			;Issue the wait request, wait for event flag=1 8 			;****************************************************6           $WAITFR_S EFN=#1		;wait for the event to end6           CMPL     R0,#SS$_NORMAL	;how did request go?-           BNEQ     OP13_ER3		;branch if error 8 			;****************************************************1 			;test IO status block to determine success or d) 			;failure of the previous I/O operation*8 			;****************************************************K           CMPW     IOSTATUS,#SS$_NORMAL	;was the previous I/O operation ok?*>           BNEQ     OP13_ER4 		;Branch if I/O condition occuredB OP13_1:   MOVZWL   IOSTATUS+2,@12(AP)	;return byte count to caller.           JMP      ALL_DONE		;return to caller8 			;****************************************************& 			;invalid number of arguments passed8 			;****************************************************! OP13_ER1: MOVL    #ERR_58,ERR_NUMS           JMP     TAPEIO_ABORT7 			;***************************************************  			;invalid lun passed8 			;****************************************************! OP13_ER2: MOVL    #ERR_59,ERR_NUMo           JMP     TAPEIO_ERROR8 			;**************************************************** 			;$WAITFR request error*8 			;****************************************************! OP13_ER3: MOVL    #ERR_60,ERR_NUMc           JMP     TAPEIO_SYSTEMa7 			;****************************************************. 			;program branches here an exception occured$ 			;with the previous I/O operation.# 			;First, check if EOF encountered*6 			;**************************************************5 OP13_ER4: MOVZWL  IOSTATUS,R0		;R0=return status codeM?           CMPL    R0,#SS$_DATAOVERUN	;Is there a data over run?QL           BEQL    OP13_1                ;Over runs are ok, go back to normalC           CMPL    R0,#SS$_ENDOFFILE     ;Did we hit an end of file?04           BEQL    OP13_2		;Branch if EOF encountered>           CMPL    R0,#SS$_PARITY        ;Is it a parity error?K           BEQL    OP13_3                ;Branch if parity error encountered M           MOVL    #ERR_61,ERR_NUM       ;severe error, perform error handling9D           JMP     TAPEIO_SYSTEM         ;Handle system related errorF OP13_2:   MOVL    #ERR_62,ERR_NUM       ;write EOF encountered messageI           MOVL    #1,@12(AP)            ;let user know of EOF encounterede=           JMP     OP13_4                ;go write the message*C OP13_3:   MOVL    #ERR_63,ERR_NUM       ;Write parity error message=I           MOVL    #-1,@12(AP)           ;let user know about parity errorhG OP13_4:   CMPL    ERROR,#1              ;should the message be written?iJ           BGTR    OP13_5                ;If .gt.1 then do not write error E           PUSHAL  CONTINUE              ;set up call to error messaget)           PUSHAL  ERR_NUM               ;            PUSHAL  ROUTIN		;A           PUSHAL  ERRFIL		; C           CALLS   #4,G^ERRMES		;have ERRMES write the error message 9 OP13_5:   JMP     ALL_DONE              ;return to caller(           .PAGEfM ;****************************************************************************  ; $ ; OP14 - process operation code - 14H ;        Read a phsyical record from tape and do not wait for completionJ ;        of I/O request. Also pass an event flag (IEFN) to the subroutine.L ;***************************************************************************: 			;******************************************************2 			;incorrect number of arguments passed to tapeio: 			;******************************************************" OP14_ER1: MOVL     #ERR_64,ERR_NUM           JMP      TAPEIO_ABORT : 			;******************************************************0 			;illegal logical unit number passed to tapeio: 			;******************************************************" OP14_ER2: MOVL     #ERR_65,ERR_NUM           JMP      TAPEIO_ERROR_: 			;******************************************************' 			;illegal count code passed to tapeio*: 			;******************************************************" OP14_ER3: MOVL     #ERR_66,ERR_NUM           JMP      TAPEIO_ERROR_: 			;******************************************************# 			;Entry point for OP14 processing*: 			;******************************************************= OP14:     CMPW     (AP),#6		;are there six parameters passed? B           BNEQ     OP14_ER1		;branch if there are not 4 parameters:           MOVL     @24(AP),ERROR        ;store error code C           MOVL     #24,OFFSET           ;store offset of error codeZ=           PUSHL    @8(AP)		;push logical unit number on stack A           CALLS    #1,LINK		;link logical unit number and channel*H           CMPL     R0,#-1               ;did LINK find a channel number?C           BEQL     OP14_ER2		;branch if no channel for logical unittN           MOVL     R0,CHANNEL           ;store channel number for $QIO request: 			;******************************************************0 			;issue $QIO request to read a physical record: 			;******************************************************D           MOVL     @20(AP),R3           ;R3=length of record to read>           BLEQ     OP14_ER3		;if count<1 then we have an error5           CMPL     R3,#1		;record length can not be 1U-           BEQL     OP14_ER5		;branch if error E           MOVL     @12(AP),R4           ;R4=desired event flag number;A           BLSS     OP14_ER6		;event flag must be between 0 and 31f9           CMPL     R4,#31		;branch if outside valid range*1           BGTR     OP14_ER6		;branch if IEFN > 31RH           MOVAQ    IOSTAT[R4],R5	;R5=desired address of I/O status block.           $QIO_S   EFN=R4,-		;use event flag 11                    CHAN=CHANNEL,-	;channel number E                    FUNC=#IO$_READLBLK,-	;read logical block from tapeME                    IOSB=(R5),-		;i/o status block for this event flag*3                    P1=@16(AP),-		;address of buffer;5                    P2=R3		;number of bytes to transer*8           CMPL     R0,#SS$_NORMAL	;error in $QIO request-           BNEQ     OP14_ER4		;branch if error A           JMP      ALL_DONE             ;all done, return to user*9 			;***************************************************** % 			;Error with $QIO (no wait) request*9 			;*****************************************************L" OP14_ER4: MOVL     #ERR_67,ERR_NUM            JMP      TAPEIO_SYSTEM9 			;******************************************************* 			;Count=1 option not supported by tapeio9 			;***************************************************** " OP14_ER5: MOVL     #ERR_68,ERR_NUM           JMP      TAPEIO_ERROR*8 			;****************************************************. 			;illegal event flag number passed to TAPEIO7 			;***************************************************r" OP14_ER6: MOVL     #ERR_69,ERR_NUM           JMP      TAPEIO_ERROR            .PAGEFO ;******************************************************************************c ;u$ ; OP15 - process operation code - 15D ;        Write a physical record to tape (do not wait for completionC ;        of I/O operation before returning to calling program. AlsoLL ;        a logical event flag number (IEFN) is passed by the calling programO ;*******************************************************************************= OP15:     CMPW     (AP),#6		;are there six parameters passed?qM           BNEQ     OP15_ER1             ;branch if there are not 4 parameters*:           MOVL     @24(AP),ERROR        ;store error code C           MOVL     #24,OFFSET           ;store offset of error codeh=           PUSHL    @8(AP)		;push logical unit number on stacktA           CALLS    #1,LINK		;link logical unit number and channel H           CMPL     R0,#-1               ;did LINK find a channel number?N           BEQL     OP15_ER2             ;branch if no channel for logical unitN           MOVL     R0,CHANNEL           ;store channel number for $QIO request: 			;******************************************************1 			;issue $QIO request to write a physical record : 			;******************************************************E           MOVL     @20(AP),R3           ;R3=length of record to writeR?           BLEQ     OP15_ER3		;if count<=1 then we have an error 1           CMPL     R3,#65534		;is number too big?S9           BGTR     OP15_ER3		;branch if number is too big :           BLBC     R3,OP15_1A           ;is the number odd8           INCL     R3			;if odd, then add 1 to make even OP15_1A:E           MOVL     @12(AP),R4           ;R4=desired event flag numberbA           BLSS     OP15_ER6		;event flag must be between 0 and 31*9           CMPL     R4,#31		;branch if outside valid rangeM1           BGTR     OP15_ER6		;branch if IEFN > 31*H           MOVAQ    IOSTAT[R4],R5	;R5=desired address of I/O status block.           $QIO_S   EFN=R4,-		;use event flag 11                    CHAN=CHANNEL,-	;channel number#?                    FUNC=#IO$_WRITELBLK,-;write a record to tape*E                    IOSB=(R5),-		;i/o status block for this event flage3                    P1=@16(AP),-		;address of buffer*5                    P2=R3		;number of bytes to transer 8           CMPL     R0,#SS$_NORMAL       ;was request ok?8           BNEQ     OP15_ER4             ;branch if errorA           JMP      ALL_DONE             ;all done, return to userP: 			;******************************************************2 			;incorrect number of arguments passed to tapeio: 			;******************************************************" OP15_ER1: MOVL     #ERR_70,ERR_NUM           JMP      TAPEIO_ABORT : 			;******************************************************0 			;illegal logical unit number passed to tapeio: 			;******************************************************" OP15_ER2: MOVL     #ERR_71,ERR_NUM           JMP      TAPEIO_ERROR : 			;******************************************************' 			;illegal count code passed to tapeio : 			;******************************************************" OP15_ER3: MOVL     #ERR_72,ERR_NUM           JMP      TAPEIO_ERRORl: 			;****************************************************** 			;error in $QIO request : 			;******************************************************" OP15_ER4: MOVL     #ERR_73,ERR_NUM            JMP      TAPEIO_SYSTEM: 			;******************************************************. 			;illegal event flag number passed to TAPEIO: 			;******************************************************" OP15_ER6: MOVL     #ERR_74,ERR_NUM           JMP      TAPEIO_ERROR*           .PAGE*O ;******************************************************************************  ;d$ ; OP16 - process operation code - 16E ;        Wait for current tape operation to complete before returning F ;        to caller. This routine used in conjuction with OPCODEs 11,12; ;        for coordinating double buffer tape I/O operationsNO ;****************************************************************************** ; OP16:     CMPW     (AP),#5		;Are there 5 parameters passed? B           BNEQ     OP16_ER1		;error and branch if not 3 parameters2           MOVL     @20(AP),ERROR	;store error code;           MOVL     #20,OFFSET		;Store offset of return code 8           PUSHL    @8(AP)		;logical unit number on stack7           CALLS    #1,LINK		;get channel number for LUNu:           CMPL     R0,#-1		;did Link find a channel number<           BEQL     OP16_ER2		;Error and branch if no channel           MOVL     R0,CHANNELP8 			;****************************************************1 			;Issue the wait request, wait for event flag=1d8 			;****************************************************7           MOVL     @12(AP),R4    	;R4=event flag number E           BLSS     OP16_ER5    		;branch if event flag number outside*)           CMPL     R4,#31		;range 0 to 31 .           BGTR     OP16_ER5 		;branch if error6           $WAITFR_S EFN=R4		;wait for the event to end6           CMPL     R0,#SS$_NORMAL	;how did request go?-           BNEQ     OP16_ER3		;branch if errorr8 			;****************************************************1 			;test IO status block to determine success or  ) 			;failure of the previous I/O operationI8 			;****************************************************E           MOVQ     IOSTAT[R4],IOSTATUS  ;R4=address of iostatus block*K           CMPW     IOSTATUS,#SS$_NORMAL	;was the previous I/O operation ok?M>           BNEQ     OP16_ER4 		;Branch if I/O condition occuredB OP16_1:   MOVZWL   IOSTATUS+2,@16(AP)	;return byte count to caller.           JMP      ALL_DONE		;return to caller8 			;****************************************************& 			;invalid number of arguments passed8 			;****************************************************! OP16_ER1: MOVL    #ERR_75,ERR_NUM*           JMP     TAPEIO_ABORT7 			;***************************************************  			;invalid lun passed8 			;****************************************************! OP16_ER2: MOVL    #ERR_76,ERR_NUMs           JMP     TAPEIO_ERROR8 			;**************************************************** 			;$WAITFR request erroru8 			;****************************************************! OP16_ER3: MOVL    #ERR_77,ERR_NUMh           JMP     TAPEIO_SYSTEM 8 			;****************************************************' 			;illegal event flag passed to TAPEIOn8 			;****************************************************! OP16_ER5: MOVL    #ERR_78,ERR_NUM            JMP     TAPEIO_ERROR7 			;***************************************************r. 			;program branches here an exception occured$ 			;with the previous I/O operation.# 			;First, check if EOF encounteredR6 			;**************************************************5 OP16_ER4: MOVZWL  IOSTATUS,R0		;R0=return status code ?           CMPL    R0,#SS$_DATAOVERUN	;Is there a data over run? L           BEQL    OP16_1                ;Over runs are ok, go back to normalC           CMPL    R0,#SS$_ENDOFFILE     ;Did we hit an end of file? 4           BEQL    OP16_2		;Branch if EOF encountered>           CMPL    R0,#SS$_PARITY        ;Is it a parity error?K           BEQL    OP16_3                ;Branch if parity error encountered M           MOVL    #ERR_79,ERR_NUM       ;severe error, perform error handlingfD           JMP     TAPEIO_SYSTEM         ;Handle system related errorF OP16_2:   MOVL    #ERR_80,ERR_NUM       ;write EOF encountered messageI           MOVL    #1,@16(AP)            ;let user know of EOF encounteredNF           $CANCEL_S CHAN=CHANNEL	;when EOF encountered cancel any more?           CMPL    R0,#SS$_NORMAL	;$QIO requests to this channela<           BNEQ    OP16_ER6		;test an error in cancel request=           JMP     OP16_4                ;go write the message C OP16_3:   MOVL    #ERR_81,ERR_NUM       ;Write parity error message*I           MOVL    #-1,@16(AP)           ;let user know about parity error*G OP16_4:   CMPL    ERROR,#1              ;should the message be written?RJ           BGTR    OP16_5                ;If .gt.1 then do not write error E           PUSHAL  CONTINUE              ;set up call to error message*)           PUSHAL  ERR_NUM               ;*           PUSHAL  ROUTIN		;#           PUSHAL  ERRFIL		; C           CALLS   #4,G^ERRMES		;have ERRMES write the error message*9 OP16_5:   JMP     ALL_DONE              ;return to caller*: 			;******************************************************, 			; Error in $CANCEL system service request: 			;******************************************************! OP16_ER6: MOVL    #ERR_85,ERR_NUM*           JMP     TAPEIO_SYSTEMi           .PAGE M ;****************************************************************************  ;l$ ; OP17 - process operation code - 17B ;        Cancel any remaining I/O requests associated with logical% ;        unit number specified by LUN*M ;****************************************************************************4: OP17:     CMPW    (AP),#3		;Are there 3 parameters passed?A           BNEQ    OP17_ER1		;error and branch if not 3 parametersA4           MOVL    @12(AP),ERROR   	;store error code9           MOVL    #12,OFFSET		;store ofset of return codeP7           PUSHL   @8(AP)		;logical unit number on stackI6           CALLS   #1,LINK 		;get channel number of LUN:           CMPL    R0,#-1		;did LINK find a channel number?;           BEQL    OP17_ER2		;error and branch if no channel*7           MOVL    R0,CHANNEL     	;store channel numberqA           		;***************************************************** 			; issue the cancel requestW7 			;***************************************************L            $CANCEL_S chan=CHANNELC           CMPL    R0,#SS$_NORMAL        ;was the cancel request ok?*,           BNEQ    OP17_ER3		;branch if errorA           JMP     ALL_DONE		;all done with request return to usere9 			;******************************************************% 			;invalid number of argumnts passed 9 			;******************************************************! OP17_ER1: MOVL    #ERR_82,ERR_NUMa           JMP     TAPEIO_ABORT9 			;*****************************************************a 			;invalid lun passed9 			;******************************************************! OP17_ER2: MOVL    #ERR_83,ERR_NUMa           JMP     TAPEIO_ERROR9 			;*****************************************************P 			;Error in $CANCEL request9 			;******************************************************! OP17_ER3: MOVL    #ERR_84,ERR_NUM	           JMP     TAPEIO_SYSTEM*8 			;**************************************************** 			;return to caller7 			;**************************************************** ALL_DONE: RET*           .PAGE M ;*****************************************************************************? ; TAPEIO_ABORT - program branches here when the calling routineOG ; has passed either an illegal opcode or an invalid number of argumentsr) ; have been passed to the calling program	A ; TAPEIO will pass address of error number to ERRMES for an aborteM ;****************************************************************************  TAPEIO_ABORT:0<           PUSHAL   ABORT 		;parameter 4 on stack (abort job)L WRITE:    PUSHAL   ERR_NUM              ;parameter 3 on stack (error number)?           PUSHAL   ROUTIN		;parameter 2 on stack (routine name) O           PUSHAL   ERRFIL               ;parameter 1 on stack (error file name)d4           CALLS    #4,G^ERRMES          ;call ERRMES9 NOWRITE:  MOVL     AP,R2		;calculate the address of error 7           ADDL     OFFSET,R2		;add the necessary offsetR3           MNEGL    ERR_NUM,@(R2)	;return error code 9           RET                           ;return to callerdN ;*****************************************************************************J ; TAPEIO_ERROR - program branches here when an error occured in TAPEIO andA ; the error is unrelated to a system service call.  TAPEIO checks3G ; the error flag passed by the caller and performs one of three options  ; based on the error flag 6 ; if IERROR = 0 - write an error message and abort jobH ; if IERROR = 1 - write an error message and return error message number: ;                 (negative number) to the calling programI ; if IERROR = 2 - write no error message but return error messsage number : ;                 (negative number) to the calling programM ;****************************************************************************R TAPEIO_ERROR:r9           MOVL     ERROR,R2		;R2=error code given by userr1           BEQL     TAPEIO_ABORT		;if 0, abort job*8           CMPL     R2,#1                ;error code = 1?)           BEQL     CONT			;if 1, continue 8           CMPL     R2,#2                ;error code = 2?L           BEQL     NOWRITE              ;if 2, do not write an error messageF           JMP      TAPEIO_ABORT         ;unknown error code, abort job3 CONT:     PUSHAL   CONTINUE		;put continue on stack*?           JMP      WRITE                ;go write error messagedM ;****************************************************************************1E ; TAPEIO_SYSTEM - program branches here when a systerm services error*G ; occured in TAPEIO. TAPEIO checks the error flag for 1 of 3 conditionstF ; IERROR = 0 write error message (System service and TAPEIO error) and ;            abort the jobF ; IERROR = 1 write error message (System service and TAPEIO error) and ;            return to caller*E ; IERROR = 2 do not write error messages but return negative value of* ;          error code*M ;****************************************************************************_ TAPEIO_SYSTEM:F           MOVL     R0,MES_NUM		;R3=system service error message numberG           $GETMSG_S -                   ;get message for message number*6                    MSGID=MES_NUM,-	;set message number=                    MSGLEN=MES_LEN,-	;length of return messageo7                    BUFADR=MES_BUF       ;message buffersG           MOVAL    MES_BUF,ERR_MES_ADR  ;move address string descriptorfC           CALLS    #0,G^TERMIO          ;go write the error message A           JMP      TAPEIO_ERROR 	;Write associated TAPEIO messageh           .PAGE N ;***************************************************************************** ;OD ; DATA - psect for holding data and processing parameters for TAPEIO ;HO ;*******************************************************************************            .PSECT  DATA,WRT,NOEXE: 			;******************************************************- 			;Item list for $GETJPI system service call*: 			;******************************************************4 JPI_ITEM: .WORD    4			;item list to get process PID           .WORD    JPI$_PID		;           .ADDRESS JPI_PID		;c           .ADDRESS JPI_PIDA		;@           .LONG    0,0,0 		;end of item list for $GETJPI request JPI_PID:  .LONG	   0			; JPI_PIDA: .LONG    0			;: 			;******************************************************- 			;Item list for $GETDVI system service callg: 			;******************************************************1 DVI_ITEM: .WORD    4			;item list to get tape PID            .WORD    DVI$_PID		;           .ADDRESS DVI_PID		;1           .ADDRESS DVI_PIDA		;4           .WORD    4			;item list to get device type"           .WORD    DVI$_DEVCLASS	;           .ADDRESS DVI_DEV 		;)           .ADDRESS DVI_DEVA             ; F           .WORD    4           		;item list for device characteristics"           .WORD    DVI$_DEVCHAR		;)           .ADDRESS DVI_CHR              ;i           .ADDRESS DVI_CHRA		;M           .LONG    0,0,0                ;end of item list for $GETDVI requestn" DVI_PID:  .LONG    0			;device PID DVI_PIDA: .LONG    0			;# DVI_DEV:  .LONG    0			;device type  DVI_DEVA: .LONG    0			;. DVI_CHR:  .LONG    0			;device characteristics DVI_CHRA: .LONG    0			;: 			;******************************************************/ 			;item list for $MOUNT system service request : 			;******************************************************< MNT_ITEM: .WORD    128			;item list for device name to mount!           .WORD    MNT$_DEVNAM		; @           .ADDRESS MNT_DEV		;need to load device name in MNT_DEV           .LONG    0			;2           .WORD    4			;item list for $MOUNT flags            .WORD    MNT$_FLAGS		;:           .ADDRESS MNT_FLG		;need to load flags in MNT_FLG           .LONG    0			;>           .LONG    0,0,0		;end of item list for $MOUNT request: MNT_DEV:  .BLKB    128			;save 8 bytes to hold device name9                                         ;mount flags are:o;                                         ;mount tape foreignaA                                         ;do not write ansi headersL                                         ;do now specify voumle name on mountL MNT_FLG:  .LONG    MNT$M_FOREIGN!MNT$M_NOHDR3!MNT$M_OVR_IDENT!MNT$M_NOASSIST: 			;******************************************************* 			;logical unit number and channel table 4 			;dimensioned (2,10). holds the channel number for9 			;the corresponding logical unit number given to TAPEIOf: 			;******************************************************; LOG_MAX:  .LONG    10			;maximum number of entries in tablen1 LOG_NUM:  .LONG    0			;current number of entries ; LOG_TAB:  .LONG    0,0			;table of logical unit numbers and 7           .LONG    0,0			;corresponding channel numbers            .LONG    0,0           .LONG    0,0           .LONG    0,0           .LONG    0,0           .LONG    0,0           .LONG    0,0           .LONG    0,0           .LONG    0,0: 			;******************************************************9 			; $QIO related parameters, constants and return values : 			;******************************************************9 CHANNEL:  .LONG    0			;channel number for current deviceu= SET_MODE: .LONG    0			;quad word to set tape characteristicsi/ SET_DEN:  .LONG    0			;setting density of tape 0 FIB:      .LONG    0,0			;file information block; IOSTATUS: .QUAD    0			;i/o status block returned from $QIO2J IOSTAT:   .BLKQ    32                   ;store a I/O status word for every 					;event flag: 			;******************************************************( 			;error number of tapeio error message: 			;******************************************************4 ERR_NUM:  .LONG   0			;error number passed to ERRMESF ABORT:    .ASCID  /AB/                  ;passed to ERRMES to abort jobI CONTINUE: .ASCID  /CO/                  ;passed to ERRMES to continue jobrM ROUTIN:   .ASCID  /TAPEIO/              ;passed to ERRMES to indicate routineaM ERRFIL:   .ASCID  /TAPEIO/              ;passed to ERRMES for error file name= OFFSET:   .LONG   0t ERROR:    .LONG   0 : 			;******************************************************0 			;parameters for writing system error messages 			;in TAPEIO_SYSTEM area : 			;****************************************************** MES_NUM:  .BLKL   1* MES_LEN:  .BLKL   1o	 MES_BUF: rO .ASCID /                                                                      /*           .PAGE1O ;*******************************************************************************H ; LINK - This subroutine simply checks to see if the logical unit number, ;        passed is contained in the table.  E ;        If the logical unit number does not exist in the table, then . ;        the returned value in R0 is set to -1B ;        If the logical unit number exists, then the correspondingE ;        channel number is returned in R0, and the index value of the*  ;        table is returned in R1O ;*******************************************************************************#           .PSECT   LINKCD,EXE,NOWRTu$           .ENTRY   LINK,^M<R2,R3,R4>I           TSTL     LOG_NUM              ;are there any entries in LOG_TABMF           BEQL     NOVALS               ;branch if there are no values4           MOVL     4(AP),R2		;R2=logical unit number8           MOVL     #1,R3                ;R3=loop counterK           CLRL     R4                   ;R4=offset ffrom logical unit table : 			;******************************************************6 			;loop to see if logical unit number is in the table: 			;******************************************************D LINK_1:   CMPL     R2,L^LOG_TAB(R4) 	;do logical unit numbers match?8           BEQL     LINK_2               ;branch if equalG           ADDL     #8,R4                ;add offset to R4 for next test*6           AOBLEQ   LOG_NUM,R3,LINK_1	;end of loop yet?: 			;******************************************************/ 			;logical unit number does not exist in table : 			;******************************************************< NOVALS:   MOVL     #-1,R0		;let caller know there is no unit           CLRL     R1			;(#           RET 				;return to caller : 			;******************************************************8 			;We have a match in the table give the channel number, 			;and index value to the caller and return: 			;******************************************************E LINK_2:	  ADDL     #4,R4                ;R4=offset for channel number :           MOVL     L^LOG_TAB(R4),R0     ;R0=channel number@           MOVL     R3,R1                ;R1=index to table value           RET            .PAGEOM ;****************************************************************************; ; F ; TERMIO - This subroutine is responsible for writing an error message> ;          to SYS$ERROR file. The address of the error message< ;          string descriptor is in the ERR_MES_ADR long wordM ;**************************************************************************** !           .PSECT   TERM,EXE,NOWRTn&           .ENTRY   TERMIO,^M<R2,R3,R4>4           TSTL     FLAG			;test if file already openD           BNEQ     BYPASS               ;bypass if file already open6           MOVL     #1,FLAG              ;set open flag@           $OPEN    FAB=TERM_FAB         ;open the SYS$ERROR file+           BLBC     R0,TERR		;test for error J           $CONNECT RAB=TERM_RAB         ;connect the record atribute block,           BLBC     R0,TERR 		;test for errorH BYPASS:   MOVL     ERR_MES_ADR,R2       ;R2=address of string descriptorB           MOVW     (R2),TERM_RAB+RAB$W_RSZ	;move length of string C           MOVL     4(R2),TERM_RAB+RAB$L_RBF	;move address of stringA7           $PUT     TAB=TERM_RAB     	;write the message*+           BLBC     R0,TERR		;test for error*"           RET				;return to caller6 			;**************************************************$ 			;could not write an error message7 			;***************************************************  TERR:     PUSHL    R0*"           CALLS    #1,G^LIB$SIGNAL7 			;*************************************************** 0 			;define the terminal file attribute block and 			;the record attribute block7 			;****************************************************#           .PSECT   TRMDAT,WRT,NOEXEPE TERM_FAB: $FAB     FNM=<SYS$ERROR>,-	;define the file attribute block*                    FAC=<PUT>,-                    RAT=CRgB TERM_RAB: $RAB     FAB=TERM_FAB 	;define the record attribut block ERR_MES_ADR: i           .LONG    0 FLAG:     .LONG    0           .END