home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************
- * spr_low.c
- *
- * The hardware dependent parts of the sprite support.
- *
- * The dependent parts, like the screen segment address, address
- * calculation and increment address to next scan line are defined
- * as macros and then the independent skeleton is included. This
- * is repeated for each display type.
- *
- * If you add new display types, you might have to define new
- * macros (for example to change color map). Be sure to define
- * something reasonable for the existing displays types, too.
- *
- **********************************************************************
- This file is part of
-
- STK -- The sprite toolkit -- version 1.0
-
- Copyright (C) Jari Karjala 1990
-
- The sprite toolkit (STK) is a FreeWare toolkit for creating high
- resolution sprite graphics with PCompatible hardware. This toolkit
- is provided as is without any warranty or such thing. See the file
- COPYING for further information.
-
- **********************************************************************/
-
- /** Tell compiler to use assembler immediately if assembler version **/
- #ifndef C_VER
- #pragma inline
- #endif
-
- #include <dos.h>
-
- #include "grtypes.h"
-
- /** The version information. Do not modify it! **/
- char *spr_version = "STK version 1.0 Copyright (C) Jari Karjala 1990";
-
- /**********************************************************************
- * Define hardware dependent macros for Hercules graphics card
- **********************************************************************/
-
- /**********************************************************************
- * Increment the given address to the next scanline - w (sprite width).
- **********************************************************************/
- #define NEXT_SCAN_LINE(adr,w) \
- (WORD)adr += 0x2000-w; \
- if ((int)adr<0) (WORD)adr -= 0x8000-90;
-
- /**********************************************************************
- * Increment the given address to the next scanline.
- * No width fixup needed in the assembler version.
- **********************************************************************/
- #define ASM_NEXT_SCAN_LINE(reg) \
- asm add reg, 0x2000; \
- asm jns NO_FIX; \
- asm sub reg, 0x8000-90; \
- NO_FIX:
-
- /**********************************************************************
- * Return offset to the byte at x,y in the screen buffer.
- **********************************************************************/
- #define SCR_OFS(x,y) (((y&3)<<13) + (y>>2)*90 + (x>>3))
-
- /**********************************************************************
- * Screen segment.
- **********************************************************************/
- #define SCR_SEG 0xB000
-
- /**********************************************************************
- * The segment difference to the start of the second page
- **********************************************************************/
- #define SCR_PAGE_2_SEG 0x800
-
- #define ADDR spr_low_herc_addr
- #define PUT spr_low_herc_put
- #define ERASE spr_low_herc_erase
-
- /***** Include the skeletons for the functions *****/
- #include "spr_low.def"
-
-
-
- /**********************************************************************
- * Define hardware dependent macros for EGA graphics card in B/W mode
- **********************************************************************/
-
- /**********************************************************************
- * Increment the given address to the next scanline - w (sprite width).
- **********************************************************************/
- #define NEXT_SCAN_LINE(adr,w) (WORD)adr += 80-w;
-
- /**********************************************************************
- * Increment the given address to the next scanline.
- * No width fixup needed in the assembler version.
- **********************************************************************/
- #define ASM_NEXT_SCAN_LINE(reg) asm add reg, 80;
-
-
- /**********************************************************************
- * Return offset to the byte at x,y in the screen buffer.
- **********************************************************************/
- #define SCR_OFS(x,y) ((y*80) + (x>>3))
-
- /**********************************************************************
- * Screen segment.
- **********************************************************************/
- #define SCR_SEG 0xA000
-
- /**********************************************************************
- * The segment difference to the start of the second page
- **********************************************************************/
- #define SCR_PAGE_2_SEG 0x800
-
- #define ADDR spr_low_ega_mono_addr
- #define PUT spr_low_ega_mono_put
- #define ERASE spr_low_ega_mono_erase
-
- /***** Include the skeletons for the functions *****/
- #include "spr_low.def"
-
-