APPLICATIONSUTILITAIRES RSX/LIGNE DE COMMANDE ★ Background printing ★

Rsx - Background Printing|Popular Computing Weekly)Applications Utilitaires Rsx/ligne De Commande
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

Double-dealing

Background printing at your fingertips with the aid of Brian Cadge

The machine code program presented here gives the Basic programmer the facility for 'Background Printing'. This is a feature usually found on the better wordprocessors and the like. Basically, what it means is that the computer can be printing a document whilst the basic program continues to do something else. Using the printer usually hangs the computer up until printing has finished.

To use the program type in the Basic loader program, save and run it. If you have made any errors in the data statements the program will tell you and you should recheck your listing.

Several new commands are now available to be used in your own programs which can now be loaded or typed in. Alternatively, the Basic loader program could be merged with your own program. Line 90 would be changed to a Goto first line number, eg, 300. It is important that the code is only loaded once, so you should add to Line 5 as follows; 5 If Peek(41400)=201 Then 300.

The new printer driver uses channel 7, instead of channel 8, the normal printer stream. So instead of using List#8 to list a program to the printer, you can now use Listft?. Similarly, use Prints 7, instead of Printed. Channel 8 still operates as normal, but take care not to use it whilst #7 is active, or output will be mixed from both! The text window #7 cannot be used.

There are also four new RSX commands available. All RSX's start with the '|' character, obtained by Shift/@. These commands are:

  • |Hold Temporarily suspends background printing.
  • |Esc will no longer stop the printer.
  • |Release Restarts printing from the
  • |Held position. Kill Aborts all background printing immediately - any output waiting to go to the printer will be lost
  • |Lfchar,n Sets the Linefeed character to 'n', the default is 10. Note the comma immediately after the command and before the number. If your printer leaves a blank line between each line printed then try typing Lfchar,0
A 2K buffer is used to store the characters to be output. If this ever fills up completely then the program will have to wait until room is available before continuing. In practice, 2K is enough for most output to be stored, so that the program is not halted.

To get the idea of what all this does, try listing the Basic loader program once it has run successfully, type; List#7. Instead of waiting for the printer, the 'ready' prompt should return almost immediately. You can now carry on using Basic as normal whilst the program is being listed on the printer. You can also send more output whilst this is happening try typing -ft 7, "Amstrad". This will be stored and printed after the listing.

Now type Hold, the printer will stop, typing Release will restart printing. Typing Kill will halt the printer and all further output will be lost.

If you want to know whether the printer is active in a program you can use X = Peek(41735) + Peek(41736) *256 to return the number of characters waiting to be printed.

You do not need to understand how the machine code program works to use the program, but the assembly language listing is included for anyone interested.

The normal VDU print vector is redirected so that each time a character is printed the program checks to see if channel 7 is being used. If it is then the character is stored in the next available position in the buffer, if not then the character is passed to the normal ROM screen printing routine.

A 2K wrap-round buffer is used, with two pointers and one counter. The counter holds the number of items in the buffer. The Input Pointer points to the next available position, the Output Pointer points to the next character to be printed. By taking Modulo 204B a wrap-round buffer is created - this feature is important for the most efficient user of the buffer.

The actual printing is done by a 'Fast Ticker Event'. This is a routine executed by the operating system 300 times a second. Ticker Events on the Amstrad are a very powerful form of interrupts under the complete control of the operating system. There are several speeds of ticker, 300 being the fastest.

This fast ticker event is set up in Lines 270 to 310 and starts at Line 1020. It firstly checks if there is anything to print and returns if not. It also returns if the Hold flag is set. If there is a character in the buffer, then the Centronics port is checked. If the printer is 'Busy' the routine doesn't wait, it simply returns. Providing the printer is ready, the character is sent and the Output Pointer and Counter are adjusted.

The RSX commands are set up in Lines 240-260 and 330-460, and the command routines start at Line 1340. For a fuller explanation of RSX commands see Popular Vol 3, numbers 50 and 51.




PopularComputingWeekly850314

★ PUBLISHER: POPULAR COMPUTING WEEKLY
★ YEAR: 1985
★ AUTHOR: Brian Cadge

CPCrulez[Content Management System] v8.7-desktop/cache
Page créée en 080 millisecondes et consultée 704 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.