1 // license:BSD-3-Clause
2 // copyright-holders:Nicola Salmoria
3
4 #include "emu.h"
5 #include "includes/88games.h"
6 #include "screen.h"
7
8
9 /***************************************************************************
10
11 Callbacks for the K052109
12
13 ***************************************************************************/
14
K052109_CB_MEMBER(_88games_state::tile_callback)15 K052109_CB_MEMBER(_88games_state::tile_callback)
16 {
17 static const int layer_colorbase[] = { 1024 / 16, 0 / 16, 256 / 16 };
18
19 *code |= ((*color & 0x0f) << 8) | (bank << 12);
20 *color = layer_colorbase[layer] + ((*color & 0xf0) >> 4);
21 }
22
23
24 /***************************************************************************
25
26 Callbacks for the K051960
27
28 ***************************************************************************/
29
K051960_CB_MEMBER(_88games_state::sprite_callback)30 K051960_CB_MEMBER(_88games_state::sprite_callback)
31 {
32 enum { sprite_colorbase = 512 / 16 };
33
34 *priority = (*color & 0x20) >> 5; /* ??? */
35 *color = sprite_colorbase + (*color & 0x0f);
36 }
37
38
39 /***************************************************************************
40
41 Callbacks for the K051316
42
43 ***************************************************************************/
44
K051316_CB_MEMBER(_88games_state::zoom_callback)45 K051316_CB_MEMBER(_88games_state::zoom_callback)
46 {
47 enum { zoom_colorbase = 768 / 16 };
48
49 *flags = (*color & 0x40) ? TILE_FLIPX : 0;
50 *code |= ((*color & 0x07) << 8);
51 *color = zoom_colorbase + ((*color & 0x38) >> 3) + ((*color & 0x80) >> 4);
52 }
53
54 /***************************************************************************
55
56 Display refresh
57
58 ***************************************************************************/
59
screen_update_88games(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect)60 uint32_t _88games_state::screen_update_88games(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
61 {
62 m_k052109->tilemap_update();
63
64 if (m_k88games_priority)
65 {
66 m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0); // tile 0
67 m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 1, 1);
68 m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, 0, 0); // tile 2
69 m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, 0, 0); // tile 1
70 m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 0, 0);
71 m_k051316->zoom_draw(screen, bitmap, cliprect, 0, 0);
72 }
73 else
74 {
75 m_k052109->tilemap_draw(screen, bitmap, cliprect, 2, TILEMAP_DRAW_OPAQUE, 0); // tile 2
76 m_k051316->zoom_draw(screen, bitmap, cliprect, 0, 0);
77 m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 0, 0);
78 m_k052109->tilemap_draw(screen, bitmap, cliprect, 1, 0, 0); // tile 1
79 m_k051960->k051960_sprites_draw(bitmap, cliprect, screen.priority(), 1, 1);
80 m_k052109->tilemap_draw(screen, bitmap, cliprect, 0, 0, 0); // tile 0
81 }
82
83 return 0;
84 }
85