blob: adfb216f038db82c65e745f8135606cd730e121f [file] [log] [blame]
Franklin Weia855d622017-01-21 15:18:31 -05001/*
2Copyright (C) 1994-1995 Apogee Software, Ltd.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19*/
20/**********************************************************************
21 module: DPMI.H
22
23 author: James R. Dose
24 date: March 31, 1994
25
26 Inline functions for performing DPMI calls.
27
28 (c) Copyright 1994 James R. Dose. All Rights Reserved.
29**********************************************************************/
30
31#ifndef __DPMI_H
32#define __DPMI_H
33
34#include "SDL.h"
35
Franklin Weia855d622017-01-21 15:18:31 -050036#include <inttypes.h>
Franklin Weia855d622017-01-21 15:18:31 -050037
38enum DPMI_Errors
39 {
40 DPMI_Warning = -2,
41 DPMI_Error = -1,
42 DPMI_Ok = 0
43 };
44
45typedef struct
46 {
47 uint32_t EDI;
48 uint32_t ESI;
49 uint32_t EBP;
50 uint32_t Reserved;
51 uint32_t EBX;
52 uint32_t EDX;
53 uint32_t ECX;
54 uint32_t EAX;
55 uint32_t Flags;
56 uint32_t ES;
57 uint32_t DS;
58 uint32_t FS;
59 uint32_t GS;
60 uint32_t IP;
61 uint16_t CS;
62 uint16_t SP;
63 uint16_t SS;
64 } dpmi_regs;
65
66uint32_t DPMI_GetRealModeVector( int num );
67
68int DPMI_CallRealModeFunction( dpmi_regs *callregs );
69int DPMI_GetDOSMemory( void **ptr, int *descriptor, unsigned length );
70int DPMI_FreeDOSMemory( int descriptor );
71int DPMI_LockMemory( void *address, unsigned length );
72int DPMI_LockMemoryRegion( void *start, void *end );
73int DPMI_UnlockMemory( void *address, unsigned length );
74int DPMI_UnlockMemoryRegion( void *start, void *end );
75
76#define DPMI_Lock( variable ) \
77 ( DPMI_LockMemory( &( variable ), sizeof( variable ) ) )
78
79#define DPMI_Unlock( variable ) \
80 ( DPMI_UnlockMemory( &( variable ), sizeof( variable ) ) )
81
82#endif