|★ APPLICATIONS ★ DISQUE ★ Disc Cataloguer ★|
|Disc Cataloguer|The Amstrad User)||Applications Disque|
This program should make it easier to keep track of disc files. It establishes a catalogue for sixty discs on one side of the CAT disc. Since each side of a disc can contain a maximum of sixty -four files, there is no space for any files other than the program and its backup and the sixty logs.
The discs are numbered 1 to 60 (or 61 to 120, 901 to 961, should it be necessary). The disc number is stored as the file name extension, and the file name is made up of the prefix CT and the date of the log, in the "yymmdd" format. The sides are identified as A or B, and each log contains the files of both sides of the particular disc. A separate file for each disc allows random access, eg. to read or write the log for disc number 10, we access the file "CT??????.010M. Each log can be sent to the printer as it is created or subsequendy read from the CAT disc. All the logs on the CAT side can be searched serially for a particular file name. If the name is a null string, the search will list all the files in each log. The program starts with logging-on of the CAT disc. It catalogues the disc into a specified buffer and stores the files which conform to the log format in the "ulog" array. This array is then updated each time a new log is written to the disc.
Creating a log is complicated by the possibility of files created under user numbers other than User 0. The disc is first catalogued to determine its format which is stored in the Disc Parameter Block. The four directory tracks are then read into the buffer, and the log is assembled into the "udisc" array. This is a fairly lengthy procedure, since files longer than 16k are spread over two or more directory entries, one entry for each completed 16k and one for any excess.
Each directory entry is 32 bytes long. Byte 0 has the user number or the value 229 if the file had been erased. Bytes 1 to 11 are the file name and extension, without the full-stopseparator. Byte 15 contains the number of records covered by the directory entry. A record is 128 bytes long but files are written in blocks of 8 records, i.e. 1024 bytes. To get the total length of a file, whose catalogue may be spread over several directories, it is necessary to sum the number of records in each individual directory referring to the file. The total number of records is then convened into the number of blocks, rounded up. A block will not contain parts of two different files, so a file 1025 bytes long will occupy two blocks: its second block will have just the last byte and the EOF token (la hex, 26 decimal), the remaining 1022 bytes will not be utilized. Each file entry is assembled into the "udisc" array in the format of: byte 1-1-byte user number in hex (erased files are not logged), bytes 2 to 12-file name and extension, bytes 13 and 14-length of tile in blocks in hex. The array is then sorted in ascending order by an elementary bubble sort Because the user number is the first character of each record and all records are the same length, the user number will automatically serve as the first key. This makes it easier to print the files under the different user numbers. The element zero of the array is used for a header record of the disc format, free space, and the number of files on each side.
The process is quite slow, since it involves extensive string manipulation and is likely to invoke one or more "garbage collections". But the delay is not excessive with up to about twenty files on the side, and most sides would probably not exceed this number. More time will be spent on accessing the discs.
When a record is written to disc using the "PRINTS,record" without the linefeed inhibitor, the operating system terminates the record with a NEWLINE and LINEFEED (codes 13 and 10 decimal). This would make each record 16 bytes long. If both sides of the logged disc contained the possible maximum of 64 files, the log would run to 3 blocks, urd the disc capacity might be exceeded if a number of such logs existed. By inhibiting the linefeed and terminating each record with newline only, up to 128 bytes are saved and allow space for the header record for each side of the logged disc.
Reading and searching the log is quite elementary. The printout has two options: the file names can be printed across the page, or down the page in two columns. The latter option will use 66 lines with the maximum of 64 files; an 11 inch page will just accommodate this number of Iir.es. but it would be safer to set the line spacing to seven lines per inch, it possible, to provide some lop and bottom margins. In this format there is space for short hand-written comments next to each file name. There is no provision to log the files with their comments to the disc.
Two machine-language routines, stored in integer arrays, are used to access the directory tracks of each disc The first one simply calls CAT with a buffer address. The sccond one. "rdir", is more complicated: it uses KL. FIND COMMAND to find the address of the BIOS routine READ SECTOR (whose command name is CHR$(132), then reads the four directory sectors into the buffer for processing. Only the officially documented routines are used, so the program should be compatible with the 664 and 6128, although it was written on the 464.