=============================================================================\r
*/\r
\r
-//#include "LIB_HEAD.H"
-#include "16_mm.h"
+//#include "LIB_HEAD.H"\r
+#include "16_mm.h"\r
\r
/*\r
=============================================================================\r
*/\r
\r
boolean mmstarted;\r
-
+\r
void huge *hugeheap;\r
void far *farheap;\r
void *nearheap;\r
*/\r
\r
boolean MML_CheckForEMS (void)\r
-{
- boolean emmcfems;
- char emmname[] = "EMMXXXX0";
-
- __asm {
- mov dx,OFF=emmname\r
+{\r
+ boolean emmcfems;\r
+ char emmname[] = "EMMXXXX0";\r
+// mov dx,OFFSET emmname\r
+ __asm {\r
+ LEA DX, emmname //fix by andrius4669\r
mov ax,0x3d00\r
int 0x21 // try to open EMMXXXX0 device\r
jc error\r
\r
mov ah,0x3e\r
int 0x21 // close handle\r
- jc error
+ jc error\r
//\r
// EMS is good\r
- //
- mov emmcfems,1
- jmp End
- error:
+ //\r
+ mov emmcfems,1\r
+ jmp End\r
+ error:\r
//\r
// EMS is bad\r
//\r
- mov emmcfems,0
- End:
- }
+ mov emmcfems,0\r
+ End:\r
+ }\r
return(emmcfems);\r
}\r
\r
void MML_SetupEMS (void)\r
{\r
char str[80],str2[10];\r
- unsigned err;
+ unsigned err;\r
struct REGS CPURegs;\r
\r
totalEMSpages = freeEMSpages = EMSpageframe = EMSpagesmapped = 0;\r
\r
- __asm
+ __asm\r
{\r
mov ah,EMS_STATUS\r
int EMS_INT // make sure EMS hardware is present\r
\r
cmp bx,4\r
jle getpages // there is only 1,2,3,or 4 pages\r
- mov bx,4 // we can't use more than 4 pages
-
-getpages:
+ mov bx,4 // we can't use more than 4 pages\r
+\r
+getpages:\r
mov [EMSpagesmapped],bx\r
mov ah,EMS_ALLOCPAGES // allocate up to 64k of EMS\r
int EMS_INT\r
or ah,ah\r
jnz error\r
- mov [EMShandle],dx
- jmp End
+ mov [EMShandle],dx\r
+ jmp End\r
error:\r
// err = CPURegs.h.ah;\r
// strcpy (str,"MML_SetupEMS: EMS error 0x");\r
// itoa(err,str2,16);\r
// strcpy (str,str2);\r
-// printf("%s\n",str);
- jmp End
-noEMS:
+// printf("%s\n",str);\r
+ jmp End\r
+noEMS:\r
End:\r
}\r
}\r
if (!EMShandle)\r
return;\r
\r
- __asm
+ __asm\r
{\r
mov ah,EMS_FREEPAGES\r
mov dx,[EMShandle]\r
int EMS_INT\r
or ah,ah\r
- jz ok
- printf("MML_ShutdownEMS: Error freeing EMS!");
+ jz ok\r
+ printf("MML_ShutdownEMS: Error freeing EMS!");\r
ok:\r
}\r
}\r
\r
for (i=0;i<EMSpagesmapped;i++)\r
{\r
- __asm
+ __asm\r
{\r
mov ah,EMS_MAPPAGE\r
mov bx,[i] // logical page\r
mov dx,[EMShandle] // handle\r
int EMS_INT\r
or ah,ah\r
- jnz error
- jmp End
+ jnz error\r
+ jmp End\r
error:\r
error = _AH;\r
strcpy (str,"MM_MapEMS: EMS error 0x");\r
itoa(error,str2,16);\r
strcpy (str,str2);\r
- printf("%s\n",str);
+ printf("%s\n",str);\r
End:\r
}\r
}\r
{\r
numUMBs = 0;\r
\r
- __asm
+ __asm\r
{\r
mov ax,0x4300\r
int 0x2f // query status of installed diver\r
cmp al,0x80\r
- je good
+ je good\r
good:\r
}\r
/* return false;\r
{\r
unsigned base,size;\r
\r
- __asm
+ __asm\r
{\r
mov ax,0x4310\r
int 0x2f\r
\r
gotone:\r
mov [base],bx\r
- mov [size],dx
+ mov [size],dx\r
done:\r
}\r
MML_UseSpace (base,size);\r
for (i=0;i<numUMBs;i++)\r
{\r
base = UMBbase[i];\r
- __asm
+ __asm\r
{\r
mov ah,XMS_FREEUMB\r
mov dx,[base]\r
- call [DWORD PTR XMSaddr]
+ call [DWORD PTR XMSaddr]\r
}\r
}\r
}\r