Difference between revisions of "VDUCHR"
m (1 revision)
Revision as of 23:58, 28 August 2013
Sends a character to the VDU driver. VDUCHR is the name given to this routine in Geoff Cox's annotated disassembly of MOS 1.20. It is mentioned in the Advanced User Guide (p.104) but not in the New Advanced User Guide.
|A||= ASCII value of character to print|
|C||= 1 if OSWRCH should send the character to the printer|
Sends the character whose ASCII value is in A to the VDU (screen) driver. This may display it on the screen, start a VDU sequence, or add it to the current VDU sequence. When the sequence is complete, the routine will execute the VDU command it forms. The accumulator may contain any value from 0 to 255 depending on the purpose.
VDUCHR is called from the official routine OSWRCH, to update the display. It can be used as a shortcut to deliver VDU sequences without having to disable and re-enable other output devices. As such it makes the screen available as a 'standard error' channel when the OSWRCH stream has been redirected to a device.
This routine is the largest in the MOS ROM, taking some 40 per cent of the
space. Please see the individual
VDU command entries for
their descriptions. If it does not recognise a VDU command it will redirect
via VDUV (&0226).
While the display is turned off with
VDU 21, VDUCHR
continues to parse incoming VDU sequences. The only commands still acted
VDU 1 and
VDU 6; all others are
discarded. As usual if a stream of binary characters is printed, it may
create a VDU sequence (a queue) that must be cleared with nine
NULs before issuing the next command.
On exit, VDUCHR returns a hint intended for OSWRCH in the carry flag. After OSWRCH calls VDUCHR it will send the character on to the printer if the carry flag is set (or if the printer is forced on.) Under MOS 1.20 the carry flag is set if one or more of the following conditions are true, and cleared otherwise:
- If VDU 2 is active, no queue is pending, and A is in the range 8 to 13, 32 to 126, or 128 to 255.
- If VDU 21 is active, no queue is pending, and A is in the range 8 to 13.
- If VDU 2 and VDU 21 are active, and the character in A is the parameter of a VDU 1 command.
From the above list, two problems are apparent in MOS 1.20, both arising
while the display is disabled. Firstly, control codes 8 to 13 are flagged
for printing even if the printer has been turned off with
VDU 3. This is reported in the New Advanced User Guide,
p.108. Secondly, the
VDU 1 command prints the character
twice, once by VDUCHR and again by OSWRCH. One workaround is to call
*FX3 with a parameter of 64 or more, and then to
do all printing through
VDU 1 commands.
Calling from BBC BASIC
- BASIC does not call VDUCHR
- BBC BASIC Entry Address: none
- 6502 Entry Address: &FFBC
- Z80 Entry Address: none
- 6809 Entry Address: none
- 80x86 Entry Address: none
- 32000 Entry Address: none
- PDP-11 Entry Address: none
- ARM Entry Address: none
This call is undocumented and applications should use OSWRCH instead. However the code at the entry point exists in MOS 1.20 and MOS 2.00. It is not implemented on non-6502 platforms and BBC BASIC does not emulate its entry point.
-- beardo 23:28, 23 September 2007 (BST)