Skip to content

N: SIO Command 'O' Open

Bill Kendrick edited this page May 27, 2022 · 8 revisions

SIO Command Open ($4F) ['O']

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

Description

Given a devicespec in the returned 256 byte buffer, parse it, and if valid, instantiate the protocol, and prepare the Atari to be able to send/receive an I/O channel for the chosen protocol.

If a devicespec is invalid, then an ERROR 165 is returned on the subsequent STATUS command (while returning an SIO ERROR 144, indicating that you should check the STATUS).

Parameters

ADAM

Parameters

  • Device 09 to 0C
  • Use AdamNET Write (EOS WRITE CHARACTER DEVICE)
Offset Value
0 'O'
1 MODE N: AUX1 Values
2 TRANS N: AUX2 Values
3-n The URL to open N: devicespec

Return Values

  • $80 - ACK. Open successful
  • $8C - NAK - Open not successful, read status byte.

ATARI

DCB Value
DDEVIC $71
DUNIT $01 - $04
DCOMND $4F 'O'
DSTATS $80
DBUF a 256 byte buffer containing N: devicespec
DTIMLO $0F
DBYT 256
DAUX1 N: AUX1 Values
DAUX2 N: AUX2 Values

Examples

ATARI

ATARI BASIC (and friends)

1000 REM THIS USES THE N: DEVICE (PROVIDED BY NDEV.COM)
1010 OPEN #1,12,2,"N:HTTPS://www.gnu.org/licenses/gpl-3.0.txt"

CC65

static unsigned char hostname[256]="N:TCP://irata.online:8005/";

/**
 * io_init() - Set-up the I/O
 */
void io_init(void)
{
  OS.vprced=ih;
  PIA.pactl |= 1;
  // Establish connection
  OS.dcb.ddevic=0x71;
  OS.dcb.dunit=1;
  OS.dcb.dcomnd='O';
  OS.dcb.dstats=0x80;
  OS.dcb.dbuf=&hostname;
  OS.dcb.dtimlo=0x0f;
  OS.dcb.dbyt=256;
  OS.dcb.daux=0;
  siov();
}

COLECO Adam

Z88DK

/* This uses eoslib: http://github.com/tschak909/eoslib */

#DEFINE NET 0x09

const char *url="N:HTTPS://WWW.GNU.ORG/licenses/gpl-3.0.txt";

unsigned char open(void)
{
  struct _OC
  {
     unsigned char cmd;
     unsigned char mode;
     unsigned char trans;
     char url[256];
  } OC;

  unsigned char r;
  
  OC.cmd = 'O';
  OC.mode = 12;
  OC.trans = 3;
  strncpy(OC.url,url,256);

  return eos_write_character_device(NET,(unsigned char *)OC,sizeof(OC)); // 0x80 means successful
}

See Also

Put other related command links here.

Clone this wiki locally