3 * Code to detect the surrounding DOS/Windows environment and support routines to work with it
4 * (C) 2009-2012 Jonathan Campbell.
5 * Hackipedia DOS library.
7 * This code is licensed under the LGPL.
8 * <insert LGPL legal text here>
16 #include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
26 #include <hw/cpu/cpu.h>
27 #include <hw/dos/dos.h>
28 #include <hw/dos/doswin.h>
29 #include <hw/dos/dosntvdm.h>
31 #if TARGET_MSDOS == 32
32 void *dpmi_alloc_dos(unsigned long len,uint16_t *selector) {
33 unsigned short rm=0,pm=0,fail=0;
35 /* convert len to paragraphs */
36 len = (len + 15) >> 4UL;
37 if (len >= 0xFF00UL) return NULL;
50 if (fail) return NULL;
53 return (void*)((unsigned long)rm << 4UL);
56 void dpmi_free_dos(uint16_t selector) {