boolean MML_CheckForEMS(void)
{
- boolean emmcfems=0;
+ boolean emmcfems = false;
+ word EMSPageFrame = 0;
+ byte err=0, str[64];
static char emmname[] = "EMMXXXX0"; //fix by andrius4669
__asm {
mov dx,OFFSET emmname //fix by andrius4669
mov ax,0x3d00
- int 0x21 // try to open EMMXXXX0 device
+ int EMM_INT // try to open EMMXXXX0 device
jc error
mov bx,ax
mov ax,0x4400
- int 0x21 // get device info
+ int EMM_INT // get device info
jc error
and dx,0x80
mov ax,0x4407
- int 0x21 // get status
+ int EMM_INT // get status
jc error
or al,al
jz error
mov ah,0x3e
- int 0x21 // close handle
+ int EMM_INT // close handle
jc error
+
+ //
+ // pageframe check
+ //
+ mov ah,EMS_GETFRAME
+ int EMS_INT // find the page frame address
+ or ah,ah
+ jnz error
+ mov [EMSPageFrame],bx
+
//
// EMS is good
//
- mov emmcfems,1
- jmp End
+ mov emmcfems,1
+ jmp End
#ifdef __BORLANDC__
}
#endif
//
// EMS is bad
//
- mov emmcfems,0
+ mov err,ah
+ mov emmcfems,0
#ifdef __BORLANDC__
}
#endif
#ifdef __WATCOMC__
}
#endif
+
+ //
+ // Pageframe switch to determine if there is one!
+ //
+ if(!EMSPageFrame)
+ {
+ emmcfems = false;
+#if defined(__DEBUG_PM__) || defined(__DEBUG_MM__)
+ printf("MML_CheckForEMS: EMS error No Pageframe!\nAddress detected to be %04x\n", EMSPageFrame);
+#endif
+ }else if(!emmcfems)// if there is an error and page frame is not 0000
+ {
+ strcpy(str,"MML_CheckForEMS: EMS error ");
+ MM_EMSerr(str, err);
+ printf("%s\n",str);
+ }
+
return(emmcfems);
}
playing += STARTADLIBSOUNDS;
break;
}
- MM_SetLock(&(memptr)audiosegs[playing],true);
+ MM_SetLock((memptr *)&audiosegs[playing],true);
}
// VW_ColorBorder (oldborder);
/*++++ if(playing)
- MM_SetLock(&(memptr)audiosegs[playing],false);*/
+ MM_SetLock((memptr *)&audiosegs[playing],false);*/
}
//==========================================================================