mirror of
https://github.com/cc65/cc65.git
synced 2025-01-09 11:30:29 +00:00
Added an improved definition of the __vic2 structure using anon
structs/unions. For compatibility reasons the new definition is active only in cc65 mode. git-svn-id: svn://svn.cc65.org/cc65/trunk@5619 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
63328d3852
commit
c09d6a7299
202
include/_vic2.h
202
include/_vic2.h
@ -1,15 +1,15 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* _vic2.h */
|
||||
/* _vic2.h */
|
||||
/* */
|
||||
/* Internal include file, do not use directly */
|
||||
/* Internal include file, do not use directly */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2000 Ullrich von Bassewitz */
|
||||
/* Wacholderweg 14 */
|
||||
/* D-70597 Stuttgart */
|
||||
/* EMail: uz@musoftware.de */
|
||||
/* (C) 1998-2012, Ullrich von Bassewitz */
|
||||
/* Roemerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided 'as-is', without any expressed or implied */
|
||||
@ -38,60 +38,150 @@
|
||||
|
||||
|
||||
|
||||
/* Define a structure with the vic register offsets */
|
||||
/* Define a structure with the vic register offsets. In cc65 mode, there
|
||||
* are aliases for the field accessible as arrays.
|
||||
*/
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
struct __vic2 {
|
||||
unsigned char spr0_x; /* Sprite 0, X coordinate */
|
||||
unsigned char spr0_y; /* Sprite 0, Y coordinate */
|
||||
unsigned char spr1_x; /* Sprite 1, X coordinate */
|
||||
unsigned char spr1_y; /* Sprite 1, Y coordinate */
|
||||
unsigned char spr2_x; /* Sprite 2, X coordinate */
|
||||
unsigned char spr2_y; /* Sprite 2, Y coordinate */
|
||||
unsigned char spr3_x; /* Sprite 3, X coordinate */
|
||||
unsigned char spr3_y; /* Sprite 3, Y coordinate */
|
||||
unsigned char spr4_x; /* Sprite 4, X coordinate */
|
||||
unsigned char spr4_y; /* Sprite 4, Y coordinate */
|
||||
unsigned char spr5_x; /* Sprite 5, X coordinate */
|
||||
unsigned char spr5_y; /* Sprite 5, Y coordinate */
|
||||
unsigned char spr6_x; /* Sprite 6, X coordinate */
|
||||
unsigned char spr6_y; /* Sprite 6, Y coordinate */
|
||||
unsigned char spr7_x; /* Sprite 7, X coordinate */
|
||||
unsigned char spr7_y; /* Sprite 7, Y coordinate */
|
||||
unsigned char spr_hi_x; /* High bits of X coordinate */
|
||||
unsigned char ctrl1; /* Control register 1 */
|
||||
unsigned char rasterline; /* Current raster line */
|
||||
unsigned char strobe_x; /* Light pen, X position */
|
||||
unsigned char strobe_y; /* Light pen, Y position */
|
||||
unsigned char spr_ena; /* Enable sprites */
|
||||
unsigned char ctrl2; /* Control register 2 */
|
||||
unsigned char spr_exp_y; /* Expand sprites in Y dir */
|
||||
unsigned char addr; /* Address of chargen and video ram */
|
||||
unsigned char irr; /* Interrupt request register */
|
||||
unsigned char imr; /* Interrupt mask register */
|
||||
unsigned char spr_bg_prio; /* Priority to background */
|
||||
unsigned char spr_mcolor; /* Sprite multicolor bits */
|
||||
unsigned char spr_exp_x; /* Expand sprites in X dir */
|
||||
unsigned char spr_coll; /* Sprite/sprite collision reg */
|
||||
unsigned char spr_bg_coll; /* Sprite/background collision reg */
|
||||
unsigned char bordercolor; /* Border color */
|
||||
unsigned char bgcolor0; /* Background color 0 */
|
||||
unsigned char bgcolor1; /* Background color 1 */
|
||||
unsigned char bgcolor2; /* Background color 2 */
|
||||
unsigned char bgcolor3; /* Background color 3 */
|
||||
unsigned char spr_mcolor0; /* Color 0 for multicolor sprites */
|
||||
unsigned char spr_mcolor1; /* Color 1 for multicolor sprites */
|
||||
unsigned char spr0_color; /* Color sprite 0 */
|
||||
unsigned char spr1_color; /* Color sprite 1 */
|
||||
unsigned char spr2_color; /* Color sprite 2 */
|
||||
unsigned char spr3_color; /* Color sprite 3 */
|
||||
unsigned char spr4_color; /* Color sprite 4 */
|
||||
unsigned char spr5_color; /* Color sprite 5 */
|
||||
unsigned char spr6_color; /* Color sprite 6 */
|
||||
unsigned char spr7_color; /* Color sprite 7 */
|
||||
union {
|
||||
struct {
|
||||
unsigned char spr0_x; /* Sprite 0, X coordinate */
|
||||
unsigned char spr0_y; /* Sprite 0, Y coordinate */
|
||||
unsigned char spr1_x; /* Sprite 1, X coordinate */
|
||||
unsigned char spr1_y; /* Sprite 1, Y coordinate */
|
||||
unsigned char spr2_x; /* Sprite 2, X coordinate */
|
||||
unsigned char spr2_y; /* Sprite 2, Y coordinate */
|
||||
unsigned char spr3_x; /* Sprite 3, X coordinate */
|
||||
unsigned char spr3_y; /* Sprite 3, Y coordinate */
|
||||
unsigned char spr4_x; /* Sprite 4, X coordinate */
|
||||
unsigned char spr4_y; /* Sprite 4, Y coordinate */
|
||||
unsigned char spr5_x; /* Sprite 5, X coordinate */
|
||||
unsigned char spr5_y; /* Sprite 5, Y coordinate */
|
||||
unsigned char spr6_x; /* Sprite 6, X coordinate */
|
||||
unsigned char spr6_y; /* Sprite 6, Y coordinate */
|
||||
unsigned char spr7_x; /* Sprite 7, X coordinate */
|
||||
unsigned char spr7_y; /* Sprite 7, Y coordinate */
|
||||
};
|
||||
struct {
|
||||
unsigned char x; /* X coordinate */
|
||||
unsigned char y; /* Y coordinate */
|
||||
} spr_pos[8];
|
||||
};
|
||||
unsigned char spr_hi_x; /* High bits of X coordinate */
|
||||
unsigned char ctrl1; /* Control register 1 */
|
||||
unsigned char rasterline; /* Current raster line */
|
||||
union {
|
||||
struct {
|
||||
unsigned char strobe_x; /* Light pen, X position */
|
||||
unsigned char strobe_y; /* Light pen, Y position */
|
||||
};
|
||||
struct {
|
||||
unsigned char x; /* Light pen, X position */
|
||||
unsigned char y; /* Light pen, Y position */
|
||||
} strobe;
|
||||
};
|
||||
unsigned char spr_ena; /* Enable sprites */
|
||||
unsigned char ctrl2; /* Control register 2 */
|
||||
unsigned char spr_exp_y; /* Expand sprites in Y dir */
|
||||
unsigned char addr; /* Address of chargen and video ram */
|
||||
unsigned char irr; /* Interrupt request register */
|
||||
unsigned char imr; /* Interrupt mask register */
|
||||
unsigned char spr_bg_prio; /* Priority to background */
|
||||
unsigned char spr_mcolor; /* Sprite multicolor bits */
|
||||
unsigned char spr_exp_x; /* Expand sprites in X dir */
|
||||
unsigned char spr_coll; /* Sprite/sprite collision reg */
|
||||
unsigned char spr_bg_coll; /* Sprite/background collision reg */
|
||||
unsigned char bordercolor; /* Border color */
|
||||
union {
|
||||
struct {
|
||||
unsigned char bgcolor0; /* Background color 0 */
|
||||
unsigned char bgcolor1; /* Background color 1 */
|
||||
unsigned char bgcolor2; /* Background color 2 */
|
||||
unsigned char bgcolor3; /* Background color 3 */
|
||||
};
|
||||
unsigned char bgcolor[4]; /* Background colors */
|
||||
};
|
||||
union {
|
||||
struct {
|
||||
unsigned char spr_mcolor0; /* Color 0 for multicolor sprites */
|
||||
unsigned char spr_mcolor1; /* Color 1 for multicolor sprites */
|
||||
};
|
||||
/* spr_color is already used ... */
|
||||
unsigned char spr_mcolors[2]; /* Color for multicolor sprites */
|
||||
};
|
||||
union {
|
||||
struct {
|
||||
unsigned char spr0_color; /* Color sprite 0 */
|
||||
unsigned char spr1_color; /* Color sprite 1 */
|
||||
unsigned char spr2_color; /* Color sprite 2 */
|
||||
unsigned char spr3_color; /* Color sprite 3 */
|
||||
unsigned char spr4_color; /* Color sprite 4 */
|
||||
unsigned char spr5_color; /* Color sprite 5 */
|
||||
unsigned char spr6_color; /* Color sprite 6 */
|
||||
unsigned char spr7_color; /* Color sprite 7 */
|
||||
};
|
||||
unsigned char spr_color[8]; /* Colors for the sprites */
|
||||
};
|
||||
|
||||
/* The following ones are only valid in the C128: */
|
||||
unsigned char x_kbd; /* Additional keyboard lines */
|
||||
unsigned char clock; /* Clock switch bit */
|
||||
unsigned char x_kbd; /* Additional keyboard lines */
|
||||
unsigned char clock; /* Clock switch bit */
|
||||
};
|
||||
#else
|
||||
struct __vic2 {
|
||||
unsigned char spr0_x; /* Sprite 0, X coordinate */
|
||||
unsigned char spr0_y; /* Sprite 0, Y coordinate */
|
||||
unsigned char spr1_x; /* Sprite 1, X coordinate */
|
||||
unsigned char spr1_y; /* Sprite 1, Y coordinate */
|
||||
unsigned char spr2_x; /* Sprite 2, X coordinate */
|
||||
unsigned char spr2_y; /* Sprite 2, Y coordinate */
|
||||
unsigned char spr3_x; /* Sprite 3, X coordinate */
|
||||
unsigned char spr3_y; /* Sprite 3, Y coordinate */
|
||||
unsigned char spr4_x; /* Sprite 4, X coordinate */
|
||||
unsigned char spr4_y; /* Sprite 4, Y coordinate */
|
||||
unsigned char spr5_x; /* Sprite 5, X coordinate */
|
||||
unsigned char spr5_y; /* Sprite 5, Y coordinate */
|
||||
unsigned char spr6_x; /* Sprite 6, X coordinate */
|
||||
unsigned char spr6_y; /* Sprite 6, Y coordinate */
|
||||
unsigned char spr7_x; /* Sprite 7, X coordinate */
|
||||
unsigned char spr7_y; /* Sprite 7, Y coordinate */
|
||||
unsigned char spr_hi_x; /* High bits of X coordinate */
|
||||
unsigned char ctrl1; /* Control register 1 */
|
||||
unsigned char rasterline; /* Current raster line */
|
||||
unsigned char strobe_x; /* Light pen, X position */
|
||||
unsigned char strobe_y; /* Light pen, Y position */
|
||||
unsigned char spr_ena; /* Enable sprites */
|
||||
unsigned char ctrl2; /* Control register 2 */
|
||||
unsigned char spr_exp_y; /* Expand sprites in Y dir */
|
||||
unsigned char addr; /* Address of chargen and video ram */
|
||||
unsigned char irr; /* Interrupt request register */
|
||||
unsigned char imr; /* Interrupt mask register */
|
||||
unsigned char spr_bg_prio; /* Priority to background */
|
||||
unsigned char spr_mcolor; /* Sprite multicolor bits */
|
||||
unsigned char spr_exp_x; /* Expand sprites in X dir */
|
||||
unsigned char spr_coll; /* Sprite/sprite collision reg */
|
||||
unsigned char spr_bg_coll; /* Sprite/background collision reg */
|
||||
unsigned char bordercolor; /* Border color */
|
||||
unsigned char bgcolor0; /* Background color 0 */
|
||||
unsigned char bgcolor1; /* Background color 1 */
|
||||
unsigned char bgcolor2; /* Background color 2 */
|
||||
unsigned char bgcolor3; /* Background color 3 */
|
||||
unsigned char spr_mcolor0; /* Color 0 for multicolor sprites */
|
||||
unsigned char spr_mcolor1; /* Color 1 for multicolor sprites */
|
||||
unsigned char spr0_color; /* Color sprite 0 */
|
||||
unsigned char spr1_color; /* Color sprite 1 */
|
||||
unsigned char spr2_color; /* Color sprite 2 */
|
||||
unsigned char spr3_color; /* Color sprite 3 */
|
||||
unsigned char spr4_color; /* Color sprite 4 */
|
||||
unsigned char spr5_color; /* Color sprite 5 */
|
||||
unsigned char spr6_color; /* Color sprite 6 */
|
||||
unsigned char spr7_color; /* Color sprite 7 */
|
||||
|
||||
/* The following ones are only valid in the C128: */
|
||||
unsigned char x_kbd; /* Additional keyboard lines */
|
||||
unsigned char clock; /* Clock switch bit */
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user