uIP is a free small TCP/IP implementation for 8- and 16- bit
microntrollers and suitable for the TRS-80 class of computers. This page deals
specifically with the port of uIP to the TRS-80 model 3. For general
information about uIP, see
http://www.dunkels.com/adam/uip/
The intent was to port the stock uIP implementation with as few changes
as possible even though there are some logical changes that could be made
for the TRS-80, such as serving files from the native file system rather
than from compiled in tables. Features not enabled in the uIP for the
model 3 source package, such as ARP and large buffers (>255), have not
been tested.
Getting uIP for the TRS-80 Model3
There are two source packages available - one for compiling with
SDCCavailable
here
and one for compiling with
MC available
here.
Also included in the tarballs are the precompiled executables so you can
give uIP a try without the hassle of actually building it.
The SDCC version includes both a TRSDOS 1.3 executable (UIPT.CMD) and an
LDOS 5.3.1 executable (UIPL.CMD). The MC version currently supports
LDOS only (UIP.CMD). See detailed information below regarding the two
versions.
Running uIP for the TRS-80 Model3
uIP requires 48k and the RS232 interface and will run on a real
model 3 as well as a model 3 emulator which includes emulation of the
serial port such as
xtrs. Just transfer
the appropriate executable to a floppy or import into the emulator
and execute it. Hit any key to exit the program and return to DOS.
Click here
for a few screenshots.
The network interface is provided by SLIP over the serial port so you
need another computer to host the other end of the SLIP interface.
I don't know if Windows can provide SLIP. Under linux, use
'slattach' to create the interface and 'ifconfig' to configure it
(you need SLIP support in the kernel):
slattach -s 9600 -p slip -L /dev/ttyS1 &
ifconfig sl0 192.168.0.1 pointopoint 192.168.0.2 up
The model 3 side of the interface ignores the hardware flow control
signals so only three signals need connected on the serial port
(RX/TX/GND). However, the documentation for slattach on linux is
very misleading; the man page says the -L flag selects 3-wire mode
suggesting it too ignores the hardware flow control signals but this
is not the case. -L only disables modem carrier detect so either
the hardware flow control signals must be connected or slattach
can be patched to disable flow control. A patch for net-tools 1.60
which adds a -X option to disable hardware flow control is available
here.
If uIP is run in the
xtrs emulator on
a host with two serial ports then the same host can also provide
the SLIP interface by cabling between the two ports.
The IP address is compiled into uIP and is 192.168.0.2. Similarly,
the baud rate is compiled in and is 9600 (8 bit, no parity). To
change these, the source must be modified and recompiled.
uIP includes both an http (web) server and ICMP echo (ping) server
so once everyting is up and running you should be able to ping the
model 3 (ping 192.168.0.2) and view the web pages (url
http://192.168.0.2/index.html in a web browser).
To make the model 3 accessible from other than just the slip host, some
form of forwarding or masquerading or routing can be used. For example,
if I recompile uIP with an IP address of 192.168.1.20 (which is a valid
IP on my home network), then I can just enable ip forwarding and proxy
arp on my slip host and the model 3 appears on the entire network.
annie:/home/matt# ifconfig sl0 192.168.1.5 pointopoint 192.168.1.20 up
annie:/home/matt# arp -Ds 192.168.1.20 eth0 pub
annie:/home/matt# echo 1 > /proc/sys/net/ipv4/ip_forward
Then, from another machine on the network:
matt@duffy:~$ ping 192.168.1.20
PING 192.168.1.20 (192.168.1.20): 56 data bytes
64 bytes from 192.168.1.20: icmp_seq=0 ttl=62 time=201.7 ms
64 bytes from 192.168.1.20: icmp_seq=1 ttl=62 time=208.0 ms
64 bytes from 192.168.1.20: icmp_seq=2 ttl=62 time=208.1 ms
Building uIP for the TRS-80 Model 3 with MC
MC (Misosys C) is a once commercial K&R C compiler which runs natively
on the TRS-80. However, the uIP for the model 3 is too large to compile
natively on the model 3 itself so it must be cross compiled on a model
4. In addition to MC itself, you need an assembler; MC is designed to
work with MRAS (Misosys Relocatable ASsembler). For more information
on these and other Misosys products see
Tim Mann's website.
The source tarball contains all the souce files individually plus an
emulator disk image (uipdisk.jv3) which contains the same files and is
ready for use with a model 4 emulator.
The model 4 tools are not standardly configured to cross compile for the
model 3 so you need to install the model 4 tools but with the model 3
libraries - the soure tarball includes an emulator disk image (mcmras3.jv3)
which is this combination of of tools and libraries. If working in an
emulator, you'll want the import/export utilities to get files from/to
the host environment.
In my setup, LDOS is in drive 0, uipdisk in drive 1, mcmras3 in drive 2,
and a utilitiy disk (containing import/export) in drive 3. To build the
entire project type 'do make (@all,d=#)' where # is the drive number where
the uipdisk is mounted (the default is drive 1 so the 'd=#' parameter is
only needed if the uip disk is not mounted on drive 1). You can enable
optimization by including the 'o' parameter ('do make (@all,d=#,o)') but
this will produce a warning about the 'uip' function is too large to
optimize - the compile will pause at this point and require a keypress to
continue (the UIP.CMD included in the tarball is compiled with
optimization.
Once the executable is built, it can be transferred to a model 3 for
execution.
Building uIP for the TRS-80 Model 3 with SDCC
SDCC (Small Device C Compiler) is a freeware ANSI C compiler which
supports among others the Z80 CPU. However, the code generator for
the Z80 is really buggy. I managed to get uIP to actually work
but only after tracking numerous compiler problems and working around
them. For information about SDCC, see
http://sdcc.sourceforge.net/.
After installing SDCC, the c startup code (crt0.o) and the printf library
(printf.o) should be replaced with those from the sdcc/ directory in the
source tarball. In debian linux, these files are under
/usr/share/sdcc/lib/z80/. Alternatively, you can modify the link command
in the makefile to just use these in sdcc/.
In addition to SDCC, you need a utility to convert from Intel hex format
to the TRS-80 CMD file format. Such a utility is included with the
xtrs package, or you can
get one here.
The only differences between the TRSDOS and LDOS versions are in the RS232
interrupt service routine. The interrupts of the model3 are somewhat
broken in the ROM; TRSDOS uses the ROM interrupt handler and requires a
hack in the rs232.c file to compensate for this, LDOS itself includes this
hack so it isn't needed but in doing so changes some addresses. Be sure to
select the appropriate DOS in the rs232.c file.
Once everyting is installed and configured, just cd to the trs80-3/
directory and type 'make'.
Remember, SDCC is really buggy - expect problems if you make
any changes.