From: sparky4 Date: Fri, 3 Jul 2015 07:20:08 +0000 (-0500) Subject: wwww problems with length of memory block... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=5d9c75b35df6e7fa69897355e86b206e186d73be;p=16.git wwww problems with length of memory block... modified: exmmtest.exe modified: palettec.exe modified: pcxtest.exe modified: src/exmmtest.c modified: src/lib/16_ca.c modified: src/lib/16_ca.h modified: src/lib/16_mm.c modified: test.exe modified: test2.exe --- diff --git a/exmmtest.exe b/exmmtest.exe index 0cda686f..32084dc7 100644 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/palettec.exe b/palettec.exe index fdbe4d52..1df956b8 100644 Binary files a/palettec.exe and b/palettec.exe differ diff --git a/pcxtest.exe b/pcxtest.exe index a48d8ebe..c1ec6d87 100644 Binary files a/pcxtest.exe and b/pcxtest.exe differ diff --git a/src/exmmtest.c b/src/exmmtest.c index 61d77a30..00d01bf1 100644 --- a/src/exmmtest.c +++ b/src/exmmtest.c @@ -40,13 +40,14 @@ main(int argc, char *argv[]) if(argv[1]) bakapee = argv[1]; else bakapee = "data/koishi~~.pcx"; - + printf("start!\n"); MM_Startup(&mm, &mmi); printf("done!\n"); printf("&main()=%Fp\n", *argv[0]); if(CA_LoadFile(bakapee, &bigbuffer, &mm, &mmi)) baka=1; - else baka=0; + else + baka=0; //MM_GetPtr(&bigbuffer, mmi.nearheap, &mm, &mmi); //hmm functions in cache system use the buffered stuff printf("size of big buffer~=%u\n", _bmsize(segu, bigbuffer)); diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index fe76ec2c..df722dae 100644 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -216,13 +216,15 @@ void CAL_GetGrChunkLength (int chunk) ========================== */ -boolean CA_FarRead(int handle, byte huge *dest, dword length) +boolean CA_FarRead(int handle, byte huge *dest, dword length, mminfo_t *mm) { boolean flag; dword fat=0; - word segm=0; + word segm=0; + //if(mm->EMSVer<0x40) if(length>0xfffflu) { + printf("pee\n"); segm=(length%0xfffflu)-1; fat=segm*0xfffflu; length-=fat; @@ -270,13 +272,15 @@ End: ========================== */ -boolean CA_FarWrite(int handle, byte huge *source, dword length) +boolean CA_FarWrite(int handle, byte huge *source, dword length, mminfo_t *mm) { boolean flag; dword fat=0; - word segm=0; + word segm=0; + //if(mm->EMSVer<0x40) if(length>0xfffflu) { + printf("pee\n"); segm=(length%0xfffflu)-1; fat=segm*0xfffflu; length-=fat; @@ -324,7 +328,7 @@ End: ========================== */ -boolean CA_ReadFile(char *filename, memptr *ptr) +boolean CA_ReadFile(char *filename, memptr *ptr, mminfo_t *mm) { int handle; dword size; @@ -333,7 +337,7 @@ boolean CA_ReadFile(char *filename, memptr *ptr) return false; size = filelength(handle); - if(!CA_FarRead(handle,*ptr,size)) + if(!CA_FarRead(handle,*ptr,size, mm)) { close(handle); return false; @@ -364,7 +368,7 @@ boolean CA_LoadFile(char *filename, memptr *ptr, mminfo_t *mm, mminfotype *mmi) size = filelength (handle); MM_GetPtr(ptr,size, mm, mmi); - if(!CA_FarRead(handle,*ptr,size)) + if(!CA_FarRead(handle,*ptr,size, mm)) { close(handle); return false; diff --git a/src/lib/16_ca.h b/src/lib/16_ca.h index d424b808..b752bae5 100644 --- a/src/lib/16_ca.h +++ b/src/lib/16_ca.h @@ -86,9 +86,9 @@ extern void (*finishcachebox) (void); void CA_OpenDebug (void); void CA_CloseDebug (void); -boolean CA_FarRead (int handle, byte huge *dest, dword length); -boolean CA_FarWrite (int handle, byte huge *source, dword length); -boolean CA_ReadFile (char *filename, memptr *ptr); +boolean CA_FarRead (int handle, byte huge *dest, dword length, mminfo_t *mm); +boolean CA_FarWrite (int handle, byte huge *source, dword length, mminfo_t *mm); +boolean CA_ReadFile (char *filename, memptr *ptr, mminfo_t *mm); boolean CA_LoadFile (char *filename, memptr *ptr, mminfo_t *mm, mminfotype *mmi); //long CA_RLEWCompress (unsigned huge *source, long length, unsigned huge *dest,unsigned rlewtag); diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 530bc45b..355a4c79 100644 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -451,7 +451,7 @@ void MML_UseSpace(unsigned segstart, dword seglength, mminfo_t *mm) extra-=fat; //printf("extra=%lu ", extra); //printf("segm=%lu\n", segm); - printf("MML_UseSpace: Segment spans two blocks!\n"); + printf("MML_UseSpace: Segment spans two blocks!\n"); } //segu: @@ -610,13 +610,11 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi) MML_SetupEMS(mm); // allocate space 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! - if(mm->EMSVer>=0x40) MML_UseSpace(mm->EMSpageframe,((dword)mm->EMSpagesmapped)*0x4000lu, mm); - else MML_UseSpace(mm->EMSpageframe,mm->EMSpagesmapped*0x4000lu, mm); + MML_UseSpace(mm->EMSpageframe,((dword)mm->EMSpagesmapped)*0x4000lu, mm); //printf("EMS3\n"); MM_MapEMS(mm); // map in used pages //printf("EMS4\n"); - if(mm->EMSVer>=0x40) mmi->EMSmem = ((dword)mm->EMSpagesmapped)*0x4000lu; - else mmi->EMSmem = mm->EMSpagesmapped*0x4000lu; + mmi->EMSmem = ((dword)mm->EMSpagesmapped)*0x4000lu; } // @@ -1090,7 +1088,7 @@ fprintf(stdout, "%s", scratch); dword MM_UnusedMemory(mminfo_t *mm) { - unsigned free; + dword free; mmblocktype huge *scan; free = 0; @@ -1098,7 +1096,7 @@ dword MM_UnusedMemory(mminfo_t *mm) while(scan->next) { - free += scan->next->start - (scan->start + scan->length); + free += (dword)scan->next->start - (scan->start + scan->length); scan = scan->next; } @@ -1121,7 +1119,7 @@ dword MM_UnusedMemory(mminfo_t *mm) dword MM_TotalFree(mminfo_t *mm) { - unsigned free; + dword free; mmblocktype huge *scan; free = 0; @@ -1130,8 +1128,8 @@ dword MM_TotalFree(mminfo_t *mm) while(scan->next) { if((scan->attributes&PURGEBITS) && !(scan->attributes&LOCKBIT)) - free += scan->length; - free += scan->next->start - (scan->start + scan->length); + free += (dword)scan->length; + free += (dword)scan->next->start - (scan->start + scan->length); scan = scan->next; } diff --git a/test.exe b/test.exe index 2d34c0e7..754df675 100644 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index 8170641b..53173f24 100644 Binary files a/test2.exe and b/test2.exe differ