]> 4ch.mooo.com Git - 16.git/commitdiff
replaced the getptr function with the one from wolfenstien! wwww
authorsparky4 <sparky4@cock.li>
Mon, 10 Aug 2015 14:10:44 +0000 (09:10 -0500)
committersparky4 <sparky4@cock.li>
Mon, 10 Aug 2015 14:10:44 +0000 (09:10 -0500)
modified:   DEBUG.16
modified:   HEAP.16
modified:   MMDUMP.16
modified:   exmmtest.exe
modified:   src/lib/16_mm.c

DEBUG.16
HEAP.16
MMDUMP.16
exmmtest.exe
src/lib/16_mm.c

index 7315a04f5b27c58cd096d2239d3d2c3dae6ce608..04159b0155be334bd3735f61a14527dcfeaba0d5 100644 (file)
--- a/DEBUG.16
+++ b/DEBUG.16
@@ -1,17 +1,17 @@
-\e[0mSeg:0      Size:5552       Owner:0x5\r
+\e[0mSeg:0      Size:5522       Owner:0x65e\r
 \e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m\r
 \e[42;32m0\e[0m\r
-\e[0mSeg:15b0   Size:256        Owner:0x3518\r
+\e[0mSeg:1592   Size:256        Owner:0x3518\r
 \e[44;34m++++\e[0m\e[47;37m_\e[0m\r
 \e[42;32m\e[0m\r
-\e[0mSeg:16b0   Size:273        Owner:0x858c\r
-\e[44;34m+++++\e[0m\e[47;37m_\e[0m\r
+\e[0mSeg:1692   Size:273        Owner:0x858c\r
+\e[44;34m++++\e[0m\e[47;37m_\e[0m\r
 \e[42;32m\e[0m\r
-\e[0mSeg:1cff   Size:40 Owner:0x35a0\r
-\e[41;31m++\e[0m\e[47;37m_\e[0m\r
-\e[42;32m000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\e[0m\r
-\e[0mSeg:ad27   Size:13017      Owner:0x3578\r
-\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m\r
+\e[0mSeg:1ce1   Size:40 Owner:0x0\r
+\e[41;31m+\e[0m\e[47;37m_\e[0m\r
+\e[42;32m0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\e[0m\r
+\e[0mSeg:ad09   Size:13047      Owner:0x0\r
+\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m\r
 \e[42;32m\e[0m\r
-\e[0mSeg:e000   Size:8191       Owner:0x358c\r
-\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m\r
+\e[0mSeg:e000   Size:8191       Owner:0x0\r
+\e[41;31m\e[0m\e[47;37m_\e[0m\r
diff --git a/HEAP.16 b/HEAP.16
index e4368cc1be7854b7f37d9370ed970c8aa079c002..d1049f1770563b4059118a3d7a3343e343cf42a7 100644 (file)
--- a/HEAP.16
+++ b/HEAP.16
@@ -1,11 +1,11 @@
 \r
        == default ==\r
 \r
-  USED block at 1d210016 of size 66\r
-  FREE block at 1d210058 of size 18\r
-  USED block at 1d21006a of size 136\r
-  USED block at 1d2100f2 of size 20\r
-  FREE block at 1d210106 of size 7926\r
+  USED block at 1d030016 of size 66\r
+  FREE block at 1d030058 of size 18\r
+  USED block at 1d03006a of size 136\r
+  USED block at 1d0300f2 of size 20\r
+  FREE block at 1d030106 of size 7926\r
 OK - end of heap\r
 \r
        == near ==\r
index 87fc5ce997482470f20f2740ac0dc69cac155e2d..107157e6c9e60a048bc08f85723e9f62ba54fc45 100644 (file)
Binary files a/MMDUMP.16 and b/MMDUMP.16 differ
index ff8006ed6bd9308adfb6ef3203ff801a1cff1f6d..ee515dbf8ee440524c6cce292a801042372b27f8 100644 (file)
Binary files a/exmmtest.exe and b/exmmtest.exe differ
index 3cb6cb757f51667ccca532964c5b84c91a51f39b..d0582540eca7f9a8eb192537618fdadf549282d9 100644 (file)
@@ -565,7 +565,7 @@ void MML_UseSpace(word segstart, dword seglength, mminfo_t *mm)
        mmblocktype huge *scan,huge *last;
        word            segm=1;
        word    oldend;
-       dword           segmlen=seglength;
+       dword           segmlen;
        dword           extra;
 
        scan = last = mm->mmhead;
@@ -582,21 +582,24 @@ void MML_UseSpace(word segstart, dword seglength, mminfo_t *mm)
                //printf("              seglen=%lu\n", scan->length);
        }
 
-       //find out how many blocks it spans!
-       //
+//
+// take the given range out of the block
+//
+       oldend = scan->start + scan->length;
+       extra = oldend - (segstart+seglength);
+
+       segmlen=extra;
+//
+// find out how many blocks it spans!
+//
        for(;segmlen>0x10000;segmlen-=0x10000)
        {
                //printf("      seglen=%lu\n", segmlen);
                segm++;
        }
 
-//
-// take the given range out of the block
-//
-       oldend = scan->start + scan->length;
-       extra = oldend - (segstart+(word)seglength);
        //++++emsver stuff!
-       if(segm>1 || extra>=0x10000lu)
+       if(segm>1/* || extra>=0x10000lu*/)
        //if(extra>0xfffflu)
        {
                scan->blob=segm;
@@ -891,47 +894,44 @@ void MM_Shutdown(mminfo_t *mm)
 ====================
 */
 
-void MM_GetPtr(memptr *baseptr,dword size, mminfo_t *mm, mminfotype *mmi)
+void MM_GetPtr (memptr *baseptr, dword size, mminfo_t *mm, mminfotype *mmi)
 {
-       mmblocktype huge *scan,huge *lastscan,huge *endscan,huge *purge,huge *next;
+       mmblocktype huge *scan,huge *lastscan,huge *endscan
+                               ,huge *purge,huge *next;
        int                     search;
-       dword   needed;
-       word    startseg;
+       unsigned        needed,startseg;
 
        needed = (size+15)/16;          // convert size from bytes to paragraphs
-//printf("."); //0000
+
        GETNEWBLOCK;                            // fill in start and next after a spot is found
        mm->mmnew->length = needed;
        mm->mmnew->useptr = baseptr;
        mm->mmnew->attributes = BASEATTRIBUTES;
-//printf("."); //0000
-       for(search = 0; search<3; search++)
+
+//tryagain:
+       for (search = 0; search<3; search++)
        {
-printf("\n     [case]");       //0000
        //
        // first search:        try to allocate right after the rover, then on up
        // second search:       search from the head pointer up to the rover
        // third search:        compress memory, then scan from start
-               if(search == 1 && mm->mmrover == mm->mmhead)
+               if (search == 1 && mm->mmrover == mm->mmhead)
                        search++;
 
-               switch(search)
+               switch (search)
                {
                case 0:
-printf("0      ");     //0000
                        lastscan = mm->mmrover;
                        scan = mm->mmrover->next;
                        endscan = NULL;
                        break;
                case 1:
-printf("1      ");     //0000
                        lastscan = mm->mmhead;
                        scan = mm->mmhead->next;
                        endscan = mm->mmrover;
                        break;
                case 2:
-printf("2      ");     //0000
-                       MM_SortMem(mm);
+                       MM_SortMem (mm);
                        lastscan = mm->mmhead;
                        scan = mm->mmhead->next;
                        endscan = NULL;
@@ -939,13 +939,11 @@ printf("2 ");     //0000
                }
 
                startseg = lastscan->start + lastscan->length;
-printf(" %x\n", startseg);
-               while(scan != endscan)
+
+               while (scan != endscan)
                {
-printf(",");   //0000
-                       if(scan->start - startseg >= needed)
+                       if (scan->start - startseg >= needed)
                        {
-printf(".");   //0000
                        //
                        // got enough space between the end of lastscan and
                        // the start of scan, so throw out anything in the middle
@@ -953,11 +951,10 @@ printf(".");      //0000
                        //
                                purge = lastscan->next;
                                lastscan->next = mm->mmnew;
-                               mm->mmnew->start = *(word *)baseptr = startseg;
+                               mm->mmnew->start = *(unsigned *)baseptr = startseg;
                                mm->mmnew->next = scan;
-                               while(purge != scan)
+                               while ( purge != scan)
                                {       // free the purgable block
-printf("               freeing block~\n");     //0000
                                        next = purge->next;
                                        FREEBLOCK(purge);
                                        purge = next;           // purge another if not at scan
@@ -969,25 +966,15 @@ printf("          freeing block~\n");     //0000
                        //
                        // if this block is purge level zero or locked, skip past it
                        //
-                       if((scan->attributes & LOCKBIT)
+                       if ( (scan->attributes & LOCKBIT)
                                || !(scan->attributes & PURGEBITS) )
                        {
-printf("       [lock] ");      //0000
                                lastscan = scan;
-printf("start=%x ", lastscan->start);
-printf("len=%x ", lastscan->length);
-printf("\n");  //0000
-printf("       %x", lastscan->start + lastscan->length);       //0000
-printf("       %x", lastscan->start + (word)lastscan->length); //0000
-printf("       %x", (word)lastscan->start + (word)lastscan->length);   //0000
-printf("\n");  //0000
-                               startseg = (word)lastscan->start + (word)lastscan->length+1;
-printf("startseg =%x   ok", startseg); //0000
+                               startseg = lastscan->start + lastscan->length;
                        }
 
-printf("       end\n");
+
                        scan=scan->next;                // look at next line
-printf("boop\n");//0000
                }
        }