Difference between revisions of "VDU 3"
m (1 revision) |
m (1 revision) |
(No difference)
|
Revision as of 01:13, 8 March 2015
Ends a print job.
Syntax | VDU 3
|
Keyboard equivalent | CTRL C |
Character stream (hex) | 03
|
Description | Ends a print job, subsequent characters are not sent to the printer. |
Description
VDU 3
, or CTRL C, ends a print job. From this point onwards,
characters 'printed' on the screen are no longer echoed to the currently
selected printer device. Note that this is a distinction from
disabling printer output, which is controlled with OSBYTE &03.
The VDU drivers must be enabled with OSBYTE &03 before VDU 3 is issued, otherwise the print job will not be terminated. Printer output must not be independantly selected with OSBYTE 3 until another VDU 2 is sent.
VDU 3 and OSBYTE 3
You shouldn't use VDU 2/VDU 3 to select printer output, you should use OSBYTE 03. If you use VDU 2/3, unexpected things may happen. The currently selected printer driver has the complete right to do absolutely anything between a VDU 3 and a VDU 2. This includes, but is not limited to, such things as sending a form feed, printing a header and footer, putting the kettle on, burning the toast, kicking the cat, etc.
- VDU 2 should be sent to OSWRCH with VDU drivers enabled to start a print job.
- To output to both the screen and the printer, characters should be sent to OSWRCH with the VDU drivers enabled and the printer driver enabled, by clearing bit 1 and bit 2 of OSBYTE 3.
- To output to just the screen, the printer driver should be disabled by setting bit 3 of OSBYTE 3.
- To output to just the printer, the VDU driver should be disabled by setting bit 1 of OSBYTE 3, and the independant printer driver should be enabled by setting bit 3 of OSBYTE 3.
- VDU 3 should be send to OSWRCH with VDU drivers enabled to end a print job.
- You should never enable the independant printer driver, or issue a VDU 1,n sequence, without first starting a print job by sending VDU 2 to the VDU driver.
Example code
OSCLI "FX3,0" :VDU 2:REM Start print job OSCLI "FX3,4" :PRINT "SCREEN ONLY" OSCLI "FX3,10":PRINT "PRINTER ONLY" OSCLI "FX3,0" :PRINT "SCREEN AND PRINTER" OSCLI "FX3,0" :VDU 3:REM End print job
Note that you should really read the current output destination and change only the bits you require, and then restore the destination afterwards. OSBYTE 3 also returns the old status which can be used later to restore it.
A%=FNbyte(3,FNbyte(236,0,&FF) AND &FD,0) :REM Enable VDU driver A%=FNbyte(3,FNbyte(236,0,&FF) OR 4,0) :REM Disable printer driver A%=FNbyte(3,FNbyte(236,0,&FF) OR 10,0) :REM Disable VDU, enable printer
Jgharston 13:16, 13 December 2007 (UTC) -- beardo 21:55, 19 September 2007 (BST)