]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_mm.h
added segm variable to mark the liking of blobs of large data
[16.git] / src / lib / 16_mm.h
index fb99af1d6212aa6af328d8b1259ae409f807e21e..2981a1a389755ff1fec8b0e235844a35d87be781 100644 (file)
 
 #include <string.h>
 #include <malloc.h>
+//#include <bios.h>
 #include "src/lib/16_head.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
@@ -33,7 +36,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
@@ -41,6 +44,7 @@
 #define MAXBLOCKS              600
 
 
+
 //--------
 
 #define        EMS_INT                 0x67
@@ -85,7 +89,7 @@ typedef void __based(__self) * memptr; //__based(seg) * memptr;
 
 typedef struct
 {
-       dword   nearheap,farheap/*,hugeheap*/,EMSmem,XMSmem,mainmem;
+       dword   nearheap,farheap,EMSmem,XMSmem,mainmem;
 } mminfotype;
 
 //==========================================================================
@@ -109,11 +113,16 @@ extern void               (* XMSaddr) (void);             // far pointer to XMS driver
 #define PURGEMASK      0xfffc
 #define BASEATTRIBUTES 0       // unlocked, non purgable
 
-#define MAXUMBS                10
+#define MAXUMBS                12
+#define MAPPAGES               mm->EMSpagesmapped
 
 typedef struct mmblockstruct
 {
-       unsigned        start,length;
+       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!
        unsigned        attributes;
        memptr          *useptr;        // pointer to the segment start
        struct mmblockstruct huge *next;
@@ -124,12 +133,14 @@ typedef struct
 {
        memptr bufferseg;
        boolean         mmstarted, bombonerror, mmerror;
-       //void  huge *hugeheap;
+       word segm;
        void huge       *farheap;
        void            *nearheap;
+       //byte          EMS_status;
        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;
 
@@ -153,13 +164,14 @@ typedef struct
 //==========================================================================
 
 boolean MML_CheckForEMS(void);
-unsigned MML_SetupEMS(mminfo_t *mm);
+byte MML_SetupEMS(mminfo_t *mm);
 void MML_ShutdownEMS(mminfo_t *mm);
-unsigned MM_MapEMS(mminfo_t *mm);
+byte MM_MapEMS(mminfo_t *mm);
+byte MM_MapXEMS(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_UseSpace(/*d*/word segstart, dword seglength, mminfo_t *mm);
 void MML_ClearBlock(mminfo_t *mm);
 
 void MM_Startup(mminfo_t *mm, mminfotype *mmi);
@@ -170,11 +182,12 @@ 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);
+void MM_ShowMemory(page_t *page, mminfo_t *mm);
+void MM_DumpData(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_Report(page_t *page, 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);