2 * Copyright (C) Prikol Software 1996-1997
3 * Copyright (C) Aleksey Volynskov 1996-1997
4 * Copyright (C) fgsfds 2019
6 * This file is part of the Doom2D PSX project.
8 * Doom2D PSX is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * Doom2D PSX is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/> or
19 * write to the Free Software Foundation, Inc.,
20 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
33 dword
dpmi_memavl(void);
35 extern int d_start
, d_end
;
39 static byte m_active
= FALSE
;
41 static void * resp
[MAX_WAD
];
42 static short resl
[MAX_WAD
];
44 void M_startup(void *heapbase
, unsigned long heapsize
) {
48 logo("M_startup(): memory init: %u kb heap at %p\n", heapsize
>> 10, heapbase
);
50 InitHeap3((void*)heapbase
, heapsize
);
52 memset(resp
, 0, sizeof(resp
));
53 memset(resl
, 0, sizeof(resl
));
54 // logo(" свободно DPMI-памяти: %uK\n",dpmi_memavl()>>10);
58 void M_shutdown(void) {
65 static void allocres(int h
) {
67 if (!(p
= malloc3(wad
[h
].l
+ 4)))
68 ERR_fatal("M_lock: malloc3 failed");
72 F_loadres(h
, p
, 0, wad
[h
].l
);
75 void * M_lock(int h
) {
76 if ((h
== -1) || (h
== 0xFFFF))
81 ERR_fatal("M_lock: funny resource number");
90 void M_unlock(void * p
) {
98 ERR_fatal("M_unlock: funny resource number");
105 // printf("M_unlock(): freeing resource %x\n", h);