Difference between revisions of "OSBYTE &98"

From BeebWiki
Jump to: navigation, search
(OS <1.20 bug)
(osword 5)
 
Line 21: Line 21:
 
*call OSBYTE &98 as above
 
*call OSBYTE &98 as above
 
*ensure that the carry flag is returned clear, indicating a valid offset
 
*ensure that the carry flag is returned clear, indicating a valid offset
*fetch the character with <code>LDA (&FA),Y</code>
+
*use <code>LDA (&FA),Y</code> to fetch the character (or simulate with [[OSWORD &05]])
 
*restore the interrupt state with <code>PLP</code>
 
*restore the interrupt state with <code>PLP</code>
  

Latest revision as of 15:50, 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
  • 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)