3 * Expanded Memory Manager library.
4 * (C) 2009-2012 Jonathan Campbell.
5 * Hackipedia DOS library.
7 * This code is licensed under the LGPL.
8 * <insert LGPL legal text here>
11 #ifndef __HW_DOS_EMM_H
12 #define __HW_DOS_EMM_H
14 #if !defined(TARGET_OS2) && !defined(TARGET_WINDOWS)
27 //#include "src/lib/doslib/cpu.h"
28 #include "src/lib/doslib/dos.h"
30 extern byte emm_status;
31 extern byte emm_present;
32 extern byte emm_version;
33 extern byte emm_phys_pages;
34 extern word emm_total_pages;
35 extern unsigned int emm_page_frame_segment;
36 extern word emm_unallocated_pages;
37 extern struct emm_phys_page_map *emm_phys_map;
39 /* FIXME: 32-bit protected mode: Who the fuck keeps changing the
40 value of ES?!? Watcom and our code rely on ES == DS! */
41 #if TARGET_MSDOS == 32
42 # define sanity() _sanity(__LINE__,__FILE__)
43 static inline void _sanity(unsigned int line,const char *f) {
54 fprintf(stderr,"%s(%u) DS(%X) != ES(%X)\n",f,line,d,e);
63 struct emm_phys_page_map {
70 void emm_phys_pages_sort();
71 void emm_update_page_count();
72 int emm_alloc_pages(unsigned int pages);
73 int emm_free_pages(unsigned int handle);
74 word emm_last_phys_page_segment(unsigned int phys_page);
75 int emm_map_page(unsigned int handle,unsigned int phys_page,unsigned int log_page);
77 #define emm_was_probed() (emm_status != 0xFF)
79 #endif /* !defined(TARGET_OS2) && !defined(TARGET_WINDOWS) */
81 #endif /* __HW_DOS_EMM_H */