|★ APPLICATIONS ★ DIVERS ★ RAM PRINT BUFFER ★|
|Ram Printer Buffer|Computing With the Amstrad)||Applications Divers|
IN the December 1986 issue of Computing with the Amstrad we explained how to expand the buffer in the Amstrad DMP 2000 printer.
When a printer outputs characters it can't do it as fast as the computer sends them. To get round this most printers have an on-board buffer, which is an area of memory where characters are stored until the print head is ready for them.
If your printer has a 100-byte buffer the Amstrad can send 100 characters to the printer and carry on with what it is doing. In the meantime the printer chugs along at its own pace taking a new character from the buffer when it needs one.
If you try and print more text than the size of buffer allows, the operating system will wait until the printer has caught up and the micro pauses until it has sent everything it wants to. Printers with larger buffers hold more text, meaning that the computer spends less time waiting and consequently you can get on with something else.
Not everyone has a DMP printer and those who do may not feel confident about delving inside and invalidating their guarantees. Rambuffer overcomes this by setting up another buffer to complement the printer's own, but locates it in the computer's memory.
It is compatible with Basic programs and rom-based software like Protext or Maxam and will work with any make or model of printer. The buffer can be located anywhere in memory and its size varied according to your needs.
Type in and run Program I, which will generate the machine code, and save it to tape or disc as RAMBUFF.BIN.
You then need to use either Program II (for CPC464/664) or Program III (for the CPC6128) to install the new facility. The reason for the difference is that on the CPC6128 the buffer is in the extra bank of RAM and initialised in a different way to the 64k models. This frees more memory for Basic programs.
Rambuffer produces three new RSX commands- |BUFON, |BUFOFF and |HOLD.
|BUFON turns the RAM buffer on and the format of the command depends on the model of CPC you are using. With the CPC464/664 it must be followed by two parameters, the first the size of buffer and the second where in memory it is to be placed.
Try and put the buffer as high up in memory as possible to leave the maximum amount available to Basic. Also be careful not to overwrite the machine code which starts at &A000 or 40960 in decimal. So:
would set up a buffer of 5k (5120 bytes) starting at location 35839 and ending at 40959. You must lower HIMEM to protect the buffer from being over written by Basic, hence the MEMORY command before |BUFON.
CPC6128 owners make use of the extra bank of ram, freeing more memory for use by Basic. Only one 16k block can be used, but in practice this is not a problem as 16k is more than adequate, holding around eight pages of text.
With the CPC6128 one parameter, between 4 and 7 is passed with the |BUFON command. This is the block of extra RAM to be used: The four 16k blocks in the first 64k are numbered 0 to 3 and the blocks in the second bank are 4 to 7. If you are using Bank Manager remember to avoid the buffer when using commands such as |SCREENCOPY.
When |BUFON has been used with parameters, there is no need for them when you next use the command. Once the buffer has been turned off with | BUFOFF, the size and location may be reset using new parameters with I BUFON, but if no parameters are present the old ones are used.
|HOLD suspends printing, although characters will still be stored in the buffer. To continue printing use |BUFON and no text will be lost. This could be handy if you wanted to change the paper in the printer in the middle of a long document.
When the buffering facility is no longer needed, |BUFOFF will restore normal printing. It also has the effect of clearing the buffer so any remaining text will be lost.
Rambuffer consists of two routines. When |BUFON is used, the firmware indirection MC WAIT PRINTER is redirected to point at the first routine, which stores characters in the buffer.
The second part takes a character from the buffer and sends it to the printer when it is ready to accept one. It is set up as an interrupt, which is the machine code equivalent of the Basic EVERY command.
Pressing the Escape key in a Basic program while printing is in progress will return operation to the keyboard as usual, but text will continue to be printed until the buffer is empty. If you want to avoid this, type |BUFOFF to clear the buffer.
CWTA L'alinéa 8 de l'article L122-5 du Code de la propriété intellectuelle explique que « Lorsque l'œuvre a été divulguée, l'auteur ne peut interdire la reproduction d'une œuvre et sa représentation effectuées à des fins de conservation ou destinées à préserver les conditions de sa consultation à des fins de recherche ou détudes privées par des particuliers, dans les locaux de l'établissement et sur des terminaux dédiés par des bibliothèques accessibles au public, par des musées ou par des services d'archives, sous réserve que ceux-ci ne recherchent aucun avantage économique ou commercial ». Pas de problème donc pour nous!
L'alinéa 8 de l'article L122-5 du Code de la propriété intellectuelle explique que « Lorsque l'œuvre a été divulguée, l'auteur ne peut interdire la reproduction d'une œuvre et sa représentation effectuées à des fins de conservation ou destinées à préserver les conditions de sa consultation à des fins de recherche ou détudes privées par des particuliers, dans les locaux de l'établissement et sur des terminaux dédiés par des bibliothèques accessibles au public, par des musées ou par des services d'archives, sous réserve que ceux-ci ne recherchent aucun avantage économique ou commercial ». Pas de problème donc pour nous!