if(errorflag==true)
{
//err = CPURegs.h.ah;
- strcpy(str,"MML_SetupEMS: EMS error 0x");
+ strcpy(str,"MM_SetupEMS: EMS error");
//itoa(err,str2,16);
- //strcat(str,&err);
- //printf("%s\n",str);
- printf("%s%x\n",str,err);
+ strcat(str,MM_EMSerr(err));
+ printf("%s\n",str);
return err;
}
mm->totalEMSpages=totalEMSpages;
if(errorflag==true)
{
//err = CPURegs.h.ah;
- strcpy(str,"MM_MapEMS: EMS error 0x");
+ strcpy(str,"MM_MapEMS: EMS error");
//itoa(err,str2,16);
- //strcat(str,&err);
- //printf("%s\n",str);
- printf("%s%x\n",str, err);
+ strcat(str,MM_EMSerr(err));
+ printf("%s\n",str);
//printf("FACK! %x\n", err);
return err;
}
byte MM_MapXEMS(mminfo_t *mm, mminfotype *mmi)
{
-//SUB EMS.MapXPages (PhysicalStart, LogicalStart, NumPages, Handle)\r
-\r
- //Maps up to 4 logical EMS pages to physical pages in the page frame, where:\r
- //PhysicalStart = Physical page first logical page is mapped to\r
- //LogicalStart = First logical page to map\r
- //NumPages = Number of pages to map (1 to 4)\r
- //Handle = EMS handle logical pages are allocated to\r
-\r
- /*//Create a buffer containing the page information\r
-// FOR x = 0 TO NumPages - 1\r
-// MapInfo$ = MapInfo$ + MKI$(LogicalStart + x) + MKI$(PhysicalStart + x)\r
-// NEXT*/\r
-\r
-// Regs.ax = &H5000 //Map the pages in the buffer\r
-// Regs.cx = NumPages //to the pageframe\r
-// Regs.dx = Handle\r
-// Regs.ds = VARSEG(MapInfo$)\r
-// Regs.si = SADD(MapInfo$)\r
-// InterruptX &H67, Regs, Regs\r
-// EMS.Error = (Regs.ax AND &HFF00&) \ &H100 //Store the status code\r
-\r
+//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
+
+ /*//Create a buffer containing the page information
+// FOR x = 0 TO NumPages - 1
+// MapInfo$ = MapInfo$ + MKI$(LogicalStart + x) + MKI$(PhysicalStart + x)
+// NEXT*/
+
+// Regs.ax = 0x5000 //Map the pages in the buffer
+// Regs.cx = NumPages //to the pageframe
+// Regs.dx = Handle
+// Regs.ds = VARSEG(MapInfo$)
+// Regs.si = SADD(MapInfo$)
+// InterruptX 0x67, Regs, Regs
+// EMS.Error = (Regs.ax AND 0xFF00&) \ 0x100 //Store the status code
+
//END SUB
char str[80];
byte err;
if(errorflag==true)
{
//err = CPURegs.h.ah;
- strcpy(str,"MM_MapXEMS: EMS error 0x");
+ //strcpy(str,"MM_MapXEMS: EMS error 0x");
+ strcpy(str,"MM_MapXEMS: EMS error");
//itoa(err,str2,16);
- //strcat(str,&err);
- //printf("%s\n",str);
- printf("%s%x\n",str, err);
+ strcat(str,MM_EMSerr(err));
+ printf("%s\n",str);
+ //printf("%s%x\n",str, err);
//printf("FACK! %x\n", err);
return err;
}
/*
=====================
=
-= MM_EMSVer
+= MM_EMSerr
=
=====================
+*/
-
-int MM_EMSVer(void)
+byte *MM_EMSerr(byte err)
{
- int EMSver;
- __asm
+ //Returns a text string describing the error code in EMS.Error.
+ static byte msag[128];
+ switch(err)
{
- mov ah,EMS_VERSION
- int EMS_INT
- mov EMSver,ax
+ case 0x0:
+ strcpy(msag, "successful");
+ break;
+ case 0x80:
+ strcpy(msag, "internal error");
+ break;
+ case 0x81:
+ strcpy(msag, "hardware malfunction");
+ break;
+ case 0x82:
+ strcpy(msag, "busy .. retry later");
+ break;
+ case 0x83:
+ strcpy(msag, "invalid handle");
+ break;
+ case 0x84:
+ strcpy(msag, "undefined function requested by application");
+ break;
+ case 0x85:
+ strcpy(msag, "no more handles available");
+ break;
+ case 0x86:
+ strcpy(msag, "error in save or restore of mapping context");
+ break;
+ case 0x87:
+ strcpy(msag, "insufficient memory pages in system");
+ break;
+ case 0x88:
+ strcpy(msag, "insufficient memory pages available");
+ break;
+ case 0x89:
+ strcpy(msag, "zero pages requested");
+ break;
+ case 0x8A:
+ strcpy(msag, "invalid logical page number encountered");
+ break;
+ case 0x8B:
+ strcpy(msag, "invalid physical page number encountered");
+ break;
+ case 0x8C:
+ strcpy(msag, "page-mapping hardware state save area is full");
+ break;
+ case 0x8D:
+ strcpy(msag, "save of mapping context failed");
+ break;
+ case 0x8E:
+ strcpy(msag, "restore of mapping context failed");
+ break;
+ case 0x8F:
+ strcpy(msag, "undefined subfunction");
+ break;
+ case 0x90:
+ strcpy(msag, "undefined attribute type");
+ break;
+ case 0x91:
+ strcpy(msag, "feature not supported");
+ break;
+ case 0x92:
+ strcpy(msag, "successful, but a portion of the source region has been overwritten");
+ break;
+ case 0x93:
+ strcpy(msag, "length of source or destination region exceeds length of region allocated to either source or destination handle");
+ break;
+ case 0x94:
+ strcpy(msag, "conventional and expanded memory regions overlap");
+ break;
+ case 0x95:
+ strcpy(msag, "offset within logical page exceeds size of logical page");
+ break;
+ case 0x96:
+ strcpy(msag, "region length exceeds 1 MB");
+ break;
+ case 0x97:
+ strcpy(msag, "source and destination EMS regions have same handle and overlap");
+ break;
+ case 0x98:
+ strcpy(msag, "memory source or destination type undefined");
+ break;
+ case 0x9A:
+ strcpy(msag, "specified alternate map register or DMA register set not supported");
+ break;
+ case 0x9B:
+ strcpy(msag, "all alternate map register or DMA register sets currently allocated");
+ break;
+ case 0x9C:
+ strcpy(msag, "alternate map register or DMA register sets not supported");
+ break;
+ case 0x9D:
+ strcpy(msag, "undefined or unallocated alternate map register or DMA register set");
+ break;
+ case 0x9E:
+ strcpy(msag, "dedicated DMA channels not supported");
+ break;
+ case 0x9F:
+ strcpy(msag, "specified dedicated DMA channel not supported");
+ break;
+ case 0xA0:
+ strcpy(msag, "no such handle name");
+ break;
+ case 0xA1:
+ strcpy(msag, "a handle found had no name, or duplicate handle name");
+ break;
+ case 0xA2:
+ strcpy(msag, "attempted to wrap around 1M conventional address space");
+ break;
+ case 0xA3:
+ strcpy(msag, "source array corrupted");
+ break;
+ case 0xA4:
+ strcpy(msag, "operating system denied access");
+ break;
+ default:
+ strcpy(msag, "undefined error");
+ break;
}
- return(EMSver);
-}*/
+ return &msag;
+}
//==========================================================================