add convenience switch to redirect debug output to COM port when building, update some debug prints to use our debug interface so print to COM port when enabled.

This commit is contained in:
Kenneth J Davis 2025-03-28 10:22:13 -04:00
parent 192cccc68f
commit 634257b913
No known key found for this signature in database
GPG Key ID: 59D5F216C38F11FD
7 changed files with 35 additions and 53 deletions

View File

@ -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

View File

@ -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)
{

View File

@ -34,6 +34,7 @@ static BYTE *dosfnsRcsId =
#endif
#include "globals.h"
#include "debug.h"
/* /// Added for SHARE. - Ron Cemer */

View File

@ -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

View File

@ -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 */

View File

@ -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();
}

View File

@ -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"