X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_mm.h;h=7425fc93b89c9affa2a8b5a9e0df79ae3493283c;hb=e0806081573e79828c100893f396dadc9d909f99;hp=8b214032226923f31ad7d8e27fb02c1ac6d5bcde;hpb=1bbf1963b1b967c37d24f6da75beaa8c213dbab8;p=16.git diff --git a/src/lib/16_mm.h b/src/lib/16_mm.h index 8b214032..7425fc93 100644 --- a/src/lib/16_mm.h +++ b/src/lib/16_mm.h @@ -25,19 +25,25 @@ #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 @@ -84,16 +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; //__segment segu; - word segu; -// } mminfotype; //========================================================================== @@ -122,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; @@ -138,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; @@ -192,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); //==========================================================================