OSBYTE &98

From BeebWiki
Revision as of 16:50, 12 August 2021 by Regregex (talk | contribs) (osword 5)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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
  • use LDA (&FA),Y to fetch the character (or simulate with OSWORD &05)
  • 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)