Additional Commands for R: Devices - FujiNetWIFI/fujinet-firmware GitHub Wiki
In addition to the Atari 850 command set for R:, there are a few additional commands that have been added to the R: (0x50-0x53) devices.
When enabled, both incoming and outgoing MODEM traffic are logged to a file called /modem_sniffer.txt on the SD card.
Value | Description |
---|---|
DDEVIC | $50 |
DUNIT | $01 (Typically $01 for R1:) |
DCOMND | $44 'D' |
DSTATS | $00 (no payload) |
DBUF | NULL (no buffer, because no payload) |
DTIMLO | $0F |
DBYT | $00 (no bytes, because no payload) |
DAUX1 | $XX (1=on, 0=off) |
DAUX2 | $00 |
Listen for TCP connections on the desired TCP port specified by aux1/aux2 (1-65535), If a port is already bound, it will be closed, and the new port specified will be bound for listening.
Value | Description |
---|---|
DDEVIC | $50 |
DUNIT | $01 (Typically $01 for R1:) |
DCOMND | $4C |
DSTATS | $00 (no payload) |
DBUF | NULL (no buffer, because no payload) |
DTIMLO | $0F |
DBYT | $00 (no bytes, because no payload) |
DAUX1 | $LL (The low byte of the 16-bit TCP port number) |
DAUX2 | $HH (The high byte of the 16-bit TCP port number) |
If the port is opened successfully, a COMPLETE will be returned, otherwise an ERROR will result.
Shut down the listening socket enabled by the above LISTEN command. This will also stop any current client connection.
Value | Description |
---|---|
DDEVIC | $50 |
DUNIT | $01 (Typically $01 for R1:) |
DCOMND | $4D |
DSTATS | $00 (no payload) |
DBUF | NULL (no buffer, because no payload) |
DTIMLO | $0F |
DBYT | $00 (no bytes, because no payload) |
DAUX1 | $00 |
DAUX2 | $00 |
This command will always return a COMPLETE.
Used after a CONFIGURE command to toggle whether to react to baud rate changes. If DAUX1=1 then any baud rate changes received via the CONFIGURE command are ignored, with a COMPLETE sent. Setting DAUX1=0 will resume normal behavior. This can be used to prevent the Atari from changing baud rate, beneficial for BBS use.
Value | Description |
---|---|
DDEVIC | $50 |
DUNIT | $01 (Typically $01 for R1:) |
DCOMND | $4E |
DSTATS | $00 (no payload) |
DBUF | NULL (no buffer, because no payload) |
DTIMLO | $0F |
DBYT | $00 (no bytes, because no payload) |
DAUX1 | $TT ($01 = lock baud rate to prevent further changes) |
DAUX2 | $00 |
This command will always return a COMPLETE.
This piece of C code shows how to set a listening port for the R: device.
/**
* FujiNet Tools for CLI
*
* rlisten - Enable TCP port XXXX for listening
*
* usage:
* rlisten <port#>
*
* Author: Thomas Cherryhomes
* <[email protected]>
*
* Released under GPL, see COPYING
* for details
*/
#include <atari.h>
#include <string.h>
#include <stdlib.h>
#include "sio.h"
#include "conio.h"
#include "err.h"
unsigned char buf[40];
unsigned short port;
/**
* SIO command to set R: listening port
*/
unsigned char listen_port(unsigned short port)
{
OS.dcb.ddevic=0x50;
OS.dcb.dunit=1;
OS.dcb.dcomnd='L';
OS.dcb.dstats=0x00;
OS.dcb.dbuf=NULL;
OS.dcb.dtimlo=0x01;
OS.dcb.dbyt=0;
OS.dcb.daux=port;
siov();
if (OS.dcb.dstats!=1)
err_sio();
return OS.dcb.dstats;
}
/**
* show options
*/
void opts(char* argv[])
{
print(argv[0]);
print(" <port#>\x9b\x9b");
print("<port#> - TCP Port # (1-65535)\x9b");
}
/**
* main
*/
int main(int argc, char* argv[])
{
unsigned char err=0;
OS.lmargn=2;
if (_is_cmdline_dos())
{
if (argc<2)
{
opts(argv);
return(1);
}
port=atoi(argv[1]);
}
else
{
// DOS 2.0/MYDOS
print("\x9b");
print("LISTEN TO WHICH PORT? ");
get_line(buf,sizeof(buf));
port=atoi(buf);
}
if (port<1)
{
print("INVALID PORT NUMBER.\x9b");
return(1);
}
err=listen_port(port);
if (!_is_cmdline_dos())
{
print("\x9bPRESS \xD2\xC5\xD4\xD5\xD2\xCE TO CONTINUE.\x9b");
get_line(buf,sizeof(buf));
}
return(err);
}