diff --git a/build.bat b/build.bat index d46de25..1c5caa9 100644 --- a/build.bat +++ b/build.bat @@ -6,8 +6,10 @@ if NOT "%1" == "/?" goto start echo ":-----------------------------------------------------------------------" echo ":- Syntax: BUILD [-r] [fat32|fat16] [msc|wc|tc|tcpp|bc] [86|186|386] " echo ":- [debug] [lfnapi] [/L #] [/D value] [list] [upx] [win] " +echo ":- [com] [com# #] " echo ":- option case is significant !! " echo ":- Note: Open Watcom (wc) is the preferred compiler " +echo ":- com does debug output on COM2, whereas com# 0 for COM1 ... " echo ":-----------------------------------------------------------------------" goto end @@ -56,6 +58,14 @@ if "%1" == "lfnapi" set ALLCFLAGS=%ALLCFLAGS% -DWITHLFNAPI if "%1" == "win" set ALLCFLAGS=%ALLCFLAGS% -DWIN31SUPPORT if "%1" == "win" set NASMFLAGS=%NASMFLAGS% -DWIN31SUPPORT +if "%1" == "com" set ALLCFLAGS=%ALLCFLAGS% -DDEBUG_PRINT_COMPORT +if "%1" == "com" set NASMFLAGS=%ALLCFLAGS% -DDEBUG_PRINT_COMPORT +REM specify comport, default is COM2, 0=COM1, 1=COM2, 2=COM3 +if "%1" == "com#" set ALLCFLAGS=%ALLCFLAGS% -DDEBUG_PRINT_COMPORT %2 +if "%1" == "com#" set NASMFLAGS=%ALLCFLAGS% -DDEBUG_PRINT_COMPORT %2 +if "%1" == "com#" shift +if "%1" == "com#" goto nextOption + if "%1" == "list" set NASMFLAGS=%NASMFLAGS% -l$*.lst if "%1" == "/L" goto setLoadSeg diff --git a/kernel/config.c b/kernel/config.c index 27e8ac7..a26643e 100644 --- a/kernel/config.c +++ b/kernel/config.c @@ -31,10 +31,6 @@ #include "init-mod.h" #include "dyndata.h" -#ifdef VERSION_STRINGS -static BYTE *RcsId = - "$Id: config.c 1705 2012-02-07 08:10:33Z perditionc $"; -#endif #ifdef DEBUG #define DebugPrintf(x) printf x @@ -342,15 +338,9 @@ void PreConfig(void) { /* Initialize the base memory pointers */ -#ifdef DEBUG - { - printf("SDA located at 0x%p\n", internal_data); - } -#endif + DebugPrintf(("SDA located at 0x%p\n", internal_data)); /* Begin by initializing our system buffers */ -#ifdef DEBUG -/* printf("Preliminary %d buffers allocated at 0x%p\n", Config.cfgBuffers, buffers);*/ -#endif + /* DebugPrintf(("Preliminary %d buffers allocated at 0x%p\n", Config.cfgBuffers, buffers));*/ LoL->sfthead = MK_FP(FP_SEG(LoL), 0xcc); /* &(LoL->firstsftt) */ /* LoL->FCBp = (sfttbl FAR *)&FcbSft; */ @@ -362,18 +352,14 @@ void PreConfig(void) LoL->CDSp = KernelAlloc(sizeof(struct cds) * LoL->lastdrive, 'L', 0); -#ifdef DEBUG -/* printf(" FCB table 0x%p\n",LoL->FCBp);*/ - printf(" sft table 0x%p\n", LoL->sfthead); - printf(" CDS table 0x%p\n", LoL->CDSp); - printf(" DPB table 0x%p\n", LoL->DPBp); -#endif +/* DebugPrintf((" FCB table 0x%p\n",LoL->FCBp));*/ + DebugPrintf((" sft table 0x%p\n", LoL->sfthead)); + DebugPrintf((" CDS table 0x%p\n", LoL->CDSp)); + DebugPrintf((" DPB table 0x%p\n", LoL->DPBp)); /* Done. Now initialize the MCB structure */ /* This next line is 8086 and 80x86 real mode specific */ -#ifdef DEBUG - printf("Preliminary allocation completed: top at %p\n", lpTop); -#endif + DebugPrintf(("Preliminary allocation completed: top at %p\n", lpTop)); } /* Do second pass initialization: near allocation and MCBs */ @@ -443,9 +429,7 @@ void PostConfig(void) /* Begin by initializing our system buffers */ /* dma_scratch = (BYTE FAR *) KernelAllocDma(BUFFERSIZE); */ -#ifdef DEBUG - /* printf("DMA scratchpad allocated at 0x%p\n", dma_scratch); */ -#endif + /* DebugPrintf(("DMA scratchpad allocated at 0x%p\n", dma_scratch)); */ config_init_buffers(Config.cfgBuffers); @@ -462,12 +446,11 @@ void PostConfig(void) LoL->CDSp = KernelAlloc(sizeof(struct cds) * LoL->lastdrive, 'L', Config.cfgLastdriveHigh); -#ifdef DEBUG -/* printf(" FCB table 0x%p\n",LoL->FCBp);*/ - printf(" sft table 0x%p\n", LoL->sfthead->sftt_next); - printf(" CDS table 0x%p\n", LoL->CDSp); - printf(" DPB table 0x%p\n", LoL->DPBp); -#endif +/* DebugPrintf((" FCB table 0x%p\n",LoL->FCBp));*/ + DebugPrintf((" sft table 0x%p\n", LoL->sfthead->sftt_next)); + DebugPrintf((" CDS table 0x%p\n", LoL->CDSp)); + DebugPrintf((" DPB table 0x%p\n", LoL->DPBp)); + if (Config.cfgStacks) { VOID FAR *stackBase = @@ -1845,9 +1828,7 @@ STATIC BOOL LoadDevice(BYTE * pLine, char FAR *top, COUNT mode) /* The device driver is paragraph aligned. */ eb.load.reloc = eb.load.load_seg = base; -#ifdef DEBUG - printf("Loading device driver %s at segment %04x\n", szBuf, base); -#endif + DebugPrintf(("Loading device driver %s at segment %04x\n", szBuf, base)); if ((result = init_DosExec(3, &eb, szBuf)) != SUCCESS) { diff --git a/kernel/dosfns.c b/kernel/dosfns.c index 3d902ee..f1479aa 100644 --- a/kernel/dosfns.c +++ b/kernel/dosfns.c @@ -34,6 +34,7 @@ static BYTE *dosfnsRcsId = #endif #include "globals.h" +#include "debug.h" /* /// Added for SHARE. - Ron Cemer */ diff --git a/kernel/error.c b/kernel/error.c index da7d382..035312b 100644 --- a/kernel/error.c +++ b/kernel/error.c @@ -27,24 +27,20 @@ /****************************************************************/ #include "portab.h" - -#ifdef VERSION_STRINGS -static BYTE *errorRcsId = - "$Id: error.c 709 2003-09-24 19:34:11Z bartoldeman $"; -#endif - #include "globals.h" +#include "debug.h" + #ifdef DEBUG /* error registers */ VOID dump(void) { - printf("Register Dump [AH = %02x CS:IP = %04x:%04x FLAGS = %04x]\n", - error_regs.AH, error_regs.CS, error_regs.IP, error_regs.FLAGS); - printf("AX:%04x BX:%04x CX:%04x DX:%04x\n", - error_regs.AX, error_regs.BX, error_regs.CX, error_regs.DX); - printf("SI:%04x DI:%04x DS:%04x ES:%04x\n", - error_regs.SI, error_regs.DI, error_regs.DS, error_regs.ES); + DebugPrintf(("Register Dump [AH = %02x CS:IP = %04x:%04x FLAGS = %04x]\n", + error_regs.AH, error_regs.CS, error_regs.IP, error_regs.FLAGS)); + DebugPrintf(("AX:%04x BX:%04x CX:%04x DX:%04x\n", + error_regs.AX, error_regs.BX, error_regs.CX, error_regs.DX)); + DebugPrintf(("SI:%04x DI:%04x DS:%04x ES:%04x\n", + error_regs.SI, error_regs.DI, error_regs.DS, error_regs.ES)); } #endif diff --git a/kernel/fatfs.c b/kernel/fatfs.c index a3e53de..1be8726 100644 --- a/kernel/fatfs.c +++ b/kernel/fatfs.c @@ -29,10 +29,8 @@ #include "portab.h" #include "globals.h" +#include "debug.h" -#ifdef VERSION_STRINGS -BYTE *RcsId = "$Id: fatfs.c 1632 2011-06-13 16:29:14Z bartoldeman $"; -#endif /* */ /* function prototypes */ diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index 40cb386..ce3fc5d 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -442,7 +442,7 @@ dispatch: if (bDumpRegs) { fmemcpy(&error_regs, user_r, sizeof(iregs)); - printf("System call (21h): %02x\n", user_r->AX); + DebugPrintf(("System call (21h): %02x\n", user_r->AX)); dump_regs = TRUE; dump(); } diff --git a/kernel/main.c b/kernel/main.c index c8afb93..33e7841 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -32,10 +32,6 @@ #include "dyndata.h" #include "debug.h" -#ifdef VERSION_STRINGS -static BYTE *mainRcsId = - "$Id: main.c 1699 2012-01-16 20:45:44Z perditionc $"; -#endif static char copyright[] = "(C) Copyright 1995-2023 Pasquale J. Villani and The FreeDOS Project.\n"