-/* Catacomb Apocalypse Source Code\r
- * Copyright (C) 1993-2014 Flat Rock Software\r
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
*\r
- * This program is free software; you can redistribute it and/or modify\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
* it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
+ * the Free Software Foundation; either version 3 of the License, or\r
* (at your option) any later version.\r
*\r
- * This program is distributed in the hope that it will be useful,\r
+ * Project 16 is distributed in the hope that it will be useful,\r
* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
* GNU General Public License for more details.\r
*\r
- * You should have received a copy of the GNU General Public License along\r
- * with this program; if not, write to the Free Software Foundation, Inc.,\r
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
*/\r
\r
// ID_MM.H\r
\r
-#ifndef __16_EXMM__\r
-#define __16_EXMM__\r
+#ifndef __16_MM__\r
+#define __16_MM__\r
\r
#include <string.h>\r
-#include <malloc.h>\r
#include "src/lib/16_head.h"\r
#include "src/lib/16_hc.h"\r
#include "src/lib/16_tail.h"\r
-//++++mh #include "src/lib/16_in.h"\r
\r
#ifdef __DEBUG__ // 1 == Debug/Dev ; 0 == Production/final\r
#define OUT_OF_MEM_MSG "MM_GetPtr: Out of memory!\nYou were short :%lu bytes\n"\r
#else\r
-#define OUT_OF_MEM_MSG "\npee\n"\r
+#define OUT_OF_MEM_MSG "\n"\r
#endif\r
\r
//#define GETNEWBLOCK {if(!(mmnew=mmfree))Quit("MM_GETNEWBLOCK: No free blocks!") ;mmfree=mmfree->next;}\r
\r
#define FREEBLOCK(x) {*x->useptr=NULL;x->next=gvar->mm.mmfree;gvar->mm.mmfree=x;}\r
\r
-#define SAVENEARHEAP 0x200 // space to leave in data segment\r
-#define SAVEFARHEAP 0//x400 // space to leave in far heap\r
+#define SAVENEARHEAP 0x400 // space to leave in data segment\r
+#define SAVEFARHEAP 0 // space to leave in far heap\r
\r
#define BUFFERSIZE 0x1000 // miscelanious, allways available buffer\r
\r
-//moved to typdefst\r
+//moved to 16_tdef.h\r
//#define MAXBLOCKS 1024\r
\r
\r
-\r
//--------\r
\r
#define EMS_INT 0x67\r
\r
//==========================================================================\r
\r
-//moved to typdefst\r
+//typedef void _seg * memptr; //moved to 16_t.h\r
+\r
/*typedef struct\r
{\r
dword nearheap,farheap,EMSmem,XMSmem,mainmem;\r
-} mminfotype;*/\r
+} mminfotype;*/ //moved to 16_tdef.h\r
\r
//==========================================================================\r
\r
extern void (* beforesort) (void);\r
extern void (* aftersort) (void);\r
-extern void (* XMSaddr) (void); // far pointer to XMS driver\r
+//extern void (* XMSaddr) (void); // far pointer to XMS driver\r
extern dword XMSDriver;\r
extern word XMSVer;\r
\r
word blob; //for data larger than 64k\r
unsigned attributes;\r
memptr *useptr; // pointer to the segment start\r
- //huge struct mmblockstruct huge *next;\r
struct mmblockstruct far *next;\r
} mmblocktype;\r
\r
{\r
memptr bufferseg;\r
boolean mmstarted, bombonerror, mmerror;\r
- //huge void huge *farheap;\r
void far *farheap;\r
#ifdef __BORLANDC__\r
void *nearheap;\r
unsigned int EMSVer;\r
word numUMBs,UMBbase[MAXUMBS];\r
//dword numUMBs,UMBbase[MAXUMBS];\r
- //huge mmblocktype huge mmblocks[MAXBLOCKS],huge *mmhead,huge *mmfree,huge *mmrover,huge *mmnew;\r
mmblocktype far mmblocks[MAXBLOCKS],far *mmhead,far *mmfree,far *mmrover,far *mmnew;\r
} mminfo_t;*/\r
\r
\r
//==========================================================================\r
\r
-boolean MML_CheckForEMS(void);\r
+boolean MML_CheckForEMS (void);\r
//byte MML_SetupEMS(mminfo_t *mm);\r
//void MML_ShutdownEMS(mminfo_t *mm);\r
-byte MM_MapEMS(global_game_variables_t *gvar);\r
+//byte MM_MapEMS(global_game_variables_t *gvar);\r
//byte MM_MapXEMS(global_game_variables_t *gvar);\r
-boolean MML_CheckForXMS(void);\r
+boolean MML_CheckForXMS (void);\r
//void MML_SetupXMS(mminfo_t *mm, mminfotype *mmi);\r
//void MML_ShutdownXMS(mminfo_t *mm);\r
-void MML_UseSpace(word segstart, dword seglength, global_game_variables_t *gvar);\r
-void MML_ClearBlock(global_game_variables_t *gvar);\r
-\r
-void MM_Startup(global_game_variables_t *gvar);\r
-void MM_Shutdown(global_game_variables_t *gvar);\r
-\r
-void MM_GetPtr(memptr *baseptr,dword size, global_game_variables_t *gvar);\r
-void MM_FreePtr(memptr *baseptr, global_game_variables_t *gvar);\r
-void MM_SetPurge(memptr *baseptr, int purge, global_game_variables_t *gvar);\r
-void MM_SetLock(memptr *baseptr, boolean locked, global_game_variables_t *gvar);\r
-void MM_SortMem(global_game_variables_t *gvar);\r
-void MM_ShowMemory(global_game_variables_t *gvar);\r
-void MM_DumpData(global_game_variables_t *gvar);\r
-dword MM_UnusedMemory(global_game_variables_t *gvar);\r
-dword MM_TotalFree(global_game_variables_t *gvar);\r
-void MM_Report_(global_game_variables_t *gvar);\r
-/*static */void MM_EMSerr(byte *stri, byte err);\r
-void MM_BombOnError(boolean bomb, global_game_variables_t *gvar);\r
+void MML_UseSpace (unsigned segstart, unsigned seglength, global_game_variables_t *gvar);\r
+void MML_ClearBlock (global_game_variables_t *gvar);\r
+\r
+void MM_Reset (global_game_variables_t *gvar);\r
+void MM_Startup (global_game_variables_t *gvar);\r
+void MM_Shutdown (global_game_variables_t *gvar);\r
+\r
+void MM_GetPtr (memptr *baseptr,dword size, global_game_variables_t *gvar);\r
+void MM_FreePtr (memptr *baseptr, global_game_variables_t *gvar);\r
+void MM_SetPurge (memptr *baseptr, int purge, global_game_variables_t *gvar);\r
+void MM_SetLock (memptr *baseptr, boolean locked, global_game_variables_t *gvar);\r
+void MM_SortMem (global_game_variables_t *gvar);\r
+void MM_ShowMemory (global_game_variables_t *gvar);\r
+void MM_ShowMemoryDetail (unsigned x, unsigned y, unsigned w, unsigned q, sdword end, mmshowmemoryinfo_t *scaninfo, global_game_variables_t *gvar);\r
+void MM_DumpData (global_game_variables_t *gvar);\r
+dword MM_UnusedMemory (global_game_variables_t *gvar);\r
+dword MM_TotalFree (global_game_variables_t *gvar);\r
+void MM_Report_ (global_game_variables_t *gvar);\r
+/*static */void MM_EMSerr (byte *stri, byte err);\r
+void MM_BombOnError (boolean bomb, global_game_variables_t *gvar);\r
//void MM_GetNewBlock(mminfo_t *mm);\r
//void MM_FreeBlock(mmblocktype *x, mminfo_t *mm);\r
-void xms_call(byte v, global_game_variables_t *gvar);\r
+void xms_call (byte v, global_game_variables_t *gvar);\r
\r
//==========================================================================\r
\r