X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_mm.c;h=d6ce8743a5679958cc8c5d7da3e762f4278dbe86;hb=cb6c00f1a3dc82e68b0b35d4dcaf92fc47c14671;hp=0fb4619a64a1c46ea277b4171af351487f398cc8;hpb=9a7642b733ee466d776d090419d1a2909627930b;p=16.git diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 0fb4619a..d6ce8743 100644 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -143,7 +143,7 @@ unsigned MML_SetupEMS(mminfo_t *mm) union REGS CPURegs; unsigned int EMSVer = 0; - byte EMS_status; + //byte EMS_status; unsigned totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle; totalEMSpages = freeEMSpages = EMSpageframe = EMSpagesmapped = 0; @@ -152,7 +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 [EMS_status],ah + //mov [EMS_status],ah jnz error mov ah,EMS_VERSION @@ -302,34 +302,31 @@ unsigned MM_MapEMS(mminfo_t *mm) return 0; } -/* -SUB EMS.MapXPages (PhysicalStart, LogicalStart, NumPages, Handle) +void MM_MapXEMS(mminfo_t *mm) +{ + +//SUB EMS.MapXPages (PhysicalStart, LogicalStart, NumPages, Handle) - 'Maps up to 4 logical EMS pages to physical pages in the page frame, where: - ' - 'PhysicalStart = Physical page first logical page is mapped to - 'LogicalStart = First logical page to map - 'NumPages = Number of pages to map (1 to 4) - 'Handle = EMS handle logical pages are allocated to + //Maps up to 4 logical EMS pages to physical pages in the page frame, where: + //PhysicalStart = Physical page first logical page is mapped to + //LogicalStart = First logical page to map + //NumPages = Number of pages to map (1 to 4) + //Handle = EMS handle logical pages are allocated to - 'Create a buffer containing the page information - FOR x = 0 TO NumPages - 1 - MapInfo$ = MapInfo$ + MKI$(LogicalStart + x) + MKI$(PhysicalStart + x) - NEXT + /*//Create a buffer containing the page information +// FOR x = 0 TO NumPages - 1 +// MapInfo$ = MapInfo$ + MKI$(LogicalStart + x) + MKI$(PhysicalStart + x) +// NEXT*/ - Regs.ax = &H5000 'Map the pages in the buffer - Regs.cx = NumPages 'to the pageframe - Regs.dx = Handle - Regs.ds = VARSEG(MapInfo$) - Regs.si = SADD(MapInfo$) - InterruptX &H67, Regs, Regs - EMS.Error = (Regs.ax AND &HFF00&) \ &H100 'Store the status code +// Regs.ax = &H5000 //Map the pages in the buffer +// Regs.cx = NumPages //to the pageframe +// Regs.dx = Handle +// Regs.ds = VARSEG(MapInfo$) +// Regs.si = SADD(MapInfo$) +// InterruptX &H67, Regs, Regs +// EMS.Error = (Regs.ax AND &HFF00&) \ &H100 //Store the status code -END SUB -*/ -void MM_MapXEMS(mminfo_t *mm) -{ - +//END SUB } //========================================================================== @@ -863,7 +860,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; } @@ -1111,27 +1108,37 @@ CA_OpenDebug (); return; } end = scan->start+scan->length-1; + 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) //{ - chx=scan->start; modexClearRegion(page, chx, chy, 4, 4, color); //} //++++ VW_Hlin(scan->start,(unsigned)end,0,color); //++++ VW_Plot(scan->start,0,15); - //modexprint(page, scan->start, chy, 1, 47, 0, ((byte *)scan->start)); - modexClearRegion(page, scan->start, 0, 4, 4, 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 //for(chx=scan->next->start;chx+4>=(word)end+1;chx+=4) //{ - chx=scan->next->start; + 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! strcpy(scratch,"Seg:"); @@ -1162,70 +1169,70 @@ CA_CloseDebug (); } //****#endif -//========================================================================== - -/* -===================== -= -= MM_DumpData -= -===================== -*/ - -void MM_DumpData(mminfo_t *mm) -{ - mmblocktype far *scan,far *best; - long lowest,oldlowest; - word owner; - byte lock,purge; - FILE *dumpfile; - - - free (mm->nearheap); - dumpfile = fopen ("mmdump.txt","w"); - if (!dumpfile){ - printf("MM_DumpData: Couldn't open MMDUMP.TXT!"); +//========================================================================== + +/* +===================== += += MM_DumpData += +===================== +*/ + +void MM_DumpData(mminfo_t *mm) +{ + mmblocktype far *scan,far *best; + long lowest,oldlowest; + word owner; + byte lock,purge; + FILE *dumpfile; + + + free (mm->nearheap); + dumpfile = fopen ("mmdump.txt","w"); + if (!dumpfile){ + printf("MM_DumpData: Couldn't open MMDUMP.TXT!\n"); return; - } - - lowest = -1; - do - { - oldlowest = lowest; - lowest = 0xffff; - - scan = mm->mmhead; - while (scan) - { - owner = (word)scan->useptr; - - if (owner && owner oldlowest) - { - best = scan; - lowest = owner; - } - - scan = scan->next; - } - - if (lowest != 0xffff) - { - if (best->attributes & PURGEBITS) - purge = 'P'; - else - purge = '-'; - if (best->attributes & LOCKBIT) - lock = 'L'; - else - lock = '-'; - fprintf (dumpfile,"0x%p (%c%c) = %u\n" - ,(word)lowest,lock,purge,best->length); - } - - } while (lowest != 0xffff); - - fclose (dumpfile); - printf("MMDUMP.TXT created."); + } + + lowest = -1; + do + { + oldlowest = lowest; + lowest = 0xffff; + + scan = mm->mmhead; + while (scan) + { + owner = (word)scan->useptr; + + if (owner && owner oldlowest) + { + best = scan; + lowest = owner; + } + + scan = scan->next; + } + + if (lowest != 0xffff) + { + if (best->attributes & PURGEBITS) + purge = 'P'; + else + purge = '-'; + if (best->attributes & LOCKBIT) + lock = 'L'; + else + lock = '-'; + fprintf (dumpfile,"0x%p (%c%c) = %u\n" + ,(word)lowest,lock,purge,best->length); + } + + } while (lowest != 0xffff); + + fclose (dumpfile); + printf("MMDUMP.TXT created.\n"); } //==========================================================================