1 /*
2 Dragonball Z
3 Banpresto, 1993
4
5 Dragonball Z 2 Super Battle
6 (c) 1994 Banpresto
7
8 Driver by David Haywood and R. Belmont
9
10 MC68000 + Konami Xexex-era video hardware and system controller ICs
11 Z80 + YM2151 + OKIM6295 for sound
12
13 Status: DBZ2 is playable with music and sound and proper controls/dips.
14
15 Note: game has an extremely complete test mode, it's beautiful for emulation.
16 flip the DIP and check it out!
17
18 TODO:
19 - Gfx priorities (note that it has two 053251)
20 - Self Test Fails
21 - Some offsets/colours in DBZ1
22
23 PCB Layout:
24
25 BP924-1 PWB250248D (note PCB is identical to DBZ2 also)
26 |-------------------------------------------------------|
27 | YM3014 Z80 32MHz 053252 222A05 222A07 |
28 | YM2151 5168 222A04 222A06 |
29 | 1.056kHz 5168 |
30 | M6295 222A10 5864 |
31 | 222A03 68000 2018 5864 053246A|
32 |J 222A11 222A12 2018 |
33 |A 5864 * * |
34 |M 5864 62256 62256 |
35 |M 053247A|
36 |A |
37 | 053936 053936 2018 |
38 | 053251 053251 2018 |
39 | CY7C128 |
40 | 054157 054156 5864 CY7C128 CY7C128 CY7C128|
41 | 222A01 222A02 5864 CY7C128 |
42 | DSW2 DSW1 5864 CY7C128 222A08 222A09 |
43 | * * |
44 |-------------------------------------------------------|
45
46 Notes:
47 68k clock: 16.000MHz
48 Z80 clock: 4.000MHz
49 YM2151 clock: 4.000MHz
50 M6295 clock: 1.056MHz (sample rate = /132)
51 Vsync: 55Hz
52 Hsync: 15.36kHz
53 *: unpopulated ROM positions on DBZ
54
55 */
56
57 #include "driver.h"
58 #include "state.h"
59
60 #include "vidhrdw/generic.h"
61 #include "vidhrdw/konamiic.h"
62 #include "cpu/m68000/m68000.h"
63 #include "cpu/z80/z80.h"
64
65 /* BG LAYER */
66
67 data16_t* dbz2_bg_videoram;
68 data16_t* dbz2_bg2_videoram;
69
70 WRITE16_HANDLER(dbz2_bg_videoram_w);
71 WRITE16_HANDLER(dbz2_bg2_videoram_w);
72
73 static int dbz2_control;
74
75 VIDEO_START(dbz);
76 VIDEO_START(dbz2);
77 VIDEO_UPDATE(dbz);
78 VIDEO_UPDATE(dbz2);
79
INTERRUPT_GEN(dbz2_interrupt)80 static INTERRUPT_GEN(dbz2_interrupt)
81 {
82 switch (cpu_getiloops())
83 {
84 case 0:
85 cpu_set_irq_line(0, MC68000_IRQ_2, HOLD_LINE);
86 break;
87
88 case 1:
89 if (K053246_is_IRQ_enabled())
90 cpu_set_irq_line(0, MC68000_IRQ_4, HOLD_LINE);
91 break;
92 }
93 }
94
95 #if 0
96 static READ16_HANDLER(dbzcontrol_r)
97 {
98 return dbz2_control;
99 }
100 #endif
101
WRITE16_HANDLER(dbzcontrol_w)102 static WRITE16_HANDLER(dbzcontrol_w)
103 {
104 /* bit 10 = enable '246 readback */
105
106 COMBINE_DATA(&dbz2_control);
107
108 if (data & 0x400)
109 {
110 K053246_set_OBJCHA_line(ASSERT_LINE);
111 }
112 else
113 {
114 K053246_set_OBJCHA_line(CLEAR_LINE);
115 }
116 }
117
READ16_HANDLER(dbz2_inp0_r)118 static READ16_HANDLER(dbz2_inp0_r)
119 {
120 return readinputport(0) | (readinputport(1)<<8);
121 }
122
READ16_HANDLER(dbz2_inp1_r)123 static READ16_HANDLER(dbz2_inp1_r)
124 {
125 return readinputport(3) | (readinputport(2)<<8);
126 }
127
READ16_HANDLER(dbz2_inp2_r)128 static READ16_HANDLER(dbz2_inp2_r)
129 {
130 return readinputport(4) | (readinputport(4)<<8);
131 }
132
WRITE16_HANDLER(dbz2_sound_command_w)133 static WRITE16_HANDLER( dbz2_sound_command_w )
134 {
135 soundlatch_w(0, data>>8);
136 }
137
WRITE16_HANDLER(dbz2_sound_cause_nmi)138 static WRITE16_HANDLER( dbz2_sound_cause_nmi )
139 {
140 cpu_set_nmi_line(1, PULSE_LINE);
141 }
142
dbz2_sound_irq(int irq)143 static void dbz2_sound_irq(int irq)
144 {
145 if (irq)
146 cpu_set_irq_line(1, 0, ASSERT_LINE);
147 else
148 cpu_set_irq_line(1, 0, CLEAR_LINE);
149 }
150
MEMORY_READ16_START(dbz2readmem)151 static MEMORY_READ16_START( dbz2readmem )
152 { 0x000000, 0x0fffff, MRA16_ROM },
153 { 0x480000, 0x48ffff, MRA16_RAM },
154 { 0x490000, 0x491fff, K054157_ram_word_r }, // '157 RAM is mirrored twice
155 { 0x492000, 0x493fff, K054157_ram_word_r },
156 { 0x498000, 0x49ffff, K054157_rom_word_8000_r }, // code near a60 in dbz2, subroutine at 730 in dbz
157 { 0x4a0000, 0x4a0fff, K053247_word_r },
158 { 0x4a1000, 0x4a3fff, MRA16_RAM },
159 { 0x4a8000, 0x4abfff, MRA16_RAM }, // palette
160 { 0x4c0000, 0x4c0001, K053246_word_r },
161 { 0x4e0000, 0x4e0001, dbz2_inp0_r },
162 { 0x4e0002, 0x4e0003, dbz2_inp1_r },
163 { 0x4e4000, 0x4e4001, dbz2_inp2_r },
164 { 0x500000, 0x501fff, MRA16_RAM },
165 { 0x508000, 0x509fff, MRA16_RAM },
166 { 0x510000, 0x513fff, MRA16_RAM },
167 { 0x518000, 0x51bfff, MRA16_RAM },
168 { 0x600000, 0x6fffff, MRA16_NOP }, // PSAC 1 ROM readback window
169 { 0x700000, 0x7fffff, MRA16_NOP }, // PSAC 2 ROM readback window
170 MEMORY_END
171
172 static MEMORY_WRITE16_START( dbz2writemem )
173 { 0x480000, 0x48ffff, MWA16_RAM },
174 { 0x490000, 0x491fff, K054157_ram_word_w },
175 { 0x492000, 0x493fff, K054157_ram_word_w },
176 { 0x4a0000, 0x4a0fff, K053247_word_w },
177 { 0x4a1000, 0x4a3fff, MWA16_RAM },
178 { 0x4a8000, 0x4abfff, paletteram16_xRRRRRGGGGGBBBBB_word_w, &paletteram16 },
179 { 0x4c0000, 0x4c0007, K053246_word_w },
180 { 0x4c4000, 0x4c4007, K053246_word_w },
181 { 0x4c8000, 0x4c8007, K054157_b_word_w },
182 { 0x4cc000, 0x4cc03f, K054157_word_w },
183 { 0x4ec000, 0x4ec001, dbzcontrol_w },
184 { 0x4d0000, 0x4d001f, MWA16_RAM, &K053936_0_ctrl },
185 { 0x4d4000, 0x4d401f, MWA16_RAM, &K053936_1_ctrl },
186 { 0x4e8000, 0x4e8001, MWA16_NOP },
187 { 0x4f0000, 0x4f0001, dbz2_sound_command_w },
188 { 0x4f4000, 0x4f4001, dbz2_sound_cause_nmi },
189 { 0x4f8000, 0x4f801f, MWA16_NOP }, // 251 #1
190 { 0x4fc000, 0x4fc01f, K053251_lsb_w }, // 251 #2
191 { 0x500000, 0x501fff, dbz2_bg2_videoram_w, &dbz2_bg2_videoram },
192 { 0x508000, 0x509fff, dbz2_bg_videoram_w, &dbz2_bg_videoram },
193 { 0x510000, 0x513fff, MWA16_RAM, &K053936_0_linectrl }, // ?? guess, it might not be
194 { 0x518000, 0x51bfff, MWA16_RAM, &K053936_1_linectrl }, // ?? guess, it might not be
195 MEMORY_END
196
197 /* dbz2 sound */
198 /* IRQ: from YM2151. NMI: from 68000. Port 0: write to ack NMI */
199
200 static MEMORY_READ_START( dbz2sound_readmem )
201 { 0x0000, 0x7fff, MRA_ROM },
202 { 0x8000, 0xbfff, MRA_RAM },
203 { 0xc000, 0xc001, YM2151_status_port_0_r },
204 { 0xd000, 0xd002, OKIM6295_status_0_r },
205 { 0xe000, 0xe001, soundlatch_r },
206 MEMORY_END
207
208 static MEMORY_WRITE_START( dbz2sound_writemem )
209 { 0x0000, 0x7fff, MWA_ROM },
210 { 0x8000, 0xbfff, MWA_RAM },
211 { 0xc000, 0xc000, YM2151_register_port_0_w },
212 { 0xc001, 0xc001, YM2151_data_port_0_w },
213 { 0xd000, 0xd001, OKIM6295_data_0_w },
214 MEMORY_END
215
216 static PORT_READ_START( dbz2sound_readport )
217 PORT_END
218
219 static PORT_WRITE_START( dbz2sound_writeport )
220 { 0x00, 0x00, IOWP_NOP },
221 PORT_END
222
223 /**********************************************************************************/
224
225
226 INPUT_PORTS_START( dbz )
227 PORT_START
228 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
229 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
230 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
231 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER1 )
232 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER1 )
233 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
234 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER1 )
235 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
236
237 PORT_START
238 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
239 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
240 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
241 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
242 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
243 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
244 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
245 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
246
247 PORT_START
248 PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) // I think this is right, but can't stomach the game long enough to check
249 PORT_DIPSETTING( 0x01, "Easy" )
250 PORT_DIPSETTING( 0x03, "Normal" )
251 PORT_DIPSETTING( 0x02, "Hard" )
252 PORT_DIPSETTING( 0x00, "Hardest" )
253 PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) // seems unused
254 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
255 PORT_DIPSETTING( 0x04, DEF_STR( On ) )
256 PORT_DIPNAME( 0x08, 0x08, DEF_STR( Flip_Screen ) ) // Definitely correct
257 PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
258 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
259 PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
260 PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
261 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
262 PORT_DIPNAME( 0x20, 0x20, DEF_STR(Service_Mode) )
263 PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
264 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
265 PORT_DIPNAME( 0x40, 0x00, "Language" )
266 PORT_DIPSETTING( 0x00, "English" )
267 PORT_DIPSETTING( 0x40, "Japanese" )
268 PORT_DIPNAME( 0x80, 0x00, "Mask ROM Test" ) //NOP'd
269 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
270 PORT_DIPSETTING( 0x80, DEF_STR( On ) )
271
272 PORT_START
273 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
274 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
275 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
276 PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_SERVICE, "Test Switch", KEYCODE_F2, IP_JOY_NONE ) // "Test"
277 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
278 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
279 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER2 )
280 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER1 )
281
282 PORT_START
283 PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
284 PORT_DIPSETTING( 0x02, DEF_STR( 4C_1C ) )
285 PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) )
286 PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) )
287 PORT_DIPSETTING( 0x04, DEF_STR( 3C_2C ) )
288 PORT_DIPSETTING( 0x01, DEF_STR( 4C_3C ) )
289 PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) )
290 PORT_DIPSETTING( 0x03, DEF_STR( 3C_4C ) )
291 PORT_DIPSETTING( 0x07, DEF_STR( 2C_3C ) )
292 PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) )
293 PORT_DIPSETTING( 0x06, DEF_STR( 2C_5C ) )
294 PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) )
295 PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) )
296 PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) )
297 PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) )
298 PORT_DIPSETTING( 0x09, DEF_STR( 1C_7C ) )
299 PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
300 PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
301 PORT_DIPSETTING( 0x20, DEF_STR( 4C_1C ) )
302 PORT_DIPSETTING( 0x50, DEF_STR( 3C_1C ) )
303 PORT_DIPSETTING( 0x80, DEF_STR( 2C_1C ) )
304 PORT_DIPSETTING( 0x40, DEF_STR( 3C_2C ) )
305 PORT_DIPSETTING( 0x10, DEF_STR( 4C_3C ) )
306 PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) )
307 PORT_DIPSETTING( 0x30, DEF_STR( 3C_4C ) )
308 PORT_DIPSETTING( 0x70, DEF_STR( 2C_3C ) )
309 PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) )
310 PORT_DIPSETTING( 0x60, DEF_STR( 2C_5C ) )
311 PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) )
312 PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) )
313 PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C ) )
314 PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C ) )
315 PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C ) )
316 // PORT_DIPSETTING( 0x00, "Disabled" )
317 INPUT_PORTS_END
318
319 INPUT_PORTS_START( dbz2 )
320 PORT_START
321 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
322 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
323 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
324 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER1 )
325 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER1 )
326 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
327 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER1 )
328 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
329
330 PORT_START
331 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
332 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
333 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
334 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
335 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
336 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
337 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
338 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
339
340 PORT_START
341 PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
342 PORT_DIPSETTING( 0x01, "Easy" )
343 PORT_DIPSETTING( 0x03, "Normal" )
344 PORT_DIPSETTING( 0x02, "Hard" )
345 PORT_DIPSETTING( 0x00, "Hardest" )
346 PORT_DIPNAME( 0x04, 0x04, DEF_STR( Flip_Screen ) )
347 PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
348 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
349 PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
350 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
351 PORT_DIPSETTING( 0x08, DEF_STR( On ) )
352 PORT_DIPNAME( 0x10, 0x10, "Level Select" )
353 PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
354 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
355 PORT_DIPNAME( 0x20, 0x20, DEF_STR(Service_Mode ) )
356 PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
357 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
358 PORT_DIPNAME( 0x40, 0x00, "Language" )
359 PORT_DIPSETTING( 0x00, "English" )
360 PORT_DIPSETTING( 0x40, "Japanese" )
361 PORT_DIPNAME( 0x80, 0x00, "Mask ROM Test" )
362 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
363 PORT_DIPSETTING( 0x80, DEF_STR( On ) )
364
365 PORT_START
366 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
367 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
368 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
369 PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_SERVICE, "Test Switch", KEYCODE_F2, IP_JOY_NONE ) // "Test"
370 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
371 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
372 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER2 )
373 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER1 )
374
375 PORT_START
376 PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
377 PORT_DIPSETTING( 0x02, DEF_STR( 4C_1C ) )
378 PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) )
379 PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) )
380 PORT_DIPSETTING( 0x04, DEF_STR( 3C_2C ) )
381 PORT_DIPSETTING( 0x01, DEF_STR( 4C_3C ) )
382 PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) )
383 PORT_DIPSETTING( 0x03, DEF_STR( 3C_4C ) )
384 PORT_DIPSETTING( 0x07, DEF_STR( 2C_3C ) )
385 PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) )
386 PORT_DIPSETTING( 0x06, DEF_STR( 2C_5C ) )
387 PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) )
388 PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) )
389 PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) )
390 PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C ) )
391 PORT_DIPSETTING( 0x09, DEF_STR( 1C_7C ) )
392 PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
393 PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
394 PORT_DIPSETTING( 0x20, DEF_STR( 4C_1C ) )
395 PORT_DIPSETTING( 0x50, DEF_STR( 3C_1C ) )
396 PORT_DIPSETTING( 0x80, DEF_STR( 2C_1C ) )
397 PORT_DIPSETTING( 0x40, DEF_STR( 3C_2C ) )
398 PORT_DIPSETTING( 0x10, DEF_STR( 4C_3C ) )
399 PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) )
400 PORT_DIPSETTING( 0x30, DEF_STR( 3C_4C ) )
401 PORT_DIPSETTING( 0x70, DEF_STR( 2C_3C ) )
402 PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) )
403 PORT_DIPSETTING( 0x60, DEF_STR( 2C_5C ) )
404 PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) )
405 PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) )
406 PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C ) )
407 PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C ) )
408 PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C ) )
409 // PORT_DIPSETTING( 0x00, "Disabled" )
410 INPUT_PORTS_END
411
412 /**********************************************************************************/
413
414 static struct YM2151interface ym2151_interface =
415 {
416 1,
417 4000000, /* total guess */
418 { YM3012_VOL(100,MIXER_PAN_LEFT,100,MIXER_PAN_RIGHT) },
419 { dbz2_sound_irq }
420 };
421
422 static struct OKIM6295interface m6295_interface =
423 {
424 1, /* 1 chip */
425 { 1056000/132 }, /* confirmed */
426 { REGION_SOUND1 },
427 { 100 }
428 };
429
430 /**********************************************************************************/
431
432 static struct GfxLayout bglayout =
433 {
434 16,16,
435 RGN_FRAC(1,1),
436 4,
437 { 0, 1, 2, 3 },
438 { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4, 8*4,
439 9*4, 10*4, 11*4, 12*4, 13*4, 14*4, 15*4 },
440 { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
441 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
442 128*8
443 };
444
445 static struct GfxDecodeInfo gfxdecodeinfo[] =
446 {
447 { REGION_GFX3, 0, &bglayout, 0x400, 64 },
448 { REGION_GFX4, 0, &bglayout, 0x800, 64 },
449 { -1 } /* end of array */
450 };
451
452 /**********************************************************************************/
453
454 static MACHINE_DRIVER_START( dbz2 )
455
456 /* basic machine hardware */
457 MDRV_CPU_ADD_TAG("main", M68000, 16000000)
MDRV_CPU_MEMORY(dbz2readmem,dbz2writemem)458 MDRV_CPU_MEMORY(dbz2readmem,dbz2writemem)
459 MDRV_CPU_VBLANK_INT(dbz2_interrupt,2)
460
461 MDRV_CPU_ADD_TAG("sound", Z80, 4000000)
462 MDRV_CPU_FLAGS(CPU_AUDIO_CPU)
463 MDRV_CPU_MEMORY(dbz2sound_readmem, dbz2sound_writemem)
464 MDRV_CPU_PORTS(dbz2sound_readport,dbz2sound_writeport)
465
466 MDRV_FRAMES_PER_SECOND(55)
467 MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
468
469 MDRV_GFXDECODE(gfxdecodeinfo)
470
471 /* video hardware */
472 MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_NEEDS_6BITS_PER_GUN | VIDEO_HAS_SHADOWS )
473 MDRV_SCREEN_SIZE(64*8, 32*8)
474 MDRV_VISIBLE_AREA(0, 48*8-1, 0, 32*8-1 )
475 MDRV_VIDEO_START(dbz2)
476 MDRV_VIDEO_UPDATE(dbz2)
477 MDRV_PALETTE_LENGTH(0x4000/2)
478
479 /* sound hardware */
480 MDRV_SOUND_ATTRIBUTES(SOUND_SUPPORTS_STEREO)
481 MDRV_SOUND_ADD(YM2151, ym2151_interface)
482 MDRV_SOUND_ADD(OKIM6295, m6295_interface)
483 MACHINE_DRIVER_END
484
485 static MACHINE_DRIVER_START( dbz )
486 MDRV_IMPORT_FROM(dbz2)
487
488 MDRV_VIDEO_START(dbz)
489 MDRV_VIDEO_UPDATE(dbz)
490 MDRV_VISIBLE_AREA(34, 34+48*8-1, 0, 32*8-1 )
491 MACHINE_DRIVER_END
492
493 /**********************************************************************************/
494
495 #define ROM_LOAD64_WORD(name,offset,length,crc) ROMX_LOAD(name, offset, length, crc, ROM_GROUPWORD | ROM_SKIP(6))
496
497 ROM_START( dbz )
498 /* main program */
499 ROM_REGION( 0x400000, REGION_CPU1, 0)
500 ROM_LOAD16_BYTE( "222a11.9e", 0x000000, 0x80000, CRC(60c7d9b2) SHA1(718ef89e89b3943845e91bedfc5c1d26229f9fe5) )
501 ROM_LOAD16_BYTE( "222a12.9f", 0x000001, 0x80000, CRC(6ebc6853) SHA1(e9b2068246228968cc6b8554215563cacaa5ba9f) )
502
503 ROM_REGION( 0x400000, REGION_USER1, 0)
504 ROM_LOAD16_BYTE( "222a11.9e", 0x000000, 0x80000, CRC(60c7d9b2) SHA1(718ef89e89b3943845e91bedfc5c1d26229f9fe5) )
505 ROM_LOAD16_BYTE( "222a12.9f", 0x000001, 0x80000, CRC(6ebc6853) SHA1(e9b2068246228968cc6b8554215563cacaa5ba9f) )
506
507 /* sound program */
508 ROM_REGION( 0x010000, REGION_CPU2, 0 )
509 ROM_LOAD("222a10.5e", 0x000000, 0x08000, CRC(1c93e30a) SHA1(8545a0ac5126b3c855e1901b186f57820699895d) )
510
511 /* tiles */
512 ROM_REGION( 0x400000, REGION_GFX1, 0)
513 ROM_LOAD( "222a01.27c", 0x000000, 0x200000, CRC(9fce4ed4) SHA1(81e19375b351ee247f066434dd595149333d73c5) )
514 ROM_LOAD( "222a02.27e", 0x200000, 0x200000, CRC(651acaa5) SHA1(33942a90fb294b5da6a48e5bfb741b31babca188) )
515
516 /* sprites */
517 ROM_REGION( 0x800000, REGION_GFX2, 0)
518 ROM_LOAD64_WORD( "222a04.3j", 0x000000, 0x200000, CRC(2533b95a) SHA1(35910836b6030130d742eae6c4bf1cdf1ff43fa4) )
519 ROM_LOAD64_WORD( "222a05.1j", 0x000002, 0x200000, CRC(731b7f93) SHA1(b676fff2ede5aa72c49fe12736cd60766462fe0b) )
520 ROM_LOAD64_WORD( "222a06.3l", 0x000004, 0x200000, CRC(97b767d3) SHA1(3d879c431586da2f88c632ab1a531b4a5ec96939) )
521 ROM_LOAD64_WORD( "222a07.1l", 0x000006, 0x200000, CRC(430bc873) SHA1(ea483195bb7f20ef3df7cfba153e5f6f8d53e5f9) )
522
523 /* K053536 PSAC-2 #1 */
524 ROM_REGION( 0x200000, REGION_GFX3, 0)
525 ROM_LOAD( "222a08.25k", 0x000000, 0x200000, CRC(6410ee1b) SHA1(2296aafd3ba25f63a12130f7b58de53e88f14e92) )
526
527 /* K053536 PSAC-2 #2 */
528 ROM_REGION( 0x200000, REGION_GFX4, 0)
529 ROM_LOAD( "222a09.25l", 0x000000, 0x200000, CRC(f7b3f070) SHA1(50ebd8cfcda292a3df5664de50f9212108d58923) )
530
531 /* sound data */
532 ROM_REGION( 0x40000, REGION_SOUND1, 0)
533 ROM_LOAD( "222a03.7c", 0x000000, 0x40000, CRC(1924467b) SHA1(57922090509bcc63b4783e8f2c5e95afd2090b87) )
534 ROM_END
535
536 ROM_START( dbz2 )
537 /* main program */
538 ROM_REGION( 0x400000, REGION_CPU1, 0)
539 ROM_LOAD16_BYTE( "a9e.9e", 0x000000, 0x80000, CRC(e6a142c9) SHA1(7951c8f7036a67a0cd3260f434654820bf3e603f) )
540 ROM_LOAD16_BYTE( "a9f.9f", 0x000001, 0x80000, CRC(76cac399) SHA1(af6daa1f8b87c861dc62adef5ca029190c3cb9ae) )
541
542 /* sound program */
543 ROM_REGION( 0x010000, REGION_CPU2, 0 )
544 ROM_LOAD("s-001.5e", 0x000000, 0x08000, CRC(154e6d03) SHA1(db15c20982692271f40a733dfc3f2486221cd604) )
545
546 /* tiles */
547 ROM_REGION( 0x400000, REGION_GFX1, 0)
548 ROM_LOAD( "ds-b01.27c", 0x000000, 0x200000, CRC(8dc39972) SHA1(c6e3d4e0ff069e08bdb68e2b0ad24cc7314e4e93) )
549 ROM_LOAD( "ds-b02.27e", 0x200000, 0x200000, CRC(7552f8cd) SHA1(1f3beffe9733b1a18d44b5e8880ff1cc97e7a8ab) )
550
551 /* sprites */
552 ROM_REGION( 0x800000, REGION_GFX2, 0)
553 ROM_LOAD64_WORD( "ds-o01.3j", 0x000000, 0x200000, CRC(d018531f) SHA1(d4082fe28e9f1f3f35aa75b4be650cadf1cef192) )
554 ROM_LOAD64_WORD( "ds-o02.1j", 0x000002, 0x200000, CRC(5a0f1ebe) SHA1(3bb9e1389299dc046a24740ef1a1c543e44b5c37) )
555 ROM_LOAD64_WORD( "ds-o03.3l", 0x000004, 0x200000, CRC(ddc3bef1) SHA1(69638ef53f627a238a12b6c206d57faadf894893) )
556 ROM_LOAD64_WORD( "ds-o04.1l", 0x000006, 0x200000, CRC(b5df6676) SHA1(194cfce460ccd29e2cceec577aae4ec936ae88e5) )
557
558 /* K053536 PSAC-2 #1 */
559 ROM_REGION( 0x400000, REGION_GFX3, 0)
560 ROM_LOAD( "ds-p01.25k", 0x000000, 0x200000, CRC(1c7aad68) SHA1(a5296cf12cec262eede55397ea929965576fea81) )
561 ROM_LOAD( "ds-p02.27k", 0x200000, 0x200000, CRC(e4c3a43b) SHA1(f327f75fe82f8aafd2cfe6bdd3a426418615974b) )
562
563 /* K053536 PSAC-2 #2 */
564 ROM_REGION( 0x400000, REGION_GFX4, 0)
565 ROM_LOAD( "ds-p03.25l", 0x000000, 0x200000, CRC(1eaa671b) SHA1(1875eefc6f2c3fc8feada56bfa6701144e8ef64b) )
566 ROM_LOAD( "ds-p04.27l", 0x200000, 0x200000, CRC(5845ff98) SHA1(73b4c3f439321ce9c462119fe933e7cbda8cd498) )
567
568 /* sound data */
569 ROM_REGION( 0x40000, REGION_SOUND1, 0)
570 ROM_LOAD( "pcm.7c", 0x000000, 0x40000, CRC(b58c884a) SHA1(0e2a7267e9dff29c9af25558081ec9d56629bc43) )
571 ROM_END
572
573
574 static DRIVER_INIT(dbz2)
575 {
576 konami_rom_deinterleave_2(REGION_GFX1);
577 }
578
DRIVER_INIT(dbz)579 static DRIVER_INIT(dbz)
580 {
581 data16_t *ROM;
582
583 konami_rom_deinterleave_2(REGION_GFX1);
584
585 ROM = (data16_t *)memory_region(REGION_CPU1);
586
587 // nop out dbz1's mask rom test
588 // tile ROM test
589 ROM[0x790/2] = 0x4e71;
590 ROM[0x792/2] = 0x4e71;
591 // PSAC2 ROM test
592 ROM[0x982/2] = 0x4e71;
593 ROM[0x984/2] = 0x4e71;
594 ROM[0x986/2] = 0x4e71;
595 ROM[0x988/2] = 0x4e71;
596 ROM[0x98a/2] = 0x4e71;
597 ROM[0x98c/2] = 0x4e71;
598 ROM[0x98e/2] = 0x4e71;
599 ROM[0x990/2] = 0x4e71;
600 }
601
602 GAMEX( 1993, dbz, 0, dbz, dbz, dbz, ROT0, "Banpresto", "Dragonball Z" , GAME_IMPERFECT_GRAPHICS )
603 GAMEX( 1994, dbz2, 0, dbz2, dbz2, dbz2, ROT0, "Banpresto", "Dragonball Z 2 Super Battle" , GAME_IMPERFECT_GRAPHICS )
604