X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_dbg.c;h=9cdd884055618c2099e3b0d84b891e0598d4977d;hb=a565be31ce92d6168ae6983042da75b0b683e52b;hp=2cc7e985c8cbcc182caf47cb0ec105c6cbaa15fc;hpb=e6a3783f754943844abac31b5b6ca3d424741173;p=16.git diff --git a/src/lib/16_dbg.c b/src/lib/16_dbg.c index 2cc7e985..9cdd8840 100755 --- a/src/lib/16_dbg.c +++ b/src/lib/16_dbg.c @@ -1,3 +1,25 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2019 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + #include "src/lib/16_dbg.h" #ifdef __DEBUG__ @@ -11,14 +33,21 @@ boolean dbg_debugpm=0; boolean dbg_debugca=0; #endif #ifdef __DEBUG_InputMgr__ -boolean dbg_testkeyin=0,dbg_testcontrolnoisy=0,dbg_nointest=0; +boolean dbg_testkeyin=0,dbg_testcontrolnoisy=0,dbg_nointest=0,dbg_joymousedelta=0; #endif #ifdef __DEBUG_MAP__ boolean dbg_maptext=0; byte *dbg_mapdata; #endif +#ifdef __DEBUG_RF__ +boolean dbg_pagenorendermap=0,dbg_pagedelayrendermap=0; +#endif +#ifdef __DEBUG_SPRI__ +boolean dbg_delayanimation=0; +#endif #endif //debug + /* ================ = @@ -28,14 +57,14 @@ byte *dbg_mapdata; */ #pragma warn -pia -void ShapeTest (global_game_variables_t *gvar) +void ShapeTest_(global_game_variables_t *gvar) { extern word NumDigi; extern word _seg *DigiList; static char buf[10]; boolean done; - ScanCode scan=0; + ScanCode scan; int i,j; // dword l; word k,x; memptr addr; @@ -52,10 +81,10 @@ static char buf[10]; // US_Print(" Page #"); // US_PrintUnsigned(i); printf(" Page #%u", i); - if (i < (gvar->pm.fi.PMSpriteStart)) +//++ if (i < (gvar->pm.fi.PMSpriteStart)) // US_Print(" (Wall)"); - printf(" (Wall)"); - else if (i < (gvar->pm.fi.PMSoundStart)) +//++ printf(" (Wall)"); +/* else if (i < (gvar->pm.fi.PMSoundStart)) // US_Print(" (Sprite)"); printf(" (Sprite)"); else if (i == (gvar->pm.fi.ChunksInFile - 1)) @@ -63,7 +92,7 @@ static char buf[10]; printf(" (Sound Info)"); else // US_Print(" (Sound)"); - printf(" (Sound)"); + printf(" (Sound)");*/ // US_Print("\n XMS: "); printf("\n XMS: "); @@ -177,12 +206,13 @@ static char buf[10]; WindowX + 8 + (j / 32),BLACK); } }*/ - printf("addr ok\n"); + printf("\naddr ok\n"); } // VW_UpdateScreen(); -// while (!(scan = LastScan)) + while (!(scan = gvar->in.inst->LastScan)) + {} // SD_Poll(); IN_ClearKey(scan); @@ -200,10 +230,10 @@ static char buf[10]; i = 0; break; case sc_S: // Sprites - i = (gvar->pm.fi.PMSpriteStart); +// i = (gvar->pm.fi.PMSpriteStart); break; case sc_D: // Digitized - i = (gvar->pm.fi.PMSoundStart); +// i = (gvar->pm.fi.PMSoundStart); break; case sc_I: // Digitized info i = (gvar->pm.fi.ChunksInFile - 1); @@ -229,76 +259,155 @@ static char buf[10]; #pragma warn +pia #ifdef __WATCOMC__ -// TODO: Could we also provide a build mode to emit debug to the "Bochs E9 hack?" -#ifdef DEBUGSERIAL -# include -# include -# include - -unsigned char _DEBUG_INITed = 0; -struct info_8250 *_DEBUG_uart = NULL; - -int _DEBUG_INIT() { - if (!_DEBUG_INITed) { - unsigned int i; - uint16_t port; - - if (!init_8250()) return 0; - - // what does the BIOS say the serial ports are? - probe_8250_bios_ports(); - for (i=0;i < bios_8250_ports;i++) { - port = get_8250_bios_port(i); - if (port == 0) continue; - probe_8250(port); - } +#ifdef __DEBUG_VL__ - // what about the standard serial ports? - for (i=0;i < (sizeof(standard_8250_ports)/sizeof(standard_8250_ports[0]));i++) { - port = standard_8250_ports[i]; - if (port == 0) continue; - probe_8250(port); - } +//=========================================================================== - // pick the first port, which is probably COM1 - if (base_8250_ports == 0) return 0; // FIXME: You know "base_8250_ports" is probably a bad variable name for the max entries in info_8250_port[] - _DEBUG_uart = &info_8250_port[0]; - _DEBUG_INITed = 1; - - // init the COM port. - // in DOSBox-X, the "log" mode will receive our text and print it into the log file - // on real hardware, our text will likely go over a null modem cable to another PC running a serial terminal program like PuTTY or minicom. - // if nothing is connected, then the bytes go off into the ether to get lost and life goes on. - uart_8250_enable_interrupt(_DEBUG_uart,0); // disable interrupts - uart_8250_set_FIFO(_DEBUG_uart,0x07); // enable FIFO (why not?), also clear xmit/recv FIFO buffers, set threshhold to 1 byte - uart_8250_set_MCR(_DEBUG_uart,3); // RTS and DTS on - uart_8250_set_line_control(_DEBUG_uart,UART_8250_LCR_8BIT | UART_8250_LCR_PARITY); // 8 bit 1 stop bit odd parity - uart_8250_set_baudrate(_DEBUG_uart,uart_8250_baud_to_divisor(_DEBUG_uart,9600)); // 9600 baud - } +/* +================ += += ShowPalVarSync += +================ +*/ + +//#define SHOWPALVARIMODQUAD ((spv.i)%QUADWH) +#define SHOWPALVARIMOD ((spv.i)%TILEWH) +#define SHOWPALVARIDIV ((spv.i)/TILEWH) +#define SHOWPALVARIMODIFCOND if((!SHOWPALVARIMOD) && spv.i) +#define SHOWPALVARIDIVIFCOND if((!SHOWPALVARIDIV) && spv.i) +//video.page[0], result.palx+TILEWH, result.paly+TILEWH, result.mult, result.mult, result.i); + return result; } -void _DEBUG(const char *msg) { - if (_DEBUG_uart != NULL) { - char c; +/* +================ += += ShowPalVal += +================ +*/ + +void ShowPalVal (global_game_variables_t *gvar) +{ + boolean done ,err; + ScanCode scan; + spv_t spv; + word ccolor = 3, xpos = gvar->video.page[0].dx, ypos = gvar->video.page[0].dy; - while ((c=(*msg++)) != 0/*NUL*/) { - while (!uart_8250_can_write(_DEBUG_uart)); // wait for the UART to indicate readiness for our output - uart_8250_write(_DEBUG_uart,(uint8_t)c); // then write it + spv.mult=(QUADWH); + spv.palq=(spv.mult)*TILEWH; + spv.i = 0; + +// IN_UserInput(1, gvar); + modexpdump(0, gvar); + + for (spv.oi = 1,done = false;!done;) + { + SHOWPALVARIMODIFCOND + { + if(err) printf("SHOWPALVARIMODIFCOND\n"); + if(spv.i==SHOWPALVARPALSIZELIMIT) spv.paly=(TILEWH*8)+spv.mult*SHOWPALVARIDIV; + spv.palx=(TILEWH*12); + }else spv.palx=(TILEWH*12)+spv.mult*SHOWPALVARIMOD; + if(spv.ivideo.page[0], spv.palx+TILEWH, spv.paly+TILEWH, spv.mult, spv.mult, 5); + modexClearRegion(&gvar->video.page[0], spv.palx+TILEWH+1, spv.paly+TILEWH+1, spv.mult-2, spv.mult-2, spv.i); + spv.oi = spv.i; } - } -} -static char _DEBUGF_TMP[256]; +#define SHOWPALVARPRINT modexprint(&(gvar->video.page[0]), xpos, ypos, 1, 1, ccolor, 8, gvar->video.VL_Started, global_temp_status_text); ypos+=8; + sprintf(global_temp_status_text, "%03u", spv.i); SHOWPALVARPRINT + sprintf(global_temp_status_text, "r %03u", gvar->video.palette[(spv.i*3)+0]/*>>2*/); SHOWPALVARPRINT + sprintf(global_temp_status_text, "g %03u", gvar->video.palette[(spv.i*3)+1]/*>>2*/); SHOWPALVARPRINT + sprintf(global_temp_status_text, "b %03u", gvar->video.palette[(spv.i*3)+2]/*>>2*/); SHOWPALVARPRINT + xpos = gvar->video.page[0].dx; ypos = gvar->video.page[0].dy; -void _DEBUGF(const char *fmt,...) { - va_list va; + while (!(scan = gvar->in.inst->LastScan)) + {} - va_start(va,fmt); - vsnprintf(_DEBUGF_TMP,sizeof(_DEBUGF_TMP),fmt,va); - _DEBUG(_DEBUGF_TMP); - va_end(va); + IN_ClearKey(scan); + switch (scan) + { + case sc_LeftArrow: + if (spv.i > 0) + { + spv.i--; + } + else + { + spv.palx=gvar->video.page[0].sw-spv.mult; + spv.paly=gvar->video.page[0].sh-spv.mult; + spv.i = SHOWPALVARPALSIZELIMIT; + } + break; + case sc_RightArrow: + if (spv.i < SHOWPALVARPALSIZELIMIT) + { + spv.i++; + } + else + { + spv.palx=TILEWH*12; + spv.paly=TILEWH*8; + spv.i = 0; + } + break; + case sc_UpArrow: + if (spv.i > 0) + { + spv.i-=16; + } + else + { + spv.palx=gvar->video.page[0].sw-spv.mult; + spv.paly=gvar->video.page[0].sh-spv.mult; + spv.i = SHOWPALVARPALSIZELIMIT; + } + break; + case sc_DownArrow: + if (spv.i < SHOWPALVARPALSIZELIMIT) + { + spv.i+=16; + } + else + { + spv.palx=TILEWH*12; + spv.paly=TILEWH*8; + spv.i = 0; + } + break; + case sc_W: // Walls + spv.i = 0; + break; + case sc_Escape: + done = true; + break; + } + } +// IN_UserInput(1, gvar); } -#endif //serial +#endif //debug vl #endif //watcomc