* SAVE DEFAULTS VERSION 1.2 S.R.Usher 17/4/88 SAV_DEF MOVEQ #-1,D1 ;Try to open TERM_DEF from default MOVEQ #3,D3 ;device, NEW(overwrite) mode LEA FILE1,A0 MOVE.L A0,A3 MOVEQ #1,D0 TRAP #2 CMP.B #-8,D0 ;If EXists error then delete it and BEQ DEL_FIL ;goto REOPEN CMP.B #-9,D0 ;If In Use error then return BEQ KEY_END CMP.B #0,D0 ;If opened then goto saving routine BEQ END_OPE LEA FILE2,A0 ;As above except for FLP1_TERM_DEF MOVE.L A0,A3 MOVEQ #1,D0 TRAP #2 CMP.B #-8,D0 BEQ DEL_FIL CMP.B #-9,D0 BEQ KEY_END CMP.B #0,D0 BEQ END_OPE LEA FILE3,A0 ;As above except for MDV1_TERM_DEF MOVE.L A0,A3 MOVEQ #1,D0 TRAP #2 CMP.B #-8,D0 BEQ DEL_FIL CMP.B #-9,D0 BEQ KEY_END CMP.B #0,D0 BEQ END_OPE REOPEN MOVEQ #2,D3 ;Change to NEW(exclusive) opening mode MOVE.L A3,A0 ;and do as above except not checking MOVEQ #1,D0 ;EXists error TRAP #2 TST.B D0 BLT KEY_END END_OPE LEA WKSPAC+64,A3 ;Load address of System Variables into MOVE.W #64,D2 ;A3 and the number of bytes into D2 MOVE.W #500,D3 ;Timeout = 10 seconds SAVE_LP MOVE.B (A3)+,D1 ;Move byte into D1 MOVEQ #5,D0 TRAP #3 ;Send it to the file TST.W D2 ;Test if D2 is zero DBLT D2,SAVE_LP ;If not then decrement D2 repeat loop TST.B 133(A6) BEQ CLOSE MOVEQ #-1,D1 MOVEQ #5,D0 TRAP #3 CLOSE MOVEQ #2,D0 ;Close file TRAP #2 BRA KEY_END ;Return DEL_FIL MOVE.L A2,A5 ;Save A2 in A5 MOVE.L A3,A0 ;Move address of filename into A0 MOVEQ #4,D0 TRAP #2 ;Delete file MOVE.L A5,A2 ;Replace A2 BRA.S REOPEN ;Return