Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_19.ADF » P/SafTxt1

P/SafTxt1

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Personal collection » Acorn ADFS disks » Electron_User_Group » EUG_19.ADF
Filename: P/SafTxt1
Read OK:
File size: 0AE8 bytes
Load address: 22204556
Exec address: 502E313A
File contents
SAFE Protection for ADFS   v2.00
~~~~ ~~~~~~~~~~ ~~~ ~~~~   ~~~~~
By Ross Little
~~ ~~~~ ~~~~~~

The program 'SAFE', is a utility for ADFS users to prevent 
them fromoverwriting files accidently.  It can only 
operate on ADFS with PAGE setat &1D00 because it reads the 
RAM directly.  In addition, it will onlyprotect against 
overwriting programs in the Currently Selected Directory. 
Pathnames are NOT protected, even if they lead to the 
current directory. The program is intended to be copied to 
your workdisks, and maybe put in a!BOOT file.  Because the 
routine intercepts the OSFILE routine which savesa 
complete file, it won't just stop at the BASIC 'SAVE' 
command, it willalso protect against the *SAVE command, 
and even extend into View and mostother interfaces.

To use the routine, you should enter it by typing '*SAFE' 
with theappropriate disk in the drive.  When entered, it 
will change certainmachine vectors, and display an 
introductory message.  From now on, youcan use your normal 
save commands, and you will not be informed of it's
presence unless a file you are trying to save exists. One 
point to note isthat, when it is not compulsory, quotation 
marks around filenames must notbe used.  It is for this 
reason that I have also intercepted the *HELPcommand.  
When this (or an abbreviation) is typed, the first item 
will beassurance that the SAFE routine is still intact, 
even when you have passedparameters.  This is deliberate, 
and for ease of use.  The routine willusually only be 
prevented from operation by pressing BREAK, or turning the
computer off.  If you do this, it won't appear after a 
*HELP, which isyour reminder that it is no longer 
operational.  To reuse it you caneither reload it with a 
*SAFE command, or simply type CALL &900, if you'venot 
turned the computer off.

The routine intercepts any attempt to save a section of 
memory, and checksit against the filenames stored in RAM.  
If a match is found, then theuser will be queried whether 
he or she wishes to overwrite the file. Please note that 
the routine will not check to see if the file is lockedor 
if the disk has been changed.  If any error has been found, 
it will bedisplayed.

The routine has been deliberately written so that it can be 
avoided ifnecessary.  If you wish to fool it into thinking 
your file does not exist,you can either enclose it in 
quotation marks when these are notcompulsory, place a 
pathname leading to the current directory, or, in some
instances, place a space before the filename.  Please note, 
though thatthe latter will not always work.

The routine can be considered P.D.
00000000  53 41 46 45 20 50 72 6f  74 65 63 74 69 6f 6e 20  |SAFE Protection |
00000010  66 6f 72 20 41 44 46 53  20 20 20 76 32 2e 30 30  |for ADFS   v2.00|
00000020  0d 7e 7e 7e 7e 20 7e 7e  7e 7e 7e 7e 7e 7e 7e 7e  |.~~~~ ~~~~~~~~~~|
00000030  20 7e 7e 7e 20 7e 7e 7e  7e 20 20 20 7e 7e 7e 7e  | ~~~ ~~~~   ~~~~|
00000040  7e 0d 42 79 20 52 6f 73  73 20 4c 69 74 74 6c 65  |~.By Ross Little|
00000050  0d 7e 7e 20 7e 7e 7e 7e  20 7e 7e 7e 7e 7e 7e 0d  |.~~ ~~~~ ~~~~~~.|
00000060  0d 54 68 65 20 10 70 72  6f 67 72 61 6d 20 10 27  |.The .program .'|
00000070  53 41 46 45 27 2c 20 69  73 20 61 20 75 74 69 6c  |SAFE', is a util|
00000080  69 74 79 1a 20 66 6f 72  1a 20 41 44 46 53 1a 20  |ity. for. ADFS. |
00000090  75 73 65 72 73 1a 20 74  6f 1a 20 70 72 65 76 65  |users. to. preve|
000000a0  6e 74 20 0d 74 68 65 6d  20 10 10 66 72 6f 6d 10  |nt .them ..from.|
000000b0  10 6f 76 65 72 77 72 69  74 69 6e 67 1a 20 10 66  |.overwriting. .f|
000000c0  69 6c 65 73 1a 20 10 61  63 63 69 64 65 6e 74 6c  |iles. .accidentl|
000000d0  79 2e 20 10 20 49 74 20  10 63 61 6e 20 10 6f 6e  |y. . It .can .on|
000000e0  6c 79 20 0d 6f 70 65 72  61 74 65 20 10 6f 6e 20  |ly .operate .on |
000000f0  41 44 46 53 20 77 69 74  68 20 50 41 47 45 20 73  |ADFS with PAGE s|
00000100  65 74 10 61 74 20 26 31  44 30 30 20 62 65 63 61  |et.at &1D00 beca|
00000110  75 73 65 1a 20 69 74 1a  20 72 65 61 64 73 1a 20  |use. it. reads. |
00000120  74 68 65 1a 20 0d 52 41  4d 20 10 64 69 72 65 63  |the. .RAM .direc|
00000130  74 6c 79 2e 20 10 20 49  6e 20 10 61 64 64 69 74  |tly. . In .addit|
00000140  69 6f 6e 2c 20 10 69 74  20 77 69 6c 6c 20 6f 6e  |ion, .it will on|
00000150  6c 79 10 70 72 6f 74 65  63 74 20 61 67 61 69 6e  |ly.protect again|
00000160  73 74 20 0d 6f 76 65 72  77 72 69 74 69 6e 67 20  |st .overwriting |
00000170  10 70 72 6f 67 72 61 6d  73 20 10 69 6e 20 10 74  |.programs .in .t|
00000180  68 65 20 43 75 72 72 65  6e 74 6c 79 1a 20 53 65  |he Currently. Se|
00000190  6c 65 63 74 65 64 20 44  69 72 65 63 74 6f 72 79  |lected Directory|
000001a0  2e 20 10 0d 50 61 74 68  6e 61 6d 65 73 20 10 61  |. ..Pathnames .a|
000001b0  72 65 20 10 4e 4f 54 20  10 70 72 6f 74 65 63 74  |re .NOT .protect|
000001c0  65 64 2c 20 10 65 76 65  6e 20 10 69 66 20 10 74  |ed, .even .if .t|
000001d0  68 65 79 20 10 6c 65 61  64 1a 20 74 6f 1a 20 74  |hey .lead. to. t|
000001e0  68 65 20 0d 63 75 72 72  65 6e 74 20 10 64 69 72  |he .current .dir|
000001f0  65 63 74 6f 72 79 2e 20  10 54 68 65 20 70 72 6f  |ectory. .The pro|
00000200  67 72 61 6d 20 69 73 20  69 6e 74 65 6e 64 65 64  |gram is intended|
00000210  20 74 6f 20 62 65 20 63  6f 70 69 65 64 20 74 6f  | to be copied to|
00000220  20 0d 79 6f 75 72 20 10  77 6f 72 6b 64 69 73 6b  | .your .workdisk|
00000230  73 2c 20 61 6e 64 20 6d  61 79 62 65 20 70 75 74  |s, and maybe put|
00000240  20 69 6e 20 61 10 21 42  4f 4f 54 20 66 69 6c 65  | in a.!BOOT file|
00000250  2e 20 20 42 65 63 61 75  73 65 20 74 68 65 20 0d  |.  Because the .|
00000260  72 6f 75 74 69 6e 65 20  10 10 69 6e 74 65 72 63  |routine ..interc|
00000270  65 70 74 73 20 10 10 74  68 65 20 10 4f 53 46 49  |epts ..the .OSFI|
00000280  4c 45 20 10 72 6f 75 74  69 6e 65 20 10 77 68 69  |LE .routine .whi|
00000290  63 68 20 10 73 61 76 65  73 10 10 61 20 0d 63 6f  |ch .saves..a .co|
000002a0  6d 70 6c 65 74 65 20 10  66 69 6c 65 2c 20 10 69  |mplete .file, .i|
000002b0  74 20 10 77 6f 6e 27 74  20 10 6a 75 73 74 20 10  |t .won't .just .|
000002c0  73 74 6f 70 20 10 61 74  20 10 74 68 65 20 42 41  |stop .at .the BA|
000002d0  53 49 43 1a 20 27 53 41  56 45 27 1a 20 0d 63 6f  |SIC. 'SAVE'. .co|
000002e0  6d 6d 61 6e 64 2c 20 10  69 74 20 10 77 69 6c 6c  |mmand, .it .will|
000002f0  10 10 61 6c 73 6f 20 10  70 72 6f 74 65 63 74 20  |..also .protect |
00000300  61 67 61 69 6e 73 74 20  74 68 65 20 2a 53 41 56  |against the *SAV|
00000310  45 20 63 6f 6d 6d 61 6e  64 2c 20 0d 61 6e 64 20  |E command, .and |
00000320  65 76 65 6e 20 65 78 74  65 6e 64 20 69 6e 74 6f  |even extend into|
00000330  20 56 69 65 77 20 61 6e  64 20 6d 6f 73 74 10 6f  | View and most.o|
00000340  74 68 65 72 20 69 6e 74  65 72 66 61 63 65 73 2e  |ther interfaces.|
00000350  0d 0d 54 6f 20 75 73 65  20 74 68 65 20 72 6f 75  |..To use the rou|
00000360  74 69 6e 65 2c 20 79 6f  75 1a 20 73 68 6f 75 6c  |tine, you. shoul|
00000370  64 1a 20 65 6e 74 65 72  1a 20 69 74 1a 20 62 79  |d. enter. it. by|
00000380  1a 20 74 79 70 69 6e 67  1a 20 27 2a 53 41 46 45  |. typing. '*SAFE|
00000390  27 1a 20 0d 77 69 74 68  1a 20 74 68 65 10 61 70  |'. .with. the.ap|
000003a0  70 72 6f 70 72 69 61 74  65 1a 20 64 69 73 6b 1a  |propriate. disk.|
000003b0  20 69 6e 1a 20 74 68 65  1a 20 64 72 69 76 65 2e  | in. the. drive.|
000003c0  1a 20 20 57 68 65 6e 1a  20 65 6e 74 65 72 65 64  |.  When. entered|
000003d0  2c 20 69 74 20 0d 77 69  6c 6c 20 63 68 61 6e 67  |, it .will chang|
000003e0  65 20 63 65 72 74 61 69  6e 10 6d 61 63 68 69 6e  |e certain.machin|
000003f0  65 20 76 65 63 74 6f 72  73 2c 20 61 6e 64 20 64  |e vectors, and d|
00000400  69 73 70 6c 61 79 20 61  6e 20 0d 69 6e 74 72 6f  |isplay an .intro|
00000410  64 75 63 74 6f 72 79 20  6d 65 73 73 61 67 65 2e  |ductory message.|
00000420  1a 20 20 46 72 6f 6d 1a  20 6e 6f 77 1a 20 6f 6e  |.  From. now. on|
00000430  2c 20 79 6f 75 10 63 61  6e 20 75 73 65 20 79 6f  |, you.can use yo|
00000440  75 72 20 6e 6f 72 6d 61  6c 20 0d 73 61 76 65 20  |ur normal .save |
00000450  63 6f 6d 6d 61 6e 64 73  2c 20 61 6e 64 20 79 6f  |commands, and yo|
00000460  75 20 77 69 6c 6c 20 6e  6f 74 1a 20 62 65 1a 20  |u will not. be. |
00000470  69 6e 66 6f 72 6d 65 64  1a 20 6f 66 20 69 74 27  |informed. of it'|
00000480  73 10 0d 70 72 65 73 65  6e 63 65 20 75 6e 6c 65  |s..presence unle|
00000490  73 73 20 61 20 66 69 6c  65 20 79 6f 75 20 61 72  |ss a file you ar|
000004a0  65 20 74 72 79 69 6e 67  20 74 6f 20 73 61 76 65  |e trying to save|
000004b0  20 65 78 69 73 74 73 2e  20 4f 6e 65 20 0d 70 6f  | exists. One .po|
000004c0  69 6e 74 20 74 6f 20 6e  6f 74 65 20 69 73 10 74  |int to note is.t|
000004d0  68 61 74 2c 20 77 68 65  6e 20 69 74 20 69 73 20  |hat, when it is |
000004e0  6e 6f 74 20 63 6f 6d 70  75 6c 73 6f 72 79 2c 20  |not compulsory, |
000004f0  71 75 6f 74 61 74 69 6f  6e 20 0d 6d 61 72 6b 73  |quotation .marks|
00000500  20 61 72 6f 75 6e 64 20  66 69 6c 65 6e 61 6d 65  | around filename|
00000510  73 20 6d 75 73 74 20 6e  6f 74 10 62 65 1a 20 75  |s must not.be. u|
00000520  73 65 64 2e 1a 20 20 49  74 1a 20 69 73 1a 20 66  |sed..  It. is. f|
00000530  6f 72 20 74 68 69 73 20  0d 72 65 61 73 6f 6e 20  |or this .reason |
00000540  74 68 61 74 20 49 20 68  61 76 65 20 61 6c 73 6f  |that I have also|
00000550  20 69 6e 74 65 72 63 65  70 74 65 64 20 74 68 65  | intercepted the|
00000560  20 2a 48 45 4c 50 10 63  6f 6d 6d 61 6e 64 2e 20  | *HELP.command. |
00000570  20 0d 57 68 65 6e 20 74  68 69 73 20 28 6f 72 20  | .When this (or |
00000580  61 6e 1a 20 61 62 62 72  65 76 69 61 74 69 6f 6e  |an. abbreviation|
00000590  29 20 69 73 20 74 79 70  65 64 2c 20 74 68 65 20  |) is typed, the |
000005a0  66 69 72 73 74 20 69 74  65 6d 20 0d 77 69 6c 6c  |first item .will|
000005b0  20 62 65 10 61 73 73 75  72 61 6e 63 65 20 74 68  | be.assurance th|
000005c0  61 74 20 74 68 65 20 53  41 46 45 20 72 6f 75 74  |at the SAFE rout|
000005d0  69 6e 65 20 69 73 20 73  74 69 6c 6c 20 69 6e 74  |ine is still int|
000005e0  61 63 74 2c 20 0d 65 76  65 6e 20 77 68 65 6e 20  |act, .even when |
000005f0  79 6f 75 20 68 61 76 65  20 70 61 73 73 65 64 10  |you have passed.|
00000600  70 61 72 61 6d 65 74 65  72 73 2e 20 20 54 68 69  |parameters.  Thi|
00000610  73 20 69 73 20 64 65 6c  69 62 65 72 61 74 65 2c  |s is deliberate,|
00000620  20 0d 61 6e 64 20 66 6f  72 1a 20 65 61 73 65 1a  | .and for. ease.|
00000630  20 6f 66 1a 20 75 73 65  2e 20 20 54 68 65 20 72  | of. use.  The r|
00000640  6f 75 74 69 6e 65 20 77  69 6c 6c 10 75 73 75 61  |outine will.usua|
00000650  6c 6c 79 20 6f 6e 6c 79  20 62 65 20 0d 70 72 65  |lly only be .pre|
00000660  76 65 6e 74 65 64 20 66  72 6f 6d 20 6f 70 65 72  |vented from oper|
00000670  61 74 69 6f 6e 20 62 79  20 70 72 65 73 73 69 6e  |ation by pressin|
00000680  67 20 42 52 45 41 4b 2c  20 6f 72 20 74 75 72 6e  |g BREAK, or turn|
00000690  69 6e 67 20 74 68 65 10  0d 63 6f 6d 70 75 74 65  |ing the..compute|
000006a0  72 20 6f 66 66 2e 20 20  49 66 20 79 6f 75 20 64  |r off.  If you d|
000006b0  6f 20 74 68 69 73 2c 20  69 74 20 77 6f 6e 27 74  |o this, it won't|
000006c0  20 61 70 70 65 61 72 1a  20 61 66 74 65 72 1a 20  | appear. after. |
000006d0  61 1a 20 0d 2a 48 45 4c  50 2c 1a 20 77 68 69 63  |a. .*HELP,. whic|
000006e0  68 20 69 73 10 79 6f 75  72 1a 20 72 65 6d 69 6e  |h is.your. remin|
000006f0  64 65 72 1a 20 74 68 61  74 1a 20 69 74 1a 20 69  |der. that. it. i|
00000700  73 1a 20 6e 6f 1a 20 6c  6f 6e 67 65 72 20 0d 6f  |s. no. longer .o|
00000710  70 65 72 61 74 69 6f 6e  61 6c 2e 20 20 54 6f 20  |perational.  To |
00000720  72 65 75 73 65 20 69 74  20 79 6f 75 20 63 61 6e  |reuse it you can|
00000730  10 65 69 74 68 65 72 20  72 65 6c 6f 61 64 20 69  |.either reload i|
00000740  74 20 77 69 74 68 20 61  20 0d 2a 53 41 46 45 20  |t with a .*SAFE |
00000750  63 6f 6d 6d 61 6e 64 2c  20 6f 72 20 73 69 6d 70  |command, or simp|
00000760  6c 79 20 74 79 70 65 20  43 41 4c 4c 20 26 39 30  |ly type CALL &90|
00000770  30 2c 20 69 66 20 79 6f  75 27 76 65 10 6e 6f 74  |0, if you've.not|
00000780  20 0d 74 75 72 6e 65 64  20 74 68 65 20 63 6f 6d  | .turned the com|
00000790  70 75 74 65 72 20 6f 66  66 2e 0d 0d 54 68 65 20  |puter off...The |
000007a0  72 6f 75 74 69 6e 65 20  69 6e 74 65 72 63 65 70  |routine intercep|
000007b0  74 73 20 61 6e 79 20 61  74 74 65 6d 70 74 20 74  |ts any attempt t|
000007c0  6f 20 73 61 76 65 20 61  20 73 65 63 74 69 6f 6e  |o save a section|
000007d0  20 6f 66 20 0d 6d 65 6d  6f 72 79 2c 20 61 6e 64  | of .memory, and|
000007e0  20 63 68 65 63 6b 73 10  69 74 20 61 67 61 69 6e  | checks.it again|
000007f0  73 74 20 74 68 65 20 66  69 6c 65 6e 61 6d 65 73  |st the filenames|
00000800  20 73 74 6f 72 65 64 1a  20 69 6e 1a 20 52 41 4d  | stored. in. RAM|
00000810  2e 1a 20 20 0d 49 66 1a  20 61 20 6d 61 74 63 68  |..  .If. a match|
00000820  20 69 73 20 66 6f 75 6e  64 2c 20 74 68 65 6e 20  | is found, then |
00000830  74 68 65 10 75 73 65 72  1a 20 77 69 6c 6c 1a 20  |the.user. will. |
00000840  62 65 20 71 75 65 72 69  65 64 20 77 68 65 74 68  |be queried wheth|
00000850  65 72 20 0d 68 65 20 6f  72 20 73 68 65 20 77 69  |er .he or she wi|
00000860  73 68 65 73 1a 20 74 6f  1a 20 6f 76 65 72 77 72  |shes. to. overwr|
00000870  69 74 65 1a 20 74 68 65  1a 20 66 69 6c 65 2e 20  |ite. the. file. |
00000880  10 50 6c 65 61 73 65 20  6e 6f 74 65 20 74 68 61  |.Please note tha|
00000890  74 1a 20 0d 74 68 65 1a  20 72 6f 75 74 69 6e 65  |t. .the. routine|
000008a0  20 77 69 6c 6c 20 6e 6f  74 20 63 68 65 63 6b 20  | will not check |
000008b0  74 6f 20 73 65 65 20 69  66 20 74 68 65 20 66 69  |to see if the fi|
000008c0  6c 65 20 69 73 20 6c 6f  63 6b 65 64 10 6f 72 20  |le is locked.or |
000008d0  0d 69 66 20 74 68 65 20  64 69 73 6b 20 68 61 73  |.if the disk has|
000008e0  1a 20 62 65 65 6e 20 63  68 61 6e 67 65 64 2e 20  |. been changed. |
000008f0  20 49 66 20 61 6e 79 20  65 72 72 6f 72 20 68 61  | If any error ha|
00000900  73 20 62 65 65 6e 20 66  6f 75 6e 64 2c 20 0d 69  |s been found, .i|
00000910  74 20 77 69 6c 6c 20 62  65 10 64 69 73 70 6c 61  |t will be.displa|
00000920  79 65 64 2e 0d 0d 54 68  65 20 72 6f 75 74 69 6e  |yed...The routin|
00000930  65 20 68 61 73 20 62 65  65 6e 20 64 65 6c 69 62  |e has been delib|
00000940  65 72 61 74 65 6c 79 1a  20 77 72 69 74 74 65 6e  |erately. written|
00000950  1a 20 73 6f 1a 20 74 68  61 74 1a 20 69 74 20 63  |. so. that. it c|
00000960  61 6e 20 62 65 20 0d 61  76 6f 69 64 65 64 20 69  |an be .avoided i|
00000970  66 10 6e 65 63 65 73 73  61 72 79 2e 20 20 49 66  |f.necessary.  If|
00000980  20 79 6f 75 20 77 69 73  68 20 74 6f 20 66 6f 6f  | you wish to foo|
00000990  6c 20 69 74 20 69 6e 74  6f 20 74 68 69 6e 6b 69  |l it into thinki|
000009a0  6e 67 20 0d 79 6f 75 72  20 66 69 6c 65 20 64 6f  |ng .your file do|
000009b0  65 73 20 6e 6f 74 20 65  78 69 73 74 2c 10 79 6f  |es not exist,.yo|
000009c0  75 1a 20 63 61 6e 1a 20  65 69 74 68 65 72 1a 20  |u. can. either. |
000009d0  65 6e 63 6c 6f 73 65 1a  20 69 74 1a 20 69 6e 1a  |enclose. it. in.|
000009e0  20 0d 71 75 6f 74 61 74  69 6f 6e 1a 20 6d 61 72  | .quotation. mar|
000009f0  6b 73 1a 20 77 68 65 6e  1a 20 74 68 65 73 65 1a  |ks. when. these.|
00000a00  20 61 72 65 1a 20 6e 6f  74 10 63 6f 6d 70 75 6c  | are. not.compul|
00000a10  73 6f 72 79 2c 20 70 6c  61 63 65 20 61 20 0d 70  |sory, place a .p|
00000a20  61 74 68 6e 61 6d 65 20  6c 65 61 64 69 6e 67 20  |athname leading |
00000a30  74 6f 20 74 68 65 20 63  75 72 72 65 6e 74 20 64  |to the current d|
00000a40  69 72 65 63 74 6f 72 79  2c 20 6f 72 2c 20 69 6e  |irectory, or, in|
00000a50  20 73 6f 6d 65 10 0d 69  6e 73 74 61 6e 63 65 73  | some..instances|
00000a60  2c 1a 20 70 6c 61 63 65  20 61 20 73 70 61 63 65  |,. place a space|
00000a70  20 62 65 66 6f 72 65 20  74 68 65 20 66 69 6c 65  | before the file|
00000a80  6e 61 6d 65 2e 20 20 50  6c 65 61 73 65 20 6e 6f  |name.  Please no|
00000a90  74 65 2c 1a 20 0d 74 68  6f 75 67 68 1a 20 74 68  |te,. .though. th|
00000aa0  61 74 10 74 68 65 20 6c  61 74 74 65 72 20 77 69  |at.the latter wi|
00000ab0  6c 6c 20 6e 6f 74 20 61  6c 77 61 79 73 20 77 6f  |ll not always wo|
00000ac0  72 6b 2e 0d 0d 54 68 65  20 72 6f 75 74 69 6e 65  |rk...The routine|
00000ad0  20 63 61 6e 20 62 65 20  63 6f 6e 73 69 64 65 72  | can be consider|
00000ae0  65 64 20 50 2e 44 2e 0d                           |ed P.D..|
00000ae8
P/SafTxt1.m0
P/SafTxt1.m1
P/SafTxt1.m2
P/SafTxt1.m4
P/SafTxt1.m5