]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_mm.c
hmmm
[16.git] / src / lib / 16_mm.c
index b1a56ad46ef077727c5e2db9536d7b6511180528..aa123376bfe59dd1f3fb128535b038e877665276 100644 (file)
@@ -634,10 +634,10 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi)
 {
        int i;
        dword length,seglength;
+       //dword length; word seglength;
        void huge       *start;
-       unsigned        segstart,endfree;
+       word    segstart;//,endfree;
 
-       //printf("mmi->segu=%Fp\n", (mmi->segu));
        if(mm->mmstarted)
                MM_Shutdown(mm);
 
@@ -655,7 +655,6 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi)
                mm->mmblocks[i].next = &(mm->mmblocks[i+1]);
        }
        mm->mmblocks[i].next = NULL;
-       //printf("mmi->segu=%Fp\n", (mmi->segu));
 
 //
 // locked block of all memory until we punch out free space
@@ -668,22 +667,22 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi)
        mm->mmnew->attributes = LOCKBIT;
        mm->mmnew->next = NULL;
        mm->mmrover = mm->mmhead;
-       //printf("mmi->segu=%Fp\n", (mmi->segu));
 
 //
 // get all available near conventional memory segments
 //
-       //printf("              nearheap making!\n");
+       printf("                nearheap making!\n");
 //---- length=coreleft();
-       //_nheapgrow();
+       _nheapgrow();
        length=_memmax();
-       start = (void huge *)(mm->nearheap = _nmalloc(length));
+       start = (void huge *)(mm->nearheap = malloc(length));
        length -= 16-(FP_OFF(start)&15);
        length -= SAVENEARHEAP;
        seglength = length / 16;                        // now in paragraphs
        segstart = FP_SEG(start)+(FP_OFF(start)+15)/16;
        MML_UseSpace(segstart,seglength, mm);
        mmi->nearheap = length;
+       printf("start=%Fp       segstart=%x     seglen=%lu      len=%lu\n", start, segstart, seglength, length);
        /*switch( _nheapchk() ) {
                case _HEAPOK:
                        printf( "OK - nearheap is good\n" );
@@ -698,24 +697,25 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi)
                        printf( "ERROR - bad node in nearheap\n" );
                break;
        }*/
-       //printf("              near heap ok!\n");
+       printf("                near heap ok!\n");
 
 //
 // get all available far conventional memory segments
 //
 //---- length=farcoreleft();
-       //printf("              farheap making!\n");
-       /*_fheapgrow();
-       length=0xff;//UL*4UL;//_memavl();
+       printf("                farheap making!\n");
+       _fheapgrow();
+       length=0xffffUL*4UL;
        start = mm->farheap = halloc(length, sizeof(byte));
        //start = mm->farheap = _fmalloc(length);
        length -= 16-(FP_OFF(start)&15);
        length -= SAVEFARHEAP;
        seglength = length / 16;                        // now in paragraphs
        segstart = FP_SEG(start)+(FP_OFF(start)+15)/16;
-       MML_UseSpace(segstart,seglength, mm);*/
-       mmi->farheap = 0;//length;
+       MML_UseSpace(segstart,seglength, mm);
+       mmi->farheap = length;
        mmi->mainmem = mmi->nearheap + mmi->farheap;
+       printf("start=%Fp       segstart=%x     seglen=%lu      len=%lu\n", start, segstart, seglength, length);
        /*switch( _fheapchk() ) {
                case _HEAPOK:
                        printf( "OK - farheap is good\n" );
@@ -730,12 +730,12 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi)
                        printf( "ERROR - bad node in farheap\n" );
                break;
        }*/
-       //printf("              far heap ok!\n");
+       printf("                far heap ok!\n");
 
 //
 // detect EMS and allocate up to 64K at page frame
 //
-printf("               EMS1\n");
+/*printf("             EMS1\n");
 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!
        mmi->EMSmem = 0;
        for(i = 1;i < __argc;i++)
@@ -782,11 +782,11 @@ printf("          XMS!\n");
 //
 // allocate the misc buffer
 //
-xmsskip:
+xmsskip:*/
 /*mmi->nearheap = 0;
-mmi->farheap = 0;
+mmi->farheap = 0;*/
 mmi->EMSmem = 0;
-mmi->XMSmem = 0;*/
+mmi->XMSmem = 0;
        mm->mmrover = mm->mmhead;               // start looking for space after low block
 
        MM_GetPtr(&(mm->bufferseg),BUFFERSIZE, mm, mmi);