Year Of The Disc Feature

Loading via a menu

Volume 2

Number 01

January 1984

Disc loading made child's play

By Pete Davidson

THE BBC disc system is extremely easy to use. However some people, especially young children, find even this system tricky.

For those who wish to use a program, rather than change it, write it or do anything else, it is easier to use a disc system if a menu of programs on the disc appears and the user types a number to select a choice. It is with that in mind that I wrote this program.

The program can be used in two ways. People with an Acorn DFS should use PROCreadmem, which reads the copy of the catalogue from the memory. The same program can then be used on any disc.

As different disc systems store the catalogue in memory in different ways, PROCread allows the user to put the file names into DATA statements.

The DATA statements are then changed if the program is used for different discs.

If you are not sure which make of DFS you have, the make is indicated on the screen when you switch your computer on.

Here are the instructions to set up an automatic loading system:

Type in the program as shown. You may type in just the part you require as indicated by the REM statements. Note that lines 1000 onwards should contain the names of the programs on your disc, rather than PROG1, etc.

Save under the program with the name "MENU".

Type *BUILD !BOOT and press Return.

After the number 1 that appears, type CHAIN"MENU" and press Return.

Press Escape. The file !BOOT will then be saved to disc.

Type *OPT4,3 and press Return. (This is required so that booting the computer will automatically run the program !BOOT.)

Once you have set up the system, to use it you boot the computer by pressing Shift and Break together, then releasing Break but continuing to hold down Shift until the disc starts.

A menu will appear on the screen. Select the number of the program you require, press Return and the program will load and run.

This program only works for Basic programs. The message "Bad program" will appear if anything else is selected.

How does it work?

With the Acorn DFS, memory locations &E00 to &E07 contain a copy of the first part of the title of a titled disc. From &E08 onwards is a copy of the names of the files on the disc in blocks of 8 (the 8th byte is not part of the name).

PROCreadmem reads these blocks of memory, while PROCread obtains the same data from DATA statements.

Note that if you have an Acorn DFS, you do not need lines 190 onwards and lines 40 and 110 should read PROCreadmem.

With any other DFS, omit lines 190 to 240 and put the program names in DATA statements from line 1000. Lines 40 and 110 should be PROCread in this case.

The file names are stored in a string array and the appropriate element in the array loaded, moved lower down in memory to give longer programs room to run (downloaded), and run.

5 Sets up KEY0 to load, download and run the program.

10 Moves the display down one line (optional).

20 Selects MODE.

30 Initialise variables. J% is a program number. L% is start location for each program (with Acorn DFS). W$(J%) are the program names.

40 Calls whichever procedure you have chosen.

50-60 Title lines. If you have an Acorn DFS (and are using PROCreadmem), put a title on the disc using TITLE (see DFS manual). If you have any other DFS (and are using PROCread), put the title in place of the @ in line 280. The first seven characters of the title will be printed by this program.

70-120 Reads the next file name and stores it in the next element of the array. It uses either PROCreadmem or PROCread as described below. A check is made that there are not too many programs to fit in one column on the screen (line 100).

130 Sets N% to the number of programs.

140 Prints the program on the screen.

150-160 Takes in request and validates it.

170 Prints a message.

180 Calls KEY0 (see line 5).

190-240 PROCreadmem reads the next 7 bytes starting at L% and stores them in a string WS(J%). These lines are only required if you have an Acorn DFS. In that case lines 40 and 110 should read PROCreadmem.

250-270 PROCread reads the next item of data, converts it to a length of 7 and stores it in WS(J%). These lines (and the DATA statements) are only required if you have a DFS other than Acorn. In that case lines 40 and 110 should read PROCread.

280-5000 The DATA required by PROCread.

This program is written for clarity rather than efficiency.

It is hoped that, while working well for beginners, more experienced users will use the ideas to write more efficient programs themselves.

Colour control codes were entered using shifted function buttons. In the listing these show in PRINT statements as numbers in brackets, underlined. 129 corresponds to shifted f1, 130 to shifted f2 and so on.

The menu is set for 20 programs (which looks neater as a single column display). Change 140 to:

140FORI%=lTON%:PRINTI%"... "W$(I%);:NEXT

and omit 100 to allow more names to appear.