X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_mm.c;h=b6af09e5bef9328c5ddd1a2e3359501f747c5bcf;hb=a01469473921b0dee332486b27897f937beabded;hp=0eb0132f446bc051e4ddbfde3f28046b1949a6b0;hpb=aa6e5def05e93a35608667154c399da3b1d8529f;p=16.git diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 0eb0132f..b6af09e5 100644 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -143,6 +143,7 @@ unsigned MML_SetupEMS(mminfo_t *mm) union REGS CPURegs; unsigned int EMSVer = 0; + byte EMSstatus; unsigned totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle; totalEMSpages = freeEMSpages = EMSpageframe = EMSpagesmapped = 0; @@ -151,6 +152,7 @@ unsigned MML_SetupEMS(mminfo_t *mm) mov ah,EMS_STATUS int EMS_INT // make sure EMS hardware is present or ah,ah + //mov [EMSstatus],ah jnz error mov ah,EMS_VERSION @@ -217,6 +219,7 @@ End: mm->EMSpagesmapped=EMSpagesmapped; mm->EMShandle=EMShandle; mm->EMSVer=EMSVer; + //mm->EMSstatus=EMSstatus; return 0; } @@ -666,14 +669,15 @@ 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("EMS1\n"); +printf("EMS1\n"); MML_SetupEMS(mm); // allocate space +printf("EMS2\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("EMS3\n"); +printf("EMS3\n"); MM_MapEMS(mm); // map in used pages -//printf("EMS4\n"); +printf("EMS4\n"); mmi->EMSmem = (MAPPAGES)*0x4000lu; } @@ -691,6 +695,7 @@ emsskip: if(MML_CheckForXMS(mm)) { printf("XMS!\n"); + //====needs work! //MML_SetupXMS(mm, mmi); // allocate as many UMBs as possible } @@ -724,8 +729,6 @@ void MM_Shutdown(mminfo_t *mm) printf("far freed\n"); free(mm->nearheap); printf("near freed\n"); - //hfree(mm->hugeheap); - //printf("huge freed\n"); if(MML_CheckForEMS()){ MML_ShutdownEMS(mm); printf("EMS freed\n"); } if(MML_CheckForXMS(mm)){ MML_ShutdownXMS(mm); printf("XMS freed\n"); } } @@ -860,7 +863,7 @@ void MM_FreePtr(memptr *baseptr, mminfo_t *mm) if(!scan) { - printf("MM_FreePtr: Block not found!"); + printf("MM_FreePtr: Block not found!\n"); return; } @@ -897,7 +900,7 @@ void MM_SetPurge(memptr *baseptr, int purge, mminfo_t *mm) mm->mmrover = mm->mmhead; else if(mm->mmrover == start) { - printf("MM_SetPurge: Block not found!"); + printf("MM_SetPurge: Block not found!\n"); return; } @@ -1072,10 +1075,10 @@ void MM_SortMem(mminfo_t *mm) void MM_ShowMemory(page_t *page, mminfo_t *mm) { mmblocktype huge *scan; - unsigned color,temp; + word color,temp; long end,owner; word chx,chy; - char scratch[160],str[16]; + byte scratch[160],str[16]; //**** VW_SetDefaultColors(); //**** VW_SetLineWidth(40); @@ -1087,7 +1090,7 @@ void MM_ShowMemory(page_t *page, mminfo_t *mm) end = -1; -//CA_OpenDebug (); +CA_OpenDebug (); chx=0; chy=0; @@ -1103,21 +1106,42 @@ void MM_ShowMemory(page_t *page, mminfo_t *mm) if(scan->start<=end) { //printf("); - write (debughandle,"\nMM_ShowMemory: Memory block order currupted!\n",strlen("\nMM_ShowMemory: Memory block order currupted!\n")); + write(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; } end = scan->start+scan->length-1; - modexhlin(page, scan->start, (unsigned)end, chy, color); + chy = scan->start/320; + chx = scan->start%320; + //modexhlin(page, scan->start, (unsigned)end, chy, color); + //for(chx=scan->start;chx+4>=(word)end;chx+=4) + //{ + modexClearRegion(page, chx, chy, 4, 4, color); + //} + //++++ VW_Hlin(scan->start,(unsigned)end,0,color); -//void VW_Plot(unsigned x, unsigned y, unsigned color); -//void VW_Hlin(unsigned xl, unsigned xh, unsigned y, unsigned color); //++++ VW_Plot(scan->start,0,15); - modexputPixel(page, scan->start, chy, 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 - modexhlin(page, end+1,scan->next->start, chy, color); + //for(chx=scan->next->start;chx+4>=(word)end+1;chx+=4) + //{ + 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; + 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! @@ -1132,16 +1156,16 @@ owner = (unsigned)scan->useptr; ultoa (owner,str,16); strcat (scratch,str); strcat (scratch,"\n"); -//write(debughandle,scratch,strlen(scratch)); +write(debughandle,scratch,strlen(scratch)); //modexprint(page, chx, chy, 1, 0, 24, &scratch); -//chy+=4; -fprintf(stdout, "%s", scratch); +chy+=4; +//fprintf(stdout, "%s", scratch); //****#endif scan = scan->next; } -//CA_CloseDebug (); +CA_CloseDebug (); //++++mh IN_Ack(); //**** VW_SetLineWidth(64); @@ -1163,8 +1187,8 @@ void MM_DumpData(mminfo_t *mm) { mmblocktype far *scan,far *best; long lowest,oldlowest; - unsigned owner; - char lock,purge; + word owner; + byte lock,purge; FILE *dumpfile; @@ -1184,7 +1208,7 @@ void MM_DumpData(mminfo_t *mm) scan = mm->mmhead; while (scan) { - owner = (unsigned)scan->useptr; + owner = (word)scan->useptr; if (owner && owner oldlowest) { @@ -1206,7 +1230,7 @@ void MM_DumpData(mminfo_t *mm) else lock = '-'; fprintf (dumpfile,"0x%p (%c%c) = %u\n" - ,(unsigned)lowest,lock,purge,best->length); + ,(word)lowest,lock,purge,best->length); } } while (lowest != 0xffff); @@ -1291,11 +1315,12 @@ dword MM_TotalFree(mminfo_t *mm) void MM_Report(page_t *page, mminfo_t *mm, mminfotype *mmi) { + printf("\n"); if(MML_CheckForEMS()) { - printf("EMM v%x.%x available\n", mm->EMSVer>>4,mm->EMSVer&0x0F); + printf("Expanded memory manager present. EMM v%x.%x available\n", mm->EMSVer>>4,mm->EMSVer&0x0F); printf("totalEMSpages=%u\n", mm->totalEMSpages); - printf("freeEMSpages=%u\n", mm->freeEMSpages); + printf("Page frame @0x%04x\n", mm->freeEMSpages); printf("EMSpageframe=%x\n", mm->EMSpageframe); } if(MML_CheckForXMS(mm)) printf("XMSaddr=%Fp\n", *XMSaddr);