]> 4ch.mooo.com Git - 16.git/blob - src/lib/doslib/dos/ddpmiphy.c
added a bunch of things~ and midi stuff~
[16.git] / src / lib / doslib / dos / ddpmiphy.c
1 /* dos.c
2  *
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.
6  *
7  * This code is licensed under the LGPL.
8  * <insert LGPL legal text here>
9  */
10
11 #ifdef TARGET_WINDOWS
12 # include <windows.h>
13 #endif
14
15 #include <stdio.h>
16 #include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
17 #include <stdlib.h>
18 #include <string.h>
19 #include <stddef.h>
20 #include <unistd.h>
21 #include <malloc.h>
22 #include <assert.h>
23 #include <fcntl.h>
24 #include <dos.h>
25
26 #include <hw/cpu/cpu.h>
27 #include <hw/dos/dos.h>
28 #include <hw/dos/doswin.h>
29 #include <hw/dos/dosntvdm.h>
30
31 #if TARGET_MSDOS == 32
32 void *dpmi_phys_addr_map(uint32_t phys,uint32_t size) {
33         uint32_t retv = 0;
34
35         __asm {
36                 mov     ax,0x0800
37                 mov     cx,word ptr phys
38                 mov     bx,word ptr phys+2
39                 mov     di,word ptr size
40                 mov     si,word ptr size+2
41                 int     0x31
42                 jc      endf
43                 mov     word ptr retv,cx
44                 mov     word ptr retv+2,bx
45 endf:
46         }
47
48         return (void*)retv;
49 }
50
51 void dpmi_phys_addr_free(void *base) {
52         __asm {
53                 mov     ax,0x0801
54                 mov     cx,word ptr base
55                 mov     bx,word ptr base+2
56                 int     0x31
57         }
58 }
59 #endif
60