.MCALL .MODULE .MODULE DIRCT,VERSION=02,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. ; ; DIR (Directory Program) ; .NLIST .LIST .PSECT CT ;+ ; Module DIRCT ; This module contains the routines which handle cassette directories. ; The main routine is NEXTCT. It is JMP'ed to from GETFIL. ;- .SBTTL Cassette symbolics and offsets CTCSR = 177500 ;Cassette control/status register CTHDSZ = 32. ;Size of cassette header record in bytes CT.FID = 0 ;Offset to filename CT.TYP = 6 ;Offset to filetype CT.SEQ = 12. ;Offset to file sequence number CT.DAY = 14. ;Offset to day of file creation CT.MON = 16. ;Offset to month of file creation CT.YER = 18. ;Offset to year of file creation CT.EOF = 4000 ;End-of-file bit in CTCSR CT.EOT = 20000 ;End-of-tape bit in CTCSR .SBTTL NEXTCT- Get the next cassette filename ;+ ; NEXTCT ; This is the main routine for handling cassette directories. It ; is JMP'ed to from GETFIL. ; INPUTS: ; Cassette positioned before a file label. ; OUTPUTS: ; R5 -> a pseudo-directory entry at IBUF+1000 ; The ASCII filename stored at CHARS ; The file sequence number stored in the length position of the ; pseudo-directory entry. ;- XTERNL GBLDAT GBLDAT GBLDAT NEXTCT:: MOV #IBUF+1000,R5 ;Use 2nd half of buffer for fake directory MOV #DS.PRM,@R5 ;Assume that a permanent entry is there MOV #IBUF,R4 ;Point to input buffer TST @#CTCSR ;Did we get an error on last operation? BPL 1$ ;Branch if not BIT #,@#CTCSR ;EOF or EOT? BNE 2$ ;Branch if not. Ignore it 1$: .READW #IOAREA,#ICHAN,R4,#CTHDSZ/2,#0 ;Read a header record TSTB IBUF ;Get anything? BEQ 2$ ;Branch if not. LEOT TST @#CTCSR ;Get an error? BPL 3$ ;Branch if not 2$: MOV #DS.EOS,@R5 ;Say end-of-segment found. CLR NXTDSG ;Say end-of-directory found. JSR R5,SPFUN ;Start the rewind .BYTE 377,SP.RW ; SEC ;Say "That's all folks" BR 7$ ; and return 3$: MOV #CHARS,R1 ;Point to ASCII filname storage area MOV R4,R2 ;Point to the filename MOV #6,R0 ;Move 6 characters 4$: MOVB (R2)+,(R1)+ ; DEC R0 ;Decrement the character count BNE 4$ ;Branch if more MOVB #BLANK,(R1)+ ;Put in the blank MOVB (R2)+,(R1)+ ;Now move in 3 character filetype MOVB (R2)+,(R1)+ ; MOVB (R2)+,(R1)+ ; MOVB #BLANK,@R1 ; and another blank CMPB #'*,CHARS ;Is it a deleted file? BNE 5$ ;Branch if not MOV #DS.EMP,@R5 ;Say so 5$: CLR DE.LEN(R5) ;Clear out the length word BISB CT.SEQ(R4),DE.LEN(R5) ;Put sequence number in place of length CALL GETDAT ;Get the creation date CALL GETNAM ;We need the RAD50 of the filename 6$: JSR R5,SPFUN ;Do some strang CT manipulations .BYTE 377,SP.BB ;Backspace a block JSR R5,SPFUN ; .BYTE 377,SP.FF ; and then forward a file. CLC ;There's more to come... 7$: RETURN .SBTTL GETDAT- Get a cassette date ;+ ; GETDAT ; This routine converts the date on a cassette file header to RT-11 ; format. The cassette date format is: ; ddmmyy ; where 'dd' is the day of the month (1-31), 'mm' is the month (1-12), ; and 'yy' is the year mod 100 (00-99). ;- XTERNL GBLDAT GETDAT:: CLR R1 ;Clear date accumulator TSTB CT.DAY(R4) ;Is there a date on the file? BEQ 2$ ;Branch if it has no date CMPB #BLANK,CT.DAY(R4) ;It may be blank BEQ 2$ ;Branch if no date MOV R4,R0 ;Point to file header ADD #CT.MON,R0 ;Point to month field CALL GETNM ;Make it binary MOV R0,R1 ;Save it MOV R4,R0 ;Point again ADD #CT.DAY,R0 ;Point to day field CALL GETNM ;Go convert it CALL 1$ ;Start accumulating date in RT-11 format MOV R4,R0 ;Yawn... ADD #CT.YER,R0 ;Point to the year field CALL GETNM ;Convert. SUB #72.,R0 ;Offset year like RT's 1$: ASL R1 ;Put field in correct position ASL R1 ; ASL R1 ; ASL R1 ; ASL R1 ; ADD R0,R1 ;Add in new number 2$: MOV R1,DE.DAT(R5) ;Save it RETURN .END