#include "src/lib/16_ca.h"
#include "src/lib/16_mm.h"
//#include "src/lib/modex16.h"
+#pragma hdrstop\r
+\r
+#pragma warn -pro\r
+#pragma warn -use
-//#define FILERL
+#define FILERL
//#define FILEINIT
void
main(int argc, char *argv[])
{
- static mminfo_t mm; mminfotype mmi;
- static const __segment segu;
- static memptr bigbuffer;
+ mminfo_t mm; mminfotype mmi;
+ __segment segu;
+#ifdef FILERL
+ memptr bigbuffer;
static char *bakapee;
word baka;
+#endif
//static page_t screen;
//mmi.segu=FP_SEG(segu);
printf("&segu=%p\n", (segu));
//printf("mmi.segu=%p\n", (mmi.segu));
- bakapee = _nmalloc(64);
+#ifdef FILERL
+ bakapee = malloc(64);
// memset(bakapee, 0, 64);
+#endif
mm.mmstarted=0;
+#ifdef FILERL
if(argv[1]) bakapee = argv[1];
else bakapee = "data/koishi~~.pcx";
+#endif
textInit();\r
baka=1;
else
baka=0;
-#endif
//hmm functions in cache system use the buffered stuff
printf("size of big buffer~=%lu\n", _bmsize(segu, bigbuffer));
+#endif
printf("dark purple = purgable\n");
printf("medium blue = non purgable\n");
printf("red = locked\n");
//
// set up the linked list (everything in the free list;
//
- //printf(" linked list making!\n");
+ printf(" linked list making!\n");
mm->mmhead = NULL;
mm->mmfree = &(mm->mmblocks[0]);
for(i=0;i<MAXBLOCKS-1;i++)
//
// locked block of all memory until we punch out free space
//
- //printf(" newblock making!\n");
+ printf(" newblock making!\n");
MM_GetNewBlock(mm);
mm->mmhead = mm->mmnew; // this will allways be the first node
mm->mmnew->start = 0;
//
// get all available near conventional memory segments
//
- //printf(" nearheap making!\n");
+ printf(" nearheap making!\n");
//---- length=coreleft();
- //_nheapgrow();
- length=_memmax();
- start = (void huge *)(mm->nearheap = _nmalloc(length));
+ _nheapgrow();
+ length=GetFreeSize();//_memmax();
+ start = /*(void huge *)*/(mm->nearheap = _nmalloc(length));
length -= 16-(FP_OFF(start)&15);
length -= SAVENEARHEAP;
seglength = length / 16; // now in paragraphs
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=_memavl();//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;
/*switch( _fheapchk() ) {
case _HEAPOK:
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++)
//
// 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);