home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / header45.zip / mvdm.h < prev    next >
C/C++ Source or Header  |  1999-03-15  |  9KB  |  356 lines

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