dosisms.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. //
  16. // dosisms.h: I'd call it dos.h, but the name's taken
  17. //
  18. #ifndef _DOSISMS_H_
  19. #define _DOSISMS_H_
  20. int dos_lockmem(void *addr, int size);
  21. int dos_unlockmem(void *addr, int size);
  22. typedef union {
  23. struct {
  24. unsigned long edi;
  25. unsigned long esi;
  26. unsigned long ebp;
  27. unsigned long res;
  28. unsigned long ebx;
  29. unsigned long edx;
  30. unsigned long ecx;
  31. unsigned long eax;
  32. } d;
  33. struct {
  34. unsigned short di, di_hi;
  35. unsigned short si, si_hi;
  36. unsigned short bp, bp_hi;
  37. unsigned short res, res_hi;
  38. unsigned short bx, bx_hi;
  39. unsigned short dx, dx_hi;
  40. unsigned short cx, cx_hi;
  41. unsigned short ax, ax_hi;
  42. unsigned short flags;
  43. unsigned short es;
  44. unsigned short ds;
  45. unsigned short fs;
  46. unsigned short gs;
  47. unsigned short ip;
  48. unsigned short cs;
  49. unsigned short sp;
  50. unsigned short ss;
  51. } x;
  52. struct {
  53. unsigned char edi[4];
  54. unsigned char esi[4];
  55. unsigned char ebp[4];
  56. unsigned char res[4];
  57. unsigned char bl, bh, ebx_b2, ebx_b3;
  58. unsigned char dl, dh, edx_b2, edx_b3;
  59. unsigned char cl, ch, ecx_b2, ecx_b3;
  60. unsigned char al, ah, eax_b2, eax_b3;
  61. } h;
  62. } regs_t;
  63. unsigned int ptr2real(void *ptr);
  64. void *real2ptr(unsigned int real);
  65. void *far2ptr(unsigned int farptr);
  66. unsigned int ptr2far(void *ptr);
  67. int dos_inportb(int port);
  68. int dos_inportw(int port);
  69. void dos_outportb(int port, int val);
  70. void dos_outportw(int port, int val);
  71. void dos_irqenable(void);
  72. void dos_irqdisable(void);
  73. void dos_registerintr(int intr, void (*handler)(void));
  74. void dos_restoreintr(int intr);
  75. int dos_int86(int vec);
  76. void *dos_getmemory(int size);
  77. void dos_freememory(void *ptr);
  78. void dos_usleep(int usecs);
  79. int dos_getheapsize(void);
  80. extern regs_t regs;
  81. #endif // _DOSISMS_H_