Econet Library Utilities

bbc/electron apps, languages, utils, educational progs, demos + more
Post Reply
User avatar
KenLowe
Posts: 2349
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Econet Library Utilities

Post by KenLowe »

Where can I get hold of the latest Econet Library Utilities for the beeb?

I've downloaded L3Utils3.zip from BeebMaster, and extracted the L3Utils3.adf disk image. Unfortunately, it's a non-interleaved ADFS file, so doesn't work with BeebEm or (out of the box) with Gotek. Fortunately, Gotek can be configured to read the non-interleaved file, so I can now read the disk image...

The !ReadMe file indicates that the contents of the Library directory are for the beeb, and the Library1 directory are for the Master. However, I've fallen at the first hurdle trying to run the USERS command when logged into my wired L3 server. On my station, I get a line of text with 'Stn. User Id. Privilege' but then the beeb hangs, and eventually I get a 'No reply from station xxx' error. I notice that the USERS command is trying to run at address &0E23, which doesn't seem correct?

Am I using the wrong Library utilities here, or am I misunderstanding how these things work???

Thanks.
User avatar
BeebMaster
Posts: 4814
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: Econet Library Utilities

Post by BeebMaster »

You can rename the disc image file to "scsi0.dat" and use it in BeebSCSI/Pi1MHz SCSI.

USERS for the BBC B loads & runs at &E23, and will also work on the Master but may overwrite user RAM.

Can you get any further with the BASIC version I posted here?

The older v2 L3 Utils is still here:

https://www.beebmaster.co.uk/Downloads/ ... W-2010.rar

That one does have an "interleaved" image in it (although the explanation in the readme file is wrong!)
Image
User avatar
BeebMaster
Posts: 4814
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: Econet Library Utilities

Post by BeebMaster »

Just checked from the master floppy disc of L3 Utils 3.0 and USERS works on BBC B OK. It should have the message "Show Users. 1.11" at the end of it if you dump it and is &1C5 bytes long. The Acorn version doesn't have a privilege column, so it looks like you've been running the SJ Research version which will have an author & date at the end like "SRL21oct85" as is shorter, &139 bytes.
Image
User avatar
KenLowe
Posts: 2349
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: Econet Library Utilities

Post by KenLowe »

Thanks for the detail. You're right, I do actually have the two versions of USERS that you've referenced. The Acorn one is &1C5 in length and the SJR one is &139 in length. I can't get either of them to work on my beeb!

Oddly, the Acorn version will run off the ADFS disk (with ADFS as the active file system). However, when I try to run it from the L3 file server (with ANFS as the active file system) it just hangs.

Edit: Right, I've just worked out what was going wrong. There's some incompatibility with ROM ARM1.13. Disabling ARM1.13 gets both version of USERS working.
User avatar
BeebMaster
Posts: 4814
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: Econet Library Utilities

Post by BeebMaster »

Seems to work here all right with ARM 1.13:
Screenshot_2021-12-31_19-57-45.png
Image
User avatar
KenLowe
Posts: 2349
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: Econet Library Utilities

Post by KenLowe »

BeebMaster wrote:
Fri Dec 31, 2021 7:59 pm
Seems to work here all right with ARM 1.13
Ok, so I was running with ANFS instead of DNFS. I've just tried with DNFS1.20 and ARM1.13, and like you it also works. Switching back to ANFS and it fails again, unless I disable ARM1.13. What happens if you swap your DNFS out for ANFS4.18?
User avatar
BeebMaster
Posts: 4814
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: Econet Library Utilities

Post by BeebMaster »

Yes, same here:
Screenshot_2021-12-31_20-45-12.png
Screenshot_2021-12-31_20-45-58.png
Whatever breaks *USERS also turns on the "show version number" flag as well!
Image
User avatar
jgharston
Posts: 4623
Joined: Thu Sep 24, 2009 12:22 pm
Location: Whitby/Sheffield
Contact:

Re: Econet Library Utilities

Post by jgharston »

KenLowe wrote:
Fri Dec 31, 2021 4:57 pm
Where can I get hold of the latest Econet Library Utilities for the beeb?
It depends on what you mean by "the latest". Loads of people updated their library utils independantly. There's also:
https://mdfs.net/Apps/Networking/

What I prefered to do was configure all the Masters to have PAGE at &1000 so then every machine could use &E00 utilities instead of having to have multiple different copies for different machines and hoping every Master was configured to run FindLib to select a Master-specific library, and having to duplicate all the platform-agnostic utils into both libraries.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.36
(C) Copyright J.G.Harston 1989,2005-2020
>_
User avatar
KenLowe
Posts: 2349
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: Econet Library Utilities

Post by KenLowe »

BeebMaster wrote:
Fri Dec 31, 2021 8:48 pm
Yes, same here

Whatever breaks *USERS also turns on the "show version number" flag as well!
Thanks for confirming.

As an aside, I notice that the findlib file that's included in the Library directory has a load and execute address of DD00 and looks to be exactly the same as the copy that's saved in the Library1 directory.

Is there meant to be a different version that runs on the beeb, because the one in the Library directory doesn't work.
User avatar
BeebMaster
Posts: 4814
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: Econet Library Utilities

Post by BeebMaster »

No, FindLib isn't for the BBC B, it's to set the Master library to Library1, so it lives in Library so that it can be found and run if the findlib configuration option is set.

I disassembled it recently here.
Image
User avatar
KenLowe
Posts: 2349
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: Econet Library Utilities

Post by KenLowe »

BeebMaster wrote:
Sat Jan 01, 2022 1:15 pm
No, FindLib isn't for the BBC B, it's to set the Master library to Library1, so it lives in Library so that it can be found and run if the findlib configuration option is set.

I disassembled it recently here.
Thanks for the clarification. Onto my next problem...

The version of CopyFiles (V2.54) in the Utils folder of L3Utils3.adf seems to be causing me some issues. I'm trying to copy the contents of an ADFS floppy over to my file server, but it doesn't seem to be transferring the load & execute parameters correctly for some of the files. I've tried writing to both my PiFS and my wired L3FS, but they both behave in the same way.

I've got an older copy (V2.41) that doesn't give me that issue.

Is this a known issue with V2.54? Is there a newer version that has this fixed (on the basis that 2.54 has fixed some issues that exist in V2.41, so I'd rather go forward and not back)?
Source Floppy Disk
Source Floppy Disk
Econet FS after running CopyFiles V2.54
Econet FS after running CopyFiles V2.54
Econet FS after running CopyFiles V2.41
Econet FS after running CopyFiles V2.41
User avatar
BeebMaster
Posts: 4814
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: Econet Library Utilities

Post by BeebMaster »

I don't know the version history of Acorn's CopyFiles at all. Looking purely at the file sizes involved, it looks like where it isn't doing the equivalent of a *LOAD into memory and then a *SAVE on the destination - so it would be using random access file handling to copy from source to destination instead - it is losing the file attributes. I think when this happens it says "Copying" rather than "Reading" followed by "Writing". It should be doing the OS call to write the file info after it's finished copying, but looks like it either isn't doing it, or setting everything to &FF.

Acorn's LogCopy is designed for ADFS<>Net copying, it can recurse as well, so that might work better.
Image
markusher
Posts: 142
Joined: Tue Jul 17, 2018 10:55 am
Contact:

Re: Econet Library Utilities

Post by markusher »

Attached is CopyFiles v2.60. I recently used it to transfer to PiFS and L3. I ended up using TreeCopy v1.63 from mdfs.net as it handles recursive directory copying.

https://mdfs.net/Software/FileTools/
Attachments
CopyFiles260.zip
(5.98 KiB) Downloaded 8 times
-Mark
4 x BBC, 1 Viglen BBC, 3 Masters, BBC AIV Domesday System, EO1S & E20 Filestore, A4000, RISC PC 600,700, StrongArm. Probably more I've missed...
User avatar
KenLowe
Posts: 2349
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: Econet Library Utilities

Post by KenLowe »

BeebMaster wrote:
Sun Jan 02, 2022 2:15 pm
I don't know the version history of Acorn's CopyFiles at all. Looking purely at the file sizes involved, it looks like where it isn't doing the equivalent of a *LOAD into memory and then a *SAVE on the destination - so it would be using random access file handling to copy from source to destination instead - it is losing the file attributes. I think when this happens it says "Copying" rather than "Reading" followed by "Writing". It should be doing the OS call to write the file info after it's finished copying, but looks like it either isn't doing it, or setting everything to &FF.

Acorn's LogCopy is designed for ADFS<>Net copying, it can recurse as well, so that might work better.
I think you're right about CopyFiles V2.54 using different copy methods, depending upon file size. You can see that CopyFiles sometimes loads multiple files into memory from the source drive, before then copying them to the destination drive. You can also see the difference in the way the files are reported on the destination file server logs. Only certain files appear on the log, even though other files are getting written. This doesn't happen on V2.41, which appears to use only one copy method, and all files appear on the file server log.
markusher wrote:
Sun Jan 02, 2022 2:59 pm
Attached is CopyFiles v2.60. I recently used it to transfer to PiFS and L3. I ended up using TreeCopy v1.63 from mdfs.net as it handles recursive directory copying.

https://mdfs.net/Software/FileTools/
Thanks for attaching V2.60, which has possibly also revealed what was going wrong with V2.54. I couldn't get V2.60 to run on my beeb, so switched on the Co-Pro and it ran successfully from there. Although V2.54 seems to run happily on the beeb (apart from the missing file attributes), I tried running it from the Co-Pro, and it started working correctly too! No more missing file attributes. That said, I'm not sure if the extra memory in the Co-Pro is just masking the issue.
User avatar
BeebMaster
Posts: 4814
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: Econet Library Utilities

Post by BeebMaster »

Possibly with the extra RAM in the co-processor there's enough space to do a straight save/load every time without opening a large file for input and writing it to the destination file. Maybe try copying the file server code which is about 34K and see what happens?

I'm trying to collate various different versions of CopyFiles, I didn't seem to have 2.60 previously.
Image
User avatar
KenLowe
Posts: 2349
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: Econet Library Utilities

Post by KenLowe »

BeebMaster wrote:
Sun Jan 02, 2022 3:31 pm
Possibly with the extra RAM in the co-processor there's enough space to do a straight save/load every time without opening a large file for input and writing it to the destination file. Maybe try copying the file server code which is about 34K and see what happens?

I'm trying to collate various different versions of CopyFiles, I didn't seem to have 2.60 previously.
Yes, that's what I was wondering. I'm going to have to come back to this another day. I'm getting nagged at!
markusher
Posts: 142
Joined: Tue Jul 17, 2018 10:55 am
Contact:

Re: Econet Library Utilities

Post by markusher »

Yes, CopyFiles does make use of CoPro RAM in later versions to increase the buffer sizes and reduce disk swapping. It may also utilise Shadow RAM on the Master 128.
-Mark
4 x BBC, 1 Viglen BBC, 3 Masters, BBC AIV Domesday System, EO1S & E20 Filestore, A4000, RISC PC 600,700, StrongArm. Probably more I've missed...
User avatar
KenLowe
Posts: 2349
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: Econet Library Utilities

Post by KenLowe »

markusher wrote:
Sun Jan 02, 2022 2:59 pm
Attached is CopyFiles v2.60. I recently used it to transfer to PiFS and L3. I ended up using TreeCopy v1.63 from mdfs.net as it handles recursive directory copying.

https://mdfs.net/Software/FileTools/
I'm not making much headway here! I think this is possibly a PiFS issue, though. I'm trying to copy a large DATA file (105,264 bytes) from floppy over to my PiFS.

With CopyFiles copying to the PiFS, it doesn't copy the full file. Only 68,568 bytes are being copied. Data appears to be getting copied in 'chunks' of 17,142 (&42F6) bytes, with a final chunk of 2,412 (&96C) bytes. So, 6 x 17,142 + 2,412 bytes is what should be getting copied, but instead I am getting 4 x 17,142 bytes.

With CopyFiles copying to my wired L3FS the full file gets copied. I haven't fully checked to see if the data is valid, but it does appear to be ok on initial inspection.

With TreeCopy (I couldn't find v1.63, only v1.61) I get a FS Error when I try to copy the file onto the PiFS. It copies to my wired L3FS without any problem.
markusher
Posts: 142
Joined: Tue Jul 17, 2018 10:55 am
Contact:

Re: Econet Library Utilities

Post by markusher »

With TreeCopy, it looks like a mismatch between the text description document (gives v1.63) and the basic program (v1.61b).

If CopyFiles and TreeCopy are both working to L3FS it certainly sounds like a PiFS issue, and it seems to be two separate issues. One with total file size and one not responding to JGH's wizardry.
-Mark
4 x BBC, 1 Viglen BBC, 3 Masters, BBC AIV Domesday System, EO1S & E20 Filestore, A4000, RISC PC 600,700, StrongArm. Probably more I've missed...
User avatar
KenLowe
Posts: 2349
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: Econet Library Utilities

Post by KenLowe »

Right, Bug found in PiFS that was causing CopyFiles to fail with large files:
cr12925 wrote:]If you can find the fs_get_random_access_info() function in fs.c and look under 'case 0', the third line (with the >> 16 in it) should be & 0xff0000 (four zeroes, not two).
Unfortunately, this hasn't fixed the 'FS Error - Unknown Operation 0x1d' error I get why I try to copy with TreeCopy:

Code: Select all

E-->L: to   0.254 from   0.248 port 0x99 ctrl 0x80 seq 0x00005124 len 0x001f 90 . 12 . 01 . 04 . 03 . 05 . 24 $ 2e . 47 G 41 A 4d M 45 E 53 S 2e . 4f O 5a Z 4d M 4f O 4f O 2e . 5a Z 4f O 52 R 4b K 31 1 2e . 44 D 41 A 54 T 41 A 0d .
L-->E: to   0.248 from   0.254 port 0x90 ctrl 0x80 seq 0x000071b4 len 0x0012 00 . 00 . 01 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 30 0 9b . 01 . 0c . 00 . 4a J 91 .
E-->L: to   0.254 from   0.248 port 0x99 ctrl 0x80 seq 0x00005128 len 0x0020 90 . 13 . 01 . 04 . 03 . 04 . 0f . 24 $ 2e . 47 G 41 A 4d M 45 E 53 S 2e . 4f O 5a Z 4d M 4f O 4f O 2e . 5a Z 4f O 52 R 4b K 31 1 2e . 44 D 41 A 54 T 41 A 0d .
   FS:            from   0.248 Set Object Info $.GAMES.OZMOO.ZORK1.DATA relative to Current, command 4
L-->E: to   0.248 from   0.254 port 0x90 ctrl 0x80 seq 0x000071b8 len 0x0002 00 . 00 .
E-->L: to   0.254 from   0.248 port 0x99 ctrl 0x80 seq 0x0000512c len 0x0029 90 . 1d . 91 . 04 . 03 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 30 0 9b . 01 . 24 $ 2e . 47 G 41 A 4d M 45 E 53 S 2e . 4f O 5a Z 4d M 4f O 4f O 2e . 5a Z 4f O 52 R 4b K 31 1 2e . 44 D 41 A 54 T 41 A  ...
   FS: to   0.248 FS Error - Unknown operation 0x1d
L-->E: to   0.248 from   0.254 port 0x90 ctrl 0x80 seq 0x000071bc len 0x000b 00 . ff . 46 F 53 S 20   45 E 72 r 72 r 6f o 72 r 0d .
stevei2791
Posts: 57
Joined: Sat Aug 29, 2015 1:21 pm
Location: Irchester
Contact:

Re: Econet Library Utilities

Post by stevei2791 »

FS operation 0x1d is function 29 - FS Create file, I think
User avatar
KenLowe
Posts: 2349
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: Econet Library Utilities

Post by KenLowe »

stevei2791 wrote:
Mon Jan 10, 2022 9:01 pm
FS operation 0x1d is function 29 - FS Create file, I think
Thanks for that info. We'll hopefully get that implemented without too much trouble!

Next problem. This time with the LogCopy utility, but I think it's a more general issue with ANFS4.18. The following code is extracted from LogFile, and it should return the file system root catalogue header (function code 4) at cb%. I can't get this to work on my beeb with ANFS4.18, but it works fine with NFS3.60 (DNFS1.20). On ANFS4.18, the beeb hangs, and then eventually comes back with a 'No reply' error. I get the same results when interrogating my wired L3FS and my PiFS.

Can someone else give this a try on a beeb with ANFS and DNFS to see if they get different behaviour. It should return with a '>' prompt after which the $ directory catalogue details should be visible at address cb%:

Code: Select all

10 DIM cb% &100:osword%=&FFF1:S$="$"
20 !cb%=&04003000:$(cb%+7)=S$
30 X%=cb%:Y%=X%DIV256:A%=&14:CALLosword%
If someone could explain why it is failing for me on ANFS that would also be very helpful.

Thanks!
User avatar
KenLowe
Posts: 2349
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: Econet Library Utilities

Post by KenLowe »

I'm not sure I like ANFS4.18 very much. I'm beginning to think it's evil!

In addition to the problem reported above, I'm also having issues with it when I'm trying to copy large files over from ADFS to my L3FS. It causes my L3FS to crash with FS internal error #FA. I've tried copying with various utilities (CopyFiles, LogCopy, ADT *XFER), and they all cause the same problem. For example, if I try to copy a file that is 0x28368 bytes long, it fails after copying 0x20B00 bytes. I think all files bigger than 0x20B00 fail. Switching back to NFS3.60 and everything starts working again.

If anyone else wants to give this a go, then try copying the DATA file from the attached ADFS disk image...
Wishbringer.zip
Test ADFS disk
(152.45 KiB) Downloaded 4 times
markusher
Posts: 142
Joined: Tue Jul 17, 2018 10:55 am
Contact:

Re: Econet Library Utilities

Post by markusher »

In Level 3, the error code FA signifies multiple block allocation fails.
It occurs in the routine ABLCKS - allocate blocks on the disc.

Code: Select all

; ALLOCATE A SERIES OF BLOCKS
;
; ON ENTRY
;   MPCYPT POINTS TO POSITION IN CYLINDER MAP
;   DIVTMP HOLDS NUMBER OF SECTORS REQUIRED
;   MPSCPT POINTS TO BIT MAP
;   MAPPTR POINTS TO MAP TABLE
;   MAPTMP POINTS TO MAP BLOCK
;   MPTMPC HOLDS CYLINDER NUMBER
;
; ON EXIT
;   DIVTMP HOLDS NUMBER OF BLOCKS LEFT
;   C SET IF FAILED
;
; USES : MAPGEN
;
ABLKS ROUT
 LDYIM MPCYMP
 LDAIY MAPPTR ;GET POINTER TO START OF CYLINDER MAP
 STA MAPGEN
 INY
 LDAIY MAPPTR
 STA MAPGEN+1
 JSR SIZE ;GET SIZE OF THIS BLOCK
 LDA MPTMPD ;MPTMPD HAS SIZE
 TAX ;**1/7/88**
 CMP DIVTMP ;SEE IF WE NEED THEM ALL
 LDA MPTMPD+1
 TAY
 SBC DIVTMP+1
 BCC #10
 LDA DIVTMP+2
 BNE #10 ;ABSALL ALLOCATES ALL BLOCKS
 LDX DIVTMP
 LDY DIVTMP+1
10 STX MKENVA ;MAKE ENTRY IN MAP BLOCK
 STY MKENVA+1
 JSR MKEN
 BCS #30 ;ALL DONE SO FINISH
 LDA ERRTYP
 BNE #30
 LDYIM 0
 SEC
 LDAIY MPCYPT
 SBC MKENVA
 STAIY MPCYPT
 INY
 LDAIY MPCYPT
 SBC MKENVA+1
 STAIY MPCYPT
 CMPIM &FF
 BNE #20
 DEY
 LDAIY MPCYPT
 CMPIM &FF
 BNE #20
 LDAIM &FA
 JSR INTERR
20 CLC
 RTS
 
30 JSR DAGRP ;NOT ABLE TO MAKE ENTRY
 LDYIM 0
 CLC
 LDAIY MAPGEN ;INCREASE FREE COUNT
 ADC MKENVA
 STAIY MAPGEN
 INY
 LDAIY MAPGEN
 ADC MKENVA+1
 STAIY MAPGEN
 INY
 LDAIY MAPGEN
 ADCIM 0
 STAIY MAPGEN
 SEC ;TO INDICATE FAILURE
 RTS

-Mark
4 x BBC, 1 Viglen BBC, 3 Masters, BBC AIV Domesday System, EO1S & E20 Filestore, A4000, RISC PC 600,700, StrongArm. Probably more I've missed...
User avatar
KenLowe
Posts: 2349
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: Econet Library Utilities

Post by KenLowe »

markusher wrote:
Sat Jan 15, 2022 12:48 pm
In Level 3, the error code FA signifies multiple block allocation fails.
It occurs in the routine ABLCKS - allocate blocks on the disc.
Thanks for the details. I did have a look through the various Econet manuals for the error description, but couldn't find anything. The description above does align with the issue I'm seeing. Still no closer to understanding why ANFS is doing this, though!
User avatar
arg
Posts: 529
Joined: Tue Feb 16, 2021 2:07 pm
Location: Cambridge
Contact:

Re: Econet Library Utilities

Post by arg »

Here's some more copy utilities for you to play with, notably "COPIER" from the SJ MDFS library utils that's designed for exactly this job.

There's also "SCOPIER" which I think is supposed to be a superior version of COPIER, but I can't remember exactly what it does.

Also "Multicopy" for completeness, though that's for econet-to-econet rather than DFS-econet so not applicable to your problem. And a thing called "copyall" that I don't remember at all.

Plus "COPY40" which is something completely different but happened to be lying around....

All BASIC programs.
Attachments
copy_progs.zip
(19.23 KiB) Downloaded 7 times
User avatar
BeebMaster
Posts: 4814
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: Econet Library Utilities

Post by BeebMaster »

Interesting, I have a later version of MultiCopy (version 1.15) which I think is from the SJ MDFS Master Disc 2.00, but there's a line numbering bug which I noticed a few years back. It's in line 630 where it checks if *DIR @ is supported, it should be GOTO660 instead of 830, otherwise it skips many of the questions for the copy, including the all-important recurse option:

Code: Select all

   10REM File server multiple file copy program
   20REM ANFS compatibility 10feb86
   30REM 'copy_time' won't write time to src fs 21apr87
   40REM Extended a/c impl. 02sep87
   50REM V1.10 *ACCESS done via FSCALL to avoid errors, & copy_time on dirs now      works.
   60REM V1.11 16feb89
   70REM traps errors to allow fixing of problems encountered
   80REM can restart where it left off or skip the offending file
   90REM changing floppy discs is possible when they go full
  100REM restart amended 16may89
  110REM skip last dir entry implemented 21may89
  120IF HIMEM<&7C00 THENMODE7
  130REM 05jun89 fixed no DIR ^ problem
  140REM 14jun89 STOPs removed
  150REM 27jul89 unnecessary *CDIRs after disc change
  160Version$="1.15"
  170 
  180maxlen%=HIMEM-TOP-3500
  190DIM Buffer% maxlen%,Name% 100,time_block% 32
  200DIM block% 150
  210dir$=STRING$(255," ")
  220 
  230osword=&FFF1:osbyte=&FFF4:oscli=&FFF7
  240osfind=&FFCE:osgbpb=&FFD1:osfile=&FFDD
  250 
  260X%=block%:Y%=X%DIV256
  270A%=&13
  280?X%=15 : REM read timeouts
  290CALL osword
  300X%?2=255 : REM long Rx timeout
  310?X%=16
  320CALL osword
  330 
  340PRINT"Multiple file copy utility V";Version$'
  350PRINT "MULTICOPY copies groups of files from"
  360PRINT "one file server to another. It may also"
  370PRINT "be used between directories or discs on"
  380PRINT "the same file server."''
  390 
  400PRINT "Log-on text for source FS"'"(or press RETURN to use current FS) :"
  410INPUT "*I AM "A$
  420IF A$<>"" THEN PROCoscli_noexec("I AM "+A$)
  430ON ERROR other_up_works%=FALSE:GOTO460
  440*DIR^
  450other_up_works%=TRUE
  460ON ERROR OFF
  470ON ERROR other_at_works%=FALSE:GOTO 500
  480*DIR @
  490other_at_works%=TRUE
  500ON ERROR OFF
  510*DIR
  520other_FS%=FNget_context(0) AND &FFFF
  530other_context%=FNget_context(6)
  540 
  550PRINT "Log-on text for dest.  FS"'"(or press RETURN for same FS) :"
  560INPUT "*I AM "A$
  570IF A$<>"" THEN PROCoscli_noexec("I AM "+A$)
  580 
  590ON ERROR dir_up_works%=FALSE:GOTO620
  600*DIR^
  610dir_up_works%=TRUE
  620ON ERROR OFF
  630ON ERROR at_works%=FALSE:GOTO830
  640*DIR @
  650at_works%=TRUE
  660 ON ERROR OFF
  670*DIR
  680 
  690same_FS%=other_FS%=(FNget_context(0) AND &FFFF)
  700IF same_FS% THEN other_context%=FNget_context(6) :REM set contexts same
  710 
  720source_context%=FALSE
  730PROCswap_context
  740PRINT "Do you wish to force overwriting of "'"locked files (Y/N) :";
  750over%=FNyes
  760PRINT "Do you wish to include sub directories  (Y/N) :";
  770nosubdir%=NOT FNyes
  780PRINT "Do you wish to copy account information (Y/N) :";
  790copy_acc%=FNyes
  800PRINT "Do you wish to copy creation date etc."'"(for system manager's use only) (Y/N) :";
  810copy_time%=FNyes
  820 
  830REM Main GOTO loop
  840 ON ERROR OFF
  850REM Source context
  860REPEAT
  870source_dir$=FNinput("source directory name      :",FALSE)
  880IF FNexists(source_dir$)<>2 THEN PRINT"Error: Couldn't find "source_dir$
  890UNTIL FNexists(source_dir$)=2
  900PROCswap_context
  910dest_dir$=FNinput("destination directory name :",FALSE)
  920restart$="":target$="":error%=FALSE
  930 REM error reenters here
  940IF source_context% PROCswap_context
  950IF FNexists(dest_dir$)<>2 THEN PROCcdir(dest_dir$)
  960PROCmove_dir(dest_dir$):PROCswap_context:GOTO970
  970REM In source context
  980PROCmove_dir(source_dir$)
  990dir$=""
 1000in_ch%=0:out_ch%=0
 1010ON ERROR GOTO 4500
 1020PROCcopy
 1030 
 1040PRINT
 1050PROCcloseDirs
 1060GOTO 830 :REM main loop
 1070END
 1080 
 1090DEFPROCmove_dir(new$)
 1100context%=FNget_context(6)
 1110IF source_context% THEN source_csd%=context% AND &FF00
 1120IF NOT(source_context%) THEN dest_csd%=context% AND &FF00
 1130handle%=FNopenin(new$)
 1140context%=(context% AND &FF00FF) OR 256*handle%
 1150block%!1=context%
 1160?block%=7
 1170X%=block%:Y%=X% DIV 256:A%=&13:CALL osword
 1180ENDPROC
 1190 
 1200DEFPROCcopy
 1210REM source context on exit
 1220LOCAL dir%,object$,type%,newdir%,time_block%!8,time_block%!12,time_block%!16
 1230IF NOT source_context% THEN PROCswap_context
 1240dir%=0
 1250 
 1260PROCexamine(dir%)
 1270IF type%=0 AND dir$=restart$ THEN error%=FALSE
 1280IF type%=0 THEN 1370
 1290IF error% AND dir$<>restart$ THEN 1320
 1300IF target$<>"" AND FNcase(object$)<target$ THEN 1320
 1310target$="":restart$="":error%=FALSE
 1320IFtype%=2 AND nosubdir% THEN 1340
 1330IFtype%=2 THEN PROCdo_a_dir ELSE PROCdo_a_file
 1340dir%=dir%+1
 1350GOTO 1260
 1360 
 1370IF dir$<>"" THEN PROCup_a_dir
 1380ENDPROC
 1390 
 1400DEFFNcase(c$)
 1410LOCAL case$,c%,i%
 1420case$=""
 1430FOR i%=1 TO LEN(c$)
 1440c%=ASC(MID$(c$,i%,1))
 1450IF c%>=ASC"a" AND c%<=ASC"z" THEN c%=c% AND &5F
 1460case$=case$+CHR$(c%)
 1470NEXT
 1480=case$
 1490 
 1500DEFPROCunlock(n$)
 1510IF over%=FALSE THEN ENDPROC
 1520IF FNexists(n$)=1 THEN PROCstar("ACCESS "+n$)
 1530ENDPROC
 1540 
 1550DEFPROCdo_a_dir
 1560REM source context on exit
 1570IF source_context% THEN PROCswap_context
 1580newdir%=FNexists(object$)<>2
 1590dir$=dir$+"."+object$
 1600IF newdir% AND FNmakeDir(dir$) THEN PROCcdir(object$):PROCwrite_info
 1610IF FNmakeDir(dir$) THEN PROCoscli("DIR """+object$+"""")
 1620PROCswap_context
 1630PROCoscli("DIR """+object$+"""")
 1640PROCcopy
 1650IF newdir% AND FNmakeDir(dir$) THEN PROCswap_context:PROCwrite_time:PROCswap_context
 1660ENDPROC
 1670 
 1680DEFPROCup_a_dir
 1690LOCAL A%
 1700testDir$=dir$
 1710A%=LEN(dir$)
 1720REPEAT A%=A%-1
 1730UNTIL MID$(dir$,A%,1)="."
 1740dir$=LEFT$(dir$,A%-1)
 1750PROCdir_up_arrow(source_dir$)
 1760PROCswap_context
 1770IF FNmakeDir(testDir$) THEN PROCdir_up_arrow(dest_dir$)
 1780PROCswap_context
 1790ENDPROC
 1800 
 1810DEF PROCdo_a_file
 1820IF error% THEN ENDPROC
 1830REM source context for entry & exit
 1840LOCAL no_access%
 1850PRINT"Copying "object$" from "source_dir$dir$" to "dest_dir$dir$" - ";
 1860no_access%=(attr% AND 4)=0 : REM no read access
 1870IF no_access% THEN PROCstar("ACCESS """+object$+""" R/")
 1880IF file_len%>maxlen% THEN PROClong_shift ELSE PROCshort_shift
 1890IF no_access% THEN PROCwrite_access
 1900PRINT"Done"
 1910ENDPROC
 1920 
 1930DEFPROCshort_shift
 1940IF at_works% AND LEFT$(object$,1)="-" THEN add$="@." ELSE add$=""
 1950PROCoscli("LOAD "+add$+object$+" "+STR$~Buffer%)
 1960PROCswap_context
 1970IF at_works% AND LEFT$(object$,1)="-" THEN add$="@." ELSE add$=""
 1980PROCunlock(add$+object$)
 1990PROCoscli("SAVE "+add$+object$+" "+STR$~(Buffer%)+" +"+STR$~(file_len%))
 2000PROCwrite_info
 2010PROCwrite_time
 2020PROCswap_context
 2030ENDPROC
 2040 
 2050DEFPROClong_shift
 2060LOCAL ptr%
 2070in_ch%=0:out_ch%=0
 2080IF at_works% AND LEFT$(object$,1)="-" THEN add$="@." ELSE add$=""
 2090in_ch%=FNopenin(add$+object$)
 2100PROCswap_context
 2110IF at_works% AND LEFT$(object$,1)="-" THEN add$="@." ELSE add$=""
 2120PROCunlock(add$+object$)
 2130out_ch%=OPENOUT(add$+object$)
 2140FOR ptr%=0 TO file_len% STEP maxlen%
 2150PROCswap_context
 2160PRINT"Doing... ";
 2170PROCgbpb(3,in_ch%,Buffer%,maxlen%,ptr%)
 2180PROCswap_context
 2190PROCgbpb(1,out_ch%,Buffer%,maxlen%-notdone%,ptr%)
 2200NEXT
 2210temp%=out_ch%:out_ch%=0
 2220CLOSE#temp%
 2230temp%=0
 2240PROCwrite_info
 2250PROCwrite_time
 2260PROCswap_context
 2270temp%=in_ch%:in_ch%=0
 2280CLOSE#temp%
 2290temp%=0
 2300ENDPROC
 2310 
 2320DEFPROCexamine(entry_number)
 2330REM source context for entry & exit
 2340block%?7=0
 2350block%!8=&D0100+entry_number : REM dir name = <cr>, noof ents =01
 2360PROCfscall(block%,16,3,TRUE)
 2370IF block%?4=0 THEN type%=0:ENDPROC : No file found
 2380IF block%?24 AND &20 THEN type%=2 ELSE type%=1 :REM Dir or file?
 2390load_addr%=block%!16
 2400exec_addr%=block%!20
 2410attr%=block%?24
 2420account%=block%?27+ (block%?28 AND 15)*256
 2430aux_acc%=block%?29+ (block%?28 DIV 16)*256
 2440file_len%=(block%!30)AND &FFFFFF
 2450block%?16=13 : REM extract object title
 2460object$=FNtrail($(block%+6))
 2470 
 2480IF NOT copy_time% THEN ENDPROC
 2490 
 2500time_block%?7=&40
 2510$(time_block%+8)=object$
 2520PROCfscall(time_block%,&14,&12,FALSE)
 2530REM If time read failed (?Acorn FS), use what we got from examine
 2540IF FSerror% THEN time_block%!8=block%!25:time_block%!10=0:time_block%!14=0:ENDPROC
 2550 FOR A%=14 TO 5 STEP -1
 2560 time_block%?(A%+3)=time_block%?A% : REM copy down ready to write
 2570 NEXT
 2580ENDPROC
 2590 
 2600DEFPROCswap_context
 2610LOCAL A%,X%,Y%,old_FS%,old_cont%
 2620source_context%=NOT source_context%
 2630X%=block%:Y%=block% DIV 256
 2640A%=&13
 2650 
 2660block%?0=0
 2670CALL osword
 2680old_FS%=block%!1
 2690block%?0=6
 2700CALL osword
 2710old_cont%=block%!1
 2720 
 2730block%!1=other_FS%
 2740other_FS%=old_FS%
 2750block%?0=1
 2760CALL osword
 2770 
 2780block%!1=other_context%
 2790other_context%=old_cont%
 2800block%?0=7
 2810CALL osword
 2820 
 2830X%=dir_up_works%
 2840dir_up_works%=other_up_works%
 2850other_up_works%=X%
 2860 
 2870X%=at_works%
 2880at_works%=other_at_works%
 2890other_at_works%=X%
 2900ENDPROC
 2910 
 2920DEFFNget_context(arg%)
 2930LOCAL A%,X%,Y%
 2940A%=&13
 2950?block%=arg%
 2960X%=block%:Y%=X% DIV 256
 2970CALL osword
 2980=block%!1
 2990 
 3000DEFPROCwrite_info
 3010LOCAL A%,X%,Y%
 3020IF copy_acc% THEN PROCoscli("ACCOUNT """+object$+""" "+STR$~account%+" ("+STR$~aux_acc%+")")
 3030PROCset_loadexecaccess
 3040ENDPROC
 3050 
 3060DEFPROCwrite_time
 3070IF NOT copy_time% THEN ENDPROC
 3080time_block%?7=&40
 3090$(time_block%+18)=object$
 3100PROCfscall(time_block%,&20,&13,FALSE)
 3110IF FSerror% THEN PRINT "Error "$(time_block%+4)" trying to write time"
 3120ENDPROC
 3130 
 3140DEFPROCwrite_access
 3150PROCdir_args
 3160PROCfscall(block%,LEN(object$)+18,&13,FALSE)
 3170ENDPROC
 3180 
 3190DEFPROCset_loadexecaccess
 3200IF type%=2 THEN PROCdir_args ELSE PROCfile_args
 3210PROCfscall(block%,LEN(object$)+18,&13,TRUE)
 3220ENDPROC
 3230 
 3240DEFPROCfile_args
 3250block%?7=1
 3260block%!8=load_addr%
 3270block%!12=exec_addr%
 3280block%?16=attr%
 3290$(block%+17)=object$
 3300ENDPROC
 3310 
 3320DEFPROCdir_args
 3330block%?7=4
 3340block%?8=attr%
 3350$(block%+9)=object$
 3360ENDPROC
 3370 
 3380DEFPROCfscall(block%,len%,op%,fatal%)
 3390LOCAL A%,X%,Y%
 3400!block%=len%*256
 3410block%!3=op%
 3420X%=block%:Y%=X% DIV 256:A%=&14
 3430CALL osword
 3440FSerror%=block%?3
 3450IF fatal% THEN IF FSerror% THEN ?(block%+4+LEN($(block%+4)))=0:CALL block%+2
 3460ENDPROC
 3470 
 3480DEFPROCdir_up_arrow(init_dir$)
 3490REM do a *dir^ , or do it the long way if that fails.
 3500IF dir_up_works% THEN PROCoscli("DIR^"):ENDPROC
 3510PROCoscli("DIR")
 3520PROCoscli("DIR """+init_dir$+"""")
 3530IF dir$<>"" THEN PROCoscli("DIR """+MID$(dir$,2)+"""")
 3540ENDPROC
 3550 
 3560DEFFNmakeDir(dir$)
 3570IF NOT(error%) THEN =TRUE ELSE =(LEFT$(restart$,LEN(dir$))=dir$)
 3580 
 3590DEFFNexists(fname$)
 3600LOCAL X%,Y%,A%
 3610X%=block%:Y%=X% DIV 256
 3620!X%=X%+12
 3630$(X%+12)=fname$
 3640A%=5
 3650=(USR(osfile) AND &FF)
 3660 
 3670DEF FNopenin(fname$)
 3680LOCAL X%,Y%,A%
 3690X%=block%:Y%=X% DIV 256
 3700$X%=fname$
 3710A%=&40
 3720=USR(osfind) AND &FF
 3730 
 3740DEFPROCcdir(d$)
 3750PROCoscli("CDIR """+d$+"""")
 3760ENDPROC
 3770 
 3780DEFFNinput_default(banner$,default$)
 3790LOCAL reply$,r$
 3800REPEAT
 3810PRINTbanner$;:reply$=GET$
 3820IF reply$=CHR$13 THEN PRINT default$:reply$=default$:GOTO3860
 3830PRINTreply$;:INPUT "" r$
 3840reply$=reply$+r$
 3850IFLEFT$(reply$,1)="*" THEN PROCoscli(reply$)
 3860UNTIL LEFT$(reply$,1)<>"*"
 3870=reply$
 3880 
 3890DEFFNinput(banner$,rep%)
 3900LOCAL reply$
 3910REPEAT
 3920PRINTbanner$;:INPUT ""reply$
 3930IFLEFT$(reply$,1)="*" THEN PROCoscli(reply$)
 3940UNTIL LEFT$(reply$,1)<>"*" AND (NOT rep% OR reply$<>"")
 3950=reply$
 3960 
 3970DEFFNyes
 3980LOCAL A%
 3990REPEAT
 4000A%=GET AND &5F
 4010UNTIL A%=&59 OR A%=&4E
 4020PRINT CHR$(A%)
 4030=A%=&59
 4040 
 4050DEFFNtrail(dum$) : REM remove trailing spaces
 4060LOCALpos%
 4070pos%=INSTR(dum$," ")
 4080IF pos%=0 THEN =dum$ ELSE =LEFT$(dum$,pos%-1)
 4090 
 4100DEFPROCoscli_noexec(cmd$)
 4110LOCAL A%,X%,Y%,Z%
 4120A%=&C6:X%=0:Y%=255
 4130Z%=(USRosbyte AND &FF00)DIV 256
 4140PROCoscli(cmd$)
 4150IF Z%=0 THEN *FX 119
 4160ENDPROC
 4170 
 4180DEFPROCstar(A$)
 4190$(block%+7)=A$
 4200PROCfscall(block%,8+LENA$,0,FALSE)
 4210IF FSerror%<>0 AND FSerror%<>&C9 AND FSerror%<>&D6 THEN ?(block%+4+LEN($(block%+4)))=0:CALL block%+2
 4220ENDPROC
 4230 
 4240DEFPROCoscli(cmd$)
 4250LOCAL X%,Y%
 4260$(block%)=cmd$
 4270X%=block%:Y%=X% DIV 256
 4280CALL oscli
 4290ENDPROC
 4300 
 4310DEFPROCgbpb(A%,h%,b%,n%,o%)
 4320LOCAL X%,Y%
 4330X%=block%:Y%=X%DIV256
 4340?X%=h%
 4350X%!1=b%
 4360X%!5=n%
 4370X%!9=o%
 4380CALL osgbpb
 4390notdone%=X%!5
 4400ENDPROC
 4410 
 4420DEFPROCsave
 4430OSCLI("Save multicopy "+STR$~PAGE+" "+STR$~TOP)
 4440ENDPROC
 4450 
 4460DEFFNinstr(a$,b$)
 4470IF LEN(b$)<LEN(a$) THEN =0
 4480=INSTR(a$,b$)
 4490 
 4500REM error routine
 4510REM entered in context of FS where error occurred
 4520IF ERR=&11 THEN PROCescape
 4530REPORT:PRINT" at line ";ERL;" ";
 4540IF source_context% THEN PRINT"on source FS"; ELSE PRINT"on dest FS";
 4550restart$=dir$:target$=object$
 4560IF dir$<>"" THEN err$=RIGHT$(dir$,LEN(dir$)-1)+"."+object$ ELSE err$=object$
 4570PRINT" while processing "err$
 4580 
 4590PROCcloseFiles
 4600 
 4610REM loop to allow OSCLI commands to fix a problem
 4620ON ERROR GOTO 4800
 4630INPUT "*"cmd$
 4640PROCoscli(cmd$)
 4650IF cmd$<>"" THEN GOTO 4610
 4660 
 4670PROCcloseDirs
 4680ON ERROR OFF
 4690PRINT"R(etry) or S(kip) :";
 4700REPEAT
 4710k%=GET AND &5F
 4720UNTIL k%=ASC"R" OR k%=ASC"S"
 4730PRINTCHR$(k%)
 4740ON ERROR GOTO 4500
 4750IF k%=ASC"S" THEN target$=target$+" "
 4760IF target$<>"" THEN target$=FNcase(target$):error%=TRUE
 4770 
 4780GOTO 930 :REM back to the reentry point
 4790 
 4800REM oscli error routine
 4810IF ERR=&11 THEN PROCescape
 4820REPORT:PRINT" at line ";ERL
 4830GOTO 4610
 4840 
 4850DEFPROCcloseFiles
 4860IF source_context% AND in_ch%<>0 THEN CLOSE#in_ch%:in_ch%=0
 4870IF NOT(source_context%) AND out_ch%<>0 THEN CLOSE#out_ch%:out_ch%=0
 4880PROCswap_context  :REM swap out of error context
 4890IF source_context% AND in_ch%<>0 THEN CLOSE#in_ch%:in_ch%=0
 4900IF NOT(source_context%) AND out_ch%<>0 THEN CLOSE#out_ch%:out_ch%=0
 4910PROCswap_context  :REM now in error context
 4920ENDPROC
 4930 
 4940DEFPROCcloseDirs
 4950IF NOT(source_context%) THEN PROCswap_context
 4960context%=FNget_context(6)
 4970current%=(context% AND &FF00) DIV &100
 4980context%=(context% AND &FF00FF) OR source_csd%
 4990block%!1=context%:?block%=7:X%=block%:Y%=X% DIV 256:A%=&13:CALL osword
 5000CLOSE#current%
 5010 
 5020PROCswap_context
 5030 
 5040context%=FNget_context(6)
 5050current%=(context% AND &FF00) DIV &100
 5060context%=(context% AND &FF00FF) OR dest_csd%
 5070block%!1=context%:?block%=7:X%=block%:Y%=X% DIV 256:A%=&13:CALL osword
 5080CLOSE#current%
 5090PROCswap_context
 5100ENDPROC
 5110 
 5120DEFPROCescape
 5130ON ERROR OFF
 5140PROCcloseFiles
 5150PROCcloseDirs
 5160REPORT:PRINT" at line ";ERL
 5170END
Image
User avatar
BeebMaster
Posts: 4814
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: Econet Library Utilities

Post by BeebMaster »

JGH has a version of MultiCopy with this and a couple of other bugs fixed:

https://mdfs.net/Apps/Networking/MDFS/SJUtils.zip
Image
User avatar
arg
Posts: 529
Joined: Tue Feb 16, 2021 2:07 pm
Location: Cambridge
Contact:

Re: Econet Library Utilities

Post by arg »

BeebMaster wrote:
Fri Jan 21, 2022 4:43 pm
Interesting, I have a later version of MultiCopy (version 1.15) which I think is from the SJ MDFS Master Disc 2.00, but there's a line numbering bug which I noticed a few years back. It's in line 630 where it checks if *DIR @ is supported, it should be GOTO660 instead of 830, otherwise it skips many of the questions for the copy, including the all-important recurse option:
Strange. Yes, it looks like I inadvertently posted an older version of Multicopy; I also have one called V1.15, but it doesn't seem to have that bug you mention. Enclosed version came from an archive labelled "dollar100" - ie. the $ directory supplied with MDFS version 1.00.
Attachments
copy_progs_100.zip
(8.13 KiB) Downloaded 3 times
Post Reply

Return to “8-bit acorn software: other”