From: sparky4 Date: Thu, 2 Jul 2015 21:13:10 +0000 (-0500) Subject: divide the memory blob into chunks X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=63c2a1f0ef54fb7867e0828dadbaff0361ec190a;p=16.git divide the memory blob into chunks modified: exmmtest.exe modified: src/lib/16_mm.c modified: src/lib/16_mm.h --- diff --git a/exmmtest.exe b/exmmtest.exe index 42dba971..df027297 100644 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index d39e2683..3f0e7e57 100644 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -410,12 +410,12 @@ void MML_ShutdownXMS(mminfo_t *mm) ====================== */ -void MML_UseSpace(unsigned segstart, unsigned seglength, mminfo_t *mm) +void MML_UseSpace(unsigned segstart, dword seglength, mminfo_t *mm) { mmblocktype huge *scan,huge *last; unsigned oldend; //++++if(mm->EMSVer) - long extra; + dword extra; scan = last = mm->mmhead; mm->mmrover = mm->mmhead; // reset rover to start of memory @@ -435,10 +435,10 @@ void MML_UseSpace(unsigned segstart, unsigned seglength, mminfo_t *mm) oldend = scan->start + scan->length; extra = oldend - (segstart+seglength); //++++emsver stuff! - if(extra < 0) + if(extra > 0xffffl) { - printf("MML_UseSpace: Segment spans two blocks!"); - return; + printf("MML_UseSpace: Segment spans two blocks!\n"); + //return; } @@ -593,11 +593,13 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi) MML_SetupEMS(mm); // allocate space printf("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); //bug! //TODO: EMS4! AND EMS 3.2 MASSIVE DATA HANDLMENT! - MML_UseSpace(mm->EMSpageframe,mm->EMSpagesmapped*0x400, mm); + if(mm->EMSVer>=0x40) MML_UseSpace(mm->EMSpageframe,((dword)mm->EMSpagesmapped)*((dword)mm->freeEMSpages), mm); + else MML_UseSpace(mm->EMSpageframe,mm->EMSpagesmapped*0x400, mm); //printf("EMS3\n"); MM_MapEMS(mm); // map in used pages //printf("EMS4\n"); - mmi->EMSmem = mm->EMSpagesmapped*0x4000l; + if(mm->EMSVer>=0x40) mmi->EMSmem = ((dword)mm->EMSpagesmapped)*((dword)mm->freeEMSpages); + else mmi->EMSmem = mm->EMSpagesmapped*0x4000l; } // diff --git a/src/lib/16_mm.h b/src/lib/16_mm.h index bef21c03..bc178f15 100644 --- a/src/lib/16_mm.h +++ b/src/lib/16_mm.h @@ -160,7 +160,7 @@ 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_UseSpace(unsigned segstart, dword seglength, mminfo_t *mm); void MML_ClearBlock(mminfo_t *mm); void MM_Startup(mminfo_t *mm, mminfotype *mmi); @@ -175,7 +175,7 @@ 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); +//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);