From 07c33a14eb8a32cfc537033ec2146c48e98ece8f Mon Sep 17 00:00:00 2001 From: sparky4 Date: Mon, 27 Feb 2017 21:18:05 -0600 Subject: [PATCH] ====++++==== undid the reversion back at b6af468f5932336434d2fd956a30af42b58c20bf unknown stability bug on lappy4 --- src/exmmtest.c | 9 ++ src/lib/16_dbg.c | 213 ++++++++++++++++++++++++++++++++++++++++++++- src/lib/16_dbg.h | 4 + src/lib/16_in.c | 16 ++++ src/lib/16_in.h | 2 + src/lib/scroll16.c | 1 + 6 files changed, 243 insertions(+), 2 deletions(-) diff --git a/src/exmmtest.c b/src/exmmtest.c index b6efd4eb..881a1356 100755 --- a/src/exmmtest.c +++ b/src/exmmtest.c @@ -221,6 +221,15 @@ PRINTBB; printf("\n\npress any key to continue!\n"); getch(); printf("press any key to continue!\n"); getch(); #endif #endif //filereadload + +/* +#ifdef __WATCOMC__ + IN_Shutdown(&gvar); + ShapeTest (&gvar); + IN_Startup(&gvar); +#endif +*/ + DebugMemory_(&gvar, 1); MM_DumpData(&gvar); MM_Report_(&gvar); diff --git a/src/lib/16_dbg.c b/src/lib/16_dbg.c index bfa55a53..576f492b 100755 --- a/src/lib/16_dbg.c +++ b/src/lib/16_dbg.c @@ -17,7 +17,7 @@ boolean dbg_testkeyin=0,dbg_testcontrolnoisy=0,dbg_nointest=0; boolean dbg_maptext=0; byte *dbg_mapdata; #endif -#endif +#endif //debug #ifdef __WATCOMC__ // TODO: Could we also provide a build mode to emit debug to the "Bochs E9 hack?" @@ -91,5 +91,214 @@ void _DEBUGF(const char *fmt,...) { _DEBUG(_DEBUGF_TMP); va_end(va); } +#endif //serial #endif //watcomc -#endif +/* +================ += += ShapeTest += +================ +*/ + +#pragma warn -pia +void ShapeTest (global_game_variables_t *gvar) +{ +extern word NumDigi; +extern word _seg *DigiList; +static char buf[10]; + + boolean done; + ScanCode scan; + int i,j; +// dword l; word k,x; + memptr addr; + PageListStruct far *page; + +// CenterWindow(20,16); +// VW_UpdateScreen(); + for (i = 0,done = false;!done;) + { +// US_ClearWindow(); +// sound = -1; + + page = &(gvar->pm.PMPages[i]); +// US_Print(" Page #"); +// US_PrintUnsigned(i); + printf(" Page #%u", i); + if (i < (gvar->pm.fi.PMSpriteStart)) +// US_Print(" (Wall)"); + printf(" (Wall)"); +/* else if (i < (gvar->pm.fi.PMSoundStart)) +// US_Print(" (Sprite)"); + printf(" (Sprite)"); + else if (i == (gvar->pm.fi.ChunksInFile - 1)) +// US_Print(" (Sound Info)"); + printf(" (Sound Info)"); + else +// US_Print(" (Sound)"); + printf(" (Sound)");*/ + +// US_Print("\n XMS: "); + printf("\n XMS: "); + if (page->xmsPage != -1) +// US_PrintUnsigned(page->xmsPage); + printf("%u", page->xmsPage); + else +// US_Print("No"); + printf("No"); + +// US_Print("\n Main: "); + if (page->mainPage != -1) +// US_PrintUnsigned(page->mainPage); + printf("\n Main: %u", page->mainPage); + else if (page->emsPage != -1) + { +// US_Print("EMS "); +// US_PrintUnsigned(page->emsPage); + printf("EMS %u", page->emsPage); + } + else +// US_Print("No"); + printf("No"); + +// US_Print("\n Last hit: "); +// US_PrintUnsigned(page->lastHit); + printf("\n Last hit: %u", page->lastHit); + +// US_Print("\n Address: "); + printf("\n Address: "); + addr = PM_GetPageAddress(i, gvar); + sprintf(buf,"0x%04x",(word)addr); +// US_Print(buf); + printf("%s", buf); + + if (addr) + { +/* if (i < PMSpriteStart) + { + // + // draw the wall + // + bufferofs += 32*SCREENWIDTH; + postx = 128; + postwidth = 1; + postsource = ((long)((unsigned)addr))<<16; + for (x=0;x<64;x++,postx++,postsource+=64) + { + wallheight[postx] = 256; + FarScalePost (); + } + bufferofs -= 32*SCREENWIDTH; + } + else if (i < PMSoundStart) + { + // + // draw the sprite + // + bufferofs += 32*SCREENWIDTH; + SimpleScaleShape (160, i-PMSpriteStart, 64); + bufferofs -= 32*SCREENWIDTH; + } + else if (i == ChunksInFile - 1) + { + US_Print("\n\n Number of sounds: "); + US_PrintUnsigned(NumDigi); + for (l = j = k = 0;j < NumDigi;j++) + { + l += DigiList[(j * 2) + 1]; + k += (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize; + } + US_Print("\n Total bytes: "); + US_PrintUnsigned(l); + US_Print("\n Total pages: "); + US_PrintUnsigned(k); + } + else + { + byte far *dp = (byte far *)MK_FP(addr,0); + for (j = 0;j < NumDigi;j++) + { + k = (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize; + if + ( + (i >= PMSoundStart + DigiList[j * 2]) + && (i < PMSoundStart + DigiList[j * 2] + k) + ) + break; + } + if (j < NumDigi) + { +// sound = j; + US_Print("\n Sound #"); + US_PrintUnsigned(j); + US_Print("\n Segment #"); + US_PrintUnsigned(i - PMSoundStart - DigiList[j * 2]); + } + for (j = 0;j < page->length;j += 32) + { + byte v = dp[j]; + int v2 = (unsigned)v; + v2 -= 128; + v2 /= 4; + if (v2 < 0) + VWB_Vlin(WindowY + WindowH - 32 + v2, + WindowY + WindowH - 32, + WindowX + 8 + (j / 32),BLACK); + else + VWB_Vlin(WindowY + WindowH - 32, + WindowY + WindowH - 32 + v2, + WindowX + 8 + (j / 32),BLACK); + } + }*/ + printf("\naddr ok\n"); + } + +// VW_UpdateScreen(); + +// while (!(scan = IN_GetLastScan())) + scan = *IN_GetScanName(scan); +// SD_Poll(); + + IN_ClearKey(scan); + switch (scan) + { + case sc_LeftArrow: + if (i) + i--; + break; + case sc_RightArrow: + if (++i >= (gvar->pm.fi.ChunksInFile)) + i--; + break; + case sc_W: // Walls + i = 0; + break; + case sc_S: // Sprites +// i = (gvar->pm.fi.PMSpriteStart); + break; + case sc_D: // Digitized +// i = (gvar->pm.fi.PMSoundStart); + break; + case sc_I: // Digitized info + i = (gvar->pm.fi.ChunksInFile - 1); + break; + case sc_L: // Load all pages + for (j = 0;j < (gvar->pm.fi.ChunksInFile);j++) + PM_GetPage(j, gvar); + break; + case sc_P: +// if (sound != -1) +// SD_PlayDigitized(sound); + break; + case sc_Escape: + done = true; + break; + case sc_Enter: + PM_GetPage(i, gvar); + break; + } + } + //SD_StopDigitized(); +} +#pragma warn +pia diff --git a/src/lib/16_dbg.h b/src/lib/16_dbg.h index 5340313a..3d7ef4af 100755 --- a/src/lib/16_dbg.h +++ b/src/lib/16_dbg.h @@ -3,6 +3,7 @@ #define _SRC_LIB_16_DBG #include "src/lib/16_head.h" +#include "src/lib/16_pm.h" #include "src/lib/16_tdef.h" #define __DEBUG__ @@ -53,4 +54,7 @@ static inline int _DEBUG_INIT() { } # endif #endif //watcomc + +void ShapeTest (global_game_variables_t *gvar); + #endif // _SRC_LIB_16_DBG diff --git a/src/lib/16_in.c b/src/lib/16_in.c index 8d17c37f..44c6aac1 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -501,11 +501,17 @@ IN_GetJoyButtonsDB(word joy) static void INL_StartKbd() { + byte far *lock_key; INL_KeyHook = 0; // Clear key hook IN_ClearKeysDown(); OldKeyVect = _dos_getvect(KeyInt); + + // turn off num-lock via BIOS + lock_key = MK_FP(0x040, 0x017); // Pointing to the address of the bios shift state keys + *lock_key&=(~(16 | 32 | 64)); // toggle off the locks by changing the values of the 4th, 5th, and 6th bits of the address byte of 0040:0017 + OldKeyVect(); // call BIOS keyhandler to change keyboard lights _dos_setvect(KeyInt,INL_KeyService); } @@ -1275,3 +1281,13 @@ boolean IN_qb(byte kee) if(inpu.Keyboard[kee]==true) return 1; else return 0; } + +ScanCode IN_GetLastScan() +{ + return inpu.LastScan; +} + +ScanCode IN_GetCurCode() +{ + return inst.CurCode; +} diff --git a/src/lib/16_in.h b/src/lib/16_in.h index 9bcec258..b56e9f46 100755 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -302,5 +302,7 @@ extern boolean IN_UserInput(dword delay,boolean clear); extern boolean IN_KeyDown(byte code); extern void IN_ClearKey(byte code); extern boolean IN_qb(byte kee); +extern ScanCode IN_GetLastScan(); +extern ScanCode IN_GetCurCode(); #endif diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index b4523474..5ba59ca5 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -741,6 +741,7 @@ void shinku(global_game_variables_t *gv) gv->video.dorender =!gv->video.dorender ; //0000gv->video.tickclk = ((*clockw)-gv->video.startclk)/18.2; } +//++++ PM_NextFrame(gv); } void near ZC_animatePlayer(map_view_t *pip, player_t *player, word pn) -- 2.39.5