1 /* Copyright (C) 1991, 1992, 1998 artofcode LLC.  All rights reserved.
2 
3   This program is free software; you can redistribute it and/or modify it
4   under the terms of the GNU General Public License as published by the
5   Free Software Foundation; either version 2 of the License, or (at your
6   option) any later version.
7 
8   This program is distributed in the hope that it will be useful, but
9   WITHOUT ANY WARRANTY; without even the implied warranty of
10   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11   General Public License for more details.
12 
13   You should have received a copy of the GNU General Public License along
14   with this program; if not, write to the Free Software Foundation, Inc.,
15   59 Temple Place, Suite 330, Boston, MA, 02111-1307.
16 
17 */
18 
19 /*$Id: dos_.h,v 1.2.6.1.2.1 2003/01/17 00:49:00 giles Exp $ */
20 /* Generic MS-DOS interface */
21 
22 #ifndef dos__INCLUDED
23 #  define dos__INCLUDED
24 
25 /* This file is needed because the various DOS compilers */
26 /* provide slightly different procedures for interfacing to DOS and */
27 /* the I/O hardware, and because the Watcom compiler is 32-bit. */
28 #include <dos.h>
29 #if defined(__WATCOMC__) || defined(_MSC_VER)
30 
31 /* ---------------- Microsoft C/C++, all models; */
32 /* ---------------- Watcom compiler, 32-bit flat model. */
33 /* ---------------- inp/outp prototypes are in conio.h, not dos.h. */
34 
35 #  include <conio.h>
36 #  define inport(px) inpw(px)
37 #  define inportb(px) inp(px)
38 #  define outport(px,w) outpw(px,w)
39 #  define outportb(px,b) outp(px,b)
40 #  define enable() _enable()
41 #  define disable() _disable()
42 #  define PTR_OFF(ptr) ((ushort)(uint)(ptr))
43 /* Define the structure and procedures for file enumeration. */
44 #define ff_name name
45 #define dos_findfirst(n,b) _dos_findfirst(n, _A_NORMAL | _A_RDONLY, b)
46 #define dos_findnext(b) _dos_findnext(b)
47 
48 /* Define things that differ between Watcom and Microsoft. */
49 #  ifdef __WATCOMC__
50 #    define MK_PTR(seg,off) (((seg) << 4) + (off))
51 #    define int86 int386
52 #    define int86x int386x
53 #    define rshort w
54 #    define ff_struct_t struct find_t
55 #  else
56 #    define MK_PTR(seg,off) (((ulong)(seg) << 16) + (off))
57 #    define cputs _cputs
58 #    define fdopen _fdopen
59 #    define O_BINARY _O_BINARY
60 #    define REGS _REGS
61 #    define rshort x
62 #    define ff_struct_t struct _find_t
63 #    define stdprn _stdprn
64 #  endif
65 
66 #else /* not Watcom or Microsoft */
67 
68 /* ---------------- Borland compiler, 16:16 pseudo-segmented model. */
69 /* ---------------- ffblk is in dir.h, not dos.h. */
70 #include <dir.h>
71 #  define MK_PTR(seg,off) MK_FP(seg,off)
72 #  define PTR_OFF(ptr) FP_OFF(ptr)
73 /* Define the regs union tag for short registers. */
74 #  define rshort x
75 /* Define the structure and procedures for file enumeration. */
76 #define ff_struct_t struct ffblk
77 #define dos_findfirst(n,b) findfirst(n, b, 0)
78 #define dos_findnext(b) findnext(b)
79 
80 #endif
81 
82 #endif /* dos__INCLUDED */
83