home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / GRAPHICS / MISC / STK100.ZIP / STKSRC.COM / SPR_LOW.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-10-20  |  4.8 KB  |  124 lines

  1. /**********************************************************************
  2. * spr_low.c
  3. *
  4. * The hardware dependent parts of the sprite support. 
  5. *
  6. * The dependent parts, like the screen segment address, address 
  7. * calculation and increment address to next scan line are defined
  8. * as macros and then the independent skeleton is included. This
  9. * is repeated for each display type.
  10. *
  11. * If you add new display types, you might have to define new
  12. * macros (for example to change color map). Be sure to define
  13. * something reasonable for the existing displays types, too.
  14. *
  15. **********************************************************************
  16.                     This file is part of
  17.  
  18.           STK -- The sprite toolkit -- version 1.0
  19.  
  20.               Copyright (C) Jari Karjala 1990
  21.  
  22. The sprite toolkit (STK) is a FreeWare toolkit for creating high
  23. resolution sprite graphics with PCompatible hardware. This toolkit 
  24. is provided as is without any warranty or such thing. See the file
  25. COPYING for further information.
  26.  
  27. **********************************************************************/
  28.  
  29. /** Tell compiler to use assembler immediately if assembler version **/
  30. #ifndef C_VER
  31. #pragma inline
  32. #endif
  33.  
  34. #include <dos.h>
  35.  
  36. #include "grtypes.h"
  37.  
  38. /** The version information. Do not modify it! **/
  39. char *spr_version = "STK version 1.0  Copyright (C) Jari Karjala 1990";
  40.  
  41. /**********************************************************************
  42. * Define hardware dependent macros for Hercules graphics card 
  43. **********************************************************************/
  44.  
  45. /**********************************************************************
  46. * Increment the given address to the next scanline - w (sprite width). 
  47. **********************************************************************/
  48. #define NEXT_SCAN_LINE(adr,w) \
  49.         (WORD)adr += 0x2000-w;      \
  50.         if ((int)adr<0) (WORD)adr -= 0x8000-90;
  51.  
  52. /**********************************************************************
  53. * Increment the given address to the next scanline.
  54. * No width fixup needed in the assembler version.
  55. **********************************************************************/
  56. #define ASM_NEXT_SCAN_LINE(reg)     \
  57.         asm add  reg, 0x2000;       \
  58.         asm jns  NO_FIX;            \
  59.         asm sub  reg, 0x8000-90;    \
  60.         NO_FIX:
  61.  
  62. /**********************************************************************
  63. * Return offset to the byte at x,y in the screen buffer.
  64. **********************************************************************/
  65. #define SCR_OFS(x,y) (((y&3)<<13) + (y>>2)*90 + (x>>3))
  66.  
  67. /**********************************************************************
  68. * Screen segment.
  69. **********************************************************************/
  70. #define SCR_SEG 0xB000
  71.  
  72. /**********************************************************************
  73. * The segment difference to the start of the second page
  74. **********************************************************************/
  75. #define SCR_PAGE_2_SEG 0x800
  76.  
  77. #define ADDR spr_low_herc_addr
  78. #define PUT spr_low_herc_put
  79. #define ERASE spr_low_herc_erase
  80.  
  81. /***** Include the skeletons for the functions *****/
  82. #include "spr_low.def"
  83.  
  84.  
  85.  
  86. /**********************************************************************
  87. * Define hardware dependent macros for EGA graphics card in B/W mode
  88. **********************************************************************/
  89.  
  90. /**********************************************************************
  91. * Increment the given address to the next scanline - w (sprite width). 
  92. **********************************************************************/
  93. #define NEXT_SCAN_LINE(adr,w)       (WORD)adr += 80-w;
  94.  
  95. /**********************************************************************
  96. * Increment the given address to the next scanline.
  97. * No width fixup needed in the assembler version.
  98. **********************************************************************/
  99. #define ASM_NEXT_SCAN_LINE(reg)     asm add  reg, 80;
  100.  
  101.  
  102. /**********************************************************************
  103. * Return offset to the byte at x,y in the screen buffer.
  104. **********************************************************************/
  105. #define SCR_OFS(x,y) ((y*80) + (x>>3))
  106.  
  107. /**********************************************************************
  108. * Screen segment.
  109. **********************************************************************/
  110. #define SCR_SEG 0xA000
  111.  
  112. /**********************************************************************
  113. * The segment difference to the start of the second page
  114. **********************************************************************/
  115. #define SCR_PAGE_2_SEG 0x800
  116.  
  117. #define ADDR spr_low_ega_mono_addr
  118. #define PUT spr_low_ega_mono_put
  119. #define ERASE spr_low_ega_mono_erase
  120.  
  121. /***** Include the skeletons for the functions *****/
  122. #include "spr_low.def"
  123.  
  124.