1 #include "driver.h"
2 #include "vidhrdw/konamiic.h"
3
4
5
6 int bottom9_video_enable;
7
8 static int layer_colorbase[3],sprite_colorbase,zoom_colorbase;
9
10
11 /***************************************************************************
12
13 Callbacks for the K052109
14
15 ***************************************************************************/
16
tile_callback(int layer,int bank,int * code,int * color)17 static void tile_callback(int layer,int bank,int *code,int *color)
18 {
19 *code |= (*color & 0x3f) << 8;
20 *color = layer_colorbase[layer] + ((*color & 0xc0) >> 6);
21 }
22
23
24 /***************************************************************************
25
26 Callbacks for the K051960
27
28 ***************************************************************************/
29
sprite_callback(int * code,int * color,int * priority,int * shadow)30 static void sprite_callback(int *code,int *color,int *priority,int *shadow)
31 {
32 /* bit 4 = priority over zoom (0 = have priority) */
33 /* bit 5 = priority over B (1 = have priority) */
34 *priority = (*color & 0x30) >> 4;
35 *color = sprite_colorbase + (*color & 0x0f);
36 }
37
38
39 /***************************************************************************
40
41 Callbacks for the K051316
42
43 ***************************************************************************/
44
zoom_callback(int * code,int * color)45 static void zoom_callback(int *code,int *color)
46 {
47 tile_info.flags = (*color & 0x40) ? TILE_FLIPX : 0;
48 *code |= ((*color & 0x03) << 8);
49 *color = zoom_colorbase + ((*color & 0x3c) >> 2);
50 }
51
52
53 /***************************************************************************
54
55 Start the video hardware emulation.
56
57 ***************************************************************************/
58
VIDEO_START(bottom9)59 VIDEO_START( bottom9 )
60 {
61 layer_colorbase[0] = 0; /* not used */
62 layer_colorbase[1] = 0;
63 layer_colorbase[2] = 16;
64 sprite_colorbase = 32;
65 zoom_colorbase = 48;
66 if (K052109_vh_start(REGION_GFX1,NORMAL_PLANE_ORDER,tile_callback))
67 return 1;
68
69 if (K051960_vh_start(REGION_GFX2,NORMAL_PLANE_ORDER,sprite_callback))
70 return 1;
71
72 if (K051316_vh_start_0(REGION_GFX3,4,TILEMAP_TRANSPARENT,0,zoom_callback))
73 return 1;
74
75 return 0;
76 }
77
78
79
80 /***************************************************************************
81
82 Display refresh
83
84 ***************************************************************************/
85
VIDEO_UPDATE(bottom9)86 VIDEO_UPDATE( bottom9 )
87 {
88 K052109_tilemap_update();
89
90 /* note: FIX layer is not used */
91 fillbitmap(bitmap,Machine->pens[layer_colorbase[1]],cliprect);
92 /* if (bottom9_video_enable)*/
93 {
94 K051960_sprites_draw(bitmap,cliprect,1,1);
95 K051316_zoom_draw_0(bitmap,cliprect,0,0);
96 K051960_sprites_draw(bitmap,cliprect,0,0);
97 tilemap_draw(bitmap,cliprect,K052109_tilemap[2],0,0);
98 /* note that priority 3 is opposite to the basic layer priority! */
99 /* (it IS used, but hopefully has no effect) */
100 K051960_sprites_draw(bitmap,cliprect,2,3);
101 tilemap_draw(bitmap,cliprect,K052109_tilemap[1],0,0);
102 }
103 }
104