Click Here To Go To The Your Computer Archive



Written By Fintan Culwin


Cover Art
Click Here To Enlarge Loading Screen

Loading Screen
Click Here To Enlarge Opening Screen

Opening Screen
Click Here To Enlarge Screenshot

Game Screenshot

Disc Cat

Fintan Culwin sorts out BBC discs

I was mildly embarrassed recently when a friend offered me some non-copyright programs. Instead of the usual muddle of discs they were neatly arranged and numbered in a box on a shelf. What was intriguing was that he had a card index itemising each file and the disc it could be found upon.

The embarssament came a few weeks later when he returned the visit. Offering to repay the programs in kind I performed my usual scrabble through the pile of discs on my shelf and madly started to *CAT them, hunting for the file I was looking for.

Card indexes are not for me, the main reason being that I cannot organise myself efficiently enough to update them. But, possibly more importantly, I don't possess massive stocks of computer equipment for it to sit idly by while I fill out forms.

The specification for this program came from this experience. What I wanted was a program which would allow me to insert the discs one at a time. After inserting the disc I would have the option of rejecting some of the files. The remained would be filed somehow. When all the discs had been processed, it would be possible to produce a printed listing of the information.

Considering the problem further, it would have to be possible to add to this list as my collection of discs grew, rather than re-catalogue the entire file. If a file grew, for example, the new information would have to overwrite the old information rather than have it entered as a separate entry.

To accommodate this, I would have to give each disc in my collection a name and a number. The first part of the printout would be an ordered list of the discs and their titles. The second part would be a list of the files in alphabetical order, together with the number of the disc that they could be found upon and the filing system information contained upon them.

This seemed simple enough for me to manage. So, satisfied that I could accommodate my ways to the system and that the system would satisfy my needs, I started the detailed planning stage.

The first and simplest problem concerned the storage of the information. With even a moderate collection of full discs, it would probably be impossible to hold all the information in the computer's memory and manipulate the information at the same time. So the information would have to be filed on disc and manipulated there.

The second problem was how to extract the information about the catalogue from the disc. Perusing my copies of the BBC's OS guides it seemed tedious to obtain the information by making a series of system calls - the first to obtain the disc catalogue and subsequent calls for each file in the catalogue. The official way, however, is not always ths most elegant. One official way however is not always the most elegant. One official call, *INFO *.*, would yield the required information but display too much of the information on the screen, and with a full directory overflow one full screen.

It is here where the wonderful flexibility of the BBC's Operating System came to the rescue. Issue the *INFO call and trap the information returned before it gets to the screen. Specifically direct it to a reserved area of memory, where the filenames can be extracted for display on the screen and the rest of the information held available for filing. It is possible to do this as most Operating System routines are vectored through the user RAM, allowing them to be trapped.

Having written and tested this part of the program, I then started to consider in more detail the structure of the file which would contain the information. As the size of the file was indeterminate, and the information had to be presented in a certain order, it seemed sensible to maintain an ordered file.

There are two choices when doing this. The most obvious way would be to hold an ordered list of disc titles, followed by an ordered list of filenames. Simple to understand but difficult to implement.

It a new disc or filename had to be added to the list it would result in a great deal of shuffling of information on the disc. The second method of storing an ordered list is more difficult to understand and code but much easier to implement on a filing system.

The information is physically stored in the sequence it is collected in. Associated with each item of information on record is a pointer to the next item of information in sequence. To add a new record and preserve the sequence you only have to change two pointers.

Such a structure is called a linked list. In this application two such lists are required, one for the disc titles and one for the filenames. A simple picture of a small linked list is shown in figure 1a and 1b. To add filename BBBBBBB to the list in 1a, you need only write the information at the end of the file with its pointer pointing to record 5, and rewrite the pointer in record 4 to point to the new record.

Using this idea, the program keeps a 33-byte record. The first two bytes are the record pointer. For a disc title the next three characters indicate the disc number in ASCII, and the disc title follows terminated by &FF. Following the pointer there is the filename. This is always nine bytes long padded out by spaces if necessary. The filename is followed by its disc number as above and 12 further bytes giving the load address, execution address and size of file.

The first two records are dummies used to start the disc titles chain and the filenames chain respectively. Bytes 5 and 6 of the first record are also used to indicate the current length of file in records.

The utility operation is straightforward. It starts by asking for the drive to be entered, the disc number and the disc name. When these have been verified you are invited to insert the disc to be processed. You're given a list of files and a chance to switch discs back. On a dual-drive system, switch the disc in and out of the second drive.

A file on the display is highlighted by a pair of arrows on the screen. The highlighted file can be changed using the up and down arrow keys. A file can be deleted from consideration using the Delete key. A deleted file is shown enclosed by stars (*). A deleted file which is highlighted can be restored by using the Delete key again.

When all is to your satisfaction press Return to start filing the details. As each file is processed, its name is shown on the screen. A side-product of this program should be a testing of your disc system.

After all the filing has been done, the screen reverts to asking for drive number, disc number and title. More discs can thus be processed in one session. To conclude the session enter the disc number as 999.

The print routine starts by asking for a catalogue title and a date reference. To skip the printout, enter "none" as the catalogue name. The catalogue will be presented as a list of discs and titles in numeric order, followed by the list of filenames in alpahbetical order. The list is paged with headings, footings and a page count. Two printer control codes can give details.

The printout routine can be extracted from the rest of the program and used in isolation. Apart from one part it is all contained in the final section of the program starting with PROCprintout. Add to this FNgetin, PROCdelt and FNceak and the routine can be applied in isolation. Alternatively for additional copies of the catalogue, load the whole program and type PROCprintout from the keyboard.

One final and rather important point. As new files are added to the catalogue file, Filecat has to grow. To avoid "Can't Extend" errors, and preserve your data in case of filing system accidents, take a blank disc, copy the Filecat file to it, in that order.

(a) before addition of file BBBBBBB
Record number Pointer Information
1 3 dummy (start of titles list)
2 4 dummy (start of filenames list)
3 7 title of disc #1
4 5 filename AAAAAAA
5 8 filename CCCCCCC
7 0 title of disc #2 (and end of list)
8 0 filename DDDDDDD (and end of list)
(b) after addition of file BBBBBBB
Record number Pointer Information
1 3 dummy (start of titles list)
2 4 dummy (start of filenames list)
3 7 title of disc #1
4 5 filename AAAAAAA
5 8 filename CCCCCCC
7 0 title of disc #2 (and end of list)
8 0 filename DDDDDDD (and end of list)
9 5 filename BBBBBBB
Figure 1. Details of a double entwined linked list