Lots of utilities make use of .LBR (Library) files to provide extra facilities such as the ability to run commands from archives or mount them as if they were drives. This article shows some more advanced uses of .LBR files and is a follow-up to our previous article: Working with .LBR files on CP/M.
Setting Dates
Later versions of the .LBR file format definition added support for dates. On CP/M these can be set using SETD v2.2, dated 1988 by Brent B. Powers. These dates can be seen using LDIR-B v2.20 as mentioned in the previous article on .LBR files. The dates can be supplied at the command line or if you have a real-time clock you can write a small piece of code to query it.
Unusually for 1988 one of the files, SETD22.UPD, contains a warning about what may happen with the dates in the year 2000. In reality this was more of a problem with the 2 digit years used by SETD and LDIR-B than the .LBR format as the latter uses Digital Research's Julian date format which records the number of days from 31 December 1977 as a 16-bit number. This would support dates properly up to around the year 2157.
The archive for SETD v2.2 contains an interesting history of its previous versions as listed below:
Version 2.0 was the original assembly language version, recoded
from the TurboPascal version, in turn recoded from the
TurboModula-2 version, which was, finally, a translation of C.B.
Falconer's LSETDATE, with a slightly different date-parsing
algorithm.
I find it interesting that it went through three languages and in particular at one point was written using Turbo Modula-2, a language which didn't exist for very long on CP/M. The Turbo Pascal version is SETD v0.1, dated 17 Oct 1987.
Finding Files Within .LBR Archives
If we have lots of .LBR archives it can be difficult sometimes to remember exactly which archive contains a particular file. To search these archives we can use LFIND v1.13, dated 8 Nov 1984 by Martin Murray. LFIND allows us to search all the .LBR files on all drives and for all users to see which contain a matching filespec. It works really well but only on CP/M 2.2 as on CP/M Plus it lists somes files multiple times.
Mounting .LBR Archives as a Drive
It is possible to mount a .LBR or a number of .LBR archives as if they were a drive using LBRDSK v2.3, dated 13 Feb 1985 by Jim Lopushinsky. From here you can read and write to them, although writing isn't ideal because it can clobber files that follow a file if you are altering an existing one. The LBRDSK archive contains SETRSX11.COM which is used to provide RSX facilities on CP/M 2.2 and for this reasons it will only work on CP/M 2.2.
LBRDSK can be used as follows. To access LBRDSK23.LBR as if it was drive E: in read/write mode:
A> LBRDSK E:=LBRDSK23.LBR
To access the members of all the .LBR archives as if they were on drive E: in read mode:
A> LBRDSK E:=*.LBR
Running Commands
It is possible to run programs directly from a .LBR archive using LRUN v2.3, dated 8 Jul 1985 originally by Gary P. Novosielski. This is very useful if you have lots of small .COM files on a disk as by including them in a .LBR archive you can reduce the amount of space they take up because there may be be less wasted space if they are not a multiple of the block size. If you don't supply LRUN with a .LBR file then it will default to 'COMMAND.LBR'. This works very well, however it isn't suitable for all programs as they may need to access other files which can't be contained in the archive. It should also be noted that the member files can't be compressed.
As an example, if we wanted to run LFIND.COM contained in TOOLS.LBR we could use:
A> LRUN -TOOLS LFIND
Alternatively if LFIND.COM was in COMMAND.LBR we could use:
A> LRUN LFIND
Basic Information
Below is some basic information about each utility that you may find useful and interesting.
Name | Version | Date | Size (Kb) | 8080 Compatible |
---|---|---|---|---|
SETD | 2.2 | 10 Feb 1988 | 3 | ✘ |
LFIND | 1.13 | 8 Nov 1984 | 5 | ✘ |
LBRDSK | 2.3 | 13 Feb 1985 | 8+1 | ✔ |
LRUN | 2.3 | 8 Jul 1985 | 2 | ✔ |
Video
The following video shows these .LBR utilities in action.