1 /* Catacomb Armageddon Source Code
2 * Copyright (C) 1993-2014 Flat Rock Software
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include "src/lib/lib_head.h"
27 #include "src/lib/16_in.h"
29 #if 1 // 1 == Debug/Dev ; 0 == Production/final
30 #define OUT_OF_MEM_MSG "MM_GetPtr: Out of memory!\nYou were short :%ld bytes"
32 #define OUT_OF_MEM_MSG "\npee\n"
36 #define SAVENEARHEAP 0x400 // space to leave in data segment
37 #define SAVEFARHEAP 0 // space to leave in far heap
39 #define BUFFERSIZE 0x1000 // miscelanious, allways available buffer
48 #define EMS_STATUS 0x40
49 #define EMS_GETFRAME 0x41
50 #define EMS_GETPAGES 0x42
51 #define EMS_ALLOCPAGES 0x43
52 #define EMS_MAPPAGE 0x44
53 #define EMS_FREEPAGES 0x45
54 #define EMS_VERSION 0x46
58 #define XMS_VERSION 0x00
60 #define XMS_ALLOCHMA 0x01
61 #define XMS_FREEHMA 0x02
63 #define XMS_GENABLEA20 0x03
64 #define XMS_GDISABLEA20 0x04
65 #define XMS_LENABLEA20 0x05
66 #define XMS_LDISABLEA20 0x06
67 #define XMS_QUERYA20 0x07
69 #define XMS_QUERYREE 0x08
70 #define XMS_ALLOC 0x09
74 #define XMS_UNLOCK 0x0D
75 #define XMS_GETINFO 0x0E
76 #define XMS_RESIZE 0x0F
78 #define XMS_ALLOCUMB 0x10
79 #define XMS_FREEUMB 0x11
81 //==========================================================================
83 typedef void /*_seg*/ * memptr;
87 long nearheap,farheap,EMSmem,XMSmem,mainmem;
90 //==========================================================================
92 extern mminfotype mminfo;
93 extern memptr bufferseg;
94 extern boolean mmerror;
96 extern void (* beforesort) (void);
97 extern void (* aftersort) (void);
99 //==========================================================================
101 void MM_Startup (void);
102 void MM_Shutdown (void);
103 void MM_MapEMS (void);
105 void MM_GetPtr (memptr *baseptr,dword size);
106 void MM_FreePtr (memptr *baseptr);
108 void MM_SetPurge (memptr *baseptr, int purge);
109 void MM_SetLock (memptr *baseptr, boolean locked);
110 void MM_SortMem (void);
112 void MM_ShowMemory (void);
114 long MM_UnusedMemory (void);
115 long MM_TotalFree (void);
117 void MM_BombOnError (boolean bomb);
119 //==========================================================================
125 boolean MML_CheckForEMS (void);
126 void MML_ShutdownEMS (void);
127 void MM_MapEMS (void);
128 boolean MML_CheckForXMS (void);
129 void MML_ShutdownXMS (void);
130 void MML_UseSpace (unsigned segstart, unsigned seglength);
131 void MML_ClearBlock (void);
133 //==========================================================================