diff -u --recursive --new-file dosemu0.51old//ChangeLog dosemu0.51//ChangeLog
--- dosemu0.51old//ChangeLog	Thu May 26 21:03:19 1994
+++ dosemu0.51//ChangeLog	Sun May 29 21:15:47 1994
@@ -1,3 +1,8 @@
+Sun May 29 1994 JES
+
+-	Stuck in a fix for DIR a: error. It's a KLUDGE  for now, but
+	I hope it will show where the error is.
+
 Thr May 26 1994 JES
 
 -	More mods to int_queue_run(). Changed where set_leds() is 
diff -u --recursive --new-file dosemu0.51old//Makefile dosemu0.51//Makefile
--- dosemu0.51old//Makefile	Thu May 26 21:03:19 1994
+++ dosemu0.51//Makefile	Sun May 29 21:15:47 1994
@@ -1,8 +1,8 @@
 # Makefile for Linux DOS emulator
 #
-# $Date: 1994/05/26 23:15:01 $
+# $Date: 1994/05/30 00:08:20 $
 # $Source: /home/src/dosemu0.60/RCS/Makefile,v $
-# $Revision: 1.59 $
+# $Revision: 1.60 $
 # $State: Exp $
 #
 
diff -u --recursive --new-file dosemu0.51old//disks.c dosemu0.51//disks.c
--- dosemu0.51old//disks.c	Thu May 26 21:03:18 1994
+++ dosemu0.51//disks.c	Sun May 29 21:15:46 1994
@@ -1,9 +1,9 @@
 /* dos emulator, Matthias Lautner
  * Extensions by Robert Sanders, 1992-93
  *
- * $Date: 1994/05/26 23:15:01 $
+ * $Date: 1994/05/30 00:08:20 $
  * $Source: /home/src/dosemu0.60/RCS/disks.c,v $
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
  * $State: Exp $
  *
  * floppy disks, dos partitions or their images (files) (maximum 8 heads)
@@ -398,9 +398,9 @@
 
   if (dp == NULL || dp->fdesc >= 0)
     return;
-  dp->fdesc = open(dp->dev_name, dp->rdonly ? O_RDONLY : O_RDWR, 0);
+  dp->fdesc = DOS_SYSCALL(open(dp->dev_name, dp->rdonly ? O_RDONLY : O_RDWR, 0));
   if (dp->fdesc < 0) {
-    error("ERROR: (disk) can't open %s: %s\n", dp->dev_name, strerror(errno));
+    d_printf("ERROR: (disk) can't open %s: %s\n", dp->dev_name, strerror(errno));
     fatalerr = 5;
     return;
   }
@@ -943,7 +943,7 @@
   }
 }
 
-#define FLUSH_DELAY 5
+#define FLUSH_DELAY 2
 
 /* flush disks every FLUSH_DELAY seconds
  * XXX - make this configurable later
diff -u --recursive --new-file dosemu0.51old//dosio.c dosemu0.51//dosio.c
--- dosemu0.51old//dosio.c	Thu May 26 21:03:18 1994
+++ dosemu0.51//dosio.c	Sun May 29 21:15:46 1994
@@ -4,12 +4,15 @@
 /*
  * Robert Sanders, started 3/1/93
  *
- * $Date: 1994/05/26 23:15:01 $
+ * $Date: 1994/05/30 00:08:20 $
  * $Source: /home/src/dosemu0.60/RCS/dosio.c,v $
- * $Revision: 1.24 $
+ * $Revision: 1.25 $
  * $State: Exp $
  *
  * $Log: dosio.c,v $
+ * Revision 1.25  1994/05/30  00:08:20  root
+ * Prep for pre51_22 and temp kludge fix for dir a: error.
+ *
  * Revision 1.24  1994/05/26  23:15:01  root
  * Prep. for pre51_21.
  *
@@ -401,7 +404,7 @@
   if (mice->intdrv)
     FD_SET(mice->fd, &fds);
 
-  switch ((selrtn = select(10, &fds, NULL, NULL, &tvptr))) {
+  switch ((selrtn = select(15, &fds, NULL, NULL, &tvptr))) {
     case 0:			/* none ready, nothing to do :-) */
       return;
       break;
diff -u --recursive --new-file dosemu0.51old//emu.c dosemu0.51//emu.c
--- dosemu0.51old//emu.c	Thu May 26 21:03:18 1994
+++ dosemu0.51//emu.c	Sun May 29 21:15:46 1994
@@ -1,12 +1,15 @@
 #define EMU_C 1
 /* Extensions by Robert Sanders, 1992-93
  *
- * $Date: 1994/05/26 23:15:01 $
+ * $Date: 1994/05/30 00:08:20 $
  * $Source: /home/src/dosemu0.60/RCS/emu.c,v $
- * $Revision: 1.86 $
+ * $Revision: 1.87 $
  * $State: Exp $
  *
  * $Log: emu.c,v $
+ * Revision 1.87  1994/05/30  00:08:20  root
+ * Prep for pre51_22 and temp kludge fix for dir a: error.
+ *
  * Revision 1.86  1994/05/26  23:15:01  root
  * Prep. for pre51_21.
  *
@@ -479,7 +482,7 @@
 #endif
 
 int scrtest_bitmap, update_screen;	/* Flags to test if screen to be updated */
-unsigned char *scrbuf;		/* the previously updated screen */
+unsigned char *scrbuf;	/* the previously updated screen */
 
 int card_init = 0;		/* VGAon exectuted flag */
 unsigned long precard_eip, precard_cs;	/* Save state at VGAon */
@@ -1015,13 +1018,9 @@
   static int partials = 0;
   static u_char timals = 0;
 
-#ifdef DPMI
-  if (in_dpmi && !in_vm86)
-    dpmi_sigalrm(&context);
-#endif /* DPMI */
-
-  if (inalrm) {
-    error("ERROR: Reentering SIGALRM!\n");
+  if (inalrm || in_sighandler) {
+    error("ERROR: Reentering SIGALRM! alrm=%d, in_sig=%d\n", inalrm, in_sighandler);
+    setitimer(TIMER_TIME, &itv, NULL);
     return;
   }
 
@@ -1028,6 +1027,11 @@
   inalrm = 1;
   in_sighandler = 1;
 
+#ifdef DPMI
+  if (in_dpmi && !in_vm86)
+    dpmi_sigalrm(&context);
+#endif /* DPMI */
+
   if (((vm86s.screen_bitmap & scrtest_bitmap && !config.console_video) ||
        (update_screen && !config.console_video)) && !running) {
     running = 1;
@@ -1036,7 +1040,9 @@
     running = 0;
   }
 
+#if 0
   setitimer(TIMER_TIME, &itv, NULL);
+#endif
 
   if (mice->intdrv)
     mouse_curtick();
@@ -1070,7 +1076,7 @@
     }
   }
   else
-    error("NOT CONFIG.TIMERS\n");
+    h_printf("NOT CONFIG.TIMERS\n");
 
   /* Call select to see if any I/O is ready on devices */
   io_select();
@@ -1079,10 +1085,6 @@
   partials++;
   if (partials == FREQ) {
     partials = 0;
-#if 0 /* Try seting leds in ports.h outb 0x20 94/05/25 */
-    if (config.console_keyb)
-      set_leds();
-#endif
     printer_tick((u_long) 0);
     if (config.fastfloppy)
       floppy_tick();
@@ -1678,8 +1680,9 @@
   exchange_uids();
 
   /* allocate screen buffer for non-console video compare speedup */
-  scrbuf = malloc(CO * LI * 2);
-  v_printf("SCREEN saves at: %p\n", scrbuf);
+  scrbuf = (u_char *)malloc(CO * LI * 2);
+  scrbuf = (u_char *)malloc(CO * LI * 2);
+  v_printf("SCREEN saves at: %p of %d size\n", scrbuf, CO * LI * 2);
 
   /* setup DOS memory, whether shared or not */
   memory_setup();
@@ -1880,6 +1883,7 @@
   static int otherints = 0;
 
   error("ERROR: signal %d received in leavedos()\n", sig);
+  show_regs();
   if (sig == SIG_TIME)
     timerints++;
   else
@@ -1906,6 +1910,7 @@
   /* remove tmpdir */
   rmdir(tmpdir);
 
+  setitimer(TIMER_TIME, NULL, NULL);
   SETSIG(SIG_TIME, ign_sigs);
   SETSIG(SIGSEGV, ign_sigs);
   SETSIG(SIGILL, ign_sigs);
@@ -1974,7 +1979,7 @@
 
 void
  usage(void) {
-  fprintf(stdout, "$Header: /home/src/dosemu0.60/RCS/emu.c,v 1.86 1994/05/26 23:15:01 root Exp root $\n");
+  fprintf(stdout, "$Header: /home/src/dosemu0.60/RCS/emu.c,v 1.87 1994/05/30 00:08:20 root Exp root $\n");
   fprintf(stdout, "usage: dos [-ABCckbVNtsgxKm234e] [-D flags] [-M SIZE] [-P FILE] [ -F File ] 2> dosdbg\n");
   fprintf(stdout, "    -A boot from first defined floppy disk (A)\n");
   fprintf(stdout, "    -B boot from second defined floppy disk (B) (#)\n");
@@ -2192,7 +2197,7 @@
     }
 
   case 5:			/* show banner */
-    p_dos_str("\n\nLinux DOS emulator " VERSTR " $Date: 1994/05/26 23:15:01 $\n");
+    p_dos_str("\n\nLinux DOS emulator " VERSTR " $Date: 1994/05/30 00:08:20 $\n");
     p_dos_str("Last configured at %s\n", CONFIG_TIME);
     p_dos_str("on %s\n", CONFIG_HOST);
     /*      p_dos_str("maintained by Robert Sanders, gt8134b@prism.gatech.edu\n\n"); */
@@ -2208,14 +2213,6 @@
     set_keyboard_bios();
     insert_into_keybuffer();
     break;
-
-#if 0				/* May 17 94 */
-  case 7:			/* Do int09 set_keyboard_bios() */
-    k_printf("Doing INT9 set_keyboard_bio() ax=0x%04x\n", LWORD(eax));
-    set_keyboard_bios();
-    LO(ax) = HI(ax);
-    break;
-#endif
 
   case 8:
     v_printf("Starting Video initialization\n");
diff -u --recursive --new-file dosemu0.51old//int.h dosemu0.51//int.h
--- dosemu0.51old//int.h	Thu May 26 21:03:19 1994
+++ dosemu0.51//int.h	Sun May 29 21:15:47 1994
@@ -3,12 +3,15 @@
 #include "ipx.h"
 
 /* 
- * $Date: 1994/05/26 23:15:01 $
+ * $Date: 1994/05/30 00:08:20 $
  * $Source: /home/src/dosemu0.60/RCS/int.h,v $
- * $Revision: 1.25 $
+ * $Revision: 1.26 $
  * $State: Exp $
  *
  * $Log: int.h,v $
+ * Revision 1.26  1994/05/30  00:08:20  root
+ * Prep for pre51_22 and temp kludge fix for dir a: error.
+ *
  * Revision 1.25  1994/05/26  23:15:01  root
  * Prep. for pre51_21.
  *
@@ -413,7 +416,7 @@
     ticks = (elapsed * 182) / 10 + last_ticks;
     LO(ax) = *(u_char *) (TICK_OVERFLOW_ADDR);
     *(u_char *) (TICK_OVERFLOW_ADDR) = 0;
-    LWORD(ecx) = ticks >> 16;
+    LWORD(ecx) = (ticks >> 16) & 0xffff;
     LWORD(edx) = ticks & 0xffff;
     /* dbug_printf("read timer st: %ud %ud t=%d\n",
 				    start_time, ticks, akt_time); */
diff -u --recursive --new-file dosemu0.51old//mfs.c dosemu0.51//mfs.c
--- dosemu0.51old//mfs.c	Thu May 26 21:03:18 1994
+++ dosemu0.51//mfs.c	Sun May 29 21:15:47 1994
@@ -146,6 +146,9 @@
  *
  * HISTORY:
  * $Log: mfs.c,v $
+ * Revision 1.39  1994/05/30  00:08:20  root
+ * Prep for pre51_22 and temp kludge fix for dir a: error.
+ *
  * Revision 1.38  1994/05/26  23:15:01  root
  * Prep. for pre51_21.
  *
@@ -726,7 +729,7 @@
 {
   int attr = 0;
 
-  if (mode & S_IFDIR)
+  if (S_ISDIR(mode) && !S_ISCHR(mode) && !S_ISBLK(mode))
     attr |= DIRECTORY;
   if (!(mode & S_IWRITE))
     attr |= READ_ONLY_FILE;
@@ -3253,7 +3256,7 @@
       sdb_file_attr(sdb) = get_dos_attr(hlist->mode);
 
       if (hlist->mode & S_IFDIR) {
-	Debug0((dbg_fd, "Directory ---> YES\n"));
+	Debug0((dbg_fd, "Directory ---> YES 0x%x\n", hlist->mode));
 	if (!(attr & DIRECTORY)) {
 	  tmp = hlist->next;
 	  free(hlist);
diff -u --recursive --new-file dosemu0.51old//ports.h dosemu0.51//ports.h
--- dosemu0.51old//ports.h	Thu May 26 21:03:19 1994
+++ dosemu0.51//ports.h	Sun May 29 21:15:47 1994
@@ -1,12 +1,15 @@
 #define PORTS_H 1
 
 /* 
- * $Date: 1994/05/26 23:15:01 $
+ * $Date: 1994/05/30 00:08:20 $
  * $Source: /home/src/dosemu0.60/RCS/ports.h,v $
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
  * $State: Exp $
  *
  * $Log: ports.h,v $
+ * Revision 1.14  1994/05/30  00:08:20  root
+ * Prep for pre51_22 and temp kludge fix for dir a: error.
+ *
  * Revision 1.13  1994/05/26  23:15:01  root
  * Prep. for pre51_21.
  *
@@ -262,7 +265,7 @@
 #if 1 /* 94/05/11 */
     *OUTB_ADD=1;
 #endif
-    if (byte != 0x20)
+    if (port == 0x20 && byte != 0x20)
       set_leds();
     break;
   case 0x60:
diff -u --recursive --new-file dosemu0.51old//termio.c dosemu0.51//termio.c
--- dosemu0.51old//termio.c	Thu May 26 21:03:18 1994
+++ dosemu0.51//termio.c	Sun May 29 21:15:46 1994
@@ -3,11 +3,14 @@
 #define TERMIO_C 1
 /* Extensions by Robert Sanders, 1992-93
  *
- * $Date: 1994/05/24 01:23:00 $
+ * $Date: 1994/05/30 00:08:20 $
  * $Source: /home/src/dosemu0.60/RCS/termio.c,v $
- * $Revision: 1.35 $
+ * $Revision: 1.36 $
  * $State: Exp $
  * $Log: termio.c,v $
+ * Revision 1.36  1994/05/30  00:08:20  root
+ * Prep for pre51_22 and temp kludge fix for dir a: error.
+ *
  * Revision 1.35  1994/05/24  01:23:00  root
  * Lutz's latest, int_queue_run() update.
  *
@@ -528,7 +531,7 @@
   if (config.console_video)
     set_console_video();
 
-  dbug_printf("$Header: /home/src/dosemu0.60/RCS/termio.c,v 1.35 1994/05/24 01:23:00 root Exp root $\n");
+  dbug_printf("$Header: /home/src/dosemu0.60/RCS/termio.c,v 1.36 1994/05/30 00:08:20 root Exp root $\n");
 
   return 0;
 }
@@ -1579,12 +1582,12 @@
     curi.fd = fd;
     curi.req = req;
     curi.param3 = param3;
-    tmp = ioctl(fd, req, param3);
-    in_ioctl = 0;
     if (iq.queued) {
       k_printf("detected queued ioctl in do_ioctl(): %d 0x%04x 0x%04x\n",
 	       iq.fd, iq.req, iq.param3);
     }
+    tmp = ioctl(fd, req, param3);
+    in_ioctl = 0;
     return tmp;
   }
 }
diff -u --recursive --new-file dosemu0.51old//video/terminal.c dosemu0.51//video/terminal.c
--- dosemu0.51old//video/terminal.c	Thu May 26 21:03:46 1994
+++ dosemu0.51//video/terminal.c	Sun May 29 21:15:56 1994
@@ -16,6 +16,7 @@
 #include "emu.h"
 #include "memory.h"
 #include "video.h"
+#include "../disks.h"
 
 unsigned char trans[] =		/* LATIN CHAR SET */
 {
@@ -477,7 +478,7 @@
 void
 clear_screen(int s, int att)
 {
-  us *sadr, *p, blank = ' ' | (att << 8);
+  u_short *sadr, *p, blank = ' ' | (att << 8);
   int lx;
 
   update_screen = 0;
@@ -485,11 +486,14 @@
   if (s > max_page)
     return;
   sadr = SCREEN_ADR(s);
+#if 0
+  scrbuf = malloc(CO * LI * 2);
+#endif
   cli();
 
   for (p = sadr, lx = 0; lx < (CO * LI); *(p++) = blank, lx++) ;
   if (!config.console_video) {
-    memcpy(scrbuf, sadr, CO * LI * 2);
+    memcpy(scrbuf, (u_char *)sadr, CO * LI * 2 );
     if (s == bios_current_screen_page) {
 #ifdef USE_NCURSES
       attrset(A_NORMAL);		/* should set attribute according to 'att' */
