From BeebWiki
Revision as of 18:42, 8 July 2020 by Jgharston (talk | contribs) (.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

OSBYTE &80 (128) - Read I/O device or buffer status

On entry, If XY<0, read buffer status
          If XY>=0, read I/O device

On exit XY=returned value
XY on entry XY on exit
0 b0-b7=buttons, b8-b15=last ADC channel converted
1 Analogue Channel 1
2 Analogue Channel 2
3 Analogue Channel 3
4 Analogue Channel 4
5 Mouse X boundary
6 Mouse Y boundary
7 Mouse X position
8 Mouse Y position
9 Mouse button state, b0=Left, b1=Middle, b2=Right
127 (128-1) low level read from buffer -1 - ie 16-bit GET (cZ80Tube, Brandy and others)
&FFFF (-1) Keyboard buffer
&FFFE (-2) Serial input buffer
&FFFD (-3) Serial output buffer
&FFFC (-4) Printer output buffer
&FFFB (-5) Sound output buffer 0
&FFFA (-6) Sound output buffer 1
&FFF9 (-7) Sound output buffer 2
&FFF8 (-8) Sound output buffer 3
&FFF7 (-9) Speech output buffer
&FFF6 (-10) Mouse input buffer
&FFF5 (-11) MIDI input buffer {check}
&FFF4 (-12) MIDI output buffer {check}

Calling from BBC BASIC

=ADVAL() calls OSBYTE &80


If an unknown device or buffer is examined, then the call is passed to sideways ROMs as an Unknown OSBYTE service call. {check: some exceptions}

Most implementations only actually check bit 7 of the parameter (ie, bit 7 of X) to chose between reading devices and reading buffers, so for instance ADVAL(255) is the same as ADVAL(-1).


Most mouse drivers do not implement calls 5, 6 and 9. The VFS Videodisk Filing System ROM used with the Domesday System implements 5, 6 and 9. The mouse buttons are more usually read with INKEY-10, INKEY-11 and INKEY-12. 8-bit systems rarely implement a mouse buffer. 32-bit systems usually use a sound system that does not use these sound output buffers.

Jgharston 18:59, 11 September 2007 (BST) Jgharston (talk) 06:54, 21 December 2018 (CET)