X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_mm.h;h=7425fc93b89c9affa2a8b5a9e0df79ae3493283c;hb=e0806081573e79828c100893f396dadc9d909f99;hp=64c946a8828e94ffad30b978b51a62a52ec88e62;hpb=3476d7884db6fecd32ab58fcdc5c2f0e8c6e2232;p=16.git diff --git a/src/lib/16_mm.h b/src/lib/16_mm.h index 64c946a8..7425fc93 100644 --- a/src/lib/16_mm.h +++ b/src/lib/16_mm.h @@ -25,23 +25,29 @@ #include //#include #include "src/lib/16_head.h" -#include "src/lib/modex16.h" +#include "src/lib/16_hc.h" +//#include "src/lib/modex16.h" //#include "src/lib/16_ca.h" //++++mh #include "src/lib/16_in.h" #ifdef __DEBUG__ // 1 == Debug/Dev ; 0 == Production/final -#define OUT_OF_MEM_MSG "MM_GetPtr: Out of memory!\nYou were short :%lu bytes" +#define OUT_OF_MEM_MSG "MM_GetPtr: Out of memory!\nYou were short :%lu bytes\n" #else #define OUT_OF_MEM_MSG "\npee\n" #endif +//#define GETNEWBLOCK {if(!(mmnew=mmfree))Quit("MM_GETNEWBLOCK: No free blocks!") ;mmfree=mmfree->next;} +#define GETNEWBLOCK {if(!mm->mmfree)MML_ClearBlock(mm);mm->mmnew=mm->mmfree;mm->mmfree=mm->mmfree->next;} -#define SAVENEARHEAP 0x200 // space to leave in data segment -#define SAVEFARHEAP 0 // space to leave in far heap +#define FREEBLOCK(x) {*x->useptr=NULL;x->next=mm->mmfree;mm->mmfree=x;} + + +#define SAVENEARHEAP 0//_memavl()/4 // space to leave in data segment +#define SAVEFARHEAP 0//x400 // space to leave in far heap #define BUFFERSIZE 0x1000 // miscelanious, allways available buffer -#define MAXBLOCKS 600//720 +#define MAXBLOCKS 720 @@ -84,15 +90,11 @@ #define XMS_FREEUMB 0x11 //========================================================================== -//I hope this is correct! -//__segment seg; -typedef void __based(__self) * memptr; //__based(seg) * memptr; typedef struct { dword nearheap,farheap,EMSmem,XMSmem,mainmem; - //word __based(__segname("_CODE")) segu; -// + //__segment segu; } mminfotype; //========================================================================== @@ -121,11 +123,8 @@ extern void (* XMSaddr) (void); // far pointer to XMS driver typedef struct mmblockstruct { - word start,length; - //dword start,length; - //word start; - //dword length; - //byte segm; //how many 64kb segment blocks it takes up if there is many data! + //word start,length; + word start; dword length; unsigned attributes; memptr *useptr; // pointer to the segment start struct mmblockstruct huge *next; @@ -137,11 +136,12 @@ typedef struct memptr bufferseg; boolean mmstarted, bombonerror, mmerror; void huge *farheap; - void *nearheap; + void __near *nearheap; //byte EMS_status; unsigned totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle; unsigned int EMSVer; word numUMBs,UMBbase[MAXUMBS]; + word endid; //end of list //dword numUMBs,UMBbase[MAXUMBS]; mmblocktype huge mmblocks[MAXBLOCKS],huge *mmhead,huge *mmfree,huge *mmrover,huge *mmnew; } mminfo_t; @@ -191,8 +191,8 @@ dword MM_TotalFree(mminfo_t *mm); void MM_Report(/*page_t *page, */mminfo_t *mm, mminfotype *mmi); static void MM_EMSerr(byte *stri, byte err); void MM_BombOnError(boolean bomb, mminfo_t *mm); -void MM_GetNewBlock(mminfo_t *mm); -void MM_FreeBlock(mmblocktype *x, mminfo_t *mm); +//void MM_GetNewBlock(mminfo_t *mm); +//void MM_FreeBlock(mmblocktype *x, mminfo_t *mm); //==========================================================================