JIMLIB.H 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #ifndef _JIMLIB_H
  2. #define _JIMLIB_H
  3. // Structure for holding the palette
  4. typedef struct
  5. {
  6. unsigned char r; // RGB values for palette
  7. unsigned char g; // From 0 to 63
  8. unsigned char b; // (Or 256 from DPaint)
  9. } rgb;
  10. // Structure used for real mode interrupts
  11. struct rminfo
  12. {
  13. long EDI;
  14. long ESI;
  15. long EBP;
  16. long reserved;
  17. long EBX;
  18. long EDX;
  19. long ECX;
  20. long EAX;
  21. short flags;
  22. short ES,DS,FS,GS,IP,CS,SP,SS;
  23. };
  24. // Structure for holding mouse status
  25. typedef struct
  26. {
  27. short x,y,b;
  28. } mouse_struct;
  29. typedef unsigned char u_char;
  30. typedef unsigned short u_short;
  31. typedef unsigned long u_long;
  32. // Prototypes for functions within jimlib.asm
  33. void UpdatePalette(rgb *Buffer);
  34. void SetPalette(unsigned char reg, unsigned char r, unsigned char g, unsigned char b);
  35. unsigned short SetVideoMode(unsigned short mode);
  36. unsigned short SSetVideoMode(unsigned short mode);
  37. void SSetVideoBank(unsigned short mode);
  38. void SSetVideoBankR(unsigned short mode);
  39. void WaitVBlank(void);
  40. void ClearVBanks(unsigned char banks);
  41. unsigned short MouseClick(void);
  42. void LongCopy(unsigned char *, unsigned char *, unsigned short);
  43. void LongSet(unsigned char *, unsigned long, unsigned length);
  44. #include "E:\jimlib\jimfunc.h"
  45. // DOS Text attributes
  46. #define DOS_BLINK 128
  47. #define DOS_INVERSE 119
  48. #define DOS_BRIGHT 8
  49. #define DOS_UNDERLINE 1
  50. typedef enum
  51. {
  52. DOS_BLACK,
  53. DOS_BLUE,
  54. DOS_GREEN,
  55. DOS_CYAN,
  56. DOS_RED,
  57. DOS_MAGENTA,
  58. DOS_BROWN,
  59. DOS_WHITE,
  60. DOS_GREY,
  61. DOS_LT_BLUE,
  62. DOS_LT_GREEN,
  63. DOS_LT_CYAN,
  64. DOS_LT_RED,
  65. DOS_LT_MAGENTA,
  66. DOS_YELLOW,
  67. DOS_BRIGHT_WHITE
  68. } dos_colours;
  69. // Some useful macros
  70. #define SCROLL_UP 6
  71. #define SCROLL_DOWN 7
  72. #define limitRange(x,l,u) x=((x)<(l))?(l):((x)>(u))?(u):(x)
  73. #define diff(x1,x2) (((x1)>(x2))?((x1)-(x2)):((x2)-(x1)))
  74. #define JIM_SEG(_ptr) (((int)(_ptr))>>4)
  75. #define JIM_OFF(_ptr) (((int)(_ptr))&0xF)
  76. #define JIM_PTR(_seg,_off) ((((int)(_seg))<<4)+((int)(_off)))
  77. #define clear(x) memset(&x,0,sizeof(x))
  78. #define save_cursor() cursor_position_routine(0)
  79. #define restore_cursor() cursor_position_routine(1)
  80. #define WORD68(x) ( ((x&0x00ff)<<8) + (x>>8) )
  81. #define LONG68(x) ( ((x&0x000000ff)<<24) + ((x&0x0000ff00)<<8)+((x&0x00ff0000)>>8)+(x>>24))
  82. // ADPCM stuff for playstation
  83. #define SUB_FORM1 (0)
  84. #define SUB_FORM2 (1<<5)
  85. #define SUB_AUDIO (1<<2)
  86. #define SUB_DATA (1<<3)
  87. #define SUB_RT (1<<6)
  88. #define SUB_EOF (1<<7 | 1<<0)
  89. #define SUB_STEREO (1<<0)
  90. #define SUB_ADPCMC (1<<2)
  91. #ifndef VGA_SCREEN
  92. #define VGA_SCREEN ((unsigned char *)0xa0000)
  93. #endif
  94. #define DOS_SCREEN ((unsigned short *)0xb8000)
  95. #endif /* _JIMLIB_H */
  96.