]> 4ch.mooo.com Git - 16.git/blob - src/lib/dl/himemsys.h
meh
[16.git] / src / lib / dl / himemsys.h
1 /* himemsys.h
2  *
3  * Support calls to use HIMEM.SYS
4  * (C) 2009-2012 Jonathan Campbell.
5  * Hackipedia DOS library.
6  *
7  * This code is licensed under the LGPL.
8  * <insert LGPL legal text here>
9  */
10
11 #ifndef __HW_DOS_XMM_H
12 #define __HW_DOS_XMM_H
13
14 #if !defined(TARGET_WINDOWS) && !defined(TARGET_OS2)
15
16 #include <stdlib.h>
17 #include <string.h>
18 #include <stdint.h>
19 #include <assert.h>
20 #include <stdio.h>
21 #include <conio.h>
22 #include <dos.h>
23
24 //#include "src/lib/doslib/cpu.h"
25 #include "src/lib/doslib/dos.h"
26
27 /* HMA memory is present */
28 #define HIMEM_F_HMA             (1 << 0)
29 /* HIMEM.SYS supports extended functions to address up to 4GB of RAM (surpassing the older API's 64MB limit) */
30 #define HIMEM_F_4GB             (1 << 1)
31
32 extern unsigned char himem_sys_present;
33 extern unsigned int himem_sys_version;
34 extern unsigned long himem_sys_entry;
35 extern unsigned char himem_sys_flags;
36 extern unsigned long himem_sys_total_free;
37 extern unsigned long himem_sys_largest_free;
38
39 #pragma pack(push,1)
40 struct himem_block_info {
41         uint32_t                block_length_kb;
42         unsigned char           lock_count;
43         unsigned char           free_handles;
44 };
45 #pragma pack(pop)
46
47 int probe_himem_sys();
48 int himem_sys_query_a20();
49 int himem_sys_local_a20(int enable);
50 int himem_sys_global_a20(int enable);
51 void himem_sys_update_free_memory_status();
52 int __cdecl himem_sys_alloc(unsigned long size/* in KB---not bytes*/);
53 int himem_sys_move(unsigned int dst_handle,uint32_t dst_offset,unsigned int src_handle,uint32_t src_offset,uint32_t length);
54 int __cdecl himem_sys_realloc(unsigned int handle,unsigned long size/* in KB---not bytes*/);
55 int himem_sys_get_handle_info(unsigned int handle,struct himem_block_info *b);
56 uint32_t himem_sys_lock(unsigned int handle);
57 int himem_sys_unlock(unsigned int handle);
58 int himem_sys_free(int handle);
59
60 #endif /* !defined(TARGET_WINDOWS) && !defined(TARGET_OS2) */
61
62 #endif /* __HW_DOS_EMM_H */