X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_mm.h;h=1ef85c953182f2a16e0bb27e149c5e4a9418383c;hb=cfa61df0152c0dff3c78b9ef35f8b82bdf7506e1;hp=08a72dd216a00413490b78c04083c1958b60f1f7;hpb=bee11e09842453ed5154248808d3d5acd67eab6f;p=16.git diff --git a/src/lib/16_mm.h b/src/lib/16_mm.h index 08a72dd2..1ef85c95 100644 --- a/src/lib/16_mm.h +++ b/src/lib/16_mm.h @@ -1,19 +1,19 @@ -/* Catacomb Apocalypse Source Code - * Copyright (C) 1993-2014 Flat Rock Software - * - * This program 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 2 of the License, or - * (at your option) any later version. - * - * This program 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, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +/* Catacomb Apocalypse Source Code + * Copyright (C) 1993-2014 Flat Rock Software + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ // ID_MM.H @@ -23,6 +23,7 @@ #include #include +//#include #include "src/lib/16_head.h" //++++mh #include "src/lib/16_in.h" @@ -33,7 +34,7 @@ #endif -#define SAVENEARHEAP 0x400 // space to leave in data segment +#define SAVENEARHEAP 0x200 // space to leave in data segment #define SAVEFARHEAP 0 // space to leave in far heap #define BUFFERSIZE 0x1000 // miscelanious, allways available buffer @@ -85,15 +86,11 @@ typedef void __based(__self) * memptr; //__based(seg) * memptr; typedef struct { - dword nearheap,farheap/*,hugeheap*/,EMSmem,XMSmem,mainmem; + dword nearheap,farheap,EMSmem,XMSmem,mainmem; } mminfotype; //========================================================================== -/*extern mminfotype mminfo; -extern memptr bufferseg; -extern boolean mmerror;*/ - extern void (* beforesort) (void); extern void (* aftersort) (void); extern void (* XMSaddr) (void); // far pointer to XMS driver @@ -113,14 +110,17 @@ extern void (* XMSaddr) (void); // far pointer to XMS driver #define PURGEMASK 0xfffc #define BASEATTRIBUTES 0 // unlocked, non purgable -#define MAXUMBS 10 +#define MAXUMBS 12 typedef struct mmblockstruct { - unsigned start,length; + word start,length; + //dword start,length; + //word start; + //dword length; unsigned attributes; memptr *useptr; // pointer to the segment start - struct mmblockstruct far *next; + struct mmblockstruct huge *next; } mmblocktype; @@ -128,20 +128,15 @@ typedef struct { memptr bufferseg; boolean mmstarted, bombonerror, mmerror; - //void huge *hugeheap; - void huge/*far*/ *farheap; + void huge *farheap; void *nearheap; unsigned totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle; unsigned int EMSVer; - unsigned numUMBs,UMBbase[MAXUMBS]; + word numUMBs,UMBbase[MAXUMBS]; + //dword numUMBs,UMBbase[MAXUMBS]; mmblocktype huge mmblocks[MAXBLOCKS],huge *mmhead,huge *mmfree,huge *mmrover,huge *mmnew; } mminfo_t; - -//#define GETNEWBLOCK {if(!(mmnew=mmfree))Quit("MM_GETNEWBLOCK: No free blocks!");mmfree=mmfree->next;} -//#define GETNEWBLOCK {if(!mmfree)MML_ClearBlock();mmnew=mmfree;mmfree=mmfree->next;} -//#define FREEBLOCK(x) {*x->useptr=NULL;x->next=mmfree;mmfree=x;} - /* ============================================================================= @@ -150,11 +145,6 @@ typedef struct ============================================================================= */ -/*static mminfotype mminfo; -static memptr bufferseg; - -static void (* beforesort) (void); -static void (* aftersort) (void);*/ /* ============================================================================= @@ -164,46 +154,31 @@ static void (* aftersort) (void);*/ ============================================================================= */ -/*static void huge *hugeheap; -static void far *farheap; -static void *nearheap; - -static mmblocktype far mmblocks[MAXBLOCKS] - ,far *mmhead,far *mmfree,far *mmrover,far *mmnew; - - -static unsigned totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle; -static unsigned int EMSVer; - -static void (* XMSaddr) (void); // far pointer to XMS driver - -static unsigned numUMBs,UMBbase[MAXUMBS];*/ - //========================================================================== -boolean MML_CheckForEMS(void); -unsigned MML_SetupEMS(mminfo_t *mm); -void MML_ShutdownEMS(mminfo_t *mm); -unsigned MM_MapEMS(mminfo_t *mm); -boolean MML_CheckForXMS(mminfo_t *mm); +boolean MML_CheckForEMS(void); +unsigned MML_SetupEMS(mminfo_t *mm); +void MML_ShutdownEMS(mminfo_t *mm); +unsigned MM_MapEMS(mminfo_t *mm); +boolean MML_CheckForXMS(mminfo_t *mm); void MML_SetupXMS(mminfo_t *mm, mminfotype *mmi); -void MML_ShutdownXMS(mminfo_t *mm); -void MML_UseSpace(unsigned segstart, unsigned seglength, mminfo_t *mm); +void MML_ShutdownXMS(mminfo_t *mm); +void MML_UseSpace(/*d*/word segstart, dword seglength, mminfo_t *mm); void MML_ClearBlock(mminfo_t *mm); - -void MM_Startup(mminfo_t *mm, mminfotype *mmi); + +void MM_Startup(mminfo_t *mm, mminfotype *mmi); void MM_Shutdown(mminfo_t *mm); - -void MM_GetPtr(memptr *baseptr,dword size, mminfo_t *mm, mminfotype *mmi); -void MM_FreePtr(memptr *baseptr, mminfo_t *mm); -void MM_SetPurge(memptr *baseptr, int purge, mminfo_t *mm); -void MM_SetLock(memptr *baseptr, boolean locked, mminfo_t *mm); -void MM_SortMem(mminfo_t *mm); -void MM_ShowMemory(mminfo_t *mm); -dword MM_UnusedMemory(mminfo_t *mm); -dword MM_TotalFree(mminfo_t *mm); -void MM_Report(mminfo_t *mm, mminfotype *mmi); -int MM_EMSVer(void); + +void MM_GetPtr(memptr *baseptr,dword size, mminfo_t *mm, mminfotype *mmi); +void MM_FreePtr(memptr *baseptr, mminfo_t *mm); +void MM_SetPurge(memptr *baseptr, int purge, mminfo_t *mm); +void MM_SetLock(memptr *baseptr, boolean locked, mminfo_t *mm); +void MM_SortMem(mminfo_t *mm); +void MM_ShowMemory(mminfo_t *mm); +dword MM_UnusedMemory(mminfo_t *mm); +dword MM_TotalFree(mminfo_t *mm); +void MM_Report(mminfo_t *mm, mminfotype *mmi); +//int MM_EMSVer(void); void MM_BombOnError(boolean bomb, mminfo_t *mm); void MM_GetNewBlock(mminfo_t *mm); void MM_FreeBlock(mmblocktype *x, mminfo_t *mm);