From 6dcce39da6365a9d07a80ddbf7bd312b2af5e8a8 Mon Sep 17 00:00:00 2001
From: sparky4 <sparky4@cock.li>
Date: Wed, 19 Apr 2017 16:51:08 -0500
Subject: [PATCH] p16 is being worked on a bunch by me wwww [16_ca needs huge
 amounts of work and I should remember what needs to be done soon][OpenVGMFile
 needs to be ported to 16_snd.c]going to port rest of code to borland c some
 time so we can use the core components of id engine here [going to add
 16_us.c eventually but the debug system and CA_ PM_ and MM_ usage is priority
 now]older zcroll renamed to xcroll][zcroll is now the pre menu game loop
 system with PROPER data usage with CAMMPM] MM_ShowMemory works how i want
 wwww

---
 src/exmmtest.c  | 17 +++++++------
 src/lib/16_mm.c | 67 +++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 64 insertions(+), 20 deletions(-)

diff --git a/src/exmmtest.c b/src/exmmtest.c
index ad274c7e..8742c046 100755
--- a/src/exmmtest.c
+++ b/src/exmmtest.c
@@ -49,7 +49,7 @@
 #define NOVID
 #endif
 #ifdef __WATCOMC__
-//#define NOVID
+#define NOVID
 #endif
 
 
@@ -69,7 +69,8 @@
 #endif
 
 ////////////////////////////////////////////////////////////////////////////
-#ifdef NOVID
+//#ifdef NOVID
+#ifdef __BORLANDC__
 void VL_Startup (global_game_variables_t *gvar){ gvar=gvar; }
 void VL_Shutdown (global_game_variables_t *gvar){ gvar=gvar; }
 void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv)
@@ -140,10 +141,6 @@ void
 main(int argc, char *argv[])
 {
 	byte w;
-								#ifndef NOVID
-	boolean			done;
-	ScanCode		scan;
-								#endif
 	static global_game_variables_t gvar;
 								#ifdef INITBBUF
 	INITBBUF
@@ -264,7 +261,11 @@ PRINTBB; KEYP
 	VGAmodeX(8, 0, &gvar);
 //	modexPalUpdate0(&gvar.video.palette);
 //	ShapeTest_(&gvar);
-
+	MM_ShowMemory(&gvar);
+#if 0
+	{
+	boolean			done;
+	ScanCode		scan;
 	for (done = false;!done;)
 	{
 		while (!(scan = gvar.in.inst->LastScan))
@@ -294,6 +295,8 @@ PRINTBB; KEYP
 			break;
 		}
 	}
+}
+#endif
 	VGAmodeX(0, 0, &gvar);
 #endif
 #endif
diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c
index 22364943..d43432fe 100755
--- a/src/lib/16_mm.c
+++ b/src/lib/16_mm.c
@@ -1320,13 +1320,12 @@ void MM_ShowMemory (global_game_variables_t *gvar)
 		scaninfo[q].y = y;
 		VW_Hlin(x,x+end,y,color,gvar);
 		VL_Plot(x,y,5,gvar);
+//++==++==optional			strcat(scratch0, AARESET); strcat(scratch0, AAGREY); strcat(scratch0,"_");
 		for(w=(scan->start)/80;w<=end/80;w++)
 		{
 //printf("+	%u	%lu\n", w, scan->length);
 			strcat(scratch0, "+");
 		}
-		//++==++==optional
-		strcat(scratch0, AARESET); strcat(scratch0, AAGREY); strcat(scratch0,"_");
 
 		if (scan->next && scan->next->start > end+1)
 		{
@@ -1426,6 +1425,7 @@ void MM_ShowMemory (global_game_variables_t *gvar)
 #endif
 #ifdef MMSMSCANINFO
 	{
+		byte scratch1[4];
 		unsigned		maxq = q;
 		boolean			done;
 		ScanCode		scancode;
@@ -1438,12 +1438,18 @@ void MM_ShowMemory (global_game_variables_t *gvar)
 			if(scaninfo[qq].scan->attributes & PURGEBITS)
 			{
 				ccolor = 6;		// dark purple = purgable
+				strcpy(scratch1, AAMAGENTA);		// dark purple = purgable
+				//printf("%s", AAMAGENTA);
 			}else{
 				ccolor = 2;		// medium blue = non purgable
+				strcpy(scratch1, AABLUE);		// medium blue = non purgable
+				//printf("%s", AABLUE);
 			}
 			if(scaninfo[qq].scan->attributes & LOCKBIT)
 			{
 				ccolor = 1;		// red = locked
+				strcpy(scratch1, AARED);		// red = locked
+				//printf("%s", AARED);
 			}
 			end = scaninfo[qq].scan->length-1;
 /*typedef struct mmblockstruct{
@@ -1454,9 +1460,9 @@ void MM_ShowMemory (global_game_variables_t *gvar)
 } mmblocktype;*/
 			//modexprint(page, x, y, t, tlsw, color, bgcolor, vidsw, const byte *str);
 #define MMSMPRINTMEMINFO modexprint(&(gvar->video.page[0]), xpos, ypos, 1, 0, ccolor, 8, gvar->video.VL_Started, global_temp_status_text); ypos+=8;
-			VL_ShowPage(&gvar->video.page[0], 1, 0);
 			if(!gvar->video.VL_Started) clrscr(); else
 			{
+				VL_ShowPage(&gvar->video.page[0], 1, 0);
 				modexClearRegion(&gvar->video.page[0], 0, 0, gvar->video.page[0].width, gvar->video.page[0].height, 8);
 			}
 			sprintf(global_temp_status_text, "block #%04u", qq); MMSMPRINTMEMINFO
@@ -1467,16 +1473,51 @@ void MM_ShowMemory (global_game_variables_t *gvar)
 			{
 				sprintf(global_temp_status_text, "free: %05u", (unsigned)(scaninfo[qq].scan->next->start-scaninfo[qq].scan->start)); MMSMPRINTMEMINFO
 			}
-			y = ypos;//scaninfo[qq].scan->start/width;
-			x = xpos;//scaninfo[qq].scan->start%width;
-			VW_Hlin(x,x+end,y,ccolor,gvar);
-			VL_Plot(x,y,5,gvar);
-			if (scaninfo[qq].scan->next && scaninfo[qq].scan->next->start > end+1)
-				VW_Hlin(x+end+1,x+(scaninfo[qq].scan->next->start-scaninfo[qq].scan->start),y,3,gvar);	// black = free//now green
+			if(gvar->video.VL_Started)
+			{
+				y = ypos;//scaninfo[qq].scan->start/width;
+				x = xpos;//scaninfo[qq].scan->start%width;
+				VW_Hlin(x,x+end,y,ccolor,gvar);
+				VL_Plot(x,y,5,gvar);
+			}
+			else
+			{
+				printf("%s", scratch1);
+				printf("%s", AAGREY); printf("_");
+				for(w=(scaninfo[qq].scan->start)/80;w<=end/80;w++)
+				{
+					//strcat(scratch1, "+");
+					printf("+");
+				}
+			}
 
-			//if (scan->next && scan->next->start > end+1) free
-			xpos = 16;
-			ypos = 16;//(gvar->video.page[0].sh-(32));//8*4
+
+				if (scaninfo[qq].scan->next && scaninfo[qq].scan->next->start > end+1) if(!gvar->video.VL_Started)
+				{
+					//strcat(scratch1, AARESET);
+					printf("%s", AARESET);
+					//strcat(scratch1,AAGREEN);
+					printf("%s", AAGREEN);
+					for(w=(end+1)/80;w<=((scaninfo[qq].scan->next->start-scaninfo[qq].scan->start)/80);w++)
+					{
+						//strcat(scratch1,"0");
+						printf("0");
+					}
+				}else VW_Hlin(x+end+1,x+(scaninfo[qq].scan->next->start-scaninfo[qq].scan->start),y,3,gvar);	// black = free//now green
+
+
+			if(gvar->video.VL_Started)
+			{
+				//if (scan->next && scan->next->start > end+1) free
+				xpos = 16;
+				ypos = 16;//(gvar->video.page[0].sh-(32));//8*4
+			}
+			else
+			{
+				//printf("%s\n", scratch1);
+				printf("%s", AARESET);
+				printf("\n");
+			}
 			while (!(scancode = gvar->in.inst->LastScan)){}
 
 			IN_ClearKey(scancode);
@@ -1498,7 +1539,7 @@ void MM_ShowMemory (global_game_variables_t *gvar)
 	}
 #endif
 
-	IN_Ack(gvar);
+	if(gvar->video.VL_Started) IN_Ack(gvar);
 
 	gvar->video.BOFS = (byte __far *)temp;
 }
-- 
2.39.5