Home

GEONius.com
19-Sep-2009
E-mail

TSION (TinyScheme with Network Extensions) on a Nintendo DS

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 on NDS]
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!

Installation

  1. Copy these files to the root directory ("/") of your DS:


    The TSION network server, 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.

  2. Create an "etc" directory in the root directory ("/") of your DS. Then copy these files to "/etc/":

Running the Line-Oriented Echo Daemon

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.

Running other Scheme Code

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 TinyScheme for the DS

Building the basic TinyScheme for the Nintendo DS is a fairly simple job:

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!


Alex Measday  /  E-mail