From: sparky4 <sparky4@cock.li>
Date: Tue, 21 Jul 2015 17:02:22 +0000 (-0500)
Subject: bakapee!!!!
X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=e6b81a7e9ec87843d27bee052ff2f793f71896ab;p=16.git

bakapee!!!!
	modified:   16.exe
	modified:   DEBUG.TXT
	modified:   MMDUMP.TXT
	modified:   exmmtest.exe
	modified:   fmemtest.exe
	modified:   fontgfx.exe
	modified:   fonttes0.exe
	modified:   fonttest.exe
	modified:   inputest.exe
	modified:   makefile
	modified:   maptest.exe
	modified:   miditest.exe
	modified:   palettec.exe
	modified:   pcxtest.exe
	modified:   sountest.exe
	modified:   src/lib/16_mm.c
	modified:   src/lib/16_mm.h
	modified:   test.exe
	modified:   test2.exe
	modified:   tsthimem.exe
---

diff --git a/16.exe b/16.exe
index 3bc10dcf..06506b05 100644
Binary files a/16.exe and b/16.exe differ
diff --git a/DEBUG.TXT b/DEBUG.TXT
index d71980c4..b442a8f8 100644
--- a/DEBUG.TXT
+++ b/DEBUG.TXT
@@ -1,7 +1,7 @@
-Seg:0	Size:140384	Owner:0x84a
-Seg:2246	Size:4096	Owner:0xfb32
-Seg:2346	Size:31344	Owner:0x1c68
-Seg:3054	Size:1026592	Owner:0x468b
-Seg:3924	Size:683456	Owner:0x5657
+Seg:0	Size:114096	Owner:0xfd10
+Seg:1bdb	Size:4096	Owner:0xb512
+Seg:1e4b	Size:8512	Owner:0x8ebc
+Seg:22ef	Size:774416	Owner:0x8e2e
+Seg:e000	Size:31344	Owner:0xd648
 
 MM_ShowMemory: Memory block order currupted!
diff --git a/MMDUMP.TXT b/MMDUMP.TXT
index 18431f44..e69de29b 100644
Binary files a/MMDUMP.TXT and b/MMDUMP.TXT differ
diff --git a/exmmtest.exe b/exmmtest.exe
index a99bb922..e979fbdb 100644
Binary files a/exmmtest.exe and b/exmmtest.exe differ
diff --git a/fmemtest.exe b/fmemtest.exe
index 624bc60e..d9ccddbf 100644
Binary files a/fmemtest.exe and b/fmemtest.exe differ
diff --git a/fontgfx.exe b/fontgfx.exe
index d182022a..3dd39f38 100644
Binary files a/fontgfx.exe and b/fontgfx.exe differ
diff --git a/fonttes0.exe b/fonttes0.exe
index 14e72e35..ae601be3 100644
Binary files a/fonttes0.exe and b/fonttes0.exe differ
diff --git a/fonttest.exe b/fonttest.exe
index be48aee6..1e5af570 100644
Binary files a/fonttest.exe and b/fonttest.exe differ
diff --git a/inputest.exe b/inputest.exe
index d13563f3..5824e8ee 100644
Binary files a/inputest.exe and b/inputest.exe differ
diff --git a/makefile b/makefile
index d0770dba..1c56ca55 100644
--- a/makefile
+++ b/makefile
@@ -13,7 +13,7 @@ TARGET_OS = dos
 #-zkl = current codepage
 
 DFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1# -zm
-CFLAGS=-zk0 -wo -x -mc -zu# -zdp# -zp16 -zq
+CFLAGS=-zk0 -wo -x -mc -zu -k48000# -zdp# -zp16 -zq
 OFLAGS=-ot -ox -ob -oh -or# -om -ol -ol+
 FLAGS=-0 -d1 -lr $(OFLAGS) $(CFLAGS) $(DFLAGS) #-d2
 SRC=src$(DIRSEP)
diff --git a/maptest.exe b/maptest.exe
index 356698ef..80f3a40b 100644
Binary files a/maptest.exe and b/maptest.exe differ
diff --git a/miditest.exe b/miditest.exe
index 06dc46fb..55eb2bf2 100644
Binary files a/miditest.exe and b/miditest.exe differ
diff --git a/palettec.exe b/palettec.exe
index 393babfd..376d8f46 100644
Binary files a/palettec.exe and b/palettec.exe differ
diff --git a/pcxtest.exe b/pcxtest.exe
index 89cf28cd..115a7fa6 100644
Binary files a/pcxtest.exe and b/pcxtest.exe differ
diff --git a/sountest.exe b/sountest.exe
index 10eefab6..a4171579 100644
Binary files a/sountest.exe and b/sountest.exe differ
diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c
index 13cafcb9..b88d3a3a 100644
--- a/src/lib/16_mm.c
+++ b/src/lib/16_mm.c
@@ -137,7 +137,7 @@ boolean MML_CheckForEMS(void)
 
 byte MML_SetupEMS(mminfo_t *mm)
 {
-	char	str[80];//,str2[10];
+	byte	str[160];
 	byte	err;
 	boolean errorflag=false;
 
@@ -207,9 +207,9 @@ End:
 	if(errorflag==true)
 	{
 		//err = CPURegs.h.ah;
-		strcpy(str,"MM_SetupEMS: EMS error");
+		strcpy(str,"MM_SetupEMS: EMS error ");
 		//itoa(err,str2,16);
-		strcat(str,MM_EMSerr(err));
+		MM_EMSerr(&str, err);
 		printf("%s\n",str);
 		return err;
 	}
@@ -265,7 +265,7 @@ void MML_ShutdownEMS(mminfo_t *mm)
 
 byte MM_MapEMS(mminfo_t *mm, mminfotype *mmi)
 {
-	char	str[80];
+	byte	str[160];
 	unsigned	EMShandle;
 	byte err;
 	boolean	errorflag=false;
@@ -292,9 +292,9 @@ byte MM_MapEMS(mminfo_t *mm, mminfotype *mmi)
 		if(errorflag==true)
 		{
 			//err = CPURegs.h.ah;
-			strcpy(str,"MM_MapEMS: EMS error");
+			strcpy(str,"MM_MapEMS: EMS error ");
 			//itoa(err,str2,16);
-			strcat(str,MM_EMSerr(err));
+			MM_EMSerr(str, err);
 			printf("%s\n",str);
 			//printf("FACK! %x\n", err);
 			return err;
@@ -329,7 +329,7 @@ byte MM_MapXEMS(mminfo_t *mm, mminfotype *mmi)
 //	EMS.Error = (Regs.ax AND 0xFF00&) \ 0x100  //Store the status code
 
 //END SUB
-	char	str[80];
+	byte	str[160];
 	byte err;
 	word	EMShandle;
 	boolean	errorflag=false;
@@ -360,9 +360,9 @@ byte MM_MapXEMS(mminfo_t *mm, mminfotype *mmi)
 		{
 			//err = CPURegs.h.ah;
 			//strcpy(str,"MM_MapXEMS: EMS error 0x");
-			strcpy(str,"MM_MapXEMS: EMS error");
+			strcpy(str,"MM_MapXEMS: EMS error ");
 			//itoa(err,str2,16);
-			strcat(str,MM_EMSerr(err));
+			MM_EMSerr(&str, err);
 			printf("%s\n",str);
 			//printf("%s%x\n",str, err);
 			//printf("FACK! %x\n", err);
@@ -642,6 +642,7 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi)
 //
 // set up the linked list (everything in the free list;
 //
+	printf("		linked list making!\n");
 	mm->mmhead = NULL;
 	mm->mmfree = &(mm->mmblocks[0]);
 	for(i=0;i<MAXBLOCKS-1;i++)
@@ -653,6 +654,7 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi)
 //
 // locked block of all memory until we punch out free space
 //
+	printf("		newblock making!\n");
 	MM_GetNewBlock(mm);
 	mm->mmhead = mm->mmnew;				// this will allways be the first node
 	mm->mmnew->start = 0;
@@ -666,6 +668,7 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi)
 //
 // get all available near conventional memory segments
 //
+	printf("		nearheap making!\n");
 //----	length=coreleft();
 	_nheapgrow();
 	length=_memavl();
@@ -676,12 +679,13 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi)
 	segstart = FP_SEG(start)+(FP_OFF(start)+15)/16;
 	MML_UseSpace(segstart,seglength, mm);
 	mmi->nearheap = length;
-	//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=_memavl();
 	start = mm->farheap = halloc(length, sizeof(byte));
@@ -693,13 +697,13 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi)
 	MML_UseSpace(segstart,seglength, mm);
 	mmi->farheap = length;
 	mmi->mainmem = mmi->nearheap + mmi->farheap;
-	//printf("far heap ok!\n");
+	printf("		far heap ok!\n");
 
 
 //
 // detect EMS and allocate up to 64K at page frame
 //
-	printf("EMS1\n\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!
+	printf("		EMS1\n\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++)
 	{
@@ -709,13 +713,13 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi)
 	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(MML_CheckForEMS())
 	{
-printf("EMS2\n");
+printf("		EMS2\n");
 		MML_SetupEMS(mm);					// allocate space
-printf("EMS3\n");
+printf("		EMS3\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!
 		//TODO: EMS4! AND EMS 3.2 MASSIVE DATA HANDLMENT!
 		MML_UseSpace(mm->EMSpageframe,(MAPPAGES)*0x4000lu, mm);
-printf("EMS4\n");
+printf("		EMS4\n");
 		if(mm->EMSVer<0x40)
 			MM_MapEMS(mm, mmi);					// map in used pages
 		else
@@ -735,7 +739,7 @@ emsskip:
 	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(MML_CheckForXMS(mm))
 	{
-		printf("XMS!\n");
+		printf("		XMS!\n");
 		//MML_SetupXMS(mm, mmi);					// allocate as many UMBs as possible
 	}
 
@@ -1386,90 +1390,91 @@ void MM_Report(page_t *page, mminfo_t *mm, mminfotype *mmi)
 =====================
 */
 
-byte *MM_EMSerr(byte err)
+static void MM_EMSerr(byte *stri, byte err)
 {
 	//Returns a text string describing the error code in EMS.Error.
 	switch(err)
 	{
 		case 0x0:
-			return "successful";
+			strcat(stri, "successful");
 		case 0x80:
-			return "internal error";
+			strcat(stri, "internal error");
 		case 0x81:
-			return "hardware malfunction";
+			strcat(stri, "hardware malfunction");
 		case 0x82:
-			return "busy .. retry later";
+			strcat(stri, "busy .. retry later");
 		case 0x83:
-			return "invalid handle";
+			strcat(stri, "invalid handle");
 		case 0x84:
-			return "undefined function requested by application";
+			strcat(stri, "undefined function requested by application");
 		case 0x85:
-			return "no more handles available";
+			strcat(stri, "no more handles available");
 		case 0x86:
-			return "error in save or restore of mapping context";
+			strcat(stri, "error in save or restore of mapping context");
 		case 0x87:
-			return "insufficient memory pages in system";
+			strcat(stri, "insufficient memory pages in system");
 		case 0x88:
-			return "insufficient memory pages available";
+			strcat(stri, "insufficient memory pages available");
 		case 0x89:
-			return "zero pages requested";
+			strcat(stri, "zero pages requested");
 		case 0x8A:
-			return "invalid logical page number encountered";
+			strcat(stri, "invalid logical page number encountered");
 		case 0x8B:
-			return "invalid physical page number encountered";
+			strcat(stri, "invalid physical page number encountered");
 		case 0x8C:
-			return "page-mapping hardware state save area is full";
+			strcat(stri, "page-mapping hardware state save area is full");
 		case 0x8D:
-			return "save of mapping context failed";
+			strcat(stri, "save of mapping context failed");
 		case 0x8E:
-			return "restore of mapping context failed";
+			strcat(stri, "restore of mapping context failed");
 		case 0x8F:
-			return "undefined subfunction";
+			strcat(stri, "undefined subfunction");
 		case 0x90:
-			return "undefined attribute type";
+			strcat(stri, "undefined attribute type");
 		case 0x91:
-			return "feature not supported";
+			strcat(stri, "feature not supported");
 		case 0x92:
-			return "successful, but a portion of the source region has been overwritten";
+			strcat(stri, "successful, but a portion of the source region has been overwritten");
 		case 0x93:
-			return "length of source or destination region exceeds length of region allocated to either source or destination handle";
+			strcat(stri, "length of source or destination region exceeds length of region allocated to either source or destination handle");
 		case 0x94:
-			return "conventional and expanded memory regions overlap";
+			strcat(stri, "conventional and expanded memory regions overlap");
 		case 0x95:
-			return "offset within logical page exceeds size of logical page";
+			strcat(stri, "offset within logical page exceeds size of logical page");
 		case 0x96:
-			return "region length exceeds 1 MB";
+			strcat(stri, "region length exceeds 1 MB");
 		case 0x97:
-			return "source and destination EMS regions have same handle and overlap";
+			strcat(stri, "source and destination EMS regions have same handle and overlap");
 		case 0x98:
-			return "memory source or destination type undefined";
+			strcat(stri, "memory source or destination type undefined");
 		case 0x9A:
-			return "specified alternate map register or DMA register set not supported";
+			strcat(stri, "specified alternate map register or DMA register set not supported");
 		case 0x9B:
-			return "all alternate map register or DMA register sets currently allocated";
+			strcat(stri, "all alternate map register or DMA register sets currently allocated");
 		case 0x9C:
-			return "alternate map register or DMA register sets not supported";
+			strcat(stri, "alternate map register or DMA register sets not supported");
 		case 0x9D:
-			return "undefined or unallocated alternate map register or DMA register set";
+			strcat(stri, "undefined or unallocated alternate map register or DMA register set");
 		case 0x9E:
-			return "dedicated DMA channels not supported";
+			strcat(stri, "dedicated DMA channels not supported");
 		case 0x9F:
-			return "specified dedicated DMA channel not supported";
+			strcat(stri, "specified dedicated DMA channel not supported");
 		case 0xA0:
-			return "no such handle name";
+			strcat(stri, "no such handle name");
 		case 0xA1:
-			return "a handle found had no name, or duplicate handle name";
+			strcat(stri, "a handle found had no name, or duplicate handle name");
 		case 0xA2:
-			return "attempted to wrap around 1M conventional address space";
+			strcat(stri, "attempted to wrap around 1M conventional address space");
 		case 0xA3:
-			return "source array corrupted";
+			strcat(stri, "source array corrupted");
 		case 0xA4:
-			return "operating system denied access";
+			strcat(stri, "operating system denied access");
 		default:
-			return "undefined error";
+			strcat(stri, "undefined error");
 	}
 }
 
+
 //==========================================================================
 
 /*
diff --git a/src/lib/16_mm.h b/src/lib/16_mm.h
index 27a397c9..0ee0c8e3 100644
--- a/src/lib/16_mm.h
+++ b/src/lib/16_mm.h
@@ -187,7 +187,7 @@ void MM_DumpData(mminfo_t *mm);
 dword MM_UnusedMemory(mminfo_t *mm);
 dword MM_TotalFree(mminfo_t *mm);
 void MM_Report(page_t *page, mminfo_t *mm, mminfotype *mmi);
-byte *MM_EMSerr(byte err);
+static void MM_EMSerr(byte *stri, byte err);
 void MM_BombOnError(boolean bomb, mminfo_t *mm);
 void MM_GetNewBlock(mminfo_t *mm);
 void MM_FreeBlock(mmblocktype *x, mminfo_t *mm);
diff --git a/test.exe b/test.exe
index 6fb52b99..9ab02f96 100644
Binary files a/test.exe and b/test.exe differ
diff --git a/test2.exe b/test2.exe
index 4433bb27..65ee9440 100644
Binary files a/test2.exe and b/test2.exe differ
diff --git a/tsthimem.exe b/tsthimem.exe
index 72f3e0bf..bb81bf53 100644
Binary files a/tsthimem.exe and b/tsthimem.exe differ