Merge remote-tracking branch 'contiki-atari/master'
diff --git a/contiki-atari/Makefile b/contiki-atari/Makefile
new file mode 100644
index 0000000..3567720
--- /dev/null
+++ b/contiki-atari/Makefile
@@ -0,0 +1,127 @@
+# Copyright (c) 2002, Adam Dunkels.
+# All rights reserved. 
+#
+# Redistribution and use in source and binary forms, with or without 
+# modification, are permitted provided that the following conditions 
+# are met: 
+# 1. Redistributions of source code must retain the above copyright 
+#    notice, this list of conditions and the following disclaimer. 
+# 2. Redistributions in binary form must reproduce the above copyright 
+#    notice, this list of conditions and the following disclaimer in the 
+#    documentation and/or other materials provided with the distribution. 
+# 3. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#      This product includes software developed by Adam Dunkels.
+# 4. The name of the author may not be used to endorse or promote
+#    products derived from this software without specific prior
+#    written permission.  
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
+#
+# Makefile for Atari 8-bit version
+# This file is part of the Contiki desktop environment
+#
+# $Id: Makefile,v 1.3 2005/04/18 22:43:22 oliverschmidt Exp $
+#
+
+all: contiki.com
+
+CONTIKI=../contiki
+SYS=atari
+
+include $(CONTIKI)/Makefile.common
+
+CC=cc65
+AS=ca65
+CFLAGS=-I ctk -I loader -I uip -I conf -I lib \
+       -I $(CONTIKI)/apps -I $(CONTIKI)/ctk -I $(CONTIKI)/ek \
+       -I $(CONTIKI)/lib -I $(CONTIKI)/uip \
+       -t $(SYS) --add-source -DWITH_ASCII \
+       -DCTK_CONIO -DWITH_CC65 -DWITH_UIP -DWITH_RS232 -DWITH_WWW # -DWITH_TELNET
+OPT=-Or
+
+%.o: %.c
+	$(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
+	$(AS) -o $@ $(AFLAGS) $(*).s
+
+%.o: apps/%.c
+	$(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
+	$(AS) -o $@ $(AFLAGS) $(*).s
+
+%.o: ctk/%.c
+	$(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
+	$(AS) -o $@ $(AFLAGS) $(*).s
+
+%.o: lib/%.c
+	$(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
+	$(AS) -o $@ $(AFLAGS) $(*).s
+
+%.o: loader/%.c
+	$(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
+	$(AS) -o $@ $(AFLAGS) $(*).s
+
+%.o: uip/%.c
+	$(CC) $(CFLAGS)  -o $(patsubst %c, %s, $(notdir $<)) $<
+	$(AS) -o $@ $(AFLAGS) $(*).s
+
+%.o: $(CONTIKI)/apps/%.c
+	$(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
+	$(AS) -o $@ $(AFLAGS) $(*).s
+
+%.o: $(CONTIKI)/ctk/%.c
+	$(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
+	$(AS) -o $@ $(AFLAGS) $(*).s
+
+%.o: $(CONTIKI)/ek/%.c
+	$(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
+	$(AS) -o $@ $(AFLAGS) $(*).s
+
+%.o: $(CONTIKI)/lib/%.c
+	$(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
+	$(AS) -o $@ $(AFLAGS) $(*).s
+
+%.o: $(CONTIKI)/uip/%.c
+	$(CC) $(CFLAGS) $(OPT) -o $(patsubst %c, %s, $(notdir $<)) $<
+	$(AS) -o $@ $(AFLAGS) $(*).s
+
+
+%.o: ctk/%.S
+	$(AS) -o $@ $(AFLAGS) $<
+
+%.o: loader/%.S
+	$(AS) -o $@ $(AFLAGS) $<
+
+contiki.com: contiki-main.o strncasecmp.o petsciiconv.o \
+ ctk-conio.o ctk.o ek.o dispatcher.o \
+ program-handler.o $(WWW) $(UIP) rs232dev.o \
+ about.o netconf.o processes.o
+	cl65 -C atari.cfg -Ln contiki-labels -o $@ -t $(SYS) $^
+	@if [ ! -f Makefile.depend ]; then \
+		echo ; \
+		echo "*** warning: you didn't make depend, result may be unaccurate!"; \
+		echo ; \
+	fi
+
+clean:
+	rm -f *.o *~ *core contiki *.s *.prg contiki-labels contiki.com Makefile.depend
+
+depend:
+	gcc -MM -MG -Iapps -Ictk -Iuip -Iconf -Ilib -I$(CC65_INC) \
+	-I$(CONTIKI)/lib -I$(CONTIKI)/ek \
+	-I$(CONTIKI)/ctk -I$(CONTIKI)/apps -I$(CONTIKI)/uip \
+	*.c */*.c $(CONTIKI)/*/*.c > Makefile.depend
+
+-include Makefile.depend
+
+codesize:
+	od65 --dump-segsize *.o | egrep '\.o|CODE'
diff --git a/contiki-atari/atari.cfg b/contiki-atari/atari.cfg
new file mode 100644
index 0000000..807ec78
--- /dev/null
+++ b/contiki-atari/atari.cfg
@@ -0,0 +1,27 @@
+MEMORY {
+    ZP: start = $82, size = $7E, type = rw, define = yes;
+    HEADER: start = $0000, size = $6, file = %O;
+    RAM: start = $10B0, size = $AB6F, file = %O;    # $AB6F: matches upper bound $BC1F
+}
+SEGMENTS {
+    EXEHDR: load = HEADER, type = wprot;
+    CODE: load = RAM, type = wprot, define = yes;
+    RODATA: load = RAM, type = wprot;
+    DATA: load = RAM, type = rw;
+    BSS: load = RAM, type = bss, define = yes;
+    ZEROPAGE: load = ZP, type = zp;
+    AUTOSTRT: load = RAM, type = wprot;
+}
+FEATURES {
+    CONDES: segment = RODATA,
+	    type = constructor,
+	    label = __CONSTRUCTOR_TABLE__,
+	    count = __CONSTRUCTOR_COUNT__;
+    CONDES: segment = RODATA,
+	    type = destructor,
+	    label = __DESTRUCTOR_TABLE__,
+	    count = __DESTRUCTOR_COUNT__;
+}
+SYMBOLS {
+    __STACKSIZE__ = $800;	# 2K stack
+}
diff --git a/contiki-atari/conf/cc-conf.h b/contiki-atari/conf/cc-conf.h
new file mode 100644
index 0000000..6216176
--- /dev/null
+++ b/contiki-atari/conf/cc-conf.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2003, Adam Dunkels.
+ * All rights reserved. 
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials provided
+ *    with the distribution. 
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgement:
+ *        This product includes software developed by Adam Dunkels. 
+ * 4. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.  
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
+ *
+ * This file is part of the Contiki desktop OS
+ *
+ * $Id: cc-conf.h,v 1.1 2003/04/12 01:54:07 sannyx Exp $
+ *
+ */
+#ifndef __CC_CONF_H__
+#define __CC_CONF_H__
+
+#define CC_CONF_REGISTER_ARGS          1
+#define CC_CONF_FUNCTION_POINTER_ARGS  1
+
+#define CC_CONF_FASTCALL               fastcall
+
+#endif /* __CC_CONF_H__ */
+
diff --git a/contiki-atari/conf/ctk-conf.h b/contiki-atari/conf/ctk-conf.h
new file mode 100644
index 0000000..31dc02b
--- /dev/null
+++ b/contiki-atari/conf/ctk-conf.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2002, Adam Dunkels.
+ * All rights reserved. 
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials provided
+ *    with the distribution. 
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgement:
+ *        This product includes software developed by Adam Dunkels. 
+ * 4. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.  
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
+ *
+ * This file is part of the "ctk" console GUI toolkit for cc65
+ *
+ * $Id: ctk-conf.h,v 1.2 2004/06/27 12:37:34 oliverschmidt Exp $
+ *
+ */
+
+#ifndef __CTK_CONF_H__
+#define __CTK_CONF_H__
+
+/*
+ * This file is used for setting various compile time settings for the
+ * CTK GUI toolkit.
+*/
+
+/* Defines which key that is to be used for activating the menus */
+#define CTK_CONF_MENU_KEY             CH_F1
+
+/* Defines which key that is to be used for switching the frontmost
+   window.  */
+#define CTK_CONF_WINDOWSWITCH_KEY     CH_F3
+
+/* Toggles support for icons. */
+#define CTK_CONF_ICONS                1 /* 107 bytes */
+
+/* Toggles support for icon bitmaps. */
+#define CTK_CONF_ICON_BITMAPS         0
+
+/* Toggles support for icon textmaps. */
+#define CTK_CONF_ICON_TEXTMAPS        1
+
+/* Toggles support for movable windows. */
+#define CTK_CONF_WINDOWMOVE           0 /* 333 bytes */
+
+/* Toggles support for closable windows. */
+#define CTK_CONF_WINDOWCLOSE          0 /* 14 bytes */
+
+/* Toggles support for menus. */
+#define CTK_CONF_MENUS                1 /* 1384 bytes */
+
+/* Defines the default width of a menu. */
+#define CTK_CONF_MENUWIDTH            16
+/* The maximum number of menu items in each menu. */
+#define CTK_CONF_MAXMENUITEMS         10
+
+#endif /* __CTK_CONF_H__ */
diff --git a/contiki-atari/conf/ek-conf.h b/contiki-atari/conf/ek-conf.h
new file mode 100644
index 0000000..d48499c
--- /dev/null
+++ b/contiki-atari/conf/ek-conf.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2002, Adam Dunkels.
+ * All rights reserved. 
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials provided
+ *    with the distribution. 
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgement:
+ *        This product includes software developed by Adam Dunkels. 
+ * 4. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.  
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
+ *
+ * This file is part of the "ek" event kernel.
+ *
+ * $Id: ek-conf.h,v 1.1 2003/04/12 00:47:16 sannyx Exp $
+ *
+ */
+
+
+#ifndef __EK_CONF_H__
+#define __EK_CONF_H__
+
+#include <time.h>
+
+typedef void *ek_data_t;
+
+typedef unsigned char ek_signal_t;
+typedef unsigned char ek_id_t;
+
+/* ek_ticks_t: should be defined to be the largest type that fits the
+   highest timeout value used by the system. For example, if all
+   timeouts are between 1 and 150, the ek_ticks_t can be typedef'd as
+   "unsigned char", but if the maximum timeout is over 256, "unsigned
+   short" is a better choise. */
+typedef unsigned short ek_ticks_t;
+
+/* ek_clock_t: should be defined to be the native clock ticks type
+   used by the underlying system. (Look for time_t or similar.) */
+typedef unsigned long ek_clock_t; 
+
+#define EK_CONF_NUMSIGNALS   32    /* Must be 2^n */
+typedef unsigned char ek_num_signals_t;
+
+#define EK_CONF_NUMTIMERS    4    /* Must be 2^n */
+typedef unsigned char ek_num_timers_t;
+
+#define EK_CONF_NUMLISTENERS  32    /* Must be 2^n */
+typedef unsigned char ek_num_listeners_t;
+
+#define EK_CONF_UNLISTEN 0
+
+#endif /* __EK_CONF_H__ */
diff --git a/contiki-atari/conf/program-handler-conf.h b/contiki-atari/conf/program-handler-conf.h
new file mode 100644
index 0000000..8bade50
--- /dev/null
+++ b/contiki-atari/conf/program-handler-conf.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2004, Adam Dunkels.
+ * All rights reserved. 
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ * 2. Redistributions in binary form must reproduce the above copyright 
+ *    notice, this list of conditions and the following disclaimer in the 
+ *    documentation and/or other materials provided with the distribution. 
+ * 3. Neither the name of the Institute nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+ * SUCH DAMAGE. 
+ *
+ * This file is part of the Contiki operating system.
+ * 
+ * Author: Adam Dunkels <adam@sics.se>
+ *
+ * $Id: program-handler-conf.h,v 1.1 2005/02/15 14:56:01 oliverschmidt Exp $
+ */
+#ifndef __PROGRAM_HANDLER_CONF_H__
+#define __PROGRAM_HANDLER_CONF_H__
+
+#define PROGRAM_HANDLER_CONF_MAX_NUMDSCS 10
+
+#endif /* __PROGRAM_HANDLER_CONF_H__ */
diff --git a/contiki-atari/conf/www-conf.h b/contiki-atari/conf/www-conf.h
new file mode 100644
index 0000000..b9418fa
--- /dev/null
+++ b/contiki-atari/conf/www-conf.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2002, Adam Dunkels.
+ * All rights reserved. 
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials provided
+ *    with the distribution. 
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgement:
+ *        This product includes software developed by Adam Dunkels. 
+ * 4. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.  
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
+ *
+ * This file is part of the Contiki desktop environment
+ *
+ * $Id: www-conf.h,v 1.1 2003/04/12 01:54:07 sannyx Exp $
+ *
+ */
+#ifndef __WWW_CONF_H__
+#define __WWW_CONF_H__
+
+/* The size of the HTML viewing area. */
+#define WWW_CONF_WEBPAGE_WIDTH 36
+#define WWW_CONF_WEBPAGE_HEIGHT 17
+
+/* The size of the "Back" history. */
+#define WWW_CONF_HISTORY_SIZE 4
+
+/* Defines the maximum length of an URL */
+#define WWW_CONF_MAX_URLLEN 70  /* 100 in c64 version */
+
+/* The maxiumum number of widgets (i.e., hyperlinks, form elements) on
+   a page. */
+#define WWW_CONF_MAX_NUMPAGEWIDGETS 5  /* 20 in c64 version :-( */
+
+/* Turns <center> support on or off; must be on for forms to work. */
+#define WWW_CONF_RENDERSTATE 0
+
+/* Toggles support for HTML forms. */
+#define WWW_CONF_FORMS       0
+
+/* Maximum lengths for various HTML form parameters. */
+#define WWW_CONF_MAX_FORMACTIONLEN  40
+#define WWW_CONF_MAX_FORMNAMELEN    20
+#define WWW_CONF_MAX_INPUTNAMELEN   20
+#define WWW_CONF_MAX_INPUTVALUELEN  34
+
+#endif /* __WWW_CONF_H__ */
diff --git a/contiki-atari/contiki-main.c b/contiki-atari/contiki-main.c
new file mode 100644
index 0000000..1daf814
--- /dev/null
+++ b/contiki-atari/contiki-main.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2002, Adam Dunkels.
+ * All rights reserved. 
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials provided
+ *    with the distribution. 
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgement:
+ *        This product includes software developed by Adam Dunkels. 
+ * 4. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.  
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
+ *
+ * This file is part of the Contiki desktop environment 
+ *
+ * $Id: contiki-main.c,v 1.1 2003/04/12 01:55:45 sannyx Exp $
+ *
+ */
+
+#include "ctk.h"
+#include "ctk-draw.h"
+#include "dispatcher.h"
+
+
+#include "uip_main.h"
+#include "uip.h"
+#include "uip_arp.h"
+#if WITH_TFE
+#include "cs8900a.h"
+#endif /* WITH_TFE */
+#include "resolv.h"
+
+#include "program-handler.h"
+
+/*-----------------------------------------------------------------------------------*/
+int
+main(void /*int argc, char **argv*/)  /* no args, cc65 rt lib needs to be adapted first! */
+{
+
+#ifdef WITH_UIP
+  uip_init();
+  uip_main_init();
+  resolv_init();
+
+#ifdef WITH_RS232
+  rs232dev_init();
+#endif /* WITH_RS232 */
+  
+#endif /* WITH_UIP */
+  
+  ek_init();
+  dispatcher_init();
+  ctk_init();
+  
+  program_handler_init();
+  
+  ctk_redraw();
+  ek_run();
+
+  clrscr();
+  
+  return 0;
+
+  /*
+  argv = argv;
+  argc = argc;
+  */
+}
+/*-----------------------------------------------------------------------------------*/
diff --git a/contiki-atari/ctk/ctk-arch.h b/contiki-atari/ctk/ctk-arch.h
new file mode 100644
index 0000000..b8fef53
--- /dev/null
+++ b/contiki-atari/ctk/ctk-arch.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002, Adam Dunkels.
+ * All rights reserved. 
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials provided
+ *    with the distribution. 
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgement:
+ *        This product includes software developed by Adam Dunkels. 
+ * 4. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.  
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
+ *
+ * This file is part of the "ctk" console GUI toolkit for cc65
+ *
+ * $Id: ctk-arch.h,v 1.1 2003/04/12 01:47:05 sannyx Exp $
+ *
+ */
+#ifndef __CTK_ARCH_H__
+#define __CTK_ARCH_H__
+
+#include "ctk-conio.h"
+
+#endif /* __CTK_ARCH_H__ */
diff --git a/contiki-atari/ctk/ctk-conio-conf.h b/contiki-atari/ctk/ctk-conio-conf.h
new file mode 100644
index 0000000..dc57256
--- /dev/null
+++ b/contiki-atari/ctk/ctk-conio-conf.h
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2002, Adam Dunkels.
+ * All rights reserved. 
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials provided
+ *    with the distribution. 
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgement:
+ *        This product includes software developed by Adam Dunkels. 
+ * 4. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.  
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
+ *
+ * This file is part of the "ctk" console GUI toolkit for cc65
+ *
+ * $Id: ctk-conio-conf.h,v 1.2 2004/08/12 21:53:46 oliverschmidt Exp $
+ *
+ */
+
+#ifndef __CTK_CONIO_CONF_H__
+#define __CTK_CONIO_CONF_H__
+
+#if 0
+/* Light gray inverted color scheme: */
+#define BORDERCOLOR         COLOR_WHITE
+#define SCREENCOLOR         COLOR_WHITE
+#define BACKGROUNDCOLOR     COLOR_WHITE
+
+#define WINDOWCOLOR_FOCUS   COLOR_BLACK
+#define WINDOWCOLOR         COLOR_GRAY2
+
+#define DIALOGCOLOR         COLOR_RED
+
+#define WIDGETCOLOR_HLINK   COLOR_BLUE
+#define WIDGETCOLOR_FWIN    COLOR_BLACK
+#define WIDGETCOLOR         COLOR_GRAY1
+#define WIDGETCOLOR_DIALOG  COLOR_RED
+#define WIDGETCOLOR_FOCUS   COLOR_BLACK
+
+#define MENUCOLOR           COLOR_BLACK
+#define OPENMENUCOLOR       COLOR_BLACK
+#define ACTIVEMENUITEMCOLOR COLOR_BLACK
+#endif /* 0 */
+
+#if 0
+/* Blue color scheme: */
+#define BORDERCOLOR         COLOR_LIGHTBLUE
+#define SCREENCOLOR         COLOR_BLUE
+#define BACKGROUNDCOLOR     COLOR_BLUE
+
+#define WINDOWCOLOR_FOCUS   COLOR_LIGHTBLUE
+#define WINDOWCOLOR         COLOR_GRAY1
+
+#define DIALOGCOLOR         COLOR_WHITE
+
+#define WIDGETCOLOR_HLINK   COLOR_CYAN
+#define WIDGETCOLOR_FWIN    COLOR_LIGHTBLUE
+#define WIDGETCOLOR         COLOR_GRAY1
+#define WIDGETCOLOR_DIALOG  COLOR_WHITE
+#define WIDGETCOLOR_FOCUS   COLOR_YELLOW
+
+#define MENUCOLOR           COLOR_WHITE
+#define OPENMENUCOLOR       COLOR_LIGHTBLUE
+#define ACTIVEMENUITEMCOLOR COLOR_YELLOW
+#endif /* 0 */
+
+#if 1
+/* Black and white monocrome color scheme: */
+#define BORDERCOLOR         COLOR_BLACK
+#define SCREENCOLOR         COLOR_BLACK
+#define BACKGROUNDCOLOR     COLOR_BLACK
+
+#define WINDOWCOLOR_FOCUS   COLOR_WHITE
+#define WINDOWCOLOR         COLOR_WHITE
+
+#define DIALOGCOLOR         COLOR_WHITE
+
+#define WIDGETCOLOR_HLINK   COLOR_WHITE
+#define WIDGETCOLOR_FWIN    COLOR_WHITE
+#define WIDGETCOLOR         COLOR_WHITE
+#define WIDGETCOLOR_DIALOG  COLOR_WHITE
+#define WIDGETCOLOR_FOCUS   COLOR_WHITE
+
+#define MENUCOLOR           COLOR_WHITE
+#define OPENMENUCOLOR       COLOR_WHITE
+#define ACTIVEMENUITEMCOLOR COLOR_WHITE
+#endif /* 0 */
+
+#if 0
+/* Blue monocrome color scheme: */
+#define BORDERCOLOR         COLOR_BLUE
+#define SCREENCOLOR         COLOR_BLUE
+#define BACKGROUNDCOLOR     COLOR_BLUE
+
+#define WINDOWCOLOR_FOCUS   COLOR_LIGHTBLUE
+#define WINDOWCOLOR         COLOR_LIGHTBLUE
+
+#define DIALOGCOLOR         COLOR_LIGHTBLUE
+
+#define WIDGETCOLOR_HLINK   COLOR_LIGHTBLUE
+#define WIDGETCOLOR_FWIN    COLOR_LIGHTBLUE
+#define WIDGETCOLOR         COLOR_LIGHTBLUE
+#define WIDGETCOLOR_DIALOG  COLOR_LIGHTBLUE
+#define WIDGETCOLOR_FOCUS   COLOR_LIGHTBLUE
+
+#define MENUCOLOR           COLOR_LIGHTBLUE
+#define OPENMENUCOLOR       COLOR_LIGHTBLUE
+#define ACTIVEMENUITEMCOLOR COLOR_LIGHTBLUE
+#endif /* 0 */
+
+#if 0
+/* Gray color scheme: */
+#define BORDERCOLOR         COLOR_GRAY1
+#define SCREENCOLOR         COLOR_GRAY1
+#define BACKGROUNDCOLOR     COLOR_GRAY1
+
+#define WINDOWCOLOR_FOCUS   COLOR_GRAY3
+#define WINDOWCOLOR         COLOR_GRAY2
+
+#define DIALOGCOLOR         COLOR_WHITE
+
+#define WIDGETCOLOR_HLINK   COLOR_LIGHTBLUE
+#define WIDGETCOLOR_FWIN    COLOR_GRAY3
+#define WIDGETCOLOR         COLOR_GRAY2
+#define WIDGETCOLOR_DIALOG  COLOR_WHITE
+#define WIDGETCOLOR_FOCUS   COLOR_YELLOW
+
+#define MENUCOLOR           COLOR_GRAY3
+#define OPENMENUCOLOR       COLOR_WHITE
+#define ACTIVEMENUITEMCOLOR COLOR_YELLOW
+#endif /* 0 */
+
+#if 0
+/* Red color scheme: */
+#define BORDERCOLOR         COLOR_BLACK
+#define SCREENCOLOR         COLOR_BLACK
+#define BACKGROUNDCOLOR     COLOR_BLACK
+
+#define WINDOWCOLOR_FOCUS   COLOR_LIGHTRED
+#define WINDOWCOLOR         COLOR_RED
+
+#define DIALOGCOLOR         COLOR_WHITE
+
+#define WIDGETCOLOR_HLINK   COLOR_LIGHTBLUE
+#define WIDGETCOLOR_FWIN    COLOR_YELLOW
+#define WIDGETCOLOR         COLOR_LIGHTRED
+#define WIDGETCOLOR_DIALOG  COLOR_WHITE
+#define WIDGETCOLOR_FOCUS   COLOR_YELLOW
+
+#define MENUCOLOR           COLOR_LIGHTRED
+#define OPENMENUCOLOR       COLOR_WHITE
+#define ACTIVEMENUITEMCOLOR COLOR_YELLOW
+#endif /* 0 */
+
+
+#endif /* __CTK_CONIO_CONF_H__ */
diff --git a/contiki-atari/uip/rs232dev.c b/contiki-atari/uip/rs232dev.c
new file mode 100644
index 0000000..ca24885
--- /dev/null
+++ b/contiki-atari/uip/rs232dev.c
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2001, Adam Dunkels.
+ * All rights reserved. 
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ * 2. Redistributions in binary form must reproduce the above copyright 
+ *    notice, this list of conditions and the following disclaimer in the 
+ *    documentation and/or other materials provided with the distribution. 
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Adam Dunkels.
+ * 4. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.  
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
+ *
+ * This file is part of the uIP TCP/IP stack.
+ *
+ * $Id: rs232dev.c,v 1.4 2005/02/23 22:42:12 oliverschmidt Exp $
+ *
+ */
+
+/*
+ * This is a generic implementation of the SLIP protocol over an RS232
+ * (serial) device. While initially intented for the C64, the code can
+ * easily be ported to other platforms as well.
+ *
+ * Huge thanks to Ullrich von Bassewitz <uz@cc65.org> of cc65 fame for
+ * and endless supply of bugfixes, insightsful comments and
+ * suggestions, and improvements to this code!
+ */
+
+#include <rs232.h>
+#include <time.h>
+#include <string.h>
+
+ /* This will include the system specific header files as well */
+#if defined(__CBM__)
+#  include <cbm.h>
+#elif defined(__ATARI__)
+#  include <atari.h>
+#endif
+
+#include "uip.h"
+
+#define SLIP_END     0300
+#define SLIP_ESC     0333
+#define SLIP_ESC_END 0334
+#define SLIP_ESC_ESC 0335
+
+
+#define SIO_RECV(c)  while(rs232_get(&c) == RS_ERR_NO_DATA)
+#define SIO_POLL(c)  (rs232_get(&c) != RS_ERR_NO_DATA)
+#define SIO_SEND(c)  rs232_put(c)
+
+#define MAX_SIZE UIP_BUFSIZE
+
+static u8_t slip_buf[MAX_SIZE + 2];
+
+static u16_t len, tmplen;
+
+#if 1
+#define printf(x)
+#else
+#include <stdio.h>
+#endif
+
+
+/*-----------------------------------------------------------------------------------*/
+static void
+rs232_err(char err)
+{
+  switch(err) {
+  case RS_ERR_OK:
+    printf("RS232 OK\n");
+    break;
+  case RS_ERR_NOT_INITIALIZED:
+    printf("RS232 not initialized\n");
+    break;
+  case RS_ERR_BAUD_TOO_FAST:
+    printf("RS232 baud too fast\n");
+    break;
+  case RS_ERR_BAUD_NOT_AVAIL:
+    printf("RS232 baud rate not available\n");
+    break;
+  case RS_ERR_NO_DATA:
+    printf("RS232 nothing to read\n");
+    break;
+  case RS_ERR_OVERFLOW:
+    printf("RS232 overflow\n");
+    break;
+  }
+
+}
+/*-----------------------------------------------------------------------------------*/
+/*
+ * rs232dev_send():
+ *
+ * Sends the packet in the uip_buf and uip_appdata buffers. The first
+ * 40 bytes of the packet (the IP and TCP headers) are read from the
+ * uip_buf buffer, and the following bytes (the application data) are
+ * read from the uip_appdata buffer.
+ *
+ */
+/*-----------------------------------------------------------------------------------*/
+void
+rs232dev_send(void)
+{
+  u16_t i;
+  u8_t *ptr;
+  u8_t c;
+
+  SIO_SEND(SLIP_END);
+
+  ptr = uip_buf;
+  for(i = 0; i < uip_len; ++i) {
+    if(i == UIP_TCPIP_HLEN) {
+      ptr = uip_appdata;
+    }
+    c = *ptr++;
+    switch(c) {
+    case SLIP_END:
+      SIO_SEND(SLIP_ESC);
+      SIO_SEND(SLIP_ESC_END);
+      break;
+    case SLIP_ESC:
+      SIO_SEND(SLIP_ESC);
+      SIO_SEND(SLIP_ESC_ESC);
+      break;
+    default:
+      SIO_SEND(c);
+      break;
+    }
+  }
+  SIO_SEND(SLIP_END);
+}
+/*-----------------------------------------------------------------------------------*/
+/*
+ * rs232dev_poll():
+ *
+ * Read all avaliable bytes from the RS232 interface into the slip_buf
+ * buffer. If no more bytes are avaliable, it returns with 0 to
+ * indicate that no packet was immediately ready. When a full packet
+ * has been read into the buffer, the packet is copied into the
+ * uip_buf buffer and the length of the packet is returned.
+ *
+ */
+/*-----------------------------------------------------------------------------------*/
+u16_t
+rs232dev_poll(void)
+{
+  u8_t c;
+  static u8_t lastc;
+  
+  while(SIO_POLL(c)) {
+    /*    printf("c %x\n", c);*/
+    switch(c) {
+    case SLIP_ESC:
+      lastc = c;
+      break;
+      
+    case SLIP_END:
+      lastc = c;
+      /* End marker found, we copy our input buffer to the uip_buf
+	 buffer and return the size of the packet we copied. */
+      memcpy(uip_buf, slip_buf, len);
+      tmplen = len;
+      len = 0;
+      return tmplen;
+      
+    default:     
+      if(lastc == SLIP_ESC) {
+	lastc = c;
+	/* Previous read byte was an escape byte, so this byte will be
+	   interpreted differently from others. */
+	switch(c) {
+	case SLIP_ESC_END:
+	  c = SLIP_END;
+	  break;
+	case SLIP_ESC_ESC:
+	  c = SLIP_ESC;
+	  break;
+	}
+      } else {
+	lastc = c;
+      }
+      
+      
+      slip_buf[len] = c;
+      ++len;
+      
+      if(len > MAX_SIZE) {
+	len = 0;
+      }
+    
+      break;
+    }
+  }
+  return 0;
+}
+/*-----------------------------------------------------------------------------------*/
+/*
+ * rs232dev_init():
+ *
+ * Initializes the RS232 device and sets the parameters of the device.
+ *
+ */ 
+/*-----------------------------------------------------------------------------------*/
+void
+rs232dev_init(void)
+{
+  char err;
+  
+  err = rs232_init(0);
+  rs232_err(err);
+  err = rs232_params(RS_BAUD_9600 | RS_BITS_8 | RS_STOP_1, RS_PAR_NONE);
+  rs232_err(err);
+
+  len = 0;
+
+  return;
+}
+/*-----------------------------------------------------------------------------------*/
diff --git a/contiki-atari/uip/rs232dev.h b/contiki-atari/uip/rs232dev.h
new file mode 100644
index 0000000..c6bd09d
--- /dev/null
+++ b/contiki-atari/uip/rs232dev.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2001, Adam Dunkels.
+ * All rights reserved. 
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ * 2. Redistributions in binary form must reproduce the above copyright 
+ *    notice, this list of conditions and the following disclaimer in the 
+ *    documentation and/or other materials provided with the distribution. 
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Adam Dunkels.
+ * 4. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.  
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
+ *
+ * This file is part of the uIP TCP/IP stack.
+ *
+ * $Id: rs232dev.h,v 1.2 2005/01/26 23:36:23 oliverschmidt Exp $
+ *
+ */
+
+#ifndef __RS232DEV_H__
+#define __RS232DEV_H__
+
+#include "uip.h"
+
+void rs232dev_init(void);
+u8_t rs232dev_read(void);
+void rs232dev_send(void);
+u16_t rs232dev_poll(void);
+
+#endif /* __RS232DEV_H__ */
diff --git a/contiki-atari/uip/uip_arch.c b/contiki-atari/uip/uip_arch.c
new file mode 100644
index 0000000..57ca785
--- /dev/null
+++ b/contiki-atari/uip/uip_arch.c
@@ -0,0 +1,371 @@
+/*
+ * Copyright (c) 2001, Adam Dunkels.
+ * All rights reserved. 
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ * 2. Redistributions in binary form must reproduce the above copyright 
+ *    notice, this list of conditions and the following disclaimer in the 
+ *    documentation and/or other materials provided with the distribution. 
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Adam Dunkels.
+ * 4. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.  
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
+ *
+ * This file is part of the uIP TCP/IP stack.
+ *
+ * $Id: uip_arch.c,v 1.4 2005/02/24 22:03:15 oliverschmidt Exp $
+ *
+ */
+
+
+#include "uip.h"
+#include "uip_arch.h"
+
+#define BUF ((uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
+#define IP_PROTO_TCP    6
+
+/*-----------------------------------------------------------------------------------*/
+#pragma optimize(push, off)
+void
+uip_add32(u8_t *op32, u16_t op16)
+{
+  asm("ldy #3");
+  asm("jsr ldaxysp");
+  asm("sta ptr1");
+  asm("stx ptr1+1");
+  asm("ldy #0");
+  asm("lda (sp),y");
+  asm("ldy #3");
+  asm("clc");
+  asm("adc (ptr1),y");
+  asm("sta _uip_acc32+3");
+  asm("dey");
+  asm("lda (ptr1),y");
+  asm("ldy #1");
+  asm("adc (sp),y");
+  asm("sta _uip_acc32+2");
+  asm("ldy #1");
+  asm("lda (ptr1),y");
+  asm("adc #0");
+  asm("sta _uip_acc32+1");
+  asm("dey");
+  asm("lda (ptr1),y");
+  asm("adc #0");
+  asm("sta _uip_acc32+0");  
+}
+#pragma optimize(pop)
+/*-----------------------------------------------------------------------------------*/
+void
+uip_add_rcv_nxt(u16_t n) {
+  uip_add32(uip_conn->rcv_nxt, n);
+  uip_conn->rcv_nxt[0] = uip_acc32[0];
+  uip_conn->rcv_nxt[1] = uip_acc32[1];
+  uip_conn->rcv_nxt[2] = uip_acc32[2];
+  uip_conn->rcv_nxt[3] = uip_acc32[3];
+  /*  asm("pha");
+  asm("lda _uip_conn");
+  asm("sta ptr1");
+  asm("lda _uip_conn+1");
+  asm("sta ptr1+1");
+  asm("pla");
+  asm("clc");
+  asm("ldy #3");
+  asm("adc (ptr1),y");
+  asm("sta (ptr1),y");
+  asm("dey");
+  asm("txa");
+  asm("adc (ptr1),y");
+  asm("sta (ptr1),y");
+  asm("dey");
+  asm("lda #0");
+  asm("adc (ptr1),y");
+  asm("sta (ptr1),y");
+  asm("dey");
+  asm("lda #0");
+  asm("adc (ptr1),y");
+  asm("sta (ptr1),y");
+
+  n=n;*/
+}
+/*-----------------------------------------------------------------------------------*/
+static u16_t chksum_ptr, chksum_len, chksum_tmp;
+static u16_t chksum(void);
+/*-----------------------------------------------------------------------------------*/
+#pragma optimize(push, off)
+u16_t
+chksum(void) {
+
+  asm("lda #0");
+  asm("sta tmp1");
+  asm("sta tmp1+1");
+  asm("lda _chksum_ptr");
+  asm("sta ptr1");
+  asm("lda _chksum_ptr+1");
+  asm("sta ptr1+1");
+
+
+  asm("lda _chksum_len+1");
+  asm("beq chksumlast");
+
+
+  /* If checksum is > 256, do the first runs. */
+  asm("ldy #0");
+  asm("clc");
+  asm("chksumloop_256:");
+  asm("lda (ptr1),y");
+  asm("adc tmp1");
+  asm("sta tmp1");
+  asm("iny");
+  asm("lda (ptr1),y");
+  asm("adc tmp1+1");
+  asm("sta tmp1+1");
+  asm("iny");
+  asm("bne chksumloop_256");
+  asm("inc ptr1+1");
+  asm("dec _chksum_len+1");
+  asm("bne chksumloop_256");
+
+  asm("chksum_endloop_256:");
+  asm("lda tmp1");
+  asm("adc #0");
+  asm("sta tmp1");
+  asm("lda tmp1+1");
+  asm("adc #0");
+  asm("sta tmp1+1");
+  asm("bcs chksum_endloop_256");
+  
+  asm("chksumlast:");
+  asm("lda _chksum_len");
+  asm("lsr");
+  asm("bcc chksum_noodd");  
+  asm("ldy _chksum_len");
+  asm("dey");
+  asm("lda (ptr1),y");
+  asm("clc");
+  asm("adc tmp1");
+  asm("sta tmp1");
+  asm("bcc noinc1");
+  asm("inc tmp1+1");
+  asm("bne noinc1");
+  asm("inc tmp1");
+  asm("noinc1:");
+  asm("dec _chksum_len");
+
+  asm("chksum_noodd:");
+  asm("clc");
+  asm("php");
+  asm("ldy _chksum_len");
+  asm("chksum_loop1:");
+  asm("cpy #0");
+  asm("beq chksum_loop1_end");
+  asm("plp");
+  asm("dey");
+  asm("dey");
+  asm("lda (ptr1),y");
+  asm("adc tmp1");
+  asm("sta tmp1");
+  asm("iny");
+  asm("lda (ptr1),y");
+  asm("adc tmp1+1");
+  asm("sta tmp1+1");
+  asm("dey");
+  asm("php");
+  asm("jmp chksum_loop1");
+  asm("chksum_loop1_end:");
+  asm("plp");
+  
+  asm("chksum_endloop:");
+  asm("lda tmp1");
+  asm("adc #0");
+  asm("sta tmp1");
+  asm("lda tmp1+1");
+  asm("adc #0");
+  asm("sta tmp1+1");
+  asm("bcs chksum_endloop");
+  
+  asm("lda tmp1");
+  asm("ldx tmp1+1");
+}
+#pragma optimize(pop)
+/*-----------------------------------------------------------------------------------*/
+u16_t
+uip_chksum(u16_t *buf, u16_t len)
+{
+  /*  unsigned long sum;
+
+  sum = 0;
+
+  chksum_ptr = (u16_t)buf;
+  while(len >= 256) {  
+    chksum_len = 256;
+    sum += chksum();
+    len -= 256;
+    chksum_ptr += 256;
+  }
+
+  if(len < 256) {
+    chksum_len = len;
+    sum += chksum();
+  }
+
+  while((sum >> 16) != 0) {
+    sum = (sum >> 16) + (sum & 0xffff);
+  }
+
+  return sum;*/
+
+  chksum_len = len;
+  chksum_ptr = (u16_t)buf;
+  return chksum();
+}
+/*-----------------------------------------------------------------------------------*/
+u16_t
+uip_ipchksum(void)
+{  
+  chksum_ptr = (u16_t)uip_buf + UIP_LLH_LEN;
+  chksum_len = UIP_IPH_LEN;  
+  return chksum();
+}
+/*-----------------------------------------------------------------------------------*/
+#pragma optimize(push, off)
+u16_t
+uip_tcpchksum(void)
+{  
+  chksum_ptr = (u16_t)&uip_buf[20 + UIP_LLH_LEN];
+  chksum_len = 20;  
+  chksum_tmp = chksum();
+
+  chksum_ptr = (u16_t)uip_appdata;
+#ifdef WITH_TFE
+  asm("lda _uip_buf+3+14");
+#else /* WITH_TFE */
+  asm("lda _uip_buf+3");
+#endif /* WITH_TFE */
+  asm("sec");
+  asm("sbc #40");
+  asm("sta _chksum_len");
+#ifdef WITH_TFE
+  asm("lda _uip_buf+2+14");
+#else /* WITH_TFE */
+  asm("lda _uip_buf+2");
+#endif /* WITH_TFE */
+  asm("sbc #0");
+  asm("sta _chksum_len+1");
+
+  asm("jsr %v", chksum);
+
+  asm("clc");
+  asm("adc _chksum_tmp");
+  asm("sta _chksum_tmp");
+  asm("txa");
+  asm("adc _chksum_tmp+1");
+  asm("sta _chksum_tmp+1");
+
+  /* Fold carry */
+  /*  asm("bcc noinc");
+  asm("inc _chksum_tmp");
+  asm("noinc:");*/
+  
+  asm("tcpchksum_loop1:");
+  asm("lda _chksum_tmp");
+  asm("adc #0");
+  asm("sta _chksum_tmp");
+  asm("lda _chksum_tmp+1");
+  asm("adc #0");
+  asm("sta _chksum_tmp+1");
+  asm("bcs tcpchksum_loop1");
+
+
+#ifdef WITH_TFE
+  asm("lda _uip_buf+3+14");
+#else /* WITH_TFE */
+  asm("lda _uip_buf+3");
+#endif /* WITH_TFE */
+  asm("sec");
+  asm("sbc #20");
+  asm("sta _chksum_len");
+#ifdef WITH_TFE
+  asm("lda _uip_buf+2+14");
+#else /* WITH_TFE */
+  asm("lda _uip_buf+2");
+#endif /* WITH_TFE */
+  asm("sbc #0");
+  asm("sta _chksum_len+1");
+  
+  
+  asm("ldy #$0c");
+  asm("clc");
+  asm("php");
+  asm("tcpchksum_loop2:");
+  asm("plp");
+#ifdef WITH_TFE
+  asm("lda _uip_buf+14,y");
+#else /* WITH_TFE */
+  asm("lda _uip_buf,y");
+#endif /* WITH_TFE */  
+  asm("adc _chksum_tmp");
+  asm("sta _chksum_tmp");
+  asm("iny");
+#ifdef WITH_TFE 
+  asm("lda _uip_buf+14,y");
+#else /* WITH_TFE */
+  asm("lda _uip_buf,y");
+#endif /* WITH_TFE */  
+  asm("adc _chksum_tmp+1");
+  asm("sta _chksum_tmp+1");
+  asm("iny");
+  asm("php");
+  asm("cpy #$14");
+  asm("bne tcpchksum_loop2");
+
+  asm("plp");
+  
+  asm("lda _chksum_tmp");
+  asm("adc #0");
+  asm("sta _chksum_tmp");
+  asm("lda _chksum_tmp+1");
+  asm("adc #6");  /* IP_PROTO_TCP */
+  asm("sta _chksum_tmp+1");
+
+  
+  asm("lda _chksum_tmp");
+  asm("adc _chksum_len+1");
+  asm("sta _chksum_tmp");
+  asm("lda _chksum_tmp+1");
+  asm("adc _chksum_len");
+  asm("sta _chksum_tmp+1");
+
+  
+
+  asm("tcpchksum_loop3:");
+  asm("lda _chksum_tmp");
+  asm("adc #0");
+  asm("sta _chksum_tmp");
+  asm("lda _chksum_tmp+1");
+  asm("adc #0");
+  asm("sta _chksum_tmp+1");
+  asm("bcs tcpchksum_loop3");
+
+
+  return chksum_tmp;
+}
+#pragma optimize(pop)
+/*-----------------------------------------------------------------------------------*/
diff --git a/contiki-atari/uip/uip_arch.h b/contiki-atari/uip/uip_arch.h
new file mode 100644
index 0000000..f7ccbb3
--- /dev/null
+++ b/contiki-atari/uip/uip_arch.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2001, Adam Dunkels.
+ * All rights reserved. 
+ *
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ * 2. Redistributions in binary form must reproduce the above copyright 
+ *    notice, this list of conditions and the following disclaimer in the 
+ *    documentation and/or other materials provided with the distribution. 
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed by Adam Dunkels.
+ * 4. The name of the author may not be used to endorse or promote
+ *    products derived from this software without specific prior
+ *    written permission.  
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
+ *
+ * This file is part of the uIP TCP/IP stack.
+ *
+ * $Id: uip_arch.h,v 1.2 2005/01/26 23:36:23 oliverschmidt Exp $
+ *
+ */
+
+#ifndef __UIP_ARCH_H__
+#define __UIP_ARCH_H__
+
+#include "uip.h"
+
+void uip_add_rcv_nxt(u16_t n);
+void uip_add32(u8_t *op32, u16_t op16);
+u16_t uip_chksum(u16_t *data, u16_t len);
+u16_t uip_ipchksum(void);
+u16_t uip_tcpchksum(void);
+
+#endif /* __UIP_ARCH_H__ */