]> 4ch.mooo.com Git - 16.git/commitdiff
Signed-off-by: sparky4 <sparky4@cock.li>
authorsparky4 <sparky4@cock.li>
Mon, 3 Aug 2015 21:21:18 +0000 (16:21 -0500)
committersparky4 <sparky4@cock.li>
Mon, 3 Aug 2015 21:21:18 +0000 (16:21 -0500)
DEBUG.16 [deleted file]
HEAP.16
MMDUMP.16 [deleted file]
exmmtest.exe
fmemtest.exe
src/lib/16_hc.c
src/lib/16_hc.h
src/lib/16_mm.c
src/lib/16_mm.h

diff --git a/DEBUG.16 b/DEBUG.16
deleted file mode 100644 (file)
index 13e4d4d..0000000
--- a/DEBUG.16
+++ /dev/null
@@ -1,8 +0,0 @@
-0      Size:5194       Owner:0x0
-0      Size:5194       Owner:0x0
-144a   Size:256        Owner:0x4d02
-Seg:154a       Size:273        Owner:0x859a
-Seg:1bd1       Size:17 Owner:0x144d
-Seg:1bd1       Size:17 Owner:0x144d
-1dd2   Size:49710      Owner:0x11
-Seg:e000       Size:4294909951 Owner:0xc22b
diff --git a/HEAP.16 b/HEAP.16
index 961857845a84f07aaa7eea40339ef041ec58dab4..abeb11d53fb682b55f1c7016311b74c2af7d3906 100644 (file)
--- a/HEAP.16
+++ b/HEAP.16
@@ -1,11 +1,10 @@
 
        == default ==
 
-  USED block at 1bd30016 of size 88
-  USED block at 1bd3009e of size 42
-  FREE block at 1bd300e0 of size 1f1e
-  USED block at 1bd31ffe of size 14
-  FREE block at 1bd32012 of size 1fea
+  USED block at 1bda0016 of size 88
+  USED block at 1bda009e of size 42
+  USED block at 1bda00e0 of size 1f1e
+  FREE block at 1bda1ffe of size 1ffe
 OK - end of heap
 
        == near ==
@@ -27,19 +26,18 @@ OK - end of heap
   USED block at 0 of size 0
   USED block at 0 of size 0
   USED block at 0 of size 0
-  USED block at 0 of size 0
 OK - end of heap
 
 Memory Type         Total      Used       Free
 ----------------  --------   --------   --------
-Default                   16358        222     16136
-Near              31286        436     30850
-Far               16358        222     16136
+Default                   16358        8168    8190
+Near              31286        31286   0
+Far               16358        8168    8190
 ----------------  --------   --------   --------
-coreleft = 30848
-farcoreleft = 46788
-GetFreeSize = 15960
-GetNearFreeSize = 30850
-GetFarFreeSize = 15960
-memavl = 30848
-stackavail = 17135
+coreleft = 0
+farcoreleft = 7996
+GetFreeSize = 8014
+GetNearFreeSize = 0
+GetFarFreeSize = 8014
+memavl = 0
+stackavail = 17041
diff --git a/MMDUMP.16 b/MMDUMP.16
deleted file mode 100644 (file)
index b14aef4..0000000
Binary files a/MMDUMP.16 and /dev/null differ
index d3de90c1bbc9e4fcaa9c7ee895a6bae25ca790e3..d0846ef58cf2dc2e11c8d1d20a06cbb15ffa5c0e 100644 (file)
Binary files a/exmmtest.exe and b/exmmtest.exe differ
index 22b194327cb752c492053767bea8399b118cab01..11bcf03cef8cd666ece091f1d21ce9963c4e0042 100644 (file)
Binary files a/fmemtest.exe and b/fmemtest.exe differ
index af747fc470b3a7f8122b2fc557a6dadb92e6600c..a7de12f3e4123f6e2896dd3347dde18308d7a668 100644 (file)
@@ -25,6 +25,8 @@
 
 #include "src/lib/16_hc.h"
 
+int heaphandle;
+
 void __near* LargestFreeBlock(size_t* Size)
 {
        size_t s0, s1;
index 7959d29566bd6b7716b28e0f5f57d08012462b89..d9677d1087bb71fc04dfc266cf4d638f2ae914a1 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "src/lib/16_head.h"
 
-int heaphandle;
+extern int heaphandle;
 
 void __near* LargestFreeBlock(size_t* Size);
 size_t _coreleft(void);
index bff437306c465da39c96dbe0e692b5858e165518..a784e4fc20d8f3abffb1e0b38b8996d280e9e7e2 100644 (file)
@@ -518,10 +518,10 @@ void MML_UseSpace(/*d*/word segstart, dword seglength, mminfo_t *mm)
        }
 
        //find out how many blocks it spans!
-       if(seglength>0xffffu)
+       if((word)seglength>0xffffu)
        {
 //             segm=seglength/0x4000u;
-               segm=seglength/0xffffu;
+               segm=(word)seglength/0xffffu;
        }
        else segm=1;
 
@@ -643,6 +643,7 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi)
 
        mm->mmstarted = true;
        mm->bombonerror = true;
+       mm->endid=0;
 
 //
 // set up the linked list (everything in the free list;
@@ -807,7 +808,8 @@ void MM_GetPtr(memptr *baseptr,dword size, mminfo_t *mm, mminfotype *mmi)
 {
        mmblocktype huge *scan,huge *lastscan,huge *endscan,huge *purge,huge *next;
        int                     search;
-       unsigned        needed,startseg;
+       dword   needed;
+       word    startseg;
 
        needed = (size+15)/16;          // convert size from bytes to paragraphs
 printf(".");   //0000
@@ -816,9 +818,9 @@ printf(".");        //0000
        mm->mmnew->useptr = baseptr;
        mm->mmnew->attributes = BASEATTRIBUTES;
 printf(".");   //0000
-       for(search = 0; search<3; search++)
+       for(search = 0; search<mm->endid; search++)
        {
-printf("|[case]");     //0000
+printf("       [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
@@ -829,19 +831,19 @@ printf("|[case]");        //0000
                switch(search)
                {
                case 0:
-printf("0");   //0000
+printf("0      ");     //0000
                        lastscan = mm->mmrover;
                        scan = mm->mmrover->next;
                        endscan = NULL;
                        break;
                case 1:
-printf("1");   //0000
+printf("1      ");     //0000
                        lastscan = mm->mmhead;
                        scan = mm->mmhead->next;
                        endscan = mm->mmrover;
                        break;
                case 2:
-printf("2");   //0000
+printf("2      ");     //0000
                        MM_SortMem(mm);
                        lastscan = mm->mmhead;
                        scan = mm->mmhead->next;
@@ -849,14 +851,14 @@ printf("2");      //0000
                        break;
                }
 
-               startseg = lastscan->start + lastscan->length;
+               startseg = lastscan->start + (word)lastscan->length;
 
                while(scan != endscan)
                {
-printf(",");   //0000
+//printf(","); //0000
                        if(scan->start - startseg >= needed)
                        {
-printf("\\");  //0000
+printf(".");   //0000
                        //
                        // got enough space between the end of lastscan and
                        // the start of scan, so throw out anything in the middle
@@ -864,7 +866,7 @@ printf("\\");       //0000
                        //
                                purge = lastscan->next;
                                lastscan->next = mm->mmnew;
-                               mm->mmnew->start = *(unsigned *)baseptr = startseg;
+                               mm->mmnew->start = *(word *)baseptr = startseg;
                                mm->mmnew->next = scan;
                                while(purge != scan)
                                {       // free the purgable block
@@ -883,12 +885,13 @@ printf("          freeing block~\n");     //0000
                        if((scan->attributes & LOCKBIT)
                                || !(scan->attributes & PURGEBITS) )
                        {
-printf("/[lock]");     //0000
+printf("       [lock] ");      //0000
+printf("len=%lu ", scan->length);
                                lastscan = scan;
-                               startseg = lastscan->start + lastscan->length;
+                               startseg = lastscan->start + (word)lastscan->length;
                        }
 
-
+printf("\n");
                        scan=scan->next;                // look at next line
                }
        }
@@ -898,6 +901,7 @@ printf("/[lock]");  //0000
                heapdump();
                printf(OUT_OF_MEM_MSG,(size-mmi->nearheap));
                printf("for stability reasons the program will shut down! wwww\n");
+               printf("                endid=%u\n",(mm->endid));
                MM_Shutdown(mm);
                exit(-1);
        }
@@ -1566,6 +1570,7 @@ void MM_GetNewBlock(mminfo_t *mm)
                return;
        }
        mm->mmfree=mm->mmfree->next;
+       mm->endid++;    //end of list
 }
 
 void MM_FreeBlock(mmblocktype *x, mminfo_t *mm)
@@ -1573,6 +1578,7 @@ void MM_FreeBlock(mmblocktype *x, mminfo_t *mm)
        x->useptr=NULL;
        x->next=mm->mmfree;
        mm->mmfree=x;
+       mm->endid--;    //end of list
 }
 
 void MM_seguin(void)
index 010a26265d932149300e24804178c17c8cdb11b2..575685c3d01c9bc16c5db4d82e9e15fe66d3954f 100644 (file)
@@ -136,6 +136,7 @@ typedef struct
        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;