.MCALL .MODULE .MODULE PIPCT,VERSION=06,COMMENT=,IDENT=NO ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. ; Edit History: ; ; 001 06-Feb-80 09:47 Fingerhut, David [240,134] ; READ FROM CASSETTE CAUSES TRAP ; (001) ; 002 09-Feb-81 09:41 AM Lorraine Ricard [240,83] ; add missing completion routine argument in SPFUN ; (002) .ENABL GBL,LC .SBTTL PSECT definitions ;+ ; The PSECT's are defined here to give them the desired ordering. ; Consider the ordering critical. Several of the PSECT's contain ; stoppers for lists in the previous PSECT. ;- PSECT IMPURE ;Impure data ; PSECT PIPCTR ;Routines to be pulled to the root PSECT PIPCT ;Main code psect PSECT PATCH ;Patch psect .BLKW 150. ;Root patch space CTHDSZ == 32. ;Size of cassette label ;DF;001 CT.SEQ == 12. ;Continuation flag SF.NF == 375 ;"Next file" special function code ASTRSK = 052 RUBOUT = 177 PSECT IMPURE $CTCSR::.WORD 177500 ;CT CSR DIRPTR: .WORD 0 ;-> current entry in "directory" SEQNUM: .WORD 0 ;Sequence number argument NAMBLK: .BLKW 4 ;.LOOKUP filename block .SBTTL NEXTCT - Get the next cassette directory entry ;+ ; NEXTCT ; This routine returns the filename of the next file on a cassette in a format ; similar to a disk directory entry. ; ; $NXTSG <> 0 => Do initial positioning. ; $DIRCH = channel number to read the directory on ; $DIRBF -> buffer to read directory into. 512. words. ; ; CALL NEXTCT ; ; C-bit = 0 => no error ; R0 <> 0 => R0 -> directory entry ; ; R0 = 0 => no more entries in directory ;- ORIGIN PIPCT NEXTCT:: TST OVRLOD ;Are we being loaded? BNE 1$ ;Branch if not INC OVRLOD ;Bump flag to indicate real entry next time RETURN ;Go home 1$: JSR R5,$SAVR1 ;Save R1 - R5 MOV $DIRBF,R3 ;R3 -> directory buffer MOV #CMDBF1,R5 ;R5 -> input buffer ;001 TST $NXTSG ;Have we been entered before? BEQ 6$ ;Branch if so CLR $NXTSG ;Don't come here again! 2$: .READW #IOAREA,$DIRCH,R5,#CTHDSZ/2,#0 ;Read in a label BCS 5$ ;Assume error here is EOT. TSTB @R5 ;Did we get anything? BEQ 5$ ;Branch if not. EOT TST @$CTCSR ;EOT here? BMI 5$ ;Branch if so CMPB @R5,#RUBOUT ;Deleted file? BEQ 4$ ;Branch if so CMPB @R5,#ASTRSK ;Deleted files begin with "*", also BEQ 4$ ;Branch if it's deleted TSTB CT.SEQ(R5) ;Sequence number 0? BNE 4$ ;Branch if not. Continued file MOV R3,-(SP) ;Save R3 MOV #DS.PRM,(R3)+ ;Say it's a permanent file MOV R5,R1 ;R1 -> filename MOV #3,R2 ;Set loop count 3$: CALL $ASCR5 ;Convert to RAD50 MOV R0,(R3)+ ;Save 1st half of filename SOB R2,3$ ;Do 3 words worth MOV (SP)+,R3 ;Restore R3 CLR DE.DAT(R3) ;Zap the date word MOV #-1,DE.LEN(R3) ;Large file ADD #DE.SIZ,R3 ;R3 -> next "directory" entry 4$: .SPFUN #IOAREA,$DIRCH,#SF.NF,#0,#0,#0,#0 ;Space to next file ;002 BCC 2$ ;Branch if no error ;**-1 5$: MOV #DS.EOS,@R3 ;Set end of segment MOV $DIRBF,R0 ;Save pointer to start of "directory" MOV R0,DIRPTR ;Save it for the next time we enter MOV #-1,SEQNUM ;Use -1 as the sequence number the first time 6$: .CLOSE $DIRCH ;Close the channel MOV DIRPTR,R5 ;R5 -> "directory" entry MOV R5,R4 ;Copy it BIT #DS.EOS,@R5 ;Is it the end? BNE 7$ ;Branch if so ;DF ;001 MOV #NAMBLK,R1 ;R1 -> filename area MOV R1,R2 ;Copy it MOV @SPCPTR,(R2)+ ;Copy in the device name TST (R4)+ ;Skip entry type MOV (R4)+,(R2)+ ;Copy 1st word of filename MOV (R4)+,(R2)+ ; and the second word MOV (R4)+,(R2)+ ; and the filetype .LOOKUP #IOAREA,$DIRCH,R1,SEQNUM ;Lookup the file MOV #1000,SEQNUM ;Use this value from now on MOV R5,R0 ;Set up return value ADD #DE.SIZ,DIRPTR ;Point to the next entry for the next pass CLR $STBLK ;Start at block 0 CLR $EXTBY ;No extra bytes BR 8$ ;Done 7$: CLR R0 ;Say no more 8$: CLC ;Clear C-bit. No errors returned RETURN .END