-\e[0mSeg:0 Size:10392 Owner:0x7cfc\r
-\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[42;32m0\r
-\e[0m\e[0mSeg:2898 Size:256 Owner:0x638e\r
-\e[44;34m+++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:2998 Size:401 Owner:0xa41a\r
-\e[44;34m++++++\e[0m\e[42;32m\r
-\e[0m\e[0mSeg:2e11 Size:36 Owner:0x0\r
-\e[41;31m+\e[0m\e[42;32m000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\r
-\e[0m\e[0mSeg:be35 Size:8651 Owner:0x0\r
-\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[42;32m\r
+\e[0mSeg:0 Size:8568 Owner:0xfe7e\r
+\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:2178 Size:256 Owner:0x5434\r
+\e[44;34m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2278 Size:17 Owner:0x9480\r
+\e[44;34m+\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:27ec Size:44 Owner:0x0\r
+\e[41;31m++\e[0m\e[42;32m0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\r
+\e[0m\e[0mSeg:b818 Size:10216 Owner:0x0\r
+\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[42;32m\r
\e[0m\e[0mSeg:e000 Size:8191 Owner:0x0\r
\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m
\ No newline at end of file
# objects
#
VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ)
-COREOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_lib.$(OBJ) 16_in.$(OBJ) 16_head.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ)
GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) 16_vrs.$(OBJ) 16_sprit.$(OBJ)
-16LIBOBJS = $(COREOBJS) wcpu.$(OBJ) 16_timer.$(OBJ)
+16LIBOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_lib.$(OBJ) 16_in.$(OBJ) 16_head.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) wcpu.$(OBJ) 16_timer.$(OBJ)
#16planar.$(OBJ) planar.$(OBJ)
DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ)
!ifeq DEBUGSERIAL 1
bakapee1 = "data/koishi~.pcx";\r
bakapee2 = "data/test.map";\r
}\r
-// printf("main()=%Fp start MM\n", *argv[0]);\r
+ //printf("main()=%Fp start MM\n", *argv[0]);\r
MM_Startup(&gvar);\r
PM_Startup(&gvar);\r
- PM_UnlockMainMem(&gvar);\r
- //PM_LockMainMem(&gvar);\r
+ //PM_UnlockMainMem(&gvar);\r
CA_Startup(&gvar);\r
// printf(" done!\n");\r
PRINTBB;\r
#endif\r
#ifdef __WATCOMC__\r
#define _FCORELEFT 0x90000UL+16UL\r
-extern union REGS CPURegs;\r
+static union REGS CPURegs;\r
+\r
+#define _AX CPURegs.x.ax\r
+#define _BX CPURegs.x.bx\r
+#define _CX CPURegs.x.cx\r
+#define _DX CPURegs.x.dx\r
+\r
+#define _SI CPURegs.x.si\r
+\r
+#define _AH CPURegs.h.ah\r
+#define _AL CPURegs.h.al\r
+#define _BH CPURegs.h.bh\r
+#define _BL CPURegs.h.bl\r
+#define _CH CPURegs.h.ch\r
+#define _CL CPURegs.h.cl\r
+#define _DH CPURegs.h.dh\r
+#define _DL CPURegs.h.dl\r
\r
#define geninterrupt(n) int86(n,&CPURegs,&CPURegs);\r
#define peekb(segm,ofs) (*(byte far*)MK_FP((segm),(ofs)))\r
unsigned int EMSVer = 0;
//byte EMS_status;
- unsigned totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle;
- totalEMSpages = freeEMSpages = EMSpageframe = EMSpagesmapped = 0;
+ unsigned totalEMSpages,freeEMSpages,EMSPageFrame,EMSpagesmapped,EMSHandle;
+ totalEMSpages = freeEMSpages = EMSPageFrame = EMSpagesmapped = 0;
__asm {
mov ah,EMS_STATUS
int EMS_INT // find the page frame address
or ah,ah
jnz error
- mov [EMSpageframe],bx
+ mov [EMSPageFrame],bx
mov ah,EMS_GETPAGES
int EMS_INT // find out how much EMS is there
int EMS_INT
or ah,ah
jnz error
- mov [EMShandle],dx
+ mov [EMSHandle],dx
jmp End
#ifdef __BORLANDC__
}
printf("%s\n",str);
return err;
}
- gvar->mm.totalEMSpages=totalEMSpages;
- gvar->mm.freeEMSpages=freeEMSpages;
- gvar->mm.EMSpageframe=EMSpageframe;
- gvar->mm.EMSpagesmapped=EMSpagesmapped;
- gvar->mm.EMShandle=EMShandle;
- gvar->mm.EMSVer=EMSVer;
+ gvar->pm.emm.totalEMSpages=totalEMSpages;
+ gvar->pm.emm.freeEMSpages=freeEMSpages;
+ gvar->pm.emm.EMSPageFrame=EMSPageFrame;
+ gvar->pm.emm.EMSpagesmapped=EMSpagesmapped;
+ gvar->pm.emm.EMSHandle=EMSHandle;
+ gvar->pm.emm.EMSVer=EMSVer;
return 0;
}
void MML_ShutdownEMS(global_game_variables_t *gvar)
{
boolean errorflag=false;
- unsigned EMShandle=gvar->mm.EMShandle;
+ unsigned EMSHandle=gvar->pm.emm.EMSHandle;
- if(!EMShandle)
+ if(!EMSHandle)
return;
__asm {
mov ah,EMS_FREEPAGES
- mov dx,[EMShandle]
+ mov dx,[EMSHandle]
int EMS_INT
or ah,ah
jz ok
byte MM_MapEMS(global_game_variables_t *gvar)
{
byte str[160];
- unsigned EMShandle;
+ unsigned EMSHandle;
byte err;
boolean errorflag=false;
int i;
- EMShandle=gvar->mm.EMShandle;
+ EMSHandle=gvar->pm.emm.EMSHandle;
for (i=0;i<4/*MAPPAGES*/;i++)
{
mov ah,EMS_MAPPAGE
mov bx,[i] // logical page
mov al,bl // physical page
- mov dx,[EMShandle] // handle
+ mov dx,[EMSHandle] // handle
int EMS_INT
or ah,ah
jnz error
//END SUB
byte str[160];
byte err;
- word EMShandle;
+ word EMSHandle;
boolean errorflag=false;
int i;
- EMShandle=gvar->mm.EMShandle;
+ EMSHandle=gvar->pm.emm.EMSHandle;
- if(gvar->mm.EMSVer<0x40)
+ if(gvar->pm.emm.EMSVer<0x40)
return 5;
for (i=0;i<MAPPAGES;i++)
mov ah,EMS_MAPXPAGE
mov cx,[i] // logical page
mov al,bl // physical page
- mov dx,[EMShandle] // handle
+ mov dx,[EMSHandle] // handle
int EMS_INT
or ah,ah
jnz error
{
MML_SetupEMS(gvar); // allocate space
//TODO: EMS4! AND EMS 3.2 MASSIVE DATA HANDLMENT!
- MML_UseSpace(gvar->mm.EMSpageframe,(MAPPAGES)*0x4000lu, gvar);
+ MML_UseSpace(gvar->pm.emm.EMSPageFrame,(MAPPAGES)*0x4000lu, gvar);
//if(gvar->pm.emm.EMSVer<0x40)
MM_MapEMS(gvar); // map in used pages
//else
gvar->mm.mmnew->useptr = baseptr;
//if(gvar->mm.mmnew->useptr==NULL){
#ifdef __DEBUG__
- printf("baseptr=%04x ", baseptr); printf("useptr=%04x\n", gvar->mm.mmnew->useptr);
- printf("*baseptr=%04x ", *baseptr); printf("*useptr=%04x\n", *(gvar->mm.mmnew->useptr));
- printf("*baseptr=%Fp ", *baseptr); printf("*useptr=%Fp\n", *(gvar->mm.mmnew->useptr));
+ printf(" MM_GetPtr\n");
+ printf(" baseptr=%04x ", baseptr); printf("useptr=%04x\n", gvar->mm.mmnew->useptr);
+ printf(" *baseptr=%04x ", *baseptr); printf("*useptr=%04x\n", *(gvar->mm.mmnew->useptr));
+ printf(" *baseptr=%Fp ", *baseptr); printf("*useptr=%Fp\n", *(gvar->mm.mmnew->useptr));
#endif
//exit(-5); }
gvar->mm.mmnew->attributes = BASEATTRIBUTES;
gvar->mm.mmrover = gvar->mm.mmhead;
else if(gvar->mm.mmrover == start)
{
- Quit("MM_SetPurge: Block not found!");
- //return;
+ //Quit("MM_SetPurge: Block not found!");
+ printf("%Fp %u\n", start->start, start->length);
+ printf("MM_SetPurge: Block not found!\n");
+ exit(1);
+ return;
}
} while(1);
if(MML_CheckForEMS())
{
printf(" LIMEMS\n");
- printf(" EMM v%x.%x available\n", gvar->mm.EMSVer>>4,gvar->mm.EMSVer&0x0F);
- printf(" totalEMSpages: %u ", gvar->mm.totalEMSpages); printf("freeEMSpages: %u\n", gvar->mm.freeEMSpages);
- printf(" EMSpageframe: %x\n", gvar->mm.EMSpageframe);
+ printf(" EMM v%x.%x available\n", gvar->pm.emm.EMSVer>>4,gvar->pm.emm.EMSVer&0x0F);
+ printf(" totalEMSpages: %u ", gvar->pm.emm.totalEMSpages); printf("freeEMSpages: %u\n", gvar->pm.emm.freeEMSpages);
+ printf(" EMSPageFrame: %x\n", gvar->pm.emm.EMSPageFrame);
}
if(MML_CheckForXMS(gvar))
{
#include "src/lib/16_head.h"
#include "src/lib/16_hc.h"
#include "src/lib/16_lib.h"
-//#include "src/lib/modex16.h"
//++++mh #include "src/lib/16_in.h"
+
#ifdef __DEBUG__ // 1 == Debug/Dev ; 0 == Production/final
#define OUT_OF_MEM_MSG "MM_GetPtr: Out of memory!\nYou were short :%lu bytes\n"
#else
void MM_SetPurge(memptr *baseptr, int purge, global_game_variables_t *gvar);
void MM_SetLock(memptr *baseptr, boolean locked, global_game_variables_t *gvar);
void MM_SortMem(global_game_variables_t *gvar);
-void MM_ShowMemory(global_game_variables_t *gvar);//,/*page_t *page, */mminfo_t *mm);
+void MM_ShowMemory(global_game_variables_t *gvar);
void MM_DumpData(global_game_variables_t *gvar);
dword MM_UnusedMemory(global_game_variables_t *gvar);
dword MM_TotalFree(global_game_variables_t *gvar);
void MM_Report_(global_game_variables_t *gvar);
-static void MM_EMSerr(byte *stri, byte err);
+/*static */void MM_EMSerr(byte *stri, byte err);
void MM_BombOnError(boolean bomb, global_game_variables_t *gvar);
//void MM_GetNewBlock(mminfo_t *mm);
//void MM_FreeBlock(mmblocktype *x, mminfo_t *mm);
\r
#include "src/lib/16_pm.h"\r
#pragma hdrstop\r
-union REGS CPURegs;\r
+\r
/*\r
// Main Mem specific variables\r
boolean MainPresent;\r
//\r
// PML_MapEMS() - Maps a logical page to a physical page\r
//\r
-void\r
-PML_MapEMS(word logical, word physical, global_game_variables_t *gvar)\r
+byte\r
+PML_MapEMS(word logical, byte physical, global_game_variables_t *gvar)\r
{\r
- union REGS CPURegs;\r
- CPURegs.h.al = physical;\r
- CPURegs.x.bx = logical;\r
- CPURegs.x.dx = gvar->pm.emm.EMSHandle;\r
- CPURegs.h.ah = EMS_MAPPAGE;\r
+ byte str[160];\r
+ unsigned EMShandle;\r
+ byte err;\r
+ boolean errorflag=false;\r
+ int i;\r
+ EMShandle=gvar->pm.emm.EMSHandle;\r
+\r
__asm {\r
+ mov ah,EMS_MAPPAGE\r
+ mov al,physical\r
+ mov bx,logical\r
+ mov dx,EMShandle\r
int EMS_INT\r
+ or ah,ah\r
+ jnz error\r
+ jmp End\r
+#ifdef __BORLANDC__\r
}\r
-\r
- if(CPURegs.h.ah)\r
+#endif\r
+ error:\r
+#ifdef __BORLANDC__\r
+ __asm {\r
+#endif\r
+ mov err,ah\r
+ mov errorflag,1\r
+#ifdef __BORLANDC__\r
+ }\r
+#endif\r
+ End:\r
+#ifdef __WATCOMC__\r
+ }\r
+#endif\r
+ if(errorflag==true)\r
{\r
+ strcpy(str,"MM_MapEMS: EMS error ");\r
+ MM_EMSerr(str, err);\r
+ printf("%s\n",str);\r
Quit("PML_MapEMS: Page mapping failed\n");\r
- return;\r
+ return err;\r
}\r
+ return 0;\r
}\r
\r
//\r
PML_StartupEMS(global_game_variables_t *gvar)\r
{\r
boolean emmcfems;\r
- union REGS CPURegs;\r
\r
int i;\r
long size;\r
emmcfems=0;\r
\r
__asm {\r
- //CPURegs.x.dx = (word)EMMDriverName;\r
- //CPURegs.x.ax = 0x3d00;\r
+ //_DX = (word)EMMDriverName;\r
+ //_AX = 0x3d00;\r
//geninterrupt(0x21); // try to open EMMXXXX0 device\r
mov dx,OFFSET EMMDriverName\r
mov ax,0x3d00\r
#ifdef __BORLANDC__\r
__asm {\r
#endif\r
- //CPURegs.x.bx = CPURegs.x.ax;\r
- //CPURegs.x.ax = 0x4400;\r
+ //_BX = _AX;\r
+ //_AX = 0x4400;\r
//geninterrupt(0x21); // get device info\r
mov bx,ax\r
mov ax,0x4400\r
#endif\r
if(emmcfems!=0) goto error;\r
__asm and dx,0x80\r
- if (!CPURegs.x.dx)\r
+ if (!_DX)\r
goto error;\r
\r
- CPURegs.x.ax = 0x4407;\r
+ _AX = 0x4407;\r
geninterrupt(0x21); // get status\r
__asm mov emmcfems,1\r
if(emmcfems!=0) goto error;\r
\r
- if (!CPURegs.h.al)\r
+ if (!_AL)\r
goto error;\r
\r
- CPURegs.h.ah = 0x3e;\r
+ _AH = 0x3e;\r
geninterrupt(0x21); // close handle\r
\r
- CPURegs.h.ah = EMS_STATUS;\r
+ _AH = EMS_STATUS;\r
geninterrupt(EMS_INT);\r
- if (CPURegs.h.ah)\r
+ if (_AH)\r
goto error; // make sure EMS hardware is present\r
\r
- CPURegs.h.ah = EMS_VERSION;\r
+ _AH = EMS_VERSION;\r
geninterrupt(EMS_INT);\r
- if (CPURegs.h.ah || (CPURegs.h.al < 0x32)) // only work on EMS 3.2 or greater (silly, but...)\r
+ if (_AH || (_AL < 0x32)) // only work on EMS 3.2 or greater (silly, but...)\r
goto error;\r
\r
- CPURegs.h.ah = EMS_GETFRAME;\r
+ _AH = EMS_GETFRAME;\r
geninterrupt(EMS_INT);\r
- if (CPURegs.h.ah)\r
+ if (_AH)\r
goto error; // find the page frame address\r
- gvar->pm.emm.EMSPageFrame = CPURegs.x.bx;\r
+ gvar->pm.emm.EMSPageFrame = _BX;\r
\r
- CPURegs.h.ah = EMS_GETPAGES;\r
+ _AH = EMS_GETPAGES;\r
geninterrupt(EMS_INT);\r
- if (CPURegs.h.ah)\r
+ if (_AH)\r
goto error;\r
- if (CPURegs.x.bx < 2)\r
+ if (_BX < 2)\r
goto error; // Require at least 2 pages (32k)\r
- gvar->pm.emm.EMSAvail = CPURegs.x.bx;\r
+ gvar->pm.emm.EMSAvail = _BX;\r
\r
// Don't hog all available EMS\r
size = gvar->pm.emm.EMSAvail * (long)EMSPageSize;\r
gvar->pm.emm.EMSAvail = size / EMSPageSize;\r
}\r
\r
- CPURegs.h.ah = EMS_ALLOCPAGES;\r
- CPURegs.x.bx = gvar->pm.emm.EMSAvail;\r
+ _AH = EMS_ALLOCPAGES;\r
+ _BX = gvar->pm.emm.EMSAvail;\r
geninterrupt(EMS_INT);\r
- if (CPURegs.h.ah)\r
+ if (_AH)\r
goto error;\r
- gvar->pm.emm.EMSHandle = CPURegs.x.dx;\r
+ gvar->pm.emm.EMSHandle = _DX;\r
\r
gvar->mmi.EMSmem += gvar->pm.emm.EMSAvail * (long)EMSPageSize;\r
\r
void\r
PML_ShutdownEMS(global_game_variables_t *gvar)\r
{\r
- union REGS CPURegs;\r
-\r
if (gvar->pm.emm.EMSPresent)\r
{\r
- CPURegs.h.ah=EMS_FREEPAGES;\r
- CPURegs.x.ax=gvar->pm.emm.EMSHandle;\r
+ _AH=EMS_FREEPAGES;\r
+ _AX=gvar->pm.emm.EMSHandle;\r
geninterrupt(EMS_INT);\r
- if (CPURegs.h.ah)\r
+ if (_AH)\r
{\r
Quit("PML_ShutdownEMS: Error freeing EMS\n");\r
//return;\r
boolean\r
PML_StartupXMS(global_game_variables_t *gvar)\r
{\r
- union REGS CPURegs;\r
-\r
XMSD;\r
gvar->pm.xmm.XMSPresent = false; // Assume failure\r
gvar->pm.xmm.XMSAvail = 0;\r
\r
- CPURegs.x.ax=0x4300;\r
+ _AX=0x4300;\r
geninterrupt(XMS_INT); // Check for presence of XMS driver\r
- if (CPURegs.h.al != 0x80)\r
+ if (_AL != 0x80)\r
goto error;\r
\r
\r
}\r
\r
XMS_CALL(XMS_QUERYFREE, gvar); // Find out how much XMS is available\r
- gvar->pm.xmm.XMSAvail = CPURegs.x.ax;\r
- if (!CPURegs.x.ax) // AJR: bugfix 10/8/92\r
+ gvar->pm.xmm.XMSAvail = _AX;\r
+ if (!_AX) // AJR: bugfix 10/8/92\r
goto error;\r
\r
gvar->pm.xmm.XMSAvail &= ~(PMPageSizeKB - 1); // Round off to nearest page size\r
if (gvar->pm.xmm.XMSAvail < (PMPageSizeKB * 2)) // Need at least 2 pages\r
goto error;\r
\r
- CPURegs.x.dx = gvar->pm.xmm.XMSAvail;\r
+ _DX = gvar->pm.xmm.XMSAvail;\r
XMS_CALL(XMS_ALLOC, gvar); // And do the allocation\r
- gvar->pm.xmm.XMSHandle = CPURegs.x.dx;\r
+ gvar->pm.xmm.XMSHandle = _DX;\r
\r
- if (!CPURegs.x.ax) // AJR: bugfix 10/8/92\r
+ if (!_AX) // AJR: bugfix 10/8/92\r
{\r
gvar->pm.xmm.XMSAvail = 0;\r
goto error;\r
__asm {\r
push si\r
}\r
- CPURegs.x.si = (word)©\r
+ _SI = (word)©\r
XMS_CALL(XMS_MOVE, gvar);\r
__asm {\r
pop si\r
}\r
- if (!CPURegs.x.ax)\r
+ if (!_AX)\r
{\r
Quit("PML_XMSCopy: Error on copy");\r
//return;\r
XMSD;\r
if (gvar->pm.xmm.XMSPresent)\r
{\r
- CPURegs.x.dx = gvar->pm.xmm.XMSHandle;\r
+ _DX = gvar->pm.xmm.XMSHandle;\r
XMS_CALL(XMS_FREE, gvar);\r
- if (CPURegs.h.bl)\r
+ if (_BL)\r
{\r
Quit("PML_ShutdownXMS: Error freeing XMS");\r
//return;\r
void __near *nearheap;\r
#endif\r
//byte EMS_status;\r
- unsigned totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle;//TODO: PM use\r
- unsigned int EMSVer;\r
word numUMBs,UMBbase[MAXUMBS];\r
//dword numUMBs,UMBbase[MAXUMBS];\r
//huge mmblocktype huge mmblocks[MAXBLOCKS],huge *mmhead,huge *mmfree,huge *mmrover,huge *mmnew;\r
boolean EMSPresent;\r
word EMSAvail,EMSPagesAvail,EMSHandle,\r
EMSPageFrame,EMSPhysicalPage, EMSVer;\r
+ word totalEMSpages, freeEMSpages, EMSpagesmapped;\r
EMSListStruct EMSList[EMSFrameCount];\r
} pm_emmi_t;\r
\r