OSDN Git Service

fdos debug thingy (16/fd-dbg.c) added for a farcoreleft verification wwww
authorsparky4 <sparky4@cock.li>
Thu, 12 Jul 2018 14:37:24 +0000 (09:37 -0500)
committersparky4 <sparky4@cock.li>
Thu, 12 Jul 2018 14:37:24 +0000 (09:37 -0500)
16/fd-dbg.c [new file with mode: 0755]
palllist.exe [new file with mode: 0755]
src/lib/doslib

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