What follows are instructions for (i) installing and running TSION's ECHOLD server on a Nintendo DS and (ii) installing and running other TinyScheme code on the DS.
TinyScheme in DeSmuME - Click image to enlarge |
The TinyScheme executable (see Running other Scheme Code) and TSION executable were built using the devkitPro tool chain (devkitARM installation instructions). TinyScheme and TSION run as standard I/O (i.e., dumb terminal) applications on the Nintendo DS. Output is written to the top screen; input, when requested by the program, is read from a pop-up keyboard on the bottom screen.
On start-up, both executables look for a configuration file,
"/etc/program.conf
", that defines (i) any
environment variables needed by the program and (ii) a UNIX-like
command line with arguments for the program. If there is no configuration
file or if there is no command line in the file, the program prompts you
for the command-line arguments. Hit "Rtrn" on the keyboard and you'll be
met by the TinyScheme ">
" prompt. If you can manage entering
more than a few keystrokes without frustration, more power to you!
tsion.nds
- the TSION executable.
echold.scm
- the Scheme code
for the line-oriented echo daemon.
tsiond.nds
,
would be ideal for use on a DS. However, to work with TinyScheme's output
mechanism, the client's socket must be converted into a buffered standard
I/O (FILE *) stream. For some reason, this doesn't work on the DS - no
output is generated despite explicit calls to fflush(3)
-
although it seems to work successfully on other platforms.
etc
" directory in the root directory ("/") of your
DS. Then copy these files to "/etc/
":
init.scm
- TinyScheme's
initialization file. TinyScheme is partially implemented in C
and then the remainder is implemented by the definitions in
init.scm
. Environment variable TINYSCHEMEINIT,
set in the following file, the TSION configuration file, points
to the initialization file, "/etc/init.scm
".
tsion.conf
- the start-up
configuration file for TSION. This file defines (i) an
environment variable needed by TinyScheme and (ii) the
TSION command line, which tells TSION to load the
"echold.scm
" file.
Simply select "tsion.nds
" and run it. The program will pick up
its environment variable and command line from "/etc/tsion.conf
".
Per the configuration file, TSION will load and execute the echo daemon code
from "echold.scm
".
The line-oriented echo daemon listens at port 10234 for connection requests from clients; e.g., telnet(1). Assuming you know the IP address of the DS, invoke telnet as follows to connect to ECHOLD on the DS:
% telnet IP-address 10234
A connection should be established with ECHOLD and then, anything you type into telnet, should be echoed back to telnet. You can try running telnet from several windows to show how ECHOLD handles multiple clients simultaneously.
The TSION executable, "tsion.nds
", is not limited to running
only the echo daemon. To run your own Scheme code, just copy the Scheme
file(s) into the DS root directory and modify the command line in
"/etc/tsion.conf
" to load your main file instead of
"echod.scm
".
If you're not interested in the networking extensions provided by TSION,
you can run the vanilla TinyScheme executable,
"tinyscheme.nds
". In this case,
TinyScheme looks for configuration file "/etc/tinyscheme.conf
"
containing a command line, "tinyscheme
argument(s)"
(as well as the definition of environment variable TINYSCHEMEINIT
;
see "tsion.conf
").
Building the basic TinyScheme for the Nintendo DS is a fairly simple job:
Makefile.nds
and
StdIONDS.c
into the target directory.
make -f Makefile.nds
".
The Make command builds (i) the "libtinyscheme.a
"
library needed by TSION and (ii) the "tinyscheme.nds
"
executable needed to run on your Nintendo DS. Done!