1 /***************************************************************************
2 
3 	Atari Arcade Classics hardware (prototypes)
4 
5 	Note: this video hardware has some similarities to Shuuz & company
6 	The sprite offset registers are stored to 3EFF80
7 
8 ****************************************************************************/
9 
10 
11 #include "driver.h"
12 #include "machine/atarigen.h"
13 #include "arcadecl.h"
14 
15 
16 
17 /*************************************
18  *
19  *	Statics
20  *
21  *************************************/
22 
23 static UINT8 has_mo;
24 
25 
26 
27 /*************************************
28  *
29  *	Video system start
30  *
31  *************************************/
32 
VIDEO_START(arcadecl)33 VIDEO_START( arcadecl )
34 {
35 	static const struct atarimo_desc modesc =
36 	{
37 		0,					/* index to which gfx system */
38 		1,					/* number of motion object banks */
39 		1,					/* are the entries linked? */
40 		0,					/* are the entries split? */
41 		0,					/* render in reverse order? */
42 		0,					/* render in swapped X/Y order? */
43 		0,					/* does the neighbor bit affect the next object? */
44 		0,					/* pixels per SLIP entry (0 for no-slip) */
45 		0,					/* pixel offset for SLIPs */
46 		0,					/* maximum number of links to visit/scanline (0=all) */
47 
48 		0x100,				/* base palette entry */
49 		0x100,				/* maximum number of colors */
50 		0,					/* transparent pen index */
51 
52 		{{ 0x00ff,0,0,0 }},	/* mask for the link */
53 		{{ 0 }},			/* mask for the graphics bank */
54 		{{ 0,0x7fff,0,0 }},	/* mask for the code index */
55 		{{ 0 }},			/* mask for the upper code index */
56 		{{ 0,0,0x000f,0 }},	/* mask for the color */
57 		{{ 0,0,0xff80,0 }},	/* mask for the X position */
58 		{{ 0,0,0,0xff80 }},	/* mask for the Y position */
59 		{{ 0,0,0,0x0070 }},	/* mask for the width, in tiles*/
60 		{{ 0,0,0,0x0007 }},	/* mask for the height, in tiles */
61 		{{ 0,0x8000,0,0 }},	/* mask for the horizontal flip */
62 		{{ 0 }},			/* mask for the vertical flip */
63 		{{ 0 }},			/* mask for the priority */
64 		{{ 0 }},			/* mask for the neighbor */
65 		{{ 0 }},			/* mask for absolute coordinates */
66 
67 		{{ 0 }},			/* mask for the special value */
68 		0,					/* resulting value to indicate "special" */
69 		0,					/* callback routine for special entries */
70 	};
71 
72 	/* initialize the playfield */
73 	if (!rampart_bitmap_init(43*8, 30*8))
74 		return 1;
75 
76 	/* initialize the motion objects */
77 	if (!atarimo_init(0, &modesc))
78 		return 1;
79 
80 	/* set the intial scroll offset */
81 	atarimo_set_xscroll(0, -4);
82 	atarimo_set_yscroll(0, 0x110);
83 	has_mo = (Machine->gfx[0]->total_elements > 10);
84 	return 0;
85 }
86 
87 
88 
89 /*************************************
90  *
91  *	Main refresh
92  *
93  *************************************/
94 
VIDEO_UPDATE(arcadecl)95 VIDEO_UPDATE( arcadecl )
96 {
97 	/* draw the playfield */
98 	rampart_bitmap_render(bitmap, cliprect);
99 
100 	/* draw and merge the MO */
101 	if (has_mo)
102 	{
103 		struct atarimo_rect_list rectlist;
104 		struct mame_bitmap *mobitmap;
105 		int x, y, r;
106 
107 		mobitmap = atarimo_render(0, cliprect, &rectlist);
108 		for (r = 0; r < rectlist.numrects; r++, rectlist.rect++)
109 			for (y = rectlist.rect->min_y; y <= rectlist.rect->max_y; y++)
110 			{
111 				UINT16 *mo = (UINT16 *)mobitmap->base + mobitmap->rowpixels * y;
112 				UINT16 *pf = (UINT16 *)bitmap->base + bitmap->rowpixels * y;
113 				for (x = rectlist.rect->min_x; x <= rectlist.rect->max_x; x++)
114 					if (mo[x])
115 					{
116 						/* not yet verified
117 						*/
118 						pf[x] = mo[x];
119 
120 						/* erase behind ourselves */
121 						mo[x] = 0;
122 					}
123 			}
124 	}
125 }
126