]> 4ch.mooo.com Git - 16.git/blob - 16/cawat/16_mm.h
modified: boop.sh
[16.git] / 16 / cawat / 16_mm.h
1 /* Catacomb Armageddon Source Code\r
2  * Copyright (C) 1993-2014 Flat Rock Software\r
3  *\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
8  *\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
13  *\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
17  */\r
18 \r
19 // ID_MM.H
20
21 #ifndef __ID_EXMM__\r
22 #define __ID_EXMM__
23
24 #include "lib_head.h"
25 //#pragma hdrstop\r
26 \r
27 //#pragma warn -pro\r
28 //#pragma warn -use\r
29 \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
32 #else\r
33 #define OUT_OF_MEM_MSG  "\npee\n"
34 #endif\r
35 \r
36 \r
37 #define SAVENEARHEAP    0x400           // space to leave in data segment\r
38 #define SAVEFARHEAP             0                       // space to leave in far heap\r
39 \r
40 #define BUFFERSIZE              0x1000          // miscelanious, allways available buffer\r
41 \r
42 #define MAXBLOCKS               600\r
43 \r
44 \r
45 //--------\r
46 \r
47 #define EMS_INT                 0x67\r
48 \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
56 \r
57 //--------\r
58 \r
59 #define XMS_VERSION             0x00\r
60 \r
61 #define XMS_ALLOCHMA    0x01\r
62 #define XMS_FREEHMA             0x02\r
63 \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
69 \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
78 \r
79 #define XMS_ALLOCUMB    0x10\r
80 #define XMS_FREEUMB             0x11\r
81 \r
82 //==========================================================================\r
83 \r
84 typedef void /*_seg*/ * memptr;\r
85 \r
86 typedef struct\r
87 {\r
88         long    nearheap,farheap,EMSmem,XMSmem,mainmem;\r
89 } mminfotype;\r
90 \r
91 //==========================================================================\r
92 \r
93 extern  mminfotype      mminfo;\r
94 extern  memptr          bufferseg;\r
95 extern  boolean         mmerror;\r
96 \r
97 extern  void            (* beforesort) (void);\r
98 extern  void            (* aftersort) (void);\r
99 \r
100 //==========================================================================\r
101 \r
102 void MM_Startup (void);\r
103 void MM_Shutdown (void);\r
104 void MM_MapEMS (void);\r
105 \r
106 void MM_GetPtr (memptr *baseptr,unsigned long size);\r
107 void MM_FreePtr (memptr *baseptr);\r
108 \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
112 \r
113 void MM_ShowMemory (void);\r
114 \r
115 long MM_UnusedMemory (void);\r
116 long MM_TotalFree (void);\r
117 \r
118 void MM_BombOnError (boolean bomb);
119
120 //==========================================================================\r
121 \r
122 //\r
123 // local prototypes\r
124 //\r
125 \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
133 \r
134 //==========================================================================
135
136 #endif