1 /*##########################################################################
2 
3     atarirle.h
4 
5     Common RLE-based motion object management functions for early 90's
6     Atari raster games.
7 
8 ##########################################################################*/
9 
10 #ifndef __ATARIRLE__
11 #define __ATARIRLE__
12 
13 
14 /*##########################################################################
15     CONSTANTS
16 ##########################################################################*/
17 
18 /* maximum number of motion object processors */
19 #define ATARIRLE_MAX				1
20 
21 #define ATARIRLE_PRIORITY_SHIFT		12
22 #define ATARIRLE_BANK_SHIFT			15
23 #define ATARIRLE_PRIORITY_MASK		((~0 << ATARIRLE_PRIORITY_SHIFT) & 0xffff)
24 #define ATARIRLE_DATA_MASK			(ATARIRLE_PRIORITY_MASK ^ 0xffff)
25 
26 #define ATARIRLE_CONTROL_MOGO		1
27 #define ATARIRLE_CONTROL_ERASE		2
28 #define ATARIRLE_CONTROL_FRAME		4
29 
30 #define ATARIRLE_COMMAND_NOP		0
31 #define ATARIRLE_COMMAND_DRAW		1
32 #define ATARIRLE_COMMAND_CHECKSUM	2
33 
34 
35 /*##########################################################################
36     TYPES & STRUCTURES
37 ##########################################################################*/
38 
39 /* description for an eight-word mask */
40 struct atarirle_entry
41 {
42 	UINT16			data[8];
43 };
44 
45 /* description of the motion objects */
46 struct atarirle_desc
47 {
48 	UINT8				region;				/* region where the GFX data lives */
49 	UINT16				spriteramentries;	/* number of entries in sprite RAM */
50 	UINT16				leftclip;			/* left clip coordinate */
51 	UINT16				rightclip;			/* right clip coordinate */
52 
53 	UINT16				palettebase;		/* base palette entry */
54 	UINT16				maxcolors;			/* maximum number of colors */
55 
56 	struct atarirle_entry codemask;			/* mask for the code index */
57 	struct atarirle_entry colormask;		/* mask for the color */
58 	struct atarirle_entry xposmask;			/* mask for the X position */
59 	struct atarirle_entry yposmask;			/* mask for the Y position */
60 	struct atarirle_entry scalemask;		/* mask for the scale factor */
61 	struct atarirle_entry hflipmask;		/* mask for the horizontal flip */
62 	struct atarirle_entry ordermask;		/* mask for the order */
63 	struct atarirle_entry prioritymask;		/* mask for the priority */
64 	struct atarirle_entry vrammask;			/* mask for the VRAM target */
65 };
66 
67 
68 
69 /*##########################################################################
70     FUNCTION PROTOTYPES
71 ##########################################################################*/
72 
73 /* setup/shutdown */
74 int atarirle_init(int map, const struct atarirle_desc *desc, UINT8 *rombase, INT32 romsize);
75 void atarirle_exit();
76 INT32 atarirle_scan(INT32 nAction, INT32 *pnMin);
77 
78 /* control handlers */
79 void atarirle_control_w(int map, UINT8 bits, INT32 scanline);
80 void atarirle_command_w(int map, UINT8 command);
81 void atarirle_eof();
82 
83 /* write handlers */
84 //WRITE16_HANDLER( atarirle_0_spriteram_w );
85 // write to atarirle_0_spriteram first!!!!!!
86 void atarirle_0_spriteram_w(UINT32 offset);
87 //WRITE32_HANDLER( atarirle_0_spriteram32_w );
88 
89 /* render helpers */
90 UINT16 *atarirle_get_vram(int map, int idx);
91 
92 
93 
94 /*##########################################################################
95     GLOBAL VARIABLES
96 ##########################################################################*/
97 
98 extern UINT16 *atarirle_0_spriteram;
99 extern UINT32 *atarirle_0_spriteram32;
100 
101 #endif
102