/**********************************************************************
* hercules.def
*
* The hardware dependent parts of the sprite support for HERCULES
*
* The dependent parts, like the screen segment address, address 
* calculation and increment address to next scan line are defined
* as macros.
*
* 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.1

              Copyright (C) Jari Karjala 1991

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.

**********************************************************************/


/**********************************************************************
* 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

