1 #include "driver.h"
2 #include "vidhrdw/konamiic.h"
3
4
5 static int zoom_colorbase[2],road_colorbase[2],sprite_colorbase;
6
7
8 /***************************************************************************
9
10 Callbacks for the K053247
11
12 ***************************************************************************/
13
overdriv_sprite_callback(int * code,int * color,int * priority_mask)14 static void overdriv_sprite_callback(int *code,int *color,int *priority_mask)
15 {
16 int pri = (*color & 0xffe0) >> 5; /* ??????? */
17 if (pri) *priority_mask = 0x02;
18 else *priority_mask = 0x00;
19
20 *color = sprite_colorbase + (*color & 0x001f);
21 }
22
23
24 /***************************************************************************
25
26 Callbacks for the K051316
27
28 ***************************************************************************/
29
zoom_callback_0(int * code,int * color)30 static void zoom_callback_0(int *code,int *color)
31 {
32 tile_info.flags = (*color & 0x40) ? TILE_FLIPX : 0;
33 *code |= ((*color & 0x03) << 8);
34 *color = zoom_colorbase[0] + ((*color & 0x3c) >> 2);
35 }
36
zoom_callback_1(int * code,int * color)37 static void zoom_callback_1(int *code,int *color)
38 {
39 tile_info.flags = (*color & 0x40) ? TILE_FLIPX : 0;
40 *code |= ((*color & 0x03) << 8);
41 *color = zoom_colorbase[1] + ((*color & 0x3c) >> 2);
42 }
43
44
45
46 /***************************************************************************
47
48 Start the video hardware emulation.
49
50 ***************************************************************************/
51
VIDEO_START(overdriv)52 VIDEO_START( overdriv )
53 {
54 K053251_vh_start();
55
56 if (K051316_vh_start_0(REGION_GFX2,4,TILEMAP_OPAQUE,0,zoom_callback_0))
57 return 1;
58
59 if (K051316_vh_start_1(REGION_GFX3,4,TILEMAP_TRANSPARENT,0,zoom_callback_1))
60 return 1;
61
62 if (K053247_vh_start(REGION_GFX1,77,22,NORMAL_PLANE_ORDER,overdriv_sprite_callback))
63 return 1;
64
65 K051316_wraparound_enable(0,1);
66 K051316_set_offset(0,14,-1);
67 K051316_set_offset(1,15,0);
68
69 return 0;
70 }
71
72
73
74 /***************************************************************************
75
76 Display refresh
77
78 ***************************************************************************/
79
VIDEO_UPDATE(overdriv)80 VIDEO_UPDATE( overdriv )
81 {
82 sprite_colorbase = K053251_get_palette_index(K053251_CI0);
83 road_colorbase[1] = K053251_get_palette_index(K053251_CI1);
84 road_colorbase[0] = K053251_get_palette_index(K053251_CI2);
85 zoom_colorbase[1] = K053251_get_palette_index(K053251_CI3);
86 zoom_colorbase[0] = K053251_get_palette_index(K053251_CI4);
87
88 fillbitmap(priority_bitmap,0,cliprect);
89
90 K051316_zoom_draw_0(bitmap,cliprect,0,0);
91 K051316_zoom_draw_1(bitmap,cliprect,0,1);
92
93 K053247_sprites_draw(bitmap,cliprect);
94 }
95