From: sparky4 <sparky4@cock.li>
Date: Thu, 12 Jul 2018 14:37:24 +0000 (-0500)
Subject: fdos debug thingy (16/fd-dbg.c) added for a farcoreleft verification wwww
X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=a345aeee10a2177753f93c6ccc1be926975ef73e;p=16.git

fdos debug thingy (16/fd-dbg.c) added for a farcoreleft verification wwww
---

diff --git a/16/fd-dbg.c b/16/fd-dbg.c
new file mode 100755
index 00000000..a4d80201
--- /dev/null
+++ b/16/fd-dbg.c
@@ -0,0 +1,77 @@
+/*
+ *  Defines the functions only necessary while debugging is active
+ */
+
+#include "config.h"
+
+#ifdef DEBUG
+
+#include <conio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <alloc.h>
+
+#include "command.h"
+
+FILE *dbg_logfile = stdout;
+char *dbg_logname = 0;
+unsigned firstMem = 0;
+
+void dbg_print(const char * const fmt, ...)
+{	va_list ap;
+
+	va_start(ap, fmt);
+	vfprintf(dbg_logfile, fmt, ap);
+	va_end(ap);
+	fflush(dbg_logfile);
+}
+
+void dbg_outc(int ch)
+{	putc(ch, dbg_logfile);
+}
+void dbg_outs(const char * const s)
+{	if(s)	fputs(s, dbg_logfile);
+	fflush(dbg_logfile);
+}
+void dbg_outsn(const char * const s)
+{	if(s)	fputs(s, dbg_logfile);
+	putc('\n', dbg_logfile);
+	fflush(dbg_logfile);
+}
+
+
+void dbg_printmem(void)
+{ static unsigned nearLast = 0;
+  static unsigned long farLast = 0;
+
+  unsigned nearThis;
+  unsigned long farThis;
+
+  switch(heapcheck()) {
+  case _HEAPCORRUPT:
+    cputs("HEAP CORRUPTED. Cannot proceed!\r\n");
+    abort();
+  case _HEAPEMPTY:
+    cputs("NO HEAP. Cannot proceed!\r\n");
+    abort();
+  default:
+    cputs("Unknown heapcheck() error. Cannot proceed!\r\n");
+    abort();
+  case _HEAPOK:
+    break;
+  }
+
+  nearThis = coreleft();
+  farThis = farcoreleft();
+
+  dprintf(("[free memory: near=%6u far=%13lu]\n", nearThis, farThis));
+  if(nearLast)
+    dprintf(("[changed    : near=%6d far=%13ld]\n"
+     , nearThis - nearLast , farThis - farLast));
+
+  nearLast = nearThis;
+  farLast = farThis;
+}
+
+#endif    /* defined(DEBUG) */
diff --git a/palllist.exe b/palllist.exe
new file mode 100755
index 00000000..166d058c
Binary files /dev/null and b/palllist.exe differ
diff --git a/src/lib/doslib b/src/lib/doslib
index 1c553707..d1b1fa1a 160000
--- a/src/lib/doslib
+++ b/src/lib/doslib
@@ -1 +1 @@
-Subproject commit 1c553707ed78522d5252677f94ddfcc31866d88f
+Subproject commit d1b1fa1aa14e9c4bcfb061ec206223c1c12bf6ce