diff -urN dosemu-0.99.11/src/base/async/dyndeb.c mydosemu/src/base/async/dyndeb.c
--- dosemu-0.99.11/src/base/async/dyndeb.c	Sat Jan  9 02:05:19 1999
+++ mydosemu/src/base/async/dyndeb.c	Thu May 13 11:54:00 1999
@@ -50,6 +50,7 @@
   debugStr[i++] = DebugFlag(d.io);       debugStr[i++] = 'i';
   debugStr[i++] = DebugFlag(d.io_trace); debugStr[i++] = 'T';
   debugStr[i++] = DebugFlag(d.serial);   debugStr[i++] = 's';
+  debugStr[i++] = DebugFlag(d.logserial);debugStr[i++] = 'l';
   debugStr[i++] = DebugFlag(d.mouse);    debugStr[i++] = 'm';
   debugStr[i++] = DebugFlag(d.defint);   debugStr[i++] = '#';
   debugStr[i++] = DebugFlag(d.printer);  debugStr[i++] = 'p';
diff -urN dosemu-0.99.11/src/base/init/config.c mydosemu/src/base/init/config.c
--- dosemu-0.99.11/src/base/init/config.c	Sat Mar 13 00:16:23 1999
+++ mydosemu/src/base/init/config.c	Thu May 13 11:53:28 1999
@@ -1116,6 +1116,9 @@
 	case 's':		/* serial */
 	    d.serial = flag;
 	    break;
+	case 'l':		/* logserial */
+	    d.logserial = flag;
+	    break;
 	case 'm':		/* mouse */
 	    d.mouse = flag;
 	    break;
@@ -1227,6 +1230,7 @@
 	"       P=packet  R=diskread S=sound  W=diskwrite c=config  d=disk\n"
 	"       g=general h=hardware i=i/o    k=keyb      m=mouse   n=ipxnet\n"
 	"       p=printer r=pic      s=serial v=video     w=warning x=xms\n"
+	"       l=logserial\n"
 	"    -E STRING pass DOS command on command line\n"
 	"    -e SIZE enable SIZE K EMS RAM\n"
 	"    -F use File as global config-file\n"
diff -urN dosemu-0.99.11/src/base/serial/Makefile mydosemu/src/base/serial/Makefile
--- dosemu-0.99.11/src/base/serial/Makefile	Sat Jan  9 02:05:19 1999
+++ mydosemu/src/base/serial/Makefile	Thu May 13 12:01:18 1999
@@ -10,15 +10,15 @@
 SUBDIR=serial
 
 #The C files, include files and dependancies here.
-CFILES = ser_init.c ser_irq.c ser_ports.c int14.c fossil.c
-DEPENDS= ser_init.d ser_irq.d ser_ports.d int14.d fossil.d
-HFILES = ser_defs.h
+CFILES = ser_init.c ser_irq.c ser_ports.c int14.c fossil.c log_serial.c
+DEPENDS= ser_init.d ser_irq.d ser_ports.d int14.d fossil.d log_serial.d
+HFILES = ser_defs.h log_serial.h
 
 # Insert all source- and header-files here.
 ALL = $(CFILES) $(HFILES) README.serial
 
 # All object-files are included here.
-OBJS = ser_init.o ser_irq.o ser_ports.o int14.o fossil.o
+OBJS = ser_init.o ser_irq.o ser_ports.o int14.o fossil.o log_serial.o
 
 all: lib
 
Binary files dosemu-0.99.11/src/base/serial/a.out and mydosemu/src/base/serial/a.out differ
diff -urN dosemu-0.99.11/src/base/serial/log_serial.c mydosemu/src/base/serial/log_serial.c
--- dosemu-0.99.11/src/base/serial/log_serial.c	Thu Jan  1 01:00:00 1970
+++ mydosemu/src/base/serial/log_serial.c	Thu May 13 18:52:14 1999
@@ -0,0 +1,137 @@
+#include <stdio.h>
+#include <sys/param.h>
+#include <sys/time.h>
+
+#include "log_serial.h"
+
+static last_type = -1;
+static struct timeval tv_last = {0,0};
+static in_quote = 0;
+static int last_was_crlf=0;
+
+static FILE *f=NULL;
+static char filename[MAXPATHLEN];
+
+static void newline(int type, int port);
+static void startquote(void);
+static void endquote(void);
+static char *typename(int type);
+
+void start_serial_log(void)
+{
+	time_t t;
+	struct tm *tm;
+
+	t= time(NULL);
+	tm = gmtime(&t);
+
+	strftime(filename, sizeof(filename), "/tmp/serial.%Y%m%d%H%M%S", tm);
+
+	f = fopen(filename, "w");
+
+	setlinebuf(f);
+
+	last_type = -1;
+	tv_last.tv_sec = 0;
+	tv_last.tv_usec = 0;
+	in_quote = 0;
+	last_was_crlf = 0;
+	
+}
+
+void end_serial_log(void)
+{
+	newline(SER_END, -1);
+	fclose(f);
+}
+
+void log_serial(int logtype, int port, char *buf, int bufLen)
+{
+	if (bufLen==STR_NT)
+		bufLen = strlen(buf);
+
+	if (logtype != last_type)
+		newline(logtype, port);
+	last_type = logtype;
+
+	while (bufLen--)
+	{
+		int c = *buf++;
+		if (last_was_crlf && !(c=='\r' || c=='\n'))
+		{
+			newline(logtype, port);
+		}
+		last_was_crlf = (c=='\r' || c=='\n');
+
+		if (c<' ' || c>'~')
+		{
+			endquote();
+			fprintf(f, " %02x", c&0xff);
+		}
+		else
+		{
+			startquote();
+			if (c=='"' || c=='\\')
+				fprintf(f, "\\");
+			fprintf(f, "%c", c);
+		}
+	}
+}
+
+long tvdiff(struct timeval *t0, struct timeval *t1)
+{
+	long diff = t0->tv_sec - t1->tv_sec;
+
+	if (diff > 2000)
+		return -1;
+
+	return diff * 1000000 + t0->tv_usec - t1->tv_usec;
+}
+
+void newline(int type, int port)
+{
+	struct timeval tv_now;
+
+	gettimeofday(&tv_now, NULL);
+
+	if (tv_last.tv_sec==0)
+		tv_last = tv_now;
+
+	endquote();
+	fprintf(f, "\n%8ld %d%s ", tvdiff(&tv_now,&tv_last), port, typename(type));
+
+	tv_last = tv_now;
+}
+
+void endquote(void)
+{
+	if (in_quote)
+	{
+		fprintf(f, "\"");
+		in_quote=0;
+	}
+}
+
+void startquote(void)
+{
+	if (!in_quote)
+	{
+		fprintf(f, " \"");
+		in_quote=1;
+	}
+}
+
+static char *typename(int type)
+{
+	switch(type)
+	{
+		case SER_READ:
+			return "<";
+		case SER_WRITE:
+			return ">";
+		case SER_END:
+			return ":";
+		default:
+			return "?";
+	}
+}
diff -urN dosemu-0.99.11/src/base/serial/log_serial.h mydosemu/src/base/serial/log_serial.h
--- dosemu-0.99.11/src/base/serial/log_serial.h	Thu Jan  1 01:00:00 1970
+++ mydosemu/src/base/serial/log_serial.h	Thu May 13 11:59:09 1999
@@ -0,0 +1,8 @@
+#define SER_READ  0
+#define SER_WRITE 1
+#define SER_END   2
+#define STR_NT -1
+
+void start_serial_log(void);
+void end_serial_log(void);
+void log_serial(int logtype, int port, char *buf, int bufLen);
diff -urN dosemu-0.99.11/src/base/serial/ser_init.c mydosemu/src/base/serial/ser_init.c
--- dosemu-0.99.11/src/base/serial/ser_init.c	Sat Jan  9 02:05:19 1999
+++ mydosemu/src/base/serial/ser_init.c	Thu May 13 12:07:17 1999
@@ -68,6 +68,8 @@
 #include "priv.h"
 #include "utilities.h"	/* due to getpwnam */
 
+#include "log_serial.h"
+
 /* See README.serial file for more information on the com[] structure 
  * The declarations for this is in ../include/serial.h
  */
@@ -233,7 +235,7 @@
 static int ser_open(int num)
 {
   s_printf("SER%d: Running ser_open, fd=%d\n",num, com[num].fd);
-  
+ 
   if (com[num].fd != -1) return (com[num].fd);
   
   if ( tty_lock(com[num].dev, 1) >= 0) {		/* Lock port */
@@ -288,6 +290,7 @@
     if (tty_lock(com[num].dev, 0) >= 0) 
       com[num].dev_locked = FALSE;
   }
+
   return (i);
 }
 
@@ -553,6 +556,8 @@
   warn("SERIAL $Header: /var/lib/cvs/itsme_homepage/projects/gt/dosemu.patch,v 1.1.1.1 2003/11/01 12:14:07 itsme Exp $\n");
   s_printf("SER: Running serial_init, %d serial ports\n", config.num_ser);
 
+  if (d.logserial) start_serial_log();
+
   /* Clean the BIOS data area at 0040:0000 for serial ports */
 #if 1
   *(u_short *) 0x400 = 0;
@@ -600,6 +605,7 @@
       ser_close(i);
     }
   }
+  if (d.logserial) end_serial_log();
 }
 
 /* The following de-initializes the mouse on the serial port that the mouse
diff -urN dosemu-0.99.11/src/base/serial/ser_ports.c mydosemu/src/base/serial/ser_ports.c
--- dosemu-0.99.11/src/base/serial/ser_ports.c	Sat Jan  9 02:05:19 1999
+++ mydosemu/src/base/serial/ser_ports.c	Thu May 13 12:00:40 1999
@@ -40,6 +40,7 @@
 #include "serial.h"
 #include "ser_defs.h"
 
+#include "log_serial.h"
 
 /*************************************************************************/
 /*                 MISCELLANOUS serial support functions                 */
@@ -944,6 +945,7 @@
     else {
       val = get_rx(num);	/* Else, read Received Byte Register */
       if(s2_printf) s_printf("SER%d: Receive 0x%x\n",num,val);
+		if(d.logserial) log_serial(SER_READ, num, (char*)&val, sizeof(char));
     }
     break;
 
@@ -1031,6 +1033,7 @@
         else
           s_printf("SER%d: Transmit 0x%x\n",num,val);
       }
+		if(d.logserial) log_serial(SER_WRITE, num, (char*)&val, sizeof(char));
     }
     break;
 
diff -urN dosemu-0.99.11/src/include/dosemu_debug.h mydosemu/src/include/dosemu_debug.h
--- dosemu-0.99.11/src/include/dosemu_debug.h	Sat Jan  9 02:05:22 1999
+++ mydosemu/src/include/dosemu_debug.h	Thu May 13 11:52:11 1999
@@ -44,6 +44,7 @@
    io,			/* port I/O          "i" */
    io_trace, 		/* I/O trace         "T" */
    serial,		/* serial            "s" */
+   logserial,	/* log serial        "l" */
    mouse,		/* mouse             "m" */
    defint,		/* default ints      "#" */
    printer,		/* printer           "p" */
