1/*
2Copyright (C) 1996-1997 Id Software, Inc.
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//
22// dosisms.h: I'd call it dos.h, but the name's taken
23//
24
25#ifndef _DOSISMS_H_
26#define _DOSISMS_H_
27
28int dos_lockmem(void *addr, int size);
29int dos_unlockmem(void *addr, int size);
30
31typedef union {
32	struct {
33		unsigned long edi;
34		unsigned long esi;
35		unsigned long ebp;
36		unsigned long res;
37		unsigned long ebx;
38		unsigned long edx;
39		unsigned long ecx;
40		unsigned long eax;
41	} d;
42	struct {
43		unsigned short di, di_hi;
44		unsigned short si, si_hi;
45		unsigned short bp, bp_hi;
46		unsigned short res, res_hi;
47		unsigned short bx, bx_hi;
48		unsigned short dx, dx_hi;
49		unsigned short cx, cx_hi;
50		unsigned short ax, ax_hi;
51		unsigned short flags;
52		unsigned short es;
53		unsigned short ds;
54		unsigned short fs;
55		unsigned short gs;
56		unsigned short ip;
57		unsigned short cs;
58		unsigned short sp;
59		unsigned short ss;
60	} x;
61	struct {
62		unsigned char edi[4];
63		unsigned char esi[4];
64		unsigned char ebp[4];
65		unsigned char res[4];
66		unsigned char bl, bh, ebx_b2, ebx_b3;
67		unsigned char dl, dh, edx_b2, edx_b3;
68		unsigned char cl, ch, ecx_b2, ecx_b3;
69		unsigned char al, ah, eax_b2, eax_b3;
70	} h;
71} regs_t;
72
73unsigned int ptr2real(void *ptr);
74void *real2ptr(unsigned int real);
75void *far2ptr(unsigned int farptr);
76unsigned int ptr2far(void *ptr);
77
78int	dos_inportb(int port);
79int	dos_inportw(int port);
80void dos_outportb(int port, int val);
81void dos_outportw(int port, int val);
82
83void dos_irqenable(void);
84void dos_irqdisable(void);
85void dos_registerintr(int intr, void (*handler)(void));
86void dos_restoreintr(int intr);
87
88int	dos_int86(int vec);
89
90void *dos_getmemory(int size);
91void dos_freememory(void *ptr);
92
93void	dos_usleep(int usecs);
94
95int dos_getheapsize(void);
96
97extern regs_t regs;
98
99#endif	// _DOSISMS_H_
100
101