;*************************** AMUS Program Label ****************************** ; Filename: ARXRES.M68 Date: 03/03/88 ; Category: UTIL Hash Code: 551-463-224-046 Version: 2.0 ; Initials: DDSS/AM Name: DAVE DRAKE ; Company: DOUBLE-D SOFTWARE SERVICES Telephone #: 7024382173 ; Related Files: ARXHIV.*,ARXDIR.*,ARXDOC.DOC ; Min. Op. Sys.: ??? Expertise Level: INT ; Special: ; Description: Modification of Dave Pallman Archive Routines to handle ; random files! ; ;***************************************************************************** ; ; Author: David F. Pallmann ; ; Copyright (C) 1984 by LMS Technical Services, Inc. ; ; ; ;***************************************************************************; ; ; ARXRES ; Modified for Random file handling (Ver 2.0) ; ; Author: David A. Drake ; Copyright (C) 1988 by Double-D Software Services ; ;***************************************************************************; ; ; File makes external references to MAC:SYSLIB.LIB. ; After assembly, enter this command: .LNKLIT file ; OBJNAM ARXRES.LIT VMAJOR=2 ;16-May-88 ddss - mod for random file handling ;edit history VEDIT=100. ;06-Jan-84 DFP creation. VEDIT=101. ;07-Apr-84 DFP correct restore of 0-byte files. VEDIT=102. ;12-Apr-84 DFP add PPNs to disk if required. VEDIT=103. ;17-Apr-84 DFP correct bug introduced by 102 edit! VEDIT=104. ;16-Mar-88 DDD Make disk errors more meaningful ;universals SEARCH SYS SEARCH SYSSYM EXTERN $ADPPN ;registers IMP=A5 ;impure index ;impure area .OFINI .OFDEF FILE,D.DDB ;DDB for writing AMOS files .OFDEF ARCDIR,D.DDB ;DDB for reading archive directory .OFDEF ARCDAT,D.DDB ;DDB for reading archive data .OFDEF WRKDDB,D.DDB ;DDB for $ADPPN call .OFDEF BLKSIZ,4 ;v2 .OFSIZ IMPSIZ START: PHDR -1,0,PH$REE!PH$REU ;program header GETIMP IMPSIZ,IMP ;allocate impure area ;get output device specification GETDEV: BYP LIN JEQ HELP FSPEC FILE(IMP) INIT FILE(IMP) ORB #D$ERC!D$BYP,FILE+D.FLG(IMP) ; 102 ;bypass '=' SKIP: BYP CMMB (A2)+,#'= JNE HELP ;get archive name GETARC: BYP LIN JEQ HELP SAVE A2 FSPEC ARCDIR(IMP),XXX MOVW #[MAP],ARCDIR+D.EXT(IMP) INIT ARCDIR(IMP) REST A2 FSPEC ARCDAT(IMP),XXX MOVW #[ARX],ARCDAT+D.EXT(IMP) INIT ARCDAT(IMP) ;open archive OPNARC: OPENI ARCDIR(IMP) OPENI ARCDAT(IMP) ;read archive entry LOOP: CTRLC ABORT FILINL ARCDIR(IMP) ;Filename MOV D1,FILE+D.FIL(IMP) TST ARCDIR+D.SIZ(IMP) JEQ ENDARC FILINW ARCDIR(IMP) ;Ext MOVW D1,FILE+D.EXT(IMP) FILINW ARCDIR(IMP) ;ppn MOVW D1,FILE+D.PPN(IMP) FILINL ARCDIR(IMP) ;bytes MOV D1,D2 FILINL ARCDIR(IMP) ;v2-Blocks MOV D1,BLKSIZ(IMP) ;v2-save in impure TYPESP Restoring PFILE FILE(IMP) TAB ;v2 FILINB ARCDIR(IMP) ;v2 MOVB D1,D3 ;v2 FILINB ARCDIR(IMP) ;v2-Filler CMPB D3,#'S ;v2-is sequential? BEQ RESSEQ ;v2-yes, do it JMP RESRAN ;v2-no, do random RESSEQ: TYPECR < - Sequential> ;v2 OPENO FILE(IMP) BEQ 10$ ; 102 CMMB FILE+D.ERR(IMP),#D$EILC ; 102 JNE DEVERR ; 102 CALL ADDPPN ; 102 10$: TSTW D2 ; 101 BEQ 30$ ; 101 20$: FILINB ARCDAT(IMP) FILOTB FILE(IMP) SOB D2,20$ 30$: CLOSE FILE(IMP) ; 101 JMP LOOP ;-------------------------------------------------------------- ;v2- ; 1) more meaningful disk error handling ; 2) fix bug - must bypass data in input file if error ;-------------------------------------------------------------- DEVERR: ERRMSG FILE+D.ERR(IMP),OT$LDQ!OT$TRM CRLF 20$: FILINB ARCDAT(IMP) ;zap through the input file SOB D2,20$ JMP LOOP ;--------------------------------------------------- ; v2 - random file restores ;--------------------------------------------------- RESRAN: TYPECR < - Random > TST BLKSIZ(IMP) ;null random file??? BEQ IGNORE ;yes, ignore it 10$: MOV BLKSIZ(IMP),FILE+D.ARG(IMP) ;set blocks to allocate DSKCTG FILE(IMP) ;allocate contig file BEQ 20$ ;no error, skip errors CMMB FILE+D.ERR(IMP),#D$EILC ;is ppn doesnt exist JNE DEVERR ;no, tell user what it is CALL ADDPPN ;yes, add the ppn BR 10$ ;go back and allocate 20$: OPENR FILE(IMP) ;open file MOV BLKSIZ(IMP),D2 ;block count 50$: MOV FILE+D.SIZ(IMP),D3 ;bytes/block MOV FILE+D.BUF(IMP),A4 ;point to buffer 100$: FILINB ARCDAT(IMP) ;get from arcfil MOVB D1,(A4)+ ;out to buffer DEC D3 ;one less to do BNE 100$ ;still more to do WRITE FILE(IMP) ;write buffer INCW FILE+D.REC+2(IMP) ;point to next block DEC D2 ;one less block to do BEQ ENDRAN ;if zero, we are done BR 50$ ;continue ENDRAN: CLOSE FILE(IMP) IGNORE: JMP LOOP HELP: TYPECR TYPECR BR EXIT ABORT: TYPECR ?aborted ENDARC: CLOSE ARCDIR(IMP) CLOSE ARCDAT(IMP) EXIT: CRLF EXIT ADDPPN: SAVE D0-D5,A0-A5 ; 103 CLR D1 ; 102 MOVW FILE+D.PPN(IMP),D1 ;PPN to add 102 CLR D2 ;password (none) 102 LEA A2,WRKDDB(IMP) ;work DDB 102 MOVW FILE+D.DEV(IMP),WRKDDB+D.DEV(IMP) ; 102 MOVW FILE+D.DRV(IMP),WRKDDB+D.DRV(IMP) ; 102 INIT WRKDDB(IMP) ; 102 CALL $ADPPN ; 102 TST D0 ; 102 BEQ 10$ ; 102 TYPECR ? error in adding PPN ; 102 10$: REST D0-D5,A0-A5 ; 103 RTN ; 102 END .