1 /* Catacomb Armageddon Source Code
\r
2 * Copyright (C) 1993-2014 Flat Rock Software
\r
4 * This program is free software; you can redistribute it and/or modify
\r
5 * it under the terms of the GNU General Public License as published by
\r
6 * the Free Software Foundation; either version 2 of the License, or
\r
7 * (at your option) any later version.
\r
9 * This program is distributed in the hope that it will be useful,
\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 * GNU General Public License for more details.
\r
14 * You should have received a copy of the GNU General Public License along
\r
15 * with this program; if not, write to the Free Software Foundation, Inc.,
\r
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
30 #if 1 // 1 == Debug/Dev ; 0 == Production/final
\r
31 #define OUT_OF_MEM_MSG "MM_GetPtr: Out of memory!\nYou were short :%ld bytes"
\r
33 #define OUT_OF_MEM_MSG "\npee\n"
37 #define SAVENEARHEAP 0x400 // space to leave in data segment
\r
38 #define SAVEFARHEAP 0 // space to leave in far heap
\r
40 #define BUFFERSIZE 0x1000 // miscelanious, allways available buffer
\r
42 #define MAXBLOCKS 600
\r
47 #define EMS_INT 0x67
\r
49 #define EMS_STATUS 0x40
\r
50 #define EMS_GETFRAME 0x41
\r
51 #define EMS_GETPAGES 0x42
\r
52 #define EMS_ALLOCPAGES 0x43
\r
53 #define EMS_MAPPAGE 0x44
\r
54 #define EMS_FREEPAGES 0x45
\r
55 #define EMS_VERSION 0x46
\r
59 #define XMS_VERSION 0x00
\r
61 #define XMS_ALLOCHMA 0x01
\r
62 #define XMS_FREEHMA 0x02
\r
64 #define XMS_GENABLEA20 0x03
\r
65 #define XMS_GDISABLEA20 0x04
\r
66 #define XMS_LENABLEA20 0x05
\r
67 #define XMS_LDISABLEA20 0x06
\r
68 #define XMS_QUERYA20 0x07
\r
70 #define XMS_QUERYREE 0x08
\r
71 #define XMS_ALLOC 0x09
\r
72 #define XMS_FREE 0x0A
\r
73 #define XMS_MOVE 0x0B
\r
74 #define XMS_LOCK 0x0C
\r
75 #define XMS_UNLOCK 0x0D
\r
76 #define XMS_GETINFO 0x0E
\r
77 #define XMS_RESIZE 0x0F
\r
79 #define XMS_ALLOCUMB 0x10
\r
80 #define XMS_FREEUMB 0x11
\r
82 //==========================================================================
\r
84 typedef void /*_seg*/ * memptr;
\r
88 long nearheap,farheap,EMSmem,XMSmem,mainmem;
\r
91 //==========================================================================
\r
93 extern mminfotype mminfo;
\r
94 extern memptr bufferseg;
\r
95 extern boolean mmerror;
\r
97 extern void (* beforesort) (void);
\r
98 extern void (* aftersort) (void);
\r
100 //==========================================================================
\r
102 void MM_Startup (void);
\r
103 void MM_Shutdown (void);
\r
104 void MM_MapEMS (void);
\r
106 void MM_GetPtr (memptr *baseptr,unsigned long size);
\r
107 void MM_FreePtr (memptr *baseptr);
\r
109 void MM_SetPurge (memptr *baseptr, int purge);
\r
110 void MM_SetLock (memptr *baseptr, boolean locked);
\r
111 void MM_SortMem (void);
\r
113 void MM_ShowMemory (void);
\r
115 long MM_UnusedMemory (void);
\r
116 long MM_TotalFree (void);
\r
118 void MM_BombOnError (boolean bomb);
120 //==========================================================================
\r
123 // local prototypes
\r
126 boolean MML_CheckForEMS (void);
\r
127 void MML_ShutdownEMS (void);
\r
128 void MM_MapEMS (void);
\r
129 boolean MML_CheckForXMS (void);
\r
130 void MML_ShutdownXMS (void);
\r
131 void MML_UseSpace (unsigned segstart, unsigned seglength);
\r
132 void MML_ClearBlock (void);
\r
134 //==========================================================================