OSWRCH
From BeebWiki
Prints a character to the currently selected output stream(s).
Contents |
Specification
| 6502 | Z80 | 6809 | PDP11 | 80x86 | 32016 | ARM | On entry: | On exit: |
| A | A | A | R0 | AL | R1 | R0 | = ASCII value of character to print | preserved |
Prints the character whose ASCII value is in A to the currently selected output stream(s), namely the screen, printer, serial port, spool file or any combination of these, or none. The character need not be in the ASCII repertoire of course; it may be part of a VDU sequence, a Teletext graphics character or a printer control code.
A complex process (see diagram, right) filters the characters according to the *FX3, *FX5, *FX6 and *SPOOL settings, the flag returned by VDUCHR,
and previous characters submitted to OSWRCH. Each of the terminators (shown in blue) does its own specific processing. The handling is 8 bit clean throughout.
| OSBYTE commands affecting OSWRCH | |
| OSBYTE &03 | Select output device |
| OSBYTE &05 | Select printer type/output channel |
| OSBYTE &06 | Select character to be ignored by printer |
| VDU codes affecting flow of control | |
VDU 1 | Send next character to printer only |
VDU 2 | Enable printer |
VDU 3 | Disable printer |
VDU 6 | Enable VDU (screen) driver |
VDU 21 | Disable VDU (screen) driver |
These five VDU commands are handled by VDUCHR. The other function of code 21, to erase the current line of input, is a feature of OSWORD 0.
Calling from BBC BASIC
-
LISTsends output to OSWRCH -
LISTOsends output to OSWRCH -
PRINTsends output to OSWRCH -
VDUsends output to OSWRCH -
CLSsends VDU 12 -
CLGsends VDU 16 -
COLOUR nsends VDU 17,n -
GCOL a,nsends VDU 18,a,n -
GCOL nsends VDU 18,0,n -
COLOUR l,psends VDU 19,l,p,0,0,0 -
COLOUR l,r,g,bsends VDU 19,l,16,r,g,b if l>=0 -
COLOUR l,r,g,bsends VDU 19,l,24,r,g,b if l<0 -
MODE nsends VDU 22,n -
OFFsends VDU 23,1,0,0,0,0,0,0,0,0 -
ONsends VDU 23,1,1,0,0,0,0,0,0,0 -
PLOT k,x,ysends VDU 25,k,x;y; -
PLOT BY x,ysends PLOT 65,x,y -
PLOT x,ysends PLOT 69,x,y -
MOVE BY x,ysends PLOT 0,x,y -
DRAW BY x,ysends PLOT 1,x,y -
MOVE x,ysends PLOT 4,x,y -
DRAW x,ysends PLOT 5,x,y -
CIRCLE x,y,rsends MOVE x,y:PLOT 145,r,0 -
CIRCLE FILL x,y,rsends MOVE x,y:PLOT 153,r,0 -
ELLIPSE x,y,a,bsends MOVE x,y:MOVE BY a,0:PLOT 193,0,b -
ELLIPSE FILLsends MOVE x,y:MOVE BY a,0:PLOT 201,0,b -
FILL x,ysends PLOT 133,x,y -
FILL BY x,ysends PLOT 129,x,y -
LINE x1,y1,x2,y2sends MOVE x1,y1:DRAW x2,y2 -
RECTANGLE x,y,wsends MOVE x,y:PLOT 13,x+w,y:PLOT 13,x+w,y+w:PLOT x,y+w:PLOT 13,x,y -
RECTANGLE x,y,w,hsends MOVE x,y:PLOT 13,x+w,y:PLOT 13,x+w,y+h:PLOT x,y+h:PLOT 13,x,y -
RECTANGLE FILL x,y,wsends MOVE x,y:PLOT 101,x+w,y+w -
RECTANGLE FILL x,y,w,hsends MOVE x,y:PLOT 101,x+w,y+h -
RECTANGLE x1,y1,w,h TO x2,y2sends MOVE x1,y1:MOVE x1+w,y1+h:PLOT 190,x2,y2 -
RECTANGLE FILL x1,y1,w,h TO x2,y2sends MOVE x1,y1:MOVE x1+w,y1+h:PLOT 189,x2,y2 -
RECTANGLE SWAP x1,y1,w,h TO x2,y2sends MOVE x1,y1:MOVE x1+w,y1+h:PLOT 191,x2,y2 -
ORIGIN x,ysends VDU 29,x;y; -
PRINT TAB(x,y);sends VDU 31,x,y
Entry points
- BBC BASIC Entry Address: &FFEE
- 6502 Entry Address: &FFEE, vectors via &020E
- Z80 Entry Address: &FFEE, vectors via &FFEF
- 6809 Entry Address: &FFEE, vectors via &FFEF
- 80x86 Entry Address: INT &49, vectors via 0000:0124
- 32000 Entry Address: SVC &01
- PDP-11 Entry Address: EMT 4, vector &04
- ARM Entry Address: SWI &00 "OS_WriteC", vector &03
Implementations
Implemented in all MOS versions. Some systems allow BPUT#0 to send output to OSWRCH.
Jgharston 17:03, 6 November 2009 (UTC)


