1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
// license:BSD-3-Clause
// copyright-holders:Bryan McPhail
/***************************************************************************
Dec0 Video emulation - Bryan McPhail, mish@tendril.co.uk
*********************************************************************/
#include "emu.h"
#include "includes/dec0.h"
/******************************************************************************/
/******************************************************************************/
void dec0_state::hbarrel_colpri_cb(u32 &colour, u32 &pri_mask)
{
pri_mask = GFX_PMASK_4; // above background, foreground
if (colour & 8)
{
pri_mask |= GFX_PMASK_2; // behind foreground
}
}
void dec0_state::bandit_colpri_cb(u32 &colour, u32 &pri_mask)
{
pri_mask = 0; // above all
if (m_pri == 0)
{
pri_mask |= GFX_PMASK_4; // behind foreground
}
}
/* HB always keeps pf2 on top of pf3, no need explicitly support priority register */
uint32_t dec0_state::screen_update_hbarrel(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0,cliprect);
bool flip = m_tilegen[0]->get_flip_state();
m_tilegen[0]->set_flip_screen(flip);
m_tilegen[1]->set_flip_screen(flip);
m_tilegen[2]->set_flip_screen(flip);
m_spritegen->set_flip_screen(flip);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 1);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 2);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 4);
m_spritegen->draw_sprites(screen, bitmap, cliprect, m_gfxdecode->gfx(3), m_buffered_spriteram, 0x800/2);
return 0;
}
/******************************************************************************/
void dec0_state::baddudes_tile_cb(tile_data &tileinfo, u32 &tile, u32 &colour, u32 &flags)
{
tileinfo.group = BIT(colour, 3) ? 1 : 0;
}
uint32_t dec0_state::screen_update_baddudes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bool flip = m_tilegen[0]->get_flip_state();
m_tilegen[0]->set_flip_screen(flip);
m_tilegen[1]->set_flip_screen(flip);
m_tilegen[2]->set_flip_screen(flip);
m_spritegen->set_flip_screen(flip);
/* WARNING: inverted wrt Midnight Resistance */
const u8 fg = (m_pri & 0x01) ? 1 : 2;
const u8 bg = (m_pri & 0x01) ? 2 : 1;
m_tilegen[bg]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0);
m_tilegen[fg]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_LAYER0 | TILEMAP_DRAW_LAYER1, 0);
if (m_pri & 2)
m_tilegen[bg]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_LAYER0, 0); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */
m_spritegen->draw_sprites(screen, bitmap, cliprect, m_gfxdecode->gfx(3), m_buffered_spriteram, 0x800/2);
if (m_pri & 4)
m_tilegen[fg]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_LAYER0, 0); // upper 8 pens of upper 8 priority marked tiles /* Foreground pens only */
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0);
return 0;
}
/******************************************************************************/
/* WARNING: inverted wrt Midnight Resistance */
/* Robocop uses it only for the title screen, so this might be just */
/* completely wrong. The top 8 bits of the register might mean */
/* something (they are 0x80 in midres, 0x00 here) */
void dec0_state::robocop_colpri_cb(u32 &colour, u32 &pri_mask)
{
pri_mask = 0; // above background, foreground
if (m_pri & 0x02)
{
const u32 trans = (m_pri & 0x04) ? 0x08 : 0x00;
if ((colour & 0x08) == trans)
pri_mask |= GFX_PMASK_2; // behind foreground
}
}
void dec0_state::midres_colpri_cb(u32 &colour, u32 &pri_mask)
{
pri_mask = 0; // above background, foreground
if (m_pri & 0x02)
{
const u32 trans = (m_pri & 0x04) ? 0x00 : 0x08;
if ((colour & 0x08) == trans)
pri_mask |= GFX_PMASK_2; // behind foreground
}
}
uint32_t dec0_state::screen_update_robocop(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0,cliprect);
bool flip = m_tilegen[0]->get_flip_state();
m_tilegen[0]->set_flip_screen(flip);
m_tilegen[1]->set_flip_screen(flip);
m_tilegen[2]->set_flip_screen(flip);
m_spritegen->set_flip_screen(flip);
const u8 fg = (m_pri & 0x01) ? 2 : 1;
const u8 bg = (m_pri & 0x01) ? 1 : 2;
m_tilegen[bg]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 1);
m_tilegen[fg]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 2);
m_spritegen->draw_sprites(screen, bitmap, cliprect, m_gfxdecode->gfx(3), m_buffered_spriteram, 0x800/2);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0);
return 0;
}
uint32_t dec0_automat_state::screen_update_automat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
screen.priority().fill(0,cliprect);
// layer enables seem different... where are they?
// the bootleg doesn't write these registers, I think they're hardcoded?, so fake them for compatibility with our implementation..
m_tilegen[0]->pf_control_0_w(0,0x0003, 0x00ff); // 8x8
m_tilegen[0]->pf_control_0_w(1,0x0003, 0x00ff);
m_tilegen[0]->pf_control_0_w(2,0x0000, 0x00ff);
m_tilegen[0]->pf_control_0_w(3,0x0001, 0x00ff); // dimensions
m_tilegen[1]->pf_control_0_w(0,0x0082, 0x00ff); // 16x16
m_tilegen[1]->pf_control_0_w(1,0x0000, 0x00ff);
m_tilegen[1]->pf_control_0_w(2,0x0000, 0x00ff);
m_tilegen[1]->pf_control_0_w(3,0x0001, 0x00ff); // dimensions
m_tilegen[2]->pf_control_0_w(0,0x0082, 0x00ff); // 16x16
m_tilegen[2]->pf_control_0_w(1,0x0003, 0x00ff);
m_tilegen[2]->pf_control_0_w(2,0x0000, 0x00ff);
m_tilegen[2]->pf_control_0_w(3,0x0001, 0x00ff); // dimensions
// scroll registers got written elsewhere, copy them across
m_tilegen[0]->pf_control_1_w(0,0x0000, 0xffff); // no scroll?
m_tilegen[0]->pf_control_1_w(1,0x0000, 0xffff); // no scroll?
m_tilegen[1]->pf_control_1_w(0,m_automat_scroll_regs[3] - 0x010a, 0xffff);
m_tilegen[1]->pf_control_1_w(1,m_automat_scroll_regs[2], 0xffff);
m_tilegen[2]->pf_control_1_w(0,m_automat_scroll_regs[1] - 0x0108, 0xffff);
m_tilegen[2]->pf_control_1_w(1,m_automat_scroll_regs[0], 0xffff);
bool flip = m_tilegen[0]->get_flip_state();
m_tilegen[0]->set_flip_screen(flip);
m_tilegen[1]->set_flip_screen(flip);
m_tilegen[2]->set_flip_screen(flip);
m_spritegen->set_flip_screen(flip);
const u8 fg = (m_pri & 0x01) ? 2 : 1;
const u8 bg = (m_pri & 0x01) ? 1 : 2;
m_tilegen[bg]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 1);
m_tilegen[fg]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 2);
m_spritegen->draw_sprites_bootleg(screen, bitmap, cliprect, m_gfxdecode->gfx(3), m_buffered_spriteram, 0x800/2); // TODO : RAM size
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0);
return 0;
}
/******************************************************************************/
uint32_t dec0_state::screen_update_birdtry(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bool flip = m_tilegen[0]->get_flip_state();
m_tilegen[0]->set_flip_screen(flip);
m_tilegen[1]->set_flip_screen(flip);
m_spritegen->set_flip_screen(flip);
/* This game doesn't have the extra playfield chip on the game board, but
the palette does show through. */
bitmap.fill(m_palette->pen(768), cliprect);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0);
m_spritegen->draw_sprites(screen, bitmap, cliprect, m_gfxdecode->gfx(3), m_buffered_spriteram, 0x800/2);
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0, 0);
return 0;
}
/******************************************************************************/
uint32_t dec0_state::screen_update_slyspy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bool flip = m_tilegen[0]->get_flip_state();
m_tilegen[0]->set_flip_screen(flip);
m_tilegen[1]->set_flip_screen(flip);
m_tilegen[2]->set_flip_screen(flip);
m_spritegen->set_flip_screen(flip);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_LAYER0 | TILEMAP_DRAW_LAYER1, 0);
m_spritegen->draw_sprites(screen, bitmap, cliprect, m_gfxdecode->gfx(3), m_buffered_spriteram, 0x800/2);
/* Redraw top 8 pens of top 8 palettes over sprites */
if (m_pri & 0x80)
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_LAYER0, 0); // upper 8 pens of upper 8 priority marked tiles
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0,0);
return 0;
}
uint32_t dec0_automat_state::screen_update_secretab(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// layer enables seem different... where are they?
// the bootleg doesn't write these registers, I think they're hardcoded?, so fake them for compatibility with our implementation..
m_tilegen[0]->pf_control_0_w(0,0x0003, 0x00ff); // 8x8
m_tilegen[0]->pf_control_0_w(1,0x0003, 0x00ff);
m_tilegen[0]->pf_control_0_w(2,0x0000, 0x00ff);
m_tilegen[0]->pf_control_0_w(3,0x0001, 0x00ff); // dimensions
m_tilegen[1]->pf_control_0_w(0,0x0082, 0x00ff); // 16x16
m_tilegen[1]->pf_control_0_w(1,0x0000, 0x00ff);
m_tilegen[1]->pf_control_0_w(2,0x0000, 0x00ff);
m_tilegen[1]->pf_control_0_w(3,0x0001, 0x00ff); // dimensions
m_tilegen[2]->pf_control_0_w(0,0x0082, 0x00ff); // 16x16
m_tilegen[2]->pf_control_0_w(1,0x0003, 0x00ff);
m_tilegen[2]->pf_control_0_w(2,0x0000, 0x00ff);
m_tilegen[2]->pf_control_0_w(3,0x0001, 0x00ff); // dimensions
// scroll registers got written elsewhere, copy them across
m_tilegen[0]->pf_control_1_w(0,0x0000, 0xffff); // no scroll?
m_tilegen[0]->pf_control_1_w(1,0x0000, 0xffff); // no scroll?
m_tilegen[1]->pf_control_1_w(0,m_automat_scroll_regs[3] - 0x010a, 0xffff);
m_tilegen[1]->pf_control_1_w(1,m_automat_scroll_regs[2], 0xffff);
m_tilegen[2]->pf_control_1_w(0,m_automat_scroll_regs[1] - 0x0108, 0xffff);
m_tilegen[2]->pf_control_1_w(1,m_automat_scroll_regs[0], 0xffff);
bool flip = m_tilegen[0]->get_flip_state();
m_tilegen[0]->set_flip_screen(flip);
m_tilegen[1]->set_flip_screen(flip);
m_tilegen[2]->set_flip_screen(flip);
m_spritegen->set_flip_screen(flip);
m_tilegen[2]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0);
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_LAYER0 | TILEMAP_DRAW_LAYER1, 0);
m_spritegen->draw_sprites_bootleg(screen, bitmap, cliprect, m_gfxdecode->gfx(3), m_buffered_spriteram, 0x800/2); // TODO : RAM size
/* Redraw top 8 pens of top 8 palettes over sprites */
if (m_pri & 0x80)
m_tilegen[1]->deco_bac06_pf_draw(screen,bitmap,cliprect,TILEMAP_DRAW_LAYER0, 0); // upper 8 pens of upper 8 priority marked tiles
m_tilegen[0]->deco_bac06_pf_draw(screen,bitmap,cliprect,0,0);
return 0;
}
/******************************************************************************/
void dec0_state::priority_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
COMBINE_DATA(&m_pri);
}
VIDEO_START_MEMBER(dec0_state,dec0_nodma)
{
save_item(NAME(m_pri));
m_buffered_spriteram = m_spriteram->live();
save_pointer(NAME(m_buffered_spriteram), 0x800/2);
m_pri = 0;
}
VIDEO_START_MEMBER(dec0_state,dec0)
{
save_item(NAME(m_pri));
m_buffered_spriteram = m_spriteram->buffer();
save_pointer(NAME(m_buffered_spriteram), 0x800/2);
m_pri = 0;
}
VIDEO_START_MEMBER(dec0_state,baddudes)
{
VIDEO_START_CALL_MEMBER(dec0);
m_tilegen[1]->set_transmask(0, 0xffff, 0x0001);
m_tilegen[1]->set_transmask(1, 0x00ff, 0xff01);
m_tilegen[2]->set_transmask(0, 0xffff, 0x0001);
m_tilegen[2]->set_transmask(1, 0x00ff, 0xff01);
}
VIDEO_START_MEMBER(dec0_state,slyspy)
{
VIDEO_START_CALL_MEMBER(dec0_nodma);
m_tilegen[1]->set_transmask(0, 0xffff, 0x0001);
m_tilegen[1]->set_transmask(1, 0x00ff, 0xff01);
}
/******************************************************************************/
|