]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_mm.h
fack!
[16.git] / src / lib / 16_mm.h
index a5c159ee51f1072bb1615a45357516784b898bea..ccf1a59b50495d07131a82260079e90a10ea506a 100644 (file)
 #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
-#define OUT_OF_MEM_MSG "MM_GetPtr: Out of memory!\nYou were short :%ld bytes"
+#define OUT_OF_MEM_MSG "MM_GetPtr: Out of memory!\nYou were short :%lu bytes"
 #else
 #define OUT_OF_MEM_MSG "\npee\n"
 #endif
 
 
-#define SAVENEARHEAP   0x200           // space to leave in data segment
-#define SAVEFARHEAP            0                       // space to leave in far heap
+#define SAVENEARHEAP   0//x200         // space to leave in data segment
+#define SAVEFARHEAP    0x400                   // space to leave in far heap
 
 #define        BUFFERSIZE              0x1000          // miscelanious, allways available buffer
 
-#define MAXBLOCKS              600
+#define MAXBLOCKS              720
+
 
 
 //--------
@@ -51,6 +54,7 @@
 #define        EMS_GETPAGES    0x42
 #define        EMS_ALLOCPAGES  0x43
 #define        EMS_MAPPAGE             0x44
+#define        EMS_MAPXPAGE            0x50
 #define        EMS_FREEPAGES   0x45
 #define        EMS_VERSION             0x46
 
 
 //==========================================================================
 //I hope this is correct!
-//__segment                seg;
-typedef void __based(__self) * memptr; //__based(seg) * memptr;
+typedef void __based(void)* memptr;
+//__segment            sega;
+//__self
+//typedef void __based( sega ) * memptr;
 
 typedef struct
 {
        dword   nearheap,farheap,EMSmem,XMSmem,mainmem;
+       //__segment segu;
 } mminfotype;
 
 //==========================================================================
@@ -111,15 +118,12 @@ extern void               (* XMSaddr) (void);             // far pointer to XMS driver
 #define BASEATTRIBUTES 0       // unlocked, non purgable
 
 #define MAXUMBS                12
+#define MAPPAGES               4//mm->EMSpagesmapped
 
 typedef struct mmblockstruct
 {
-       word    start,length;
-       //dword start,length;
-       //word  start;
-       //dword length;
-       word segm;                              //how many 64kb segment blocks it takes up if there is many data!
-       //dword segmlen;                //length of the multi segment data
+       //word  start,length;
+       word    start;  dword length;
        unsigned        attributes;
        memptr          *useptr;        // pointer to the segment start
        struct mmblockstruct huge *next;
@@ -131,7 +135,8 @@ typedef struct
        memptr bufferseg;
        boolean         mmstarted, bombonerror, mmerror;
        void huge       *farheap;
-       void            *nearheap;
+       void    *nearheap;
+       //byte          EMS_status;
        unsigned        totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle;
        unsigned int EMSVer;
        word numUMBs,UMBbase[MAXUMBS];
@@ -159,9 +164,10 @@ 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, mminfotype *mmi);
+byte MM_MapXEMS(mminfo_t *mm, mminfotype *mmi);
 boolean MML_CheckForXMS(mminfo_t *mm);
 void MML_SetupXMS(mminfo_t *mm, mminfotype *mmi);
 void MML_ShutdownXMS(mminfo_t *mm);
@@ -176,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);
+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);