home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cdisk.zip / VDD / MVDM.H < prev    next >
C/C++ Source or Header  |  1993-02-17  |  8KB  |  327 lines

  1. /***    MVDM.H
  2.  *
  3.  *    MVDM constants and types
  4.  *
  5.  *    Include file hierarchy:
  6.  *
  7.  *      mvdm.h
  8.  *        basemac.h
  9.  *        basedef.h
  10.  *        vdmprop.h
  11.  *        vdmm.h
  12.  *        v8086.h
  13.  *        vdos.h
  14.  *        vpic.h
  15.  *        vdmbios.h
  16.  *        vkbd.h
  17.  *        vlpt.h
  18.  *        vdma.h
  19.  *
  20.  *    By default, ALL portions of ALL include files are included (ie,
  21.  *    INCL_ALL is assumed).
  22.  *
  23.  *    To control what is included, use INCL_NONE and then select from
  24.  *    the following:
  25.  *
  26.  *        INCL_DEF
  27.  *        INCL_MI        BUGBUG 22-Feb-89 JeffPar:  NOT included by default
  28.  *        INCL_TYPES
  29.  *        INCL_MVDMTYPES
  30.  *        INCL_SSTODS
  31.  *        INCL_ROMBIOS
  32.  *        INCL_PAGE
  33.  *        INCL_VDH
  34.  *        INCL_VDHVPIC
  35.  *        INCL_VDHALL
  36.  *        INCL_VDDHELPERS
  37.  *        INCL_VDHVKBD
  38.  *        INCL_VDHVLPT
  39.  *        INCL_VDHVDMA
  40.  *
  41.  *
  42.  *    MODIFICATION HISTORY
  43.  *    10/11/88    JTP        Created.
  44.  *    12/02/88    SB        Deleted VDMINFO include.
  45.  *    12/04/88    JTP        Moved MVDM-specific definitions to here.
  46.  */
  47.  
  48.  
  49. #ifndef INCL_NONE
  50. #define INCL_DEF
  51. #define INCL_TYPES
  52. #define INCL_MVDMTYPES
  53. #define INCL_SSTODS
  54. #define INCL_ROMBIOS
  55. #define INCL_PAGE
  56. #define INCL_VDHALL
  57. #define INCL_VDDHELPERS
  58. #define INCL_VDHVKBD
  59. #define INCL_VDHVLPT
  60. #define INCL_VDHVDMA
  61. #endif
  62.  
  63. #ifdef    INCL_VDHALL        // if all VDH services, set defines
  64. #define INCL_VDH
  65. #define INCL_VDHVPIC
  66. #define INCL_VDHVKBD
  67. #define INCL_VDHVLPT
  68. #define INCL_VDHVDMA
  69. #endif
  70.  
  71. #ifdef    INCL_VDH        // VDH services require MVDM types
  72. #define INCL_MVDMTYPES
  73. #endif
  74.  
  75. #ifdef    INCL_VDHVPIC        // VDH services require MVDM types
  76. #define INCL_MVDMTYPES
  77. #endif
  78.  
  79. #ifdef    INCL_VDHVKBD        // VDH services require MVDM types
  80. #define INCL_MVDMTYPES
  81. #endif
  82.  
  83. #ifdef    INCL_VDHVLPT        // VDH services require MVDM types
  84. #define INCL_MVDMTYPES
  85. #endif
  86.  
  87. #ifdef    INCL_VDHVDMA        // VDH services require MVDM types
  88. #define INCL_MVDMTYPES
  89. #endif
  90.  
  91. #ifdef    INCL_MVDMTYPES        // MVDM types depend on basic types
  92. #define INCL_TYPES
  93. #endif
  94.  
  95. #ifdef    INCL_TYPES        // types depend on basemaca.inc macros
  96. #define INCL_DEF
  97. #endif
  98.  
  99.  
  100. /*** Required generic include files
  101.  */
  102.  
  103. //c-begin
  104. #include "basemac.h"        // macros for C
  105. //c-end
  106. //masm-begin
  107. //include basemaca.inc        // macros for MASM
  108. //masm-end
  109.  
  110. #include "basedef.h"        // basic OS/2 data types
  111. //c-begin
  112. #include "string.h"        // for str* and mem* prototypes
  113. //c-end
  114.  
  115.  
  116. /*** MVDM-specific equates (required for function prototypes)
  117.  */
  118.  
  119. #define VDHENTRY PASCAL     // to declare exported VDH services
  120. #define HOOKENTRY PASCAL     // to declare "hook" entry points
  121. #define PDDENTRY FAR32 PASCAL    // to declare PDD and VDD entry points
  122. #define VDDENTRY FAR32 PASCAL 
  123.  
  124. #define VDDInit main        // kludge to force compiler to ref. __acrtused
  125.  
  126.  
  127. /*** MVDM-specific macros
  128.  */
  129.  
  130. //c-begin
  131. #define BEGIN_GLOBAL_CODE    code_seg()
  132. #define END_GLOBAL_CODE     code_seg()
  133.  
  134. #define BEGIN_GLOBAL_DATA    data_seg()
  135. #define END_GLOBAL_DATA     data_seg()
  136.  
  137. #define BEGIN_INIT_CODE     code_seg("CINIT_TEXT", "CODE")
  138. #define END_INIT_CODE        code_seg()
  139.  
  140. #define BEGIN_INIT_DATA     data_seg("CINIT_DATA", "CINITDATA")
  141. #define END_INIT_DATA        data_seg()
  142.  
  143. #define BEGIN_INSTANCE_DATA    data_seg("MVDMINSTDATA", "MIDATA")
  144. #define END_INSTANCE_DATA    data_seg()
  145.  
  146. #define BEGIN_SWAP_CODE     code_seg("CSWAP_TEXT","CODE")
  147. #define END_SWAP_CODE        code_seg()
  148.  
  149. #define BEGIN_SWAP_DATA     data_seg("CSWAP_DATA","CSWAPDATA")
  150. #define END_SWAP_DATA        data_seg()
  151.  
  152. #define BEGIN_SWAP_INSTANCE    data_seg("SWAPINSTDATA","SIDATA")
  153. #define END_SWAP_INSTANCE    data_seg()
  154. //c-end
  155.  
  156.  
  157. #ifdef    INCL_VDDHELPERS
  158.  
  159. ULONG PRIVENTRY vdhSaveFlags(VOID);    // prototypes for helper externals
  160. VOID  PRIVENTRY vdhRestoreFlags(ULONG);
  161. VOID  PRIVENTRY vdhInt3(VOID);
  162. ULONG PRIVENTRY vdhXCHG(PULONG, ULONG);
  163. ULONG PRIVENTRY vdhBTC(PULONG, ULONG);
  164. ULONG PRIVENTRY vdhBTR(PULONG, ULONG);
  165. ULONG PRIVENTRY vdhBTS(PULONG, ULONG);
  166. ULONG PRIVENTRY vdhBSF(ULONG);
  167. ULONG PRIVENTRY vdhBSR(ULONG);
  168. VOID  PRIVENTRY vdhOutSB(PORT, PBYTE, ULONG, BOOL);
  169. PSZ   PRIVENTRY vdhFindToken(PSZ);
  170. INT   PRIVENTRY vdhCompareStr(PSZ, PSZ, BOOL);
  171. VOID  PRIVENTRY vdhMoveMem(PVOID, PVOID, INT, INT, UINT, BOOL);
  172.  
  173. //c-begin
  174. #ifdef FUNCS                // can't find easy way to allow
  175. #pragma function(inp, inpw, outp, outpw)// both intrinsics and functions -JTP
  176. #endif
  177.  
  178. #define STRTOKEN(p)      vdhFindToken(p)
  179. #define STRCOMPARE(p,q,f) vdhCompareStr(p,q,f)
  180.  
  181. #define DISABLE()    _disable()    // _disable() intrinsic fixed now
  182. #define ENABLE()    _enable()    // _enable() intrinsic fixed now
  183. #define SAVEFLAGS()    vdhSaveFlags()    // preserve flags
  184. #define RESTOREFLAGS(f)    vdhRestoreFlags(f) // restore flags
  185. #define INT3()        vdhInt3()    // execute an INT 3
  186.  
  187. #define INB(p)        ((BYTE)inp(p))
  188. #ifndef IO8BIT
  189. #define INW(p)        inpw(p)
  190. #else
  191. #define INW(p)        ((WORD)(inp(p) + (inp((p)+1)<<8)))
  192. #endif
  193.  
  194. #define OUTB(p,b)    outp(p,b)
  195. #define OUTSB(p,pb,n,f) vdhOutSB(p,pb,n,f)
  196. #ifndef IO8BIT
  197. #define OUTW(p,w)    outpw(p,w)
  198. #else
  199. #define OUTW(p,w)    (outp(p,(BYTE)(w)), outp((p)+1,(BYTE)((w)>>8)))
  200. #endif
  201. //c-end
  202.  
  203. //masm-begin
  204. //DISABLE macro              ;alias for CLI (similar to C)
  205. //      cli
  206. //      endm
  207. //
  208. //ENABLE  macro              ;alias for STI (similar to C)
  209. //      sti
  210. //      endm
  211. //
  212. //PUSHFLAGS macro          ;alias for PUSHF
  213. //      pushf
  214. //      endm
  215. //
  216. //POPFLAGS macro          ;alias for POPF
  217. //      popf
  218. //      endm
  219. //
  220. //INT3      macro           ;alias for INT 3
  221. //      int 3
  222. //      endm
  223. //
  224. //INB      macro      ral,rdx     ;alias for IN AL,DX (also supports IN AH,DX)
  225. //      ifidni  <ral>,<ah>
  226. //        xchg    al,ah
  227. //        in        al,rdx
  228. //        xchg    al,ah
  229. //      else
  230. //        in        ral,rdx
  231. //      endif
  232. //      endm
  233. //
  234. //INW      macro      rax,rdx     ;alias for IN AX,DX (provides support for IO8BIT)
  235. //      IFNDEF IO8BIT
  236. //      in      rax,rdx
  237. //      ELSE
  238. //      in      al,rdx
  239. //      xchg      al,ah
  240. //      inc      rdx
  241. //      jmp      $+2
  242. //      in      al,rdx
  243. //      xchg      al,ah
  244. //      dec      rdx
  245. //      ENDIF
  246. //      endm
  247. //
  248. //OUTB      macro      rdx,ral     ;alias for OUT DX,AL (also supports OUT DX,AH)
  249. //      ifidni  <ral>,<ah>
  250. //        xchg    al,ah
  251. //        out        rdx,al
  252. //        xchg    al,ah
  253. //      else
  254. //        out        rdx,ral
  255. //      endif
  256. //      endm
  257. //
  258. //OUTW      macro      rdx,rax     ;alias for OUT DX,AX (provides support for IO8BIT)
  259. //      IFNDEF IO8BIT
  260. //      out      rdx,rax
  261. //      ELSE
  262. //      out      rdx,al
  263. //      xchg      al,ah
  264. //      inc      rdx
  265. //      jmp      $+2
  266. //      out      rdx,al
  267. //      xchg      al,ah
  268. //      dec      rdx
  269. //      ENDIF
  270. //      endm
  271. //masm-end
  272.  
  273. #endif    // INCL_VDDHELPERS
  274.  
  275.  
  276. /*** MVDM-specific types
  277.  */
  278.  
  279. #ifdef    INCL_MVDMTYPES
  280.  
  281. typedef PVOID PVDM;        // linear pointer into VDM    /* pvdm */
  282.  
  283. typedef PBYTE PBVDM;        // same as PVDM, but often needs less casting
  284.  
  285. typedef BYTE VBREG;        // virtual byte register    /* vb */
  286.  
  287. #endif    // INCL_MVDMTYPES
  288.  
  289.  
  290. /*** MVDM-specific include files
  291.  */
  292.  
  293. #ifdef    INCL_VDH
  294. #include "vdmprop.h"        // DOS property services
  295. #include "vdmm.h"        // VDM Manager services
  296. #include "v8086.h"        // 8086 emulation services
  297. #include "vdos.h"        // DOS emulation services
  298. #endif
  299.  
  300. #ifdef    INCL_VDHVPIC
  301. #include "vpic.h"        // VPIC services
  302. #endif
  303.  
  304. #ifdef    INCL_VDHVKBD
  305. #include "vkbd.h"        // VKBD services
  306. #endif
  307.  
  308. #ifdef    INCL_VDHVLPT
  309. #include "vlpt.h"        // VLPT services
  310. #endif
  311.  
  312. #ifdef    INCL_VDHVDMA
  313. #include "vdma.h"        // VDMA services
  314. #endif
  315.  
  316. #ifdef    INCL_ROMBIOS        // ROM BIOS Data Area definitions
  317. #include "vdmbios.h"
  318. #endif
  319.  
  320. #ifdef    INCL_MI         // machine instructions
  321. typedef UCHAR  uchar_t;     // BUGBUG 22-Feb-89 JeffPar:
  322. typedef USHORT ushort_t;    //  MI.H needs to be fixed!!!
  323. typedef ULONG  ulong_t;
  324.  
  325. #include "mi.h"
  326. #endif
  327.