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
20 files changed:
-Seg:0 Size:140384 Owner:0x84a\r
-Seg:2246 Size:4096 Owner:0xfb32\r
-Seg:2346 Size:31344 Owner:0x1c68\r
-Seg:3054 Size:1026592 Owner:0x468b\r
-Seg:3924 Size:683456 Owner:0x5657\r
+Seg:0 Size:114096 Owner:0xfd10\r
+Seg:1bdb Size:4096 Owner:0xb512\r
+Seg:1e4b Size:8512 Owner:0x8ebc\r
+Seg:22ef Size:774416 Owner:0x8e2e\r
+Seg:e000 Size:31344 Owner:0xd648\r
\r
MM_ShowMemory: Memory block order currupted!\r
\r
MM_ShowMemory: Memory block order currupted!\r
#-zkl = current codepage
DFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1# -zm
#-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)
OFLAGS=-ot -ox -ob -oh -or# -om -ol -ol+
FLAGS=-0 -d1 -lr $(OFLAGS) $(CFLAGS) $(DFLAGS) #-d2
SRC=src$(DIRSEP)
byte MML_SetupEMS(mminfo_t *mm)
{
byte MML_SetupEMS(mminfo_t *mm)
{
- char str[80];//,str2[10];
byte err;
boolean errorflag=false;
byte err;
boolean errorflag=false;
if(errorflag==true)
{
//err = CPURegs.h.ah;
if(errorflag==true)
{
//err = CPURegs.h.ah;
- strcpy(str,"MM_SetupEMS: EMS error");
+ strcpy(str,"MM_SetupEMS: EMS error ");
- strcat(str,MM_EMSerr(err));
printf("%s\n",str);
return err;
}
printf("%s\n",str);
return err;
}
byte MM_MapEMS(mminfo_t *mm, mminfotype *mmi)
{
byte MM_MapEMS(mminfo_t *mm, mminfotype *mmi)
{
unsigned EMShandle;
byte err;
boolean errorflag=false;
unsigned EMShandle;
byte err;
boolean errorflag=false;
if(errorflag==true)
{
//err = CPURegs.h.ah;
if(errorflag==true)
{
//err = CPURegs.h.ah;
- strcpy(str,"MM_MapEMS: EMS error");
+ strcpy(str,"MM_MapEMS: EMS error ");
- strcat(str,MM_EMSerr(err));
printf("%s\n",str);
//printf("FACK! %x\n", err);
return err;
printf("%s\n",str);
//printf("FACK! %x\n", err);
return err;
// EMS.Error = (Regs.ax AND 0xFF00&) \ 0x100 //Store the status code
//END SUB
// EMS.Error = (Regs.ax AND 0xFF00&) \ 0x100 //Store the status code
//END SUB
byte err;
word EMShandle;
boolean errorflag=false;
byte err;
word EMShandle;
boolean errorflag=false;
{
//err = CPURegs.h.ah;
//strcpy(str,"MM_MapXEMS: EMS error 0x");
{
//err = CPURegs.h.ah;
//strcpy(str,"MM_MapXEMS: EMS error 0x");
- strcpy(str,"MM_MapXEMS: EMS error");
+ strcpy(str,"MM_MapXEMS: EMS error ");
- strcat(str,MM_EMSerr(err));
printf("%s\n",str);
//printf("%s%x\n",str, err);
//printf("FACK! %x\n", err);
printf("%s\n",str);
//printf("%s%x\n",str, err);
//printf("FACK! %x\n", err);
//
// set up the linked list (everything in the free list;
//
//
// 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++)
mm->mmhead = NULL;
mm->mmfree = &(mm->mmblocks[0]);
for(i=0;i<MAXBLOCKS-1;i++)
//
// locked block of all memory until we punch out free space
//
//
// 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;
MM_GetNewBlock(mm);
mm->mmhead = mm->mmnew; // this will allways be the first node
mm->mmnew->start = 0;
//
// get all available near conventional memory segments
//
//
// get all available near conventional memory segments
//
+ printf(" nearheap making!\n");
//---- length=coreleft();
_nheapgrow();
length=_memavl();
//---- length=coreleft();
_nheapgrow();
length=_memavl();
segstart = FP_SEG(start)+(FP_OFF(start)+15)/16;
MML_UseSpace(segstart,seglength, mm);
mmi->nearheap = length;
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();
//
// get all available far conventional memory segments
//
//---- length=farcoreleft();
+ printf(" farheap making!\n");
_fheapgrow();
length=_memavl();
start = mm->farheap = halloc(length, sizeof(byte));
_fheapgrow();
length=_memavl();
start = mm->farheap = halloc(length, sizeof(byte));
MML_UseSpace(segstart,seglength, mm);
mmi->farheap = length;
mmi->mainmem = mmi->nearheap + mmi->farheap;
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
//
//
// 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++)
{
mmi->EMSmem = 0;
for(i = 1;i < __argc;i++)
{
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("\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())
{
MML_SetupEMS(mm); // allocate space
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!
MML_UseSpace(mm->EMSpageframe,(MAPPAGES)*0x4000lu, mm);
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);
if(mm->EMSVer<0x40)
MM_MapEMS(mm, mmi); // map in used pages
else
if(mm->EMSVer<0x40)
MM_MapEMS(mm, mmi); // map in used pages
else
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("\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))
{
//MML_SetupXMS(mm, mmi); // allocate as many UMBs as possible
}
//MML_SetupXMS(mm, mmi); // allocate as many UMBs as possible
}
-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:
{
//Returns a text string describing the error code in EMS.Error.
switch(err)
{
case 0x0:
+ strcat(stri, "successful");
- return "internal error";
+ strcat(stri, "internal error");
- return "hardware malfunction";
+ strcat(stri, "hardware malfunction");
- return "busy .. retry later";
+ strcat(stri, "busy .. retry later");
- return "invalid handle";
+ strcat(stri, "invalid handle");
- return "undefined function requested by application";
+ strcat(stri, "undefined function requested by application");
- return "no more handles available";
+ strcat(stri, "no more handles available");
- return "error in save or restore of mapping context";
+ strcat(stri, "error in save or restore of mapping context");
- return "insufficient memory pages in system";
+ strcat(stri, "insufficient memory pages in system");
- return "insufficient memory pages available";
+ strcat(stri, "insufficient memory pages available");
- return "zero pages requested";
+ strcat(stri, "zero pages requested");
- return "invalid logical page number encountered";
+ strcat(stri, "invalid logical page number encountered");
- return "invalid physical page number encountered";
+ strcat(stri, "invalid physical page number encountered");
- return "page-mapping hardware state save area is full";
+ strcat(stri, "page-mapping hardware state save area is full");
- return "save of mapping context failed";
+ strcat(stri, "save of mapping context failed");
- return "restore of mapping context failed";
+ strcat(stri, "restore of mapping context failed");
- return "undefined subfunction";
+ strcat(stri, "undefined subfunction");
- return "undefined attribute type";
+ strcat(stri, "undefined attribute type");
- return "feature not supported";
+ strcat(stri, "feature not supported");
- 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");
- 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");
- return "conventional and expanded memory regions overlap";
+ strcat(stri, "conventional and expanded memory regions overlap");
- return "offset within logical page exceeds size of logical page";
+ strcat(stri, "offset within logical page exceeds size of logical page");
- return "region length exceeds 1 MB";
+ strcat(stri, "region length exceeds 1 MB");
- return "source and destination EMS regions have same handle and overlap";
+ strcat(stri, "source and destination EMS regions have same handle and overlap");
- return "memory source or destination type undefined";
+ strcat(stri, "memory source or destination type undefined");
- return "specified alternate map register or DMA register set not supported";
+ strcat(stri, "specified alternate map register or DMA register set not supported");
- return "all alternate map register or DMA register sets currently allocated";
+ strcat(stri, "all alternate map register or DMA register sets currently allocated");
- return "alternate map register or DMA register sets not supported";
+ strcat(stri, "alternate map register or DMA register sets not supported");
- return "undefined or unallocated alternate map register or DMA register set";
+ strcat(stri, "undefined or unallocated alternate map register or DMA register set");
- return "dedicated DMA channels not supported";
+ strcat(stri, "dedicated DMA channels not supported");
- return "specified dedicated DMA channel not supported";
+ strcat(stri, "specified dedicated DMA channel not supported");
- return "no such handle name";
+ strcat(stri, "no such handle name");
- return "a handle found had no name, or duplicate handle name";
+ strcat(stri, "a handle found had no name, or duplicate handle name");
- return "attempted to wrap around 1M conventional address space";
+ strcat(stri, "attempted to wrap around 1M conventional address space");
- return "source array corrupted";
+ strcat(stri, "source array corrupted");
- return "operating system denied access";
+ strcat(stri, "operating system denied access");
- return "undefined error";
+ strcat(stri, "undefined error");
//==========================================================================
/*
//==========================================================================
/*
dword MM_UnusedMemory(mminfo_t *mm);
dword MM_TotalFree(mminfo_t *mm);
void MM_Report(page_t *page, mminfo_t *mm, mminfotype *mmi);
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);
void MM_BombOnError(boolean bomb, mminfo_t *mm);
void MM_GetNewBlock(mminfo_t *mm);
void MM_FreeBlock(mmblocktype *x, mminfo_t *mm);