Difference between revisions of "OSBYTE &98"
m (1 revision) |
(OS <1.20 bug) |
||
Line 13: | Line 13: | ||
No range checking is performed on the buffer number and nonexistant | No range checking is performed on the buffer number and nonexistant | ||
buffer numbers have undefined results | buffer numbers have undefined results | ||
+ | |||
+ | ;Note | ||
+ | Under BBC OS 1.20 and earlier, Y contains the offset of the character in the | ||
+ | buffer instead of the character. This condition can be detected by calling | ||
+ | [[OSBYTE &00]] with X<>0 and receiving X=1; in which case the user should: | ||
+ | *disable interrupts with <code>PHP:SEI</code> | ||
+ | *call OSBYTE &98 as above | ||
+ | *ensure that the carry flag is returned clear, indicating a valid offset | ||
+ | *fetch the character with <code>LDA (&FA),Y</code> | ||
+ | *restore the interrupt state with <code>PLP</code> | ||
+ | |||
+ | if they require the character value which will be left in A. | ||
+ | |||
+ | Under later BBC OS versions and Electron OS 1.00 the character is returned | ||
+ | directly in Y. | ||
==See Also== | ==See Also== |
Revision as of 13:14, 12 August 2021
OSBYTE &98 (152) - Examine Buffer Status
X=buffer number On exit C=0 Y=offset from address held at &FA to the next byte to get C=1 buffer empty (Acorn MOS 2.00) The Y register actually contains the next value,not just an offset as with the earlier OS. Note Interrupts should be disabled during this call to ensure the interrupt routine doesn't alter the buffer while you're reading it This OSByte doesn't actually remove the byte No range checking is performed on the buffer number and nonexistant buffer numbers have undefined results
- Note
Under BBC OS 1.20 and earlier, Y contains the offset of the character in the buffer instead of the character. This condition can be detected by calling OSBYTE &00 with X<>0 and receiving X=1; in which case the user should:
- disable interrupts with
PHP:SEI
- call OSBYTE &98 as above
- ensure that the carry flag is returned clear, indicating a valid offset
- fetch the character with
LDA (&FA),Y
- restore the interrupt state with
PLP
if they require the character value which will be left in A.
Under later BBC OS versions and Electron OS 1.00 the character is returned directly in Y.
See Also
Jgharston 22:09, 26 May 2009 (UTC)