OSDN Git Service

add printf-like _DEBUGF() function for debugging, too
authorJonathan Campbell <jonathan@castus.tv>
Sat, 28 May 2016 11:46:55 +0000 (04:46 -0700)
committerJonathan Campbell <jonathan@castus.tv>
Sat, 28 May 2016 11:46:55 +0000 (04:46 -0700)
src/16.c
src/lib/16_dbg.c
src/lib/16_dbg.h
src/scroll.c
src/test.c

index 380c335..e7cee88 100755 (executable)
--- a/src/16.c
+++ b/src/16.c
@@ -59,6 +59,7 @@ main(int argc, char *argv[])
 #endif\r
        }\r
        _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log\r
+       _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);\r
 \r
        //screen = modexDefaultPage();\r
        engi_stat = ENGI_RUN;\r
index be2c1d2..2215c42 100644 (file)
@@ -3,6 +3,10 @@
 
 // TODO: Could we also provide a build mode to emit debug to the "Bochs E9 hack?"
 #ifdef DEBUGSERIAL
+# include <stdarg.h>
+# include <stdlib.h>
+# include <stdio.h>
+
 unsigned char _DEBUG_INITed = 0;
 struct info_8250 *_DEBUG_uart = NULL;
 
@@ -57,5 +61,16 @@ void _DEBUG(const char *msg) {
                }
        }
 }
+
+static char _DEBUGF_TMP[256];
+
+void _DEBUGF(const char *fmt,...) {
+       va_list va;
+
+       va_start(va,fmt);
+       vsnprintf(_DEBUGF_TMP,sizeof(_DEBUGF_TMP),fmt,va);
+       _DEBUG(_DEBUGF_TMP);
+       va_end(va);
+}
 #endif
 
index e408ac0..9aaf964 100644 (file)
@@ -5,9 +5,13 @@
 # ifdef DEBUGSERIAL
 #  include <hw/8250/8250.h>
 
+void _DEBUGF(const char *fmt,...);
 void _DEBUG(const char *msg);
 int _DEBUG_INIT();
 # else
+static inline void _DEBUGF(const char *fmt,...) {
+       // NOTHING
+}
 static inline void _DEBUG(const char *msg) {
        // NOTHING
 }
index b108a20..8f8c27f 100755 (executable)
@@ -91,6 +91,7 @@ void main(int argc, char *argv[])
 #endif
        }
        _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log
+       _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);
 
        pan.pn=1;
        //player[0].data = &pp;
index 2c698a6..bb3792a 100755 (executable)
@@ -70,6 +70,7 @@ void main(int argc, char *argv[])
 #endif\r
        }\r
        _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log\r
+       _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);\r
 \r
        /* load our palette */\r
        modexLoadPalFile("data/default.pal", &pal2);\r