N: SIO Command 'S' Status - FujiNetWIFI/fujinet-firmware GitHub Wiki
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:
| Offset | Description |
|---|---|
| 0 | LO Byte of # of bytes waiting |
| 1 | HI Byte of # of bytes waiting |
| 2 | 0=Disconnected, 1=Connected |
| 3 | Extended Error code |
It is expected that the buffer point to the DVSTAT location in the OS ($02EA)
Parameters
| DCB | Value |
|---|---|
| DDEVIC | $71 |
| DUNIT | $01 - $04 |
| DCOMND | $53 'S' |
| DSTATS | $40 |
| DBUF | DVSTAT |
| DTIMLO | $0F |
| DBYT | 4 |
| DAUX1 | N: Status DAUX1 Values |
| DAUX2 | N: 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 |
|---|---|
| 0 | Client has data available |
| 1 | Client is connected |
| 2 | Client has an error |
| 3 | Server connection available (client is waiting) |
| 4 | Server error |
| 5 | NOT USED |
| 6 | NOT USED |
| 7 | NOT USED |
Examples
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.