//screen.width += (16*2);\r
//screen.height += (16*2);\r
\r
- printf("main()=%Fp start MM\n", *argv[0]);\r
+// printf("main()=%Fp start MM\n", *argv[0]);\r
MM_Startup(&mm, &mmi);\r
//PM_Startup();\r
//PM_UnlockMainMem();\r
CA_Startup(&gvar);\r
- printf(" done!\n");\r
+// printf(" done!\n");\r
printf("&main()= %Fp\n", *argv[0]);\r
printf("bigbuffer= %Fp\n", bigbuffer);\r
printf("&bigbuffer= %Fp\n", &bigbuffer);\r
MM_DumpData(&mm);\r
//++++modexLeave();\r
MM_Report(&mm, &mmi);\r
- printf(" stop!\n");\r
+// printf(" stop!\n");\r
#ifdef FILERL\r
MM_FreePtr(&bigbuffer, &mm);\r
#endif\r
//PM_Shutdown();\r
CA_Shutdown(&gvar);\r
MM_Shutdown(&mm);\r
- printf(" done!\n");\r
+// printf(" done!\n");\r
#ifdef FILERL\r
free(bakapee);\r
if(baka) printf("\nyay!\n");\r
modexEnter();\r
/* setup camera and screen~ */\r
screen = modexDefaultPage();\r
- screen.width += (16*2);\r
- screen.height += (16*2);\r
+ //screen.width += (16*2);\r
+ //screen.height += (16*2);\r
//++++ modexShowPage(&screen);\r
//modexprint(16, 16, 1, 15, "wwww");\r
//getch();\r
colpee=32;\r
for(e=0x00; e<=0xFE; e++)\r
{\r
- if(chx+8>(SCREEN_WIDTH/2)-16)\r
+ if(chx+8>(screen.width/2))\r
{\r
chx=0;\r
chy+=8;\r
unlink("profile.16");\r
gvar->handle.profilehandle = open("profile.16", O_CREAT | O_WRONLY | O_TEXT);\r
#endif\r
+ unlink("debug0.16");\r
+ gvar->handle.showmemhandle = open("debug0.16", O_CREAT | O_WRONLY | O_TEXT);\r
/*++++\r
// MDM begin - (GAMERS EDGE)\r
//\r
#ifdef PROFILE\r
close(gvar->handle.profilehandle);\r
#endif\r
+ close(gvar->handle.showmemhandle);\r
/*++++\r
close(maphandle);\r
close(grhandle);\r
\r
typedef struct\r
{\r
+ int showmemhandle;\r
int profilehandle,debughandle;\r
int heaphandle;\r
} handle_t;\r
MM_SetLock(&(memptr)audiosegs[playing],false);*/
}
-
//==========================================================================
-//****#if 0
/*
=====================
=
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];
-
+ word chx,chy;
+ byte scratch[160],scratch0[4096],str[16];
+ byte d = "#";
//**** VW_SetDefaultColors();
//**** VW_SetLineWidth(40);
//++++mh temp = bufferofs;
//**** VW_SetScreen (0,0);
scan = mm->mmhead;
-
end = -1;
CA_OpenDebug (gvar);
-
-//++++ chx=0;
+ chx=0;
//++++ chy=0;
-
while(scan)
{
-/*++++ if(scan->attributes & PURGEBITS)
- color = 5; // dark purple = purgable
+ 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(gvar->handle.debughandle,"\nMM_ShowMemory: Memory block order currupted!\n",strlen("\nMM_ShowMemory: Memory block order currupted!\n"));
//modexprint(&page, chx, chy, 1, 0, 24, "\nMM_ShowMemory: Memory block order currupted!\n");
- return;
+ break;
}
end = scan->start+scan->length-1;
//++++ chy = scan->start/320;
//{
//++++ modexClearRegion(page, chx, chy, 4, 4, color);
//}
-
//++++ VW_Hlin(scan->start,(unsigned)end,0,color);
-
+ for(chx=scan->start;chx>=(word)end;chx++)
+ {
+ strcat(scratch0,&d);
+ }
+ strcat (scratch0,AAWHITE); strcat(scratch0,&d);
//++++ 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,AABLACK);
+ for(chx=end+1;chx>=(word)scan->next->start;chx++)
+ {
+ strcat(scratch0,&d);
+ }
+ }
//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!
+ if (scan->next && scan->next->start > end+1)
+ {
+ //write(gvar->handle.showmemhandle,AABLACK,strlen(AABLACK));
+ //for(chx=scan->start;chx>=(word)end;chx++)
+ //{
+ //write(gvar->handle.showmemhandle,"_",1);
+ //}
+ //write(gvar->handle.showmemhandle,"\n",strlen("\n"));
+ strcat(scratch0,AABLACK); strcat(scratch0,0x10);
+ }*/
+//++++ VW_Hlin(x+end+1,x+(scan->next->start-scan->start),y,0); // black = free
+write(gvar->handle.showmemhandle,scratch0,strlen(scratch0));
strcpy(scratch,"Seg:");
ultoa (scan->start,str,16);
strcat (scratch,str);
//modexprint(page, chx, chy, 1, 0, 24, &scratch);
//++++chy+=4;
//fprintf(stdout, "%s", scratch);
-//****#endif
scan = scan->next;
}
//**** 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");
#define FREEBLOCK(x) {*x->useptr=NULL;x->next=mm->mmfree;mm->mmfree=x;mm->endid--;}
+#define AAMAGENTA "\x1b[35;35m"
+#define AABLUE "\x1b[34;34m"
+#define AARED "\x1b[31;31m"
+#define AABLACK "\x1b[40;40m"
+#define AAWHITE "\x1b[37;37m"
+#define AARESET "\x1b[0m"
#define SAVENEARHEAP 0x200 // space to leave in data segment
#define SAVEFARHEAP 0//x400 // space to leave in far heap
byte far* VGA=(byte far*) 0xA0000000; /* this points to video memory. */\r
\r
static void fadePalette(sbyte fade, sbyte start, word iter, byte *palette);\r
-static byte tmppal[PAL_SIZE];
+static byte tmppal[PAL_SIZE];\r
int old_mode;\r
-
-/////////////////////////////////////////////////////////////////////////////
-// //
-// setvideo() - This function Manages the video modes //
-// //
-/////////////////////////////////////////////////////////////////////////////
-void VGAmodeX(sword vq)
-{
- union REGS in, out;
-
- if(!vq)
- { // deinit the video
- // change to the video mode we were in before we switched to mode 13h
- modexLeave();
- in.h.ah = 0x00;
- in.h.al = old_mode;
- int86(0x10, &in, &out);
-
- }
- else if(vq==1)
- { // init the video
- // get old video mode
- in.h.ah = 0xf;
- int86(0x10, &in, &out);
- old_mode = out.h.al;
- // enter mode
- modexEnter();
- }
-}
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+// //\r
+// setvideo() - This function Manages the video modes //\r
+// //\r
+/////////////////////////////////////////////////////////////////////////////\r
+void VGAmodeX(sword vq)\r
+{\r
+ union REGS in, out;\r
+\r
+ if(!vq)\r
+ { // deinit the video\r
+ // change to the video mode we were in before we switched to mode 13h\r
+ modexLeave();\r
+ in.h.ah = 0x00;\r
+ in.h.al = old_mode;\r
+ int86(0x10, &in, &out);\r
+\r
+ }\r
+ else if(vq==1)\r
+ { // init the video\r
+ // get old video mode\r
+ in.h.ah = 0xf;\r
+ int86(0x10, &in, &out);\r
+ old_mode = out.h.al;\r
+ // enter mode\r
+ modexEnter();\r
+ }\r
+}\r
\r
static void\r
vgaSetMode(byte mode)\r
}\r
\r
\r
-/* utility */
+/* utility */\r
void\r
modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset)\r
{\r
}\r
\r
void modexputPixel(page_t *page, int x, int y, byte color)\r
-{
+{\r
word pageOff = (word) page->data;\r
/* Each address accesses four neighboring pixels, so set\r
Write Plane Enable according to which pixel we want\r
to modify. The plane is determined by the two least\r
- significant bits of the x-coordinate: */
- //modexSelectPlane(PLANE(x));\r
- outp(SC_INDEX, 0x02);\r
- outp(SC_DATA, 0x01 << (x & 3));\r
+ significant bits of the x-coordinate: */\r
+ modexSelectPlane(PLANE(x));\r
+ //outp(SC_INDEX, 0x02);\r
+ //outp(SC_DATA, 0x01 << (x & 3));\r
\r
/* The offset of the pixel into the video segment is\r
offset = (width * y + x) / 4, and write the given\r
}\r
\r
byte modexgetPixel(page_t *page, int x, int y)\r
-{
+{\r
word pageOff = (word) page->data;\r
/* Select the plane from which we must read the pixel color: */\r
outpw(GC_INDEX, 0x04);\r
\r
return VGA[(unsigned)((page->width/4) * y) + (x / 4) + pageOff];\r
\r
-}
-
-void modexhlin(page_t *page, word xl, word xh, word y, word color)
-{
- word x;
- word yy=0;
-
- for(x=0;x<xh*4;x+=4)
- {
- if(x+4>=SCREEN_WIDTH-1){ x=0; yy+=4; }
- modexClearRegion(page, x+xl, y+yy, 4, 4, color);
- }
- //modexputPixel(page, x+xl, y, color);
+}\r
+\r
+void modexhlin(page_t *page, word xl, word xh, word y, word color)\r
+{\r
+ word x;\r
+ word yy=0;\r
+\r
+ for(x=0;x<xh*4;x+=4)\r
+ {\r
+ if(x+4>=SCREEN_WIDTH-1){ x=0; yy+=4; }\r
+ modexClearRegion(page, x+xl, y+yy, 4, 4, color);\r
+ }\r
+ //modexputPixel(page, x+xl, y, color);\r
}\r
\r
void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str)\r
-{
- word i, s, o, w, j, xp;
+{\r
+ word i, s, o, w, j, xp;\r
byte l[1024];\r
- word addr = (word) l;
- word chw=0;
- byte c;
-
+ word addr = (word) l;\r
+ word chw=0;\r
+ byte c;\r
+\r
switch(t)\r
{\r
- case 0:
+ case 0:\r
w=14;\r
break;\r
- case 1:
+ case 1:\r
w=8;\r
break;\r
- case 2:
+ case 2:\r
w=8;\r
break;\r
- case 3:
+ case 3:\r
w=16;\r
break;\r
- default:
+ default:\r
t=3;\r
w=16;\r
break;\r
- }
+ }\r
\r
s=romFonts[t].seg;\r
- o=romFonts[t].off;
+ o=romFonts[t].off;\r
\r
for(; *str != '\0'; str++)\r
- {
- c = (*str);
- if((c=='\n'/* || c=="\
-"*/) || chw
->=page->width)
- {
- chw=0;
- y+=w;
- continue;
- }
+ {\r
+ c = (*str);\r
+ if((c=='\n'/* || c=="\\r
+"*/) || chw\r
+>=page->width)\r
+ {\r
+ chw=0;\r
+ y+=w;\r
+ continue;\r
+ }\r
//load the letter 'A'\r
__asm {\r
MOV DI, addr\r
INC DI\r
DEC CX\r
JNZ L1\r
- }
+ }\r
\r
- for(i=0; i<w; i++)
+ for(i=0; i<w; i++)\r
{\r
- j=1<<8;
+ j=1<<8;\r
xp=0;\r
- while(j)
- {
- modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol);
- xp++;
- j>>=1;
- }
+ while(j)\r
+ {\r
+ modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol);\r
+ xp++;\r
+ j>>=1;\r
+ }\r
}\r
chw += xp;\r
}\r
-}
-
+}\r
+\r
void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str)\r
-{
- word i, s, o, w, j, xp;
+{\r
+ word i, s, o, w, j, xp;\r
byte l[1024];\r
- word addr = (word) l;
- word chw=0;
- byte c;
-
+ word addr = (word) l;\r
+ word chw=0;\r
+ byte c;\r
+\r
switch(t)\r
{\r
- case 0:
+ case 0:\r
w=14;\r
break;\r
- case 1:
+ case 1:\r
w=8;\r
break;\r
- case 2:
+ case 2:\r
w=8;\r
break;\r
- case 3:
+ case 3:\r
w=16;\r
break;\r
- default:
+ default:\r
t=3;\r
w=16;\r
break;\r
- }
+ }\r
\r
s=romFonts[t].seg;\r
- o=romFonts[t].off;
+ o=romFonts[t].off;\r
\r
for(; *str != '\0'; str++)\r
- {
- c = (*str);
- if((c=='\n'/* || c=="\
-"*/)/* || chw>=page->width*/)
- {
- chw=0;
- y+=w;
- continue;
- }
+ {\r
+ c = (*str);\r
+ if((c=='\n'/* || c=="\\r
+"*/)/* || chw>=page->width*/)\r
+ {\r
+ chw=0;\r
+ y+=w;\r
+ continue;\r
+ }\r
//load the letter 'A'\r
__asm {\r
MOV DI, addr\r
INC DI\r
DEC CX\r
JNZ L1\r
- }
+ }\r
\r
- for(i=0; i<w; i++)
+ for(i=0; i<w; i++)\r
{\r
- j=1<<8;
+ j=1<<8;\r
xp=0;\r
- while(j)
- {
- //modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol);
- modexClearRegion(page, (x+xp+chw)*8, (y+i)*8, 8, 8, l[i] & j ? col:bgcol);
- xp++;
- j>>=1;
- }
+ while(j)\r
+ {\r
+ //modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol);\r
+ modexClearRegion(page, (x+xp+chw)*8, (y+i)*8, 8, 8, l[i] & j ? col:bgcol);\r
+ xp++;\r
+ j>>=1;\r
+ }\r
}\r
chw += xp;\r
}\r