5. USING RAM AS A BUFFER

An important feature of Romlt is its ability to provide the user with an extensive buffer area which can be used to extend the BBC micro's internal buffers. These include the keyboard, sound, speech and RS423 buffers. But probably the most useful is to set up sideways Ram as a printer buffer.

This will give you more than 15K of buffer area (with a 16K Ram), which will be sufficient to release your micro very quickly when printing even substantial lengths of text.

The command which makes all this possible is *BUFFER. It has an optional numeric parameter to select the function to which the buffer is to be put. This may take the value 0-8 as in the accompanying table. So that *BUFFER 8 would select the speech buffer, and so on.

It is a feature of the BBC micro that pressing ESCAPE flushes, or clears, all internal buffers. Since this may be inconvenient when using the special Ram buffer described here, this feature has been disabled.

If however you wish ESCAPE to flush the designated buffer, you should use as numeric parameter the number in parentheses in the table below (with values in the range 128-136).

Thus *BUFFER 130 would select the RS423 output buffer; and the buffer could be flushed by pressing ESCAPE .

Parameter

Buffer type

0 (128)

Keyboard buffer

1 (129)

RS423 input buffer

2 (130)

RS423 output buffer

3 (131)

Printer buffer

4 (132)

Sound channel 0

5 (133)

Sound channel 1

6 (134)

Sound channel 2

7 (135)

Sound channel 3

8 (136)

Speech buffer

It is important to note that when the buffer facility is used it will erase the whole contents of the sideways Ram, which may contain RaFS files.

To avoid the loss of RaFS files when using *BUFFER you may easily save the current contents of the Ram as follows:

*BLOCK R DISC name RETURN

or

*BLOCK R TAPE name RETURN

This will store the whole contents of RaFS Ram under the filename "name". To load it back into Ram, type:

*BLOCK DISC R name RETURN

or

*BLOCK TAPE R name RETURN

Because use of the buffer has the destructive effect described, the facility must, as a precaution, be first enabled with the command *ENABLE (or *EN.).

Thus, to set up sideways Ram as a printer buffer which will not be cleared on pressing ESCAPE , use the following:

*EN. RETURN
*BUFFER 3 RETURN

Because it is assumed that this will be the most frequent use of the Buffer command; this particular option has been installed as the default. This means that if you require to use the printer buffer, with ESCAPE not clearing the buffer, you may simply type:

*BUFFER RETURN

It should be remembered that *BUFFER should be called from within the Ram filing system. If any filing system commands are required when using the buffer, the filing system required should be first initialised (eg type *DISC once *BUFFER has been called).

To return to RaFS use when you have finished with the buffer facility, type