void MML_SetupXMS(mminfo_t *mm, mminfotype *mmi)
{
- unsigned base,size;
+ word base,size;
getmemory:
__asm {
#ifdef __WATCOMC__
}
#endif
- printf("base=%u ", base); printf("size=%u\n", size);
+// printf("base=%u ", base); printf("size=%u\n", size);
MML_UseSpace(base,size, mm);
mmi->XMSmem += size*16;
mm->UMBbase[mm->numUMBs] = base;
{
pop ds
}*/
- //printf("MML_UseSpace: Segment spans two blocks!\n");
+ printf("MML_UseSpace: Segment spans two blocks!\n");
}
//
//MM_MapXEMS(mm, mmi); // map in used pages
}
-mmi->XMSmem=0;
-goto xmsskip;
-
//
// detect XMS and get upper memory blocks
//
emsskip:
mmi->XMSmem = 0;
+ goto xmsskip;
for(i = 1;i <
#ifdef __WATCOMC__
__argc
if(!(mm->mmstarted))
return;
- _ffree(mm->farheap); printf(" far freed\n");
+ _ffree(mm->farheap);// printf(" far freed\n");
#ifdef __WATCOMC__
- _nfree(mm->nearheap); printf(" near freed\n");
+ _nfree(mm->nearheap);// printf(" near freed\n");
#endif
#ifdef __BORLANDC__
- free(mm->nearheap); printf(" near freed\n");
+ free(mm->nearheap);// printf(" near freed\n");
#endif
- if(MML_CheckForEMS()){ MML_ShutdownEMS(mm); printf(" EMS freed\n"); }
- if(MML_CheckForXMS(mm)){ MML_ShutdownXMS(mm); printf(" XMS freed\n"); }
+ if(MML_CheckForEMS()){ MML_ShutdownEMS(mm); }//printf(" EMS freed\n"); }
+ if(MML_CheckForXMS(mm)){ MML_ShutdownXMS(mm); }//printf(" XMS freed\n"); }
}
//==========================================================================
if (mm->bombonerror)
{
#ifdef __WATCOMC__
- heapdump();
+ //heapdump();
#endif
printf(OUT_OF_MEM_MSG,(size-mmi->nearheap));
printf("for stability reasons the program will shut down! wwww\n");
MM_SetLock(&(memptr)audiosegs[playing],false);*/
}
-
//==========================================================================
-//****#if 0
/*
=====================
=
=====================
*/
-void MM_ShowMemory(/*page_t *page, */mminfo_t *mm)
+void MM_ShowMemory(global_game_variables_t *gvar,/*page_t *page, */mminfo_t *mm)
{
mmblocktype huge *scan;
-//++++ word color;
+ //byte color;
word temp;
- long end,owner;
-//++++ word chx,chy;
- byte scratch[160],str[16];
-
+ sdword end,owner;
+ //word chx,chy;
+ word w;
+ byte scratch[160],scratch0[4096],str[16];
+ byte d = '#';
//**** VW_SetDefaultColors();
//**** VW_SetLineWidth(40);
//++++mh temp = bufferofs;
//++++mh bufferofs = 0;
//**** VW_SetScreen (0,0);
-
scan = mm->mmhead;
-
end = -1;
-CA_OpenDebug ();
-
-//++++ chx=0;
-//++++ chy=0;
-
+ CA_OpenDebug (gvar);
+ w=0;
while(scan)
{
-/*++++ if(scan->attributes & PURGEBITS)
- color = 5; // dark purple = purgable
+ strcpy(scratch, AARESET);
+ if(scan->attributes & PURGEBITS)
+ strcpy(scratch0, AAMAGENTA); // dark purple = purgable
else
- color = 9; // medium blue = non purgable
+ strcpy(scratch0, AABLUE); // medium blue = non purgable
if(scan->attributes & LOCKBIT)
- color = 12; // red = locked*/
+ strcpy(scratch0, AARED); // red = locked
if(scan->start<=end)
{
- //printf(");
- write(debughandle,"\nMM_ShowMemory: Memory block order currupted!\n",strlen("\nMM_ShowMemory: Memory block order currupted!\n"));
+ printf("\n%d\n\n", end);
+ strcat(scratch, "MM_ShowMemory: Memory block order currupted!\n");
+ strcat(scratch, "End's Size: ");
+ ultoa (end,str,10);
+ strcat (scratch,str);
+ strcat(scratch, "\nscan->start's Size: ");
+ ultoa (scan->start,str,10);
+ strcat (scratch,str);
+ write(gvar->handle.debughandle,scratch,strlen(scratch));
//modexprint(&page, chx, chy, 1, 0, 24, "\nMM_ShowMemory: Memory block order currupted!\n");
- return;
+ break;
}
- end = scan->start+scan->length-1;
+ end = scan->start+(word)scan->length-1;
//++++ chy = scan->start/320;
//++++ chx = scan->start%320;
//modexhlin(page, scan->start, (unsigned)end, chy, color);
//{
//++++ modexClearRegion(page, chx, chy, 4, 4, color);
//}
-
//++++ VW_Hlin(scan->start,(unsigned)end,0,color);
-
+// for(w=0;w>=(word)scan->length/80;w++)
+// {
+// printf("+ %lu\n", w);
+ //ultoa (w,str,10);
+ //strcat (scratch0,str);
+ strcat(scratch0, "+");
+// }
+ strcat(scratch0, AARESET); strcat(scratch0, AAGREY); strcat(scratch0,"_");
//++++ VW_Plot(scan->start,0,15);
//++++ modexClearRegion(page, chx, chy, 4, 4, 15);
- if(scan->next->start > end+1)
//++++ VW_Hlin(end+1,scan->next->start,0,0); // black = free
+ if(scan->next->start > end+1)
+ {
+ strcat(scratch0, AARESET);
+ //ultoa (w,str,10);
+ //strcat (scratch0,str);
+ strcat(scratch0,AAGREEN);
+// for(w=(scan->next->start)/80;w>=(word)((scan->length+1)/80);w++)
+// {
+// printf("0 %lu\n", w);
+ strcat(scratch0,"0");
+// }
+ }
+ strcat(scratch0, AARESET);
+ strcat(scratch0,"\n");
//for(chx=scan->next->start;chx+4>=(word)end+1;chx+=4)
//{
-//++++ chx+=scan->next->start;
-//++++ modexClearRegion(page, chx, chy, 4, 4, 2);
+// chx+=scan->next->start;
+// modexClearRegion(page, chx, chy, 4, 4, 2);
//}
//modexhlin(page, end+1,scan->next->start, chy, 0);
-
-/*
- end = scan->length-1;
- y = scan->start/320;
+/* y = scan->start/320;
x = scan->start%320;
VW_Hlin(x,x+end,y,color);
- VW_Plot(x,y,15);
- if (scan->next && scan->next->start > end+1)
- VW_Hlin(x+end+1,x+(scan->next->start-scan->start),y,0); // black = free
-*/
-
-//****#if 0
-//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!
-strcpy(scratch,"Seg:");
-ultoa (scan->start,str,16);
-strcat (scratch,str);
-strcat (scratch,"\tSize:");
-ultoa ((dword)scan->length,str,10);
-strcat (scratch,str);
-strcat (scratch,"\tOwner:0x");
-owner = (unsigned)scan->useptr;
-ultoa (owner,str,16);
-strcat (scratch,str);
-strcat (scratch,"\n");
-write(debughandle,scratch,strlen(scratch));
+ VW_Plot(x,y,15);*/
+//++++ VW_Hlin(x+end+1,x+(scan->next->start-scan->start),y,0); // black = free
+ strcat(scratch,"Seg:");
+ ultoa (scan->start,str,16);
+ strcat (scratch,str);
+ strcat (scratch,"\tSize:");
+ ultoa ((dword)scan->length,str,10);
+ strcat (scratch,str);
+ strcat (scratch,"\tOwner:0x");
+ owner = (unsigned)scan->useptr;
+ ultoa (owner,str,16);
+ strcat (scratch,str);
+ strcat (scratch,"\n");
+ write(gvar->handle.debughandle,scratch,strlen(scratch));
+ write(gvar->handle.debughandle,scratch0,strlen(scratch0));
//modexprint(page, chx, chy, 1, 0, 24, &scratch);
//++++chy+=4;
//fprintf(stdout, "%s", scratch);
-//****#endif
scan = scan->next;
}
-CA_CloseDebug ();
+ CA_CloseDebug (gvar);
//++++mh IN_Ack();
//**** VW_SetLineWidth(64);
//++++mh bufferofs = temp;
}
-//****#endif
//==========================================================================
byte lock,purge;
FILE *dumpfile;
-
- //++++free(mm->nearheap);
+ free(mm->nearheap);
dumpfile = fopen ("mmdump.16","w");
if (!dumpfile){
printf("MM_DumpData: Couldn't open MMDUMP.16!\n");
scan = scan->next;
}
-// return free*16l;
- return free;
+ return free*16lu;
+// return free;
}
//==========================================================================
scan = scan->next;
}
-// return free*16l;
- return free;
+ return free*16lu;
+// return free;
}
//==========================================================================