From: sparky4 Date: Fri, 9 Dec 2016 16:30:18 +0000 (-0600) Subject: no idea why bcexmm.exe is broke w tweaked zcroll.exe a bit also Quit is refined now~ X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=52711700f92f02fe8976d2e035a04a4501842b9f;p=16.git no idea why bcexmm.exe is broke w tweaked zcroll.exe a bit also Quit is refined now~ --- diff --git a/DEBUG.16B b/DEBUG.16B new file mode 100755 index 00000000..f30673d9 --- /dev/null +++ b/DEBUG.16B @@ -0,0 +1,210 @@ +Seg:0 Size:4897 Owner:0x0 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++0 +Seg:1321 Size:256 Owner:0x993 +++++ +Seg:1421 Size:256 Owner:0x798 +++++ +Seg:1521 Size:256 Owner:0x79a +++++ +Seg:1621 Size:256 Owner:0x79c ++++++ +Seg:1721 Size:256 Owner:0x79e +++++ +Seg:1821 Size:256 Owner:0x7a0 +++++ +Seg:1921 Size:256 Owner:0x7a2 +++++ +Seg:1a21 Size:256 Owner:0x7a4 +++++ +Seg:1b21 Size:256 Owner:0x7a6 ++++++ +Seg:1c21 Size:256 Owner:0x7a8 +++++ +Seg:1d21 Size:256 Owner:0x7aa +++++ +Seg:1e21 Size:256 Owner:0x7ac +++++ +Seg:1f21 Size:256 Owner:0x7ae +++++ +Seg:2021 Size:256 Owner:0x7b0 ++++++ +Seg:2121 Size:256 Owner:0x7b2 +++++ +Seg:2221 Size:256 Owner:0x7b4 +++++ +Seg:2321 Size:256 Owner:0x7b6 +++++ +Seg:2421 Size:256 Owner:0x7b8 +++++ +Seg:2521 Size:256 Owner:0x7ba ++++++ +Seg:2621 Size:256 Owner:0x7bc +++++ +Seg:2721 Size:256 Owner:0x7be +++++ +Seg:2821 Size:256 Owner:0x7c0 +++++ +Seg:2921 Size:256 Owner:0x7c2 +++++ +Seg:2a21 Size:256 Owner:0x7c4 ++++++ +Seg:2b21 Size:256 Owner:0x7c6 +++++ +Seg:2c21 Size:256 Owner:0x7c8 +++++ +Seg:2d21 Size:256 Owner:0x7ca +++++ +Seg:2e21 Size:256 Owner:0x7cc +++++ +Seg:2f21 Size:256 Owner:0x7ce ++++++ +Seg:3021 Size:256 Owner:0x7d0 +++++ +Seg:3121 Size:256 Owner:0x7d2 +++++ +Seg:3221 Size:256 Owner:0x7d4 +++++ +Seg:3321 Size:256 Owner:0x7d6 +++++ +Seg:3421 Size:256 Owner:0x7d8 ++++++ +Seg:3521 Size:256 Owner:0x7da +++++ +Seg:3621 Size:256 Owner:0x7dc +++++ +Seg:3721 Size:256 Owner:0x7de +++++ +Seg:3821 Size:256 Owner:0x7e0 +++++ +Seg:3921 Size:256 Owner:0x7e2 ++++++ +Seg:3a21 Size:256 Owner:0x7e4 +++++ +Seg:3b21 Size:256 Owner:0x7e6 +++++ +Seg:3c21 Size:256 Owner:0x7e8 +++++ +Seg:3d21 Size:256 Owner:0x7ea +++++ +Seg:3e21 Size:256 Owner:0x7ec ++++++ +Seg:3f21 Size:256 Owner:0x7ee +++++ +Seg:4021 Size:256 Owner:0x7f0 +++++ +Seg:4121 Size:256 Owner:0x7f2 +++++ +Seg:4221 Size:256 Owner:0x7f4 +++++ +Seg:4321 Size:256 Owner:0x7f6 ++++++ +Seg:4421 Size:256 Owner:0x7f8 +++++ +Seg:4521 Size:256 Owner:0x7fa +++++ +Seg:4621 Size:256 Owner:0x7fc +++++ +Seg:4721 Size:256 Owner:0x7fe +++++ +Seg:4821 Size:256 Owner:0x800 ++++++ +Seg:4921 Size:256 Owner:0x802 +++++ +Seg:4a21 Size:256 Owner:0x804 +++++ +Seg:4b21 Size:256 Owner:0x806 +++++ +Seg:4c21 Size:256 Owner:0x808 +++++ +Seg:4d21 Size:256 Owner:0x80a ++++++ +Seg:4e21 Size:256 Owner:0x80c +++++ +Seg:4f21 Size:256 Owner:0x80e +++++ +Seg:5021 Size:256 Owner:0x810 +++++ +Seg:5121 Size:256 Owner:0x812 +++++ +Seg:5221 Size:256 Owner:0x814 ++++++ +Seg:5321 Size:256 Owner:0x816 +++++ +Seg:5421 Size:256 Owner:0x818 +++++ +Seg:5521 Size:256 Owner:0x81a +++++ +Seg:5621 Size:256 Owner:0x81c +++++ +Seg:5721 Size:256 Owner:0x81e ++++++ +Seg:5821 Size:256 Owner:0x820 +++++ +Seg:5921 Size:256 Owner:0x822 +++++ +Seg:5a21 Size:256 Owner:0x824 +++++ +Seg:5b21 Size:256 Owner:0x826 +++++ +Seg:5c21 Size:256 Owner:0x828 ++++++ +Seg:5d21 Size:256 Owner:0x82a +++++ +Seg:5e21 Size:256 Owner:0x82c +++++ +Seg:5f21 Size:256 Owner:0x82e +++++ +Seg:6021 Size:256 Owner:0x830 +++++ +Seg:6121 Size:256 Owner:0x832 ++++++ +Seg:6221 Size:256 Owner:0x834 +++++ +Seg:6321 Size:256 Owner:0x836 +++++ +Seg:6421 Size:256 Owner:0x838 +++++ +Seg:6521 Size:256 Owner:0x83a +++++ +Seg:6621 Size:256 Owner:0x83c ++++++ +Seg:6721 Size:256 Owner:0x83e +++++ +Seg:6821 Size:256 Owner:0x840 +++++ +Seg:6921 Size:256 Owner:0x842 +++++ +Seg:6a21 Size:256 Owner:0x844 +++++ +Seg:6b21 Size:256 Owner:0x846 ++++++ +Seg:6c21 Size:256 Owner:0x848 +++++ +Seg:6d21 Size:256 Owner:0x84a +++++ +Seg:6e21 Size:256 Owner:0x84c +++++ +Seg:6f21 Size:256 Owner:0x84e +++++ +Seg:7021 Size:256 Owner:0x850 ++++++ +Seg:7121 Size:256 Owner:0x852 +++++ +Seg:7221 Size:256 Owner:0x854 +++++ +Seg:7321 Size:256 Owner:0x856 +++++ +Seg:7421 Size:256 Owner:0x858 +++++ +Seg:7521 Size:256 Owner:0x85a ++++++ +Seg:7621 Size:256 Owner:0x85c +++++ +Seg:7721 Size:256 Owner:0x85e +++++ +Seg:7821 Size:273 Owner:0xfde +++++ +Seg:9fde Size:32802 Owner:0x0 + +Seg:9ffe Size:24577 Owner:0x0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \ No newline at end of file diff --git a/MEMINFO.16B b/MEMINFO.16B deleted file mode 100755 index e69de29b..00000000 diff --git a/MMDUMP.16B b/MMDUMP.16B index 3c667e2a..451d087e 100755 Binary files a/MMDUMP.16B and b/MMDUMP.16B differ diff --git a/bcexmm.dsk b/bcexmm.dsk index d066bdd4..c8d927e3 100755 Binary files a/bcexmm.dsk and b/bcexmm.dsk differ diff --git a/bcexmm.exe b/bcexmm.exe index b8e96146..585ca07a 100755 Binary files a/bcexmm.exe and b/bcexmm.exe differ diff --git a/bcexmm.prj b/bcexmm.prj index ff689086..72ec764f 100755 Binary files a/bcexmm.prj and b/bcexmm.prj differ diff --git a/src/.scroll.c.kate-swp b/src/.scroll.c.kate-swp deleted file mode 100755 index 29d7843f..00000000 Binary files a/src/.scroll.c.kate-swp and /dev/null differ diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index 7298ca3f..61838010 100755 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -1028,7 +1028,7 @@ dinorm: if ((handle = open(GREXT"DICT."EXT, O_RDONLY | O_BINARY, S_IREAD)) == -1) - Quit ("Can't open "GREXT"DICT."EXT"!"); + Quit (gvar, "Can't open "GREXT"DICT."EXT"!"); read(handle, &grhuffman, sizeof(grhuffman)); close(handle); @@ -1040,7 +1040,7 @@ dinorm: if ((handle = open(GREXT"HEAD."EXT, O_RDONLY | O_BINARY, S_IREAD)) == -1) - Quit ("Can't open "GREXT"HEAD."EXT"!"); + Quit (gvar, "Can't open "GREXT"HEAD."EXT"!"); CA_FarRead(handle, (memptr)grstarts, (NUMCHUNKS+1)*FILEPOSSIZE); @@ -1054,7 +1054,7 @@ dinorm: // grhandle = open(GREXT"GRAPH."EXT, O_RDONLY | O_BINARY); if (grhandle == -1) - Quit ("Cannot open "GREXT"GRAPH."EXT"!"); + Quit (gvar, "Cannot open "GREXT"GRAPH."EXT"!"); // @@ -1134,11 +1134,11 @@ void CAL_SetupMapFile (global_game_variables_t *gvar) // #ifdef MAPHEADERLINKED // if ((maphandle = open("GAMEMAPS."EXT, // O_RDONLY | O_BINARY, S_IREAD)) == -1) -// Quit ("Can't open GAMEMAPS."EXT"!"); +// Quit (gvar, "Can't open GAMEMAPS."EXT"!"); // //#else // if ((maphandle = open("MAPTEMP."EXT, // O_RDONLY | O_BINARY, S_IREAD)) == -1) -// Quit ("Can't open MAPTEMP."EXT"!"); +// Quit (gvar, "Can't open MAPTEMP."EXT"!"); // #endif } @@ -1164,7 +1164,7 @@ void CAL_SetupMapFile (global_game_variables_t *gvar) #ifndef AUDIOHEADERLINKED if ((handle = open("AUDIOHED."EXT, O_RDONLY | O_BINARY, S_IREAD)) == -1) - Quit ("Can't open AUDIOHED."EXT"!"); + Quit (gvar, "Can't open AUDIOHED."EXT"!"); length = filelength(handle); MM_GetPtr (&(memptr)audiostarts,length); CA_FarRead(handle, (byte far *)audiostarts, length); @@ -1181,11 +1181,11 @@ void CAL_SetupMapFile (global_game_variables_t *gvar) #ifndef AUDIOHEADERLINKED if ((audiohandle = open("AUDIOT."EXT, O_RDONLY | O_BINARY, S_IREAD)) == -1) - Quit ("Can't open AUDIOT."EXT"!"); + Quit (gvar, "Can't open AUDIOT."EXT"!"); #else if ((audiohandle = open("AUDIO."EXT, O_RDONLY | O_BINARY, S_IREAD)) == -1) - Quit ("Can't open AUDIO."EXT"!"); + Quit (gvar, "Can't open AUDIO."EXT"!"); #endif }*/ @@ -1291,7 +1291,7 @@ void CA_CacheAudioChunk (int chunk) // MDM begin - (GAMERS EDGE) // if (!FindFile("AUDIO."EXT,NULL,2)) - Quit("CA_CacheAudioChunk(): Can't find audio files."); + Quit (gvar, "CA_CacheAudioChunk(): Can't find audio files."); // // MDM end @@ -1630,7 +1630,7 @@ void CAL_CacheSprite (int chunk, byte far *compressed) break; default: - Quit ("CAL_CacheSprite: Bad shifts number!"); + Quit (gvar, "CAL_CacheSprite: Bad shifts number!"); } #endif @@ -1789,7 +1789,7 @@ void CA_CacheGrChunk (int chunk) // MDM begin - (GAMERS EDGE) // if (!FindFile("EGAGRAPH."EXT,NULL,2)) - Quit("CA_CacheGrChunk(): Can't find graphics files."); + Quit (gvar, "CA_CacheGrChunk(): Can't find graphics files."); // // MDM end @@ -2255,7 +2255,7 @@ void CA_CacheMarks (char *title) // MDM begin - (GAMERS EDGE) // if (!FindFile("EGAGRAPH."EXT,NULL,2)) - Quit("CA_CacheMarks(): Can't find graphics files."); + Quit (gvar, "CA_CacheMarks(): Can't find graphics files."); // // MDM end diff --git a/src/lib/16_dbg.c b/src/lib/16_dbg.c index c3a4d5bb..7f34624b 100755 --- a/src/lib/16_dbg.c +++ b/src/lib/16_dbg.c @@ -9,7 +9,6 @@ boolean dbg_debugpm=0; #ifdef __DEBUG_InputMgr__ boolean dbg_testkeyin=0,dbg_testcontrolnoisy=0; #endif -boolean dbg_nommpmca=0; #endif diff --git a/src/lib/16_dbg.h b/src/lib/16_dbg.h index eb1743eb..06c3fccf 100755 --- a/src/lib/16_dbg.h +++ b/src/lib/16_dbg.h @@ -18,7 +18,6 @@ extern boolean dbg_debugpm; #ifdef __DEBUG_InputMgr__ extern boolean dbg_testkeyin,dbg_testcontrolnoisy; #endif -extern boolean dbg_nommpmca; #endif # ifdef DEBUGSERIAL diff --git a/src/lib/16_head.c b/src/lib/16_head.c index e56baa94..7c25afa5 100755 --- a/src/lib/16_head.c +++ b/src/lib/16_head.c @@ -78,71 +78,7 @@ US_CheckParm(char *parm,char **strings) } return(-1); } -#ifdef __BORLANDC__ -//=========================================================================== -/* -========================== -= -= Quit -= -========================== -*/ - -void Quit (char *error) -{ - unsigned finscreen; - memptr screen; - union REGS in, out; - - //ClearMemory (); - if (!*error) - { - //WriteConfig (); - } - else - { - //CA_CacheGrChunk (ERRORSCREEN); - //screen = grsegs[ERRORSCREEN]; - } - - //ShutdownId (); - //IN_Shutdown(); - //modexLeave(); - in.h.ah = 0x00; - in.h.al = 0x3; - int86(0x10, &in, &out); - - if (error && *error) - { - //movedata ((unsigned)screen,7,0xb800,0,7*160); - //gotoxy (10,4); - printf("\n"); - puts(error); - printf("\n"); - //gotoxy (1,8); - exit(1); - } - else - if (!error || !(*error)) - { - //clrscr(); - //#ifndef JAPAN - movedata ((unsigned)screen,7,0xb800,0,4000); - //gotoxy(1,24); - //#endif -//asm mov bh,0 -//asm mov dh,23 // row -//asm mov dl,0 // collumn -//asm mov ah,2 -//asm int 0x10 - } - - exit(0); -} - -//=========================================================================== -#endif byte dirchar(byte in) { diff --git a/src/lib/16_head.h b/src/lib/16_head.h index a6222773..7fd72c44 100755 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -200,9 +200,6 @@ typedef union REGPACK regs_t; long int filesize(FILE *fp); void printmeminfoline(byte *strc, const byte *pee, size_t h_total, size_t h_used, size_t h_free); int US_CheckParm(char *parm,char **strings); -#ifdef __BORLANDC__ -void Quit (char *error); -#endif byte dirchar(byte in); #endif/*__16_HEAD_H__*/ diff --git a/src/lib/16_in.c b/src/lib/16_in.c index e5d2ec1b..9adfe42a 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -850,7 +850,7 @@ register KeyboardDef *def; realdelta = false; } else if (DemoMode == demo_PlayDone) - Quit("Demo playback exceeded"); + Quit ("Demo playback exceeded"); else { #endif @@ -973,7 +973,7 @@ register KeyboardDef *def; DemoOffset += 2; if (DemoOffset >= DemoSize) - Quit("Demo buffer overflow"); + Quit ("Demo buffer overflow"); DemoBuffer[DemoOffset] = 1; DemoBuffer[DemoOffset + 1] = dbyte; diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 5bbad2b1..98d0c43f 100755 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -28,7 +28,7 @@ Primary coder: John Carmack RELIES ON --------- -Quit (char *error) function +Quit (global_game_variables_t *gvar, char *error) function WORK TO DO @@ -285,7 +285,7 @@ void MML_ShutdownEMS(global_game_variables_t *gvar) } #endif if(errorflag==true) - Quit("MML_ShutdownEMS: Error freeing EMS!\n"); //++++ add something + Quit (gvar, "MML_ShutdownEMS: Error freeing EMS!\n"); //++++ add something } /* @@ -1105,7 +1105,7 @@ void MM_SetPurge(memptr *baseptr, int purge, global_game_variables_t *gvar) gvar->mm.mmrover = gvar->mm.mmhead; else if(gvar->mm.mmrover == start) { - Quit("MM_SetPurge: Block not found!"); + Quit (gvar, "MM_SetPurge: Block not found!"); //return; } @@ -1145,7 +1145,7 @@ void MM_SetLock(memptr *baseptr, boolean locked, global_game_variables_t *gvar) gvar->mm.mmrover = gvar->mm.mmhead; else if(gvar->mm.mmrover == start) { - Quit("MM_SetLock: Block not found!"); + Quit (gvar, "MM_SetLock: Block not found!"); //return; } diff --git a/src/lib/16_pm.c b/src/lib/16_pm.c index 3a125111..4cf50396 100755 --- a/src/lib/16_pm.c +++ b/src/lib/16_pm.c @@ -139,7 +139,7 @@ PML_MapEMS(word logical, byte physical, global_game_variables_t *gvar) strcpy(str,"MM_MapEMS: EMS error "); MM_EMSerr(str, err); printf("%s\n",str); - Quit("PML_MapEMS: Page mapping failed\n"); + Quit (gvar, "PML_MapEMS: Page mapping failed\n"); return err; } return 0; @@ -352,7 +352,7 @@ PML_ShutdownEMS(global_game_variables_t *gvar) strcpy(str,"PML_ShutdownEMS: Error freeing EMS "); MM_EMSerr(str, err); printf("%s\n",str); - Quit("PML_ShutdownEMS: Error freeing EMS\n"); + Quit (gvar, "PML_ShutdownEMS: Error freeing EMS\n"); //return; } } @@ -532,7 +532,7 @@ PML_XMSCopy(boolean toxms,byte far *addr,word xmspage,word length, global_game_v if (!addr) { - Quit("PML_XMSCopy: zero address\n"); + Quit (gvar, "PML_XMSCopy: zero address\n"); //return; } @@ -554,7 +554,7 @@ PML_XMSCopy(boolean toxms,byte far *addr,word xmspage,word length, global_game_v } if (!_AX) { - Quit("PML_XMSCopy: Error on copy"); + Quit (gvar, "PML_XMSCopy: Error on copy"); //return; } } @@ -621,7 +621,7 @@ PML_ShutdownXMS(global_game_variables_t *gvar) #endif if(errorflag==true) { - Quit("PML_ShutdownXMS: Error freeing XMS"); + Quit (gvar, "PML_ShutdownXMS: Error freeing XMS"); //return; } } @@ -656,7 +656,7 @@ PM_SetMainMemPurge(int level, global_game_variables_t *gvar) else { - Quit("MainPresent IS NULL\n"); + Quit (gvar, "MainPresent IS NULL\n"); } } @@ -765,7 +765,7 @@ PML_StartupMainMem(global_game_variables_t *gvar) gvar->mm.mmerror = false; if (gvar->pm.mm.MainPagesAvail < PMMinMainMem) { - Quit("PM_SetupMainMem: Not enough main memory"); + Quit (gvar, "PM_SetupMainMem: Not enough main memory"); //return; } gvar->pm.mm.MainPresent = true; @@ -801,22 +801,22 @@ PML_ReadFromFile(byte far *buf,long offset,word length, global_game_variables_t { if (!buf) { - Quit("PML_ReadFromFile: Null pointer"); + Quit (gvar, "PML_ReadFromFile: Null pointer"); //return; } if (!offset) { - Quit("PML_ReadFromFile: Zero offset"); + Quit (gvar, "PML_ReadFromFile: Zero offset"); //return; } if (lseek(gvar->pm.fi.PageFile,offset,SEEK_SET) != offset) { - Quit("PML_ReadFromFile: Seek failed"); + Quit (gvar, "PML_ReadFromFile: Seek failed"); //return; } if (!CA_FarRead(gvar->pm.fi.PageFile,buf,length, gvar)) { - Quit("PML_ReadFromFile: Read failed"); + Quit (gvar, "PML_ReadFromFile: Read failed"); //return; } } @@ -838,7 +838,7 @@ PML_OpenPageFile(global_game_variables_t *gvar) gvar->pm.fi.PageFile = open(gvar->pm.fi.PageFileName,O_RDONLY + O_BINARY); if (gvar->pm.fi.PageFile == -1) { - Quit("PML_OpenPageFile: Unable to open page file"); + Quit (gvar, "PML_OpenPageFile: Unable to open page file"); //return; } @@ -859,7 +859,7 @@ PML_OpenPageFile(global_game_variables_t *gvar) MM_GetPtr(&buf, size, gvar); if (!CA_FarRead(gvar->pm.fi.PageFile,(byte far *)buf,size, gvar)) { - Quit("PML_OpenPageFile: Offset read failed"); + Quit (gvar, "PML_OpenPageFile: Offset read failed"); //return; } offsetptr = (dword far *)buf; @@ -872,7 +872,7 @@ PML_OpenPageFile(global_game_variables_t *gvar) MM_GetPtr(&buf,size, gvar); if (!CA_FarRead(gvar->pm.fi.PageFile,(byte far *)buf,size, gvar)) { - Quit("PML_OpenPageFile: Length read failed"); + Quit (gvar, "PML_OpenPageFile: Length read failed"); //return; } lengthptr = (word far *)buf; @@ -949,7 +949,7 @@ PML_GetEMSAddress(int page,PMLockType lock, global_game_variables_t *gvar) } if (emspage == -1) - Quit("PML_GetEMSAddress: EMS find failed"); + Quit (gvar, "PML_GetEMSAddress: EMS find failed"); gvar->pm.emm.EMSList[emspage].lastHit = gvar->pm.PMFrameCount; offset = emspage * EMSPageSizeSeg; @@ -1018,7 +1018,7 @@ PML_GiveLRUPage(boolean mainonly, global_game_variables_t *gvar) } if (lru == -1) - Quit("PML_GiveLRUPage: LRU Search failed"); + Quit (gvar, "PML_GiveLRUPage: LRU Search failed"); return(lru); } @@ -1073,7 +1073,7 @@ PML_PutPageInXMS(int pagenum, global_game_variables_t *gvar) { usexms = PML_GiveLRUXMSPage(gvar); if (usexms == -1) - Quit("PML_PutPageInXMS: No XMS LRU"); + Quit (gvar, "PML_PutPageInXMS: No XMS LRU"); page->xmsPage = gvar->pm.PMPages[usexms].xmsPage; gvar->pm.PMPages[usexms].xmsPage = -1; } @@ -1091,16 +1091,16 @@ PML_TransferPageSpace(int orig,int new, global_game_variables_t *gvar) PageListStruct far *origpage,far *newpage; if (orig == new) - Quit("PML_TransferPageSpace: Identity replacement"); + Quit (gvar, "PML_TransferPageSpace: Identity replacement"); origpage = &gvar->pm.PMPages[orig]; newpage = &gvar->pm.PMPages[new]; if (origpage->locked != pml_Unlocked) - Quit("PML_TransferPageSpace: Killing locked page"); + Quit (gvar, "PML_TransferPageSpace: Killing locked page"); if ((origpage->emsPage == -1) && (origpage->mainPage == -1)) - Quit("PML_TransferPageSpace: Reusing non-existent page"); + Quit (gvar, "PML_TransferPageSpace: Reusing non-existent page"); // Copy page that's about to be purged into XMS PML_PutPageInXMS(orig, gvar); @@ -1116,7 +1116,7 @@ PML_TransferPageSpace(int orig,int new, global_game_variables_t *gvar) origpage->mainPage = origpage->emsPage = -1; if (!addr) - Quit("PML_TransferPageSpace: Zero replacement"); + Quit (gvar, "PML_TransferPageSpace: Zero replacement"); return(addr); } @@ -1157,10 +1157,10 @@ PML_GetAPageBuffer(int pagenum,boolean mainonly, global_game_variables_t *gvar) } } if (n == -1) - Quit("PML_GetPageBuffer: MainPagesAvail lied"); + Quit (gvar, "PML_GetPageBuffer: MainPagesAvail lied"); addr = gvar->pm.mm.MainMemPages[n]; if (!addr) - Quit("PML_GetPageBuffer: Purged main block"); + Quit (gvar, "PML_GetPageBuffer: Purged main block"); page->mainPage = n; gvar->pm.MainPagesUsed++; } @@ -1168,7 +1168,7 @@ PML_GetAPageBuffer(int pagenum,boolean mainonly, global_game_variables_t *gvar) addr = PML_TransferPageSpace(PML_GiveLRUPage(mainonly, gvar),pagenum, gvar); if (!addr) - Quit("PML_GetPageBuffer: Search failed"); + Quit (gvar, "PML_GetPageBuffer: Search failed"); return(addr); } @@ -1194,7 +1194,7 @@ PML_GetPageFromXMS(int pagenum,boolean mainonly, global_game_variables_t *gvar) gvar->pm.xmm.XMSProtectPage = pagenum; checkaddr = PML_GetAPageBuffer(pagenum,mainonly, gvar); if (FP_OFF(checkaddr)) - Quit("PML_GetPageFromXMS: Non segment pointer"); + Quit (gvar, "PML_GetPageFromXMS: Non segment pointer"); addr = (memptr)FP_SEG(checkaddr); PML_CopyFromXMS(addr,page->xmsPage,page->length, gvar); gvar->pm.xmm.XMSProtectPage = -1; @@ -1232,7 +1232,7 @@ PM_GetPage(int pagenum, global_game_variables_t *gvar) memptr result; if (pagenum >= gvar->pm.fi.ChunksInFile) - Quit("PM_GetPage: Invalid page request"); + Quit (gvar, "PM_GetPage: Invalid page request"); #ifdef __DEBUG_2__ // for debugging __asm { @@ -1250,7 +1250,7 @@ PM_GetPage(int pagenum, global_game_variables_t *gvar) { boolean mainonly = (pagenum >= gvar->pm.fi.PMSoundStart); if (!gvar->pm.PMPages[pagenum].offset) // JDC: sparse page - Quit ("Tried to load a sparse page!"); + Quit (gvar, "Tried to load a sparse page!"); if (!(result = PML_GetPageFromXMS(pagenum,mainonly, gvar))) { if (gvar->pm.PMPages[pagenum].lastHit == gvar->pm.PMFrameCount) @@ -1290,7 +1290,7 @@ void PM_SetPageLock(int pagenum,PMLockType lock, global_game_variables_t *gvar) { if (pagenum < gvar->pm.fi.PMSoundStart) - Quit("PM_SetPageLock: Locking/unlocking non-sound page"); + Quit (gvar, "PM_SetPageLock: Locking/unlocking non-sound page"); gvar->pm.PMPages[pagenum].locked = lock; } @@ -1357,7 +1357,7 @@ PM_Preload(boolean (*update)(word current,word total), global_game_variables_t * page++; if (page >= gvar->pm.fi.ChunksInFile) - Quit ("PM_Preload: Pages>=gvar->pm.fi.ChunksInFile"); + Quit (gvar, "PM_Preload: Pages>=gvar->pm.fi.ChunksInFile"); PM_GetPage(page, gvar); @@ -1376,7 +1376,7 @@ PM_Preload(boolean (*update)(word current,word total), global_game_variables_t * ; addr = PM_GetPage(oogypage, gvar); if (!addr) - Quit("PM_Preload: XMS buffer failed"); + Quit (gvar, "PM_Preload: XMS buffer failed"); while (xmstotal) { @@ -1384,15 +1384,15 @@ PM_Preload(boolean (*update)(word current,word total), global_game_variables_t * page++; if (page >= gvar->pm.fi.ChunksInFile) - Quit ("PM_Preload: Pages>=gvar->pm.fi.ChunksInFile"); + Quit (gvar, "PM_Preload: Pages>=gvar->pm.fi.ChunksInFile"); p = &gvar->pm.PMPages[page]; p->xmsPage = gvar->pm.XMSPagesUsed++; if (gvar->pm.XMSPagesUsed > gvar->pm.xmm.XMSPagesAvail) - Quit("PM_Preload: Exceeded XMS pages"); + Quit (gvar, "PM_Preload: Exceeded XMS pages"); if (p->length > PMPageSize) - Quit("PM_Preload: Page too long"); + Quit (gvar, "PM_Preload: Page too long"); PML_ReadFromFile((byte far *)addr,p->offset,p->length, gvar); PML_CopyToXMS((byte far *)addr,p->xmsPage,p->length, gvar); @@ -1445,7 +1445,7 @@ PM_NextFrame(global_game_variables_t *gvar) { char buf[40]; sprintf(buf,"PM_NextFrame: Page %d is locked",i); - Quit(buf); + Quit(gvar, buf); } } //#endif @@ -1536,7 +1536,7 @@ PM_Startup(global_game_variables_t *gvar) if (!gvar->pm.mm.MainPresent && !gvar->pm.emm.EMSPresent && !gvar->pm.xmm.XMSPresent) { - Quit("PM_Startup: No main or EMS\n"); + Quit (gvar, "PM_Startup: No main or EMS\n"); //return; } diff --git a/src/lib/16_scr.h b/src/lib/16_scr.h index 94af24e6..38c72637 100755 --- a/src/lib/16_scr.h +++ b/src/lib/16_scr.h @@ -94,6 +94,7 @@ typedef struct //printf("mv[%u].tx: %d", pan.pn, mv[pan.pn].tx); printf(" mv[%u].ty: %d ", pan.pn, mv[pan.pn].ty); //printf("gvar.kurokku: "); printf("%.0f ", clock()); printf("tiku=%lu ", gvar.kurokku.tiku); printf("t=%.0f ", gvar.kurokku.t); printf("ticktock()=%f ", ticktock(&gvar)); printf("%.0f fps", (double)gvar.kurokku.tiku/ticktock(&gvar)); //printf("map.width=%d map.height=%d map.data[0]=%d\n", mv[0].map->width, mv[0].map->height, mv[0].map->data[0]); +//printf("&global_temp_status_text = %Fp\n", &global_temp_status_text); #define SCROLLEXITMESG printf("tx: %d ", mv[0].tx);\ printf("ty: %d\n", mv[0].ty);\ printf("\n");\ @@ -115,9 +116,6 @@ typedef struct \ printf("gvar.video.p=%u ", gvar.video.p); printf("gvar.video.r=%u ", gvar.video.r);\ printf("pageflipflop=%u\n", pageflipflop);\ -\ - printf("&global_temp_status_text = %Fp\n", &global_temp_status_text);\ -\ printf("\n"); extern boolean pageflipflop, pageploop; diff --git a/src/lib/16_t.h b/src/lib/16_t.h index b0fdb481..35eb2f4b 100755 --- a/src/lib/16_t.h +++ b/src/lib/16_t.h @@ -67,6 +67,20 @@ typedef void _seg * memptr;//typedef void __based( void ) * memptr; ////old //-- #ifdef __WATCOMC__ #define _argv __argv #define _argc __argc + +//from http://www.verycomputer.com/3_65d875cc818b54ec_1.htm +void clrscr(void); +#pragma aux clrscr= \ + " mov ah, 0fh " \ + " int 10h " \ + " xor ah, ah " \ + " int 10h " ; +//from http://stackoverflow.com/questions/18425748/gotoxy-function-using-printf-s-position +inline void gotoxy(int x,int y) +{ + printf("\x1B[%d;%df", y, x); + fflush(stdout); // @jxh +} #endif #endif/*_TYPE_H_*/ diff --git a/src/lib/16_tail.c b/src/lib/16_tail.c index bd5b6f1e..6cd9eb92 100755 --- a/src/lib/16_tail.c +++ b/src/lib/16_tail.c @@ -71,20 +71,13 @@ void Startup16(global_game_variables_t *gvar) #endif gvar->mm.mmstarted=0; gvar->pm.PMStarted=0; -#ifdef __DEBUG__ - if(!dbg_nommpmca) -#endif MM_Startup(gvar); +#ifdef __WATCOMC__ IN_Startup(gvar); -#ifdef __DEBUG__ - if(!dbg_nommpmca){ #endif PM_Startup(gvar); PM_UnlockMainMem(gvar); CA_Startup(gvar); -#ifdef __DEBUG__ - } -#endif } //=========================================================================== @@ -101,22 +94,160 @@ void Startup16(global_game_variables_t *gvar) void Shutdown16(global_game_variables_t *gvar) { -#ifdef __DEBUG__ - if(!dbg_nommpmca) -#endif PM_Shutdown(gvar); +#ifdef __WATCOMC__ IN_Shutdown(gvar); -#ifdef __DEBUG__ - if(!dbg_nommpmca){ #endif CA_Shutdown(gvar); MM_Shutdown(gvar); -#ifdef __DEBUG__ - } -#endif } +//=========================================================================== + +/* +==================== += += ReadConfig += +==================== +*/ + +/*void ReadConfig(void) +{ + int file; + SDMode sd; + SMMode sm; + SDSMode sds; + + + if ( (file = open(configname,O_BINARY | O_RDONLY)) != -1) + { + // + // valid config file + // + read(file,Scores,sizeof(HighScore) * MaxScores); + + read(file,&sd,sizeof(sd)); + read(file,&sm,sizeof(sm)); + read(file,&sds,sizeof(sds)); + + read(file,&mouseenabled,sizeof(mouseenabled)); + read(file,&joystickenabled,sizeof(joystickenabled)); + read(file,&joypadenabled,sizeof(joypadenabled)); + read(file,&joystickprogressive,sizeof(joystickprogressive)); + read(file,&joystickport,sizeof(joystickport)); + + read(file,&dirscan,sizeof(dirscan)); + read(file,&buttonscan,sizeof(buttonscan)); + read(file,&buttonmouse,sizeof(buttonmouse)); + read(file,&buttonjoy,sizeof(buttonjoy)); + + read(file,&viewsize,sizeof(viewsize)); + read(file,&mouseadjustment,sizeof(mouseadjustment)); + + close(file); + + if (sd == sdm_AdLib && !AdLibPresent && !SoundBlasterPresent) + { + sd = sdm_PC; + sd = smm_Off; + } + + if ((sds == sds_SoundBlaster && !SoundBlasterPresent) || + (sds == sds_SoundSource && !SoundSourcePresent)) + sds = sds_Off; + + if (!MousePresent) + mouseenabled = false; + if (!JoysPresent[joystickport]) + joystickenabled = false; + + MainMenu[6].active=1; + MainItems.curpos=0; + } + else + { + // + // no config file, so select by hardware + // + if (SoundBlasterPresent || AdLibPresent) + { + sd = sdm_AdLib; + sm = smm_AdLib; + } + else + { + sd = sdm_PC; + sm = smm_Off; + } + + if (SoundBlasterPresent) + sds = sds_SoundBlaster; + else if (SoundSourcePresent) + sds = sds_SoundSource; + else + sds = sds_Off; + + if (MousePresent) + mouseenabled = true; + + joystickenabled = false; + joypadenabled = false; + joystickport = 0; + joystickprogressive = false; + + viewsize = 15; + mouseadjustment=5; + } + + SD_SetMusicMode (sm); + SD_SetSoundMode (sd); + SD_SetDigiDevice (sds); +}*/ + + +/* +==================== += += WriteConfig += +==================== +*/ + +/*void WriteConfig(void) +{ + int file; + + file = open(configname,O_CREAT | O_BINARY | O_WRONLY, + S_IREAD | S_IWRITE | S_IFREG); + + if (file != -1) + { + write(file,Scores,sizeof(HighScore) * MaxScores); + + write(file,&SoundMode,sizeof(SoundMode)); + write(file,&MusicMode,sizeof(MusicMode)); + write(file,&DigiMode,sizeof(DigiMode)); + + write(file,&mouseenabled,sizeof(mouseenabled)); + write(file,&joystickenabled,sizeof(joystickenabled)); + write(file,&joypadenabled,sizeof(joypadenabled)); + write(file,&joystickprogressive,sizeof(joystickprogressive)); + write(file,&joystickport,sizeof(joystickport)); + + write(file,&dirscan,sizeof(dirscan)); + write(file,&buttonscan,sizeof(buttonscan)); + write(file,&buttonmouse,sizeof(buttonmouse)); + write(file,&buttonjoy,sizeof(buttonjoy)); + + write(file,&viewsize,sizeof(viewsize)); + write(file,&mouseadjustment,sizeof(mouseadjustment)); + + close(file); + } +}*/ + //=========================================================================== /* @@ -159,7 +290,22 @@ void DebugMemory_(global_game_variables_t *gvar, boolean q) #endif if(q) MM_ShowMemory (gvar); } -#ifdef __WATCOMC__ + +/* +========================== += += ClearMemory += +========================== +*/ + +void ClearMemory (global_game_variables_t *gvar) +{ + PM_UnlockMainMem(gvar); + //snd + MM_SortMem (gvar); +} + /* ========================== = @@ -168,46 +314,43 @@ void DebugMemory_(global_game_variables_t *gvar, boolean q) ========================== */ -void Quit (char *error) +void Quit (global_game_variables_t *gvar, char *error) { //unsigned finscreen; memptr screen=0; - union REGS in, out; - //ClearMemory (); + ClearMemory (gvar); if (!*error) { - //WriteConfig (); +// #ifndef JAPAN +// CA_CacheGrChunk (ORDERSCREEN); +// screen = grsegs[ORDERSCREEN]; +// #endif +// WriteConfig (); } else { - //CA_CacheGrChunk (ERRORSCREEN); - //screen = grsegs[ERRORSCREEN]; +// CA_CacheGrChunk (ERRORSCREEN); +// screen = grsegs[ERRORSCREEN]; } - - //ShutdownId (); - IN_Shutdown(); - //modexLeave(); - in.h.ah = 0x00; - in.h.al = 0x3; - int86(0x10, &in, &out); + Shutdown16(gvar); if (error && *error) { - //movedata ((unsigned)screen,7,0xb800,0,7*160); - //gotoxy (10,4); - fprintf(stderr, "%s\n", error); - //gotoxy (1,8); - exit(1); + movedata((unsigned)screen,7,0xb800,0,7*160); + gotoxy (10,4); + fprintf(stderr, "%s\n", error); + gotoxy (1,8); + exit(1); } else if (!error || !(*error)) { - //clrscr(); - //#ifndef JAPAN + clrscr(); +#ifndef JAPAN movedata ((unsigned)screen,7,0xb800,0,4000); - //gotoxy(1,24); - //#endif + gotoxy(1,24); +#endif //asm mov bh,0 //asm mov dh,23 // row //asm mov dl,0 // collumn @@ -217,7 +360,6 @@ void Quit (char *error) exit(0); } -#endif //=========================================================================== diff --git a/src/lib/16_tail.h b/src/lib/16_tail.h index 8d1274d8..8cd30094 100755 --- a/src/lib/16_tail.h +++ b/src/lib/16_tail.h @@ -32,10 +32,9 @@ void DebugMemory_(global_game_variables_t *gvar, boolean q); void Shutdown16(global_game_variables_t *gvar); void Startup16(global_game_variables_t *gvar); -#ifdef __WATCOMC__ -void Quit (char *error); -#endif +void ClearMemory (global_game_variables_t *gvar); +void Quit (global_game_variables_t *gvar, char *error); void nibbletest(); void booleantest(); -#endif +#endif /*__16_TAIL__ */ diff --git a/src/scroll.c b/src/scroll.c index 03859245..5beb4743 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -29,8 +29,6 @@ //#define FADE #define MODEX //this is for mode x initiating -extern boolean dbg_nommpmca; - //word far *clock= (word far*) 0x046C; /* 18.2hz clock */ //bitmap_t *p; global_game_variables_t gvar; @@ -60,8 +58,6 @@ boolean panswitch=0;//1 void main(int argc, char *argv[]) { - dbg_nommpmca=1; - if(argv[1]) bakapee = atoi(argv[1]); else bakapee = 1;