DPMI.H 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  3. SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
  4. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  5. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  6. IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  7. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  8. FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  9. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
  10. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  11. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
  12. */
  13. /*
  14. * $Source: f:/miner/source/bios/rcs/dpmi.h $
  15. * $Revision: 1.9 $
  16. * $Author: john $
  17. * $Date: 1995/01/14 19:20:14 $
  18. *
  19. * Prototypes for DPMI services.
  20. *
  21. * $Log: dpmi.h $
  22. * Revision 1.9 1995/01/14 19:20:14 john
  23. * Added function to set a selector's base address.
  24. *
  25. * Revision 1.8 1994/11/28 20:22:03 john
  26. * Added some variables that return the amount of available
  27. * memory.
  28. *
  29. * Revision 1.7 1994/11/15 18:26:38 john
  30. * Added verbose flag.
  31. *
  32. * Revision 1.6 1994/11/07 11:35:05 john
  33. * Added prototype for real_free
  34. *
  35. * Revision 1.5 1994/10/27 19:54:48 john
  36. * Added unlock region function,.
  37. *
  38. * Revision 1.4 1994/09/27 18:27:56 john
  39. * Added pragma to make inp,outp,enable,disable intrinsic
  40. *
  41. * Revision 1.3 1994/09/27 11:54:45 john
  42. * Added DPMI init function.
  43. *
  44. * Revision 1.2 1994/08/24 18:53:51 john
  45. * Made Cyberman read like normal mouse; added dpmi module; moved
  46. * mouse from assembly to c. Made mouse buttons return time_down.
  47. *
  48. * Revision 1.1 1994/08/24 10:22:48 john
  49. * Initial revision
  50. *
  51. *
  52. */
  53. #ifndef _DPMI_H
  54. #define _DPMI_H
  55. #include "types.h"
  56. typedef struct dpmi_real_regs {
  57. uint edi;
  58. uint esi;
  59. uint ebp;
  60. uint reserved_by_system;
  61. uint ebx;
  62. uint edx;
  63. uint ecx;
  64. uint eax;
  65. ushort flags;
  66. ushort es,ds,fs,gs,ip,cs,sp,ss;
  67. } dpmi_real_regs;
  68. #pragma intrinsic( inp );
  69. #pragma intrinsic( outp );
  70. #pragma intrinsic( _enable );
  71. #pragma intrinsic( _disable );
  72. #define DPMI_real_segment(P) ((((uint) (P)) >> 4) & 0xFFFF)
  73. #define DPMI_real_offset(P) (((uint) (P)) & 0xF)
  74. // Initializes dpmi. Returns zero if failed.
  75. extern int dpmi_init(int verbose);
  76. // Returns a pointer to a temporary dos memory block. Size must be < 1024 bytes.
  77. extern void *dpmi_get_temp_low_buffer( int size );
  78. extern void *dpmi_real_malloc( int size, ushort *selector );
  79. extern void dpmi_real_free( ushort selector );
  80. extern void dpmi_real_int386x( ubyte intno, dpmi_real_regs * rregs );
  81. extern void dpmi_real_call(dpmi_real_regs * rregs);
  82. extern int dpmi_lock_region(void *address, unsigned length);
  83. extern int dpmi_unlock_region(void *address, unsigned length);
  84. // returns 0 if failed...
  85. extern int dpmi_allocate_selector( void * address, int size, ushort * selector );
  86. extern int dpmi_modify_selector_base( ushort selector, void * address );
  87. extern int dpmi_modify_selector_limit( ushort selector, int size );
  88. // Sets the PM handler. Returns 0 if succssful
  89. extern int dpmi_set_pm_handler(unsigned intnum, void far * isr );
  90. extern unsigned int dpmi_virtual_memory;
  91. extern unsigned int dpmi_available_memory;
  92. extern unsigned int dpmi_physical_memory;
  93. extern unsigned int dpmi_dos_memory;
  94. #endif
  95.