[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

B-22. Function Name: READST

Purpose: Read status word
Call address: $FFB7 (hex) 65463 (decimal)
Communication registers: A
Preparatory routines: None
Error returns: None
Stack requirements: 2
Registers affected: A

Description: This routine returns the current status of the I/O devices in the accumulator. The routine is usually called after new communication to an I/O device. The routine gives you information about device status, or errors that have occurred during the I/O operation.

The bits returned in the accumulator contain the following information: (see table below)
ST BIT POSITIONST NUMERIC VALUECASETTE READSERIAL/RWTAPE VERIFY + LOAD
0 0   Time out write  
1 2   Time out read  
2 4 Short block   Short block
3 8 Long block   Long block
4 16 Unrecoverable read error   Any mismatch
5 32 Checksum error   Checksum error
6 64 End of file EOI line  
7 -128 End of tape Device not present End of tape

How to Use:

  1. Call this routine.
  2. Decode the information in the A register as it refers to your program.

EXAMPLE:

   ;CHECK FOR END OF FILE DURING READ
   JSR READST
   AND #64                       ;CHECK EOF BIT (EOF=END OF FILE)
   BNE EOF                       ;BRANCH ON EOF

[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated December 17, 2002.