Wiki Home >> N:-SIO-Command-'S'---Status

N:-SIO-Command-'S'---Status


SIO Command Status ($53) ['S']

This is a command for Devices $71-$78 - The N: Device (see SIO-Commands-for-Device-IDs-$71-to-$78).

Description

For Atari, Return the status of the currently opened protocol channel, in the following format:

OffsetDescription
0LO Byte of # of bytes waiting
1HI Byte of # of bytes waiting
20=Disconnected, 1=Connected
3Extended Error code

It is expected that the buffer point to the DVSTAT location in the OS ($02EA)

Parameters

DCBValue
DDEVIC$71
DUNIT$01 - $04
DCOMND$53 'S'
DSTATS$40
DBUFDVSTAT
DTIMLO$0F
DBYT4
DAUX1N: Status DAUX1 Values
DAUX2N: Status DAUX2 Values

Coleco Adam Implementation

AdamNet has a specific STATUS command (which can be retrieved using the EOS REQUEST STATUS and EOS GET STATUS BYTE commands), this is used to return a bit field

bit #Description
0Client has data available
1Client is connected
2Client has an error
3Server connection available (client is waiting)
4Server error
5NOT USED
6NOT USED
7NOT USED

Examples

Atari BASIC

REM Request Status (CMD 83 'S')
XIO 13,#1,0,0,"N:"

REM Read DVSTAT results from OS variables 746-749 ($02EA)
BW = PEEK(746) + PEEK(747)*256
CONNECTED = PEEK(748)
ERROR = PEEK(749)

PRINT "BYTES WAITING: ";BW
PRINT "CONNECTED: ";CONNECTED

ATARI

CC65

  // Get # of bytes waiting
  OS.dcb.ddevic=0x71;
  OS.dcb.dunit=1;
  OS.dcb.dcomnd='S';
  OS.dcb.dstats=0x40;
  OS.dcb.dbuf=&status;
  OS.dcb.dtimlo=0x0f;
  OS.dcb.dbyt=4;
  OS.dcb.daux=0;
  siov();

  bw=(status[1]<<8)+status[0];
  connected=status[2];

ADAM

Z88DK C

/* THIS USES EOSLIB: http://github.com/tschak909/eoslib */

#define NET 0x09
#define ACK 0x80
#define CONNECTED 2 /* second bit */

bool connected(void)
{
  DCB *dcb;
  while (eos_request_device_status(NET,dcb) < ACK);
  return eos_get_device_status(NET) & CONNECTED;
}

See Also

Put other related command links here.


Wiki content is mirrored from the FujiNet Github Wiki