1 /***************************************************************************
2
3 Shanghai 3 (c)1993 Sunsoft (68000 AY8910 OKI6295)
4 Hebereke no Popoon (c)1994 Sunsoft (68000 Z80 YM3438 OKI6295)
5 Blocken (c)1994 KID / Visco (68000 Z80 YM3438 OKI6295)
6
7 These games use the custom blitter GA9201 KA01-0249 (120pin IC)
8
9 driver by Nicola Salmoria
10
11 TODO:
12 shangha3:
13 - The zoom used for the "100" floating score when you remove tiles is very
14 rough.
15 heberpop:
16 - Unknown writes to sound ports 40/41
17 blocken:
18 - incomplete zoom support, and missing rotation support.
19
20 ***************************************************************************/
21
22 #include "driver.h"
23 #include "cpu/z80/z80.h"
24
25
26 extern data16_t *shangha3_ram;
27 extern size_t shangha3_ram_size;
28 extern int shangha3_do_shadows;
29
30 WRITE16_HANDLER( shangha3_flipscreen_w );
31 WRITE16_HANDLER( shangha3_gfxlist_addr_w );
32 WRITE16_HANDLER( shangha3_blitter_go_w );
33 VIDEO_START( shangha3 );
34 VIDEO_UPDATE( shangha3 );
35
36
37
38 /* this looks like a simple protection check */
39 /*
40 write read
41 78 78 -> 0
42 9b 10 -> 1
43 9b 20 -> 3
44 9b 40 -> 7
45 9b 80 -> f
46 08 -> e
47 10 -> c
48 20 -> 8
49 40 -> 0
50 */
READ16_HANDLER(shangha3_prot_r)51 static READ16_HANDLER( shangha3_prot_r )
52 {
53 static int count;
54 static int result[] = { 0x0,0x1,0x3,0x7,0xf,0xe,0xc,0x8,0x0};
55
56 log_cb(RETRO_LOG_DEBUG, LOGPRE "PC %04x: read 20004e\n",activecpu_get_pc());
57
58 return result[count++ % 9];
59 }
WRITE16_HANDLER(shangha3_prot_w)60 static WRITE16_HANDLER( shangha3_prot_w )
61 {
62 log_cb(RETRO_LOG_DEBUG, LOGPRE "PC %04x: write %02x to 20004e\n",activecpu_get_pc(),data);
63 }
64
65
READ16_HANDLER(heberpop_gfxrom_r)66 static READ16_HANDLER( heberpop_gfxrom_r )
67 {
68 UINT8 *ROM = memory_region(REGION_GFX1);
69
70 return ROM[2*offset] | (ROM[2*offset+1] << 8);
71 }
72
73
74
WRITE16_HANDLER(shangha3_coinctrl_w)75 static WRITE16_HANDLER( shangha3_coinctrl_w )
76 {
77 if (ACCESSING_MSB)
78 {
79 coin_lockout_w(0,~data & 0x0400);
80 coin_lockout_w(1,~data & 0x0400);
81 coin_counter_w(0,data & 0x0100);
82 coin_counter_w(1,data & 0x0200);
83 }
84 }
85
WRITE16_HANDLER(heberpop_coinctrl_w)86 static WRITE16_HANDLER( heberpop_coinctrl_w )
87 {
88 if (ACCESSING_LSB)
89 {
90 /* the sound ROM bank is selected by the main CPU! */
91 OKIM6295_set_bank_base(0,(data & 0x08) ? 0x40000 : 0x00000);
92
93 coin_lockout_w(0,~data & 0x04);
94 coin_lockout_w(1,~data & 0x04);
95 coin_counter_w(0,data & 0x01);
96 coin_counter_w(1,data & 0x02);
97 }
98 }
99
100
WRITE16_HANDLER(heberpop_sound_command_w)101 static WRITE16_HANDLER( heberpop_sound_command_w )
102 {
103 if (ACCESSING_LSB)
104 {
105 soundlatch_w(0,data & 0xff);
106 cpu_set_irq_line_and_vector(1,0,HOLD_LINE,0xff); /* RST 38h */
107 }
108 }
109
110
111
MEMORY_READ16_START(shangha3_readmem)112 static MEMORY_READ16_START( shangha3_readmem )
113 { 0x000000, 0x07ffff, MRA16_ROM },
114 { 0x100000, 0x100fff, MRA16_RAM },
115 { 0x200000, 0x200001, input_port_0_word_r },
116 { 0x200002, 0x200003, input_port_1_word_r },
117 { 0x20001e, 0x20001f, AY8910_read_port_0_lsb_r },
118 { 0x20004e, 0x20004f, shangha3_prot_r },
119 { 0x20006e, 0x20006f, OKIM6295_status_0_lsb_r },
120 { 0x300000, 0x30ffff, MRA16_RAM },
121 MEMORY_END
122
123 static MEMORY_WRITE16_START( shangha3_writemem )
124 { 0x000000, 0x07ffff, MWA16_ROM },
125 { 0x100000, 0x100fff, paletteram16_RRRRRGGGGGBBBBBx_word_w, &paletteram16 },
126 { 0x200008, 0x200009, shangha3_blitter_go_w },
127 { 0x20000a, 0x20000b, MWA16_NOP }, /* irq ack? */
128 { 0x20000c, 0x20000d, shangha3_coinctrl_w },
129 { 0x20002e, 0x20002f, AY8910_write_port_0_lsb_w },
130 { 0x20003e, 0x20003f, AY8910_control_port_0_lsb_w },
131 { 0x20004e, 0x20004f, shangha3_prot_w },
132 { 0x20006e, 0x20006f, OKIM6295_data_0_lsb_w },
133 { 0x300000, 0x30ffff, MWA16_RAM, &shangha3_ram, &shangha3_ram_size }, /* gfx & work ram */
134 { 0x340000, 0x340001, shangha3_flipscreen_w },
135 { 0x360000, 0x360001, shangha3_gfxlist_addr_w },
136 MEMORY_END
137
138
139 static MEMORY_READ16_START( heberpop_readmem )
140 { 0x000000, 0x0fffff, MRA16_ROM },
141 { 0x100000, 0x100fff, MRA16_RAM },
142 { 0x200000, 0x200001, input_port_0_word_r },
143 { 0x200002, 0x200003, input_port_1_word_r },
144 { 0x200004, 0x200005, input_port_2_word_r },
145 { 0x300000, 0x30ffff, MRA16_RAM },
146 { 0x800000, 0xb7ffff, heberpop_gfxrom_r },
147 MEMORY_END
148
149 static MEMORY_WRITE16_START( heberpop_writemem )
150 { 0x000000, 0x0fffff, MWA16_ROM },
151 { 0x100000, 0x100fff, paletteram16_RRRRRGGGGGBBBBBx_word_w, &paletteram16 },
152 { 0x200008, 0x200009, shangha3_blitter_go_w },
153 { 0x20000a, 0x20000b, MWA16_NOP }, /* irq ack? */
154 { 0x20000c, 0x20000d, heberpop_coinctrl_w },
155 { 0x20000e, 0x20000f, heberpop_sound_command_w },
156 { 0x300000, 0x30ffff, MWA16_RAM, &shangha3_ram, &shangha3_ram_size }, /* gfx & work ram */
157 { 0x340000, 0x340001, shangha3_flipscreen_w },
158 { 0x360000, 0x360001, shangha3_gfxlist_addr_w },
159 MEMORY_END
160
161 static MEMORY_READ16_START( blocken_readmem )
162 { 0x000000, 0x0fffff, MRA16_ROM },
163 { 0x100000, 0x100001, input_port_0_word_r },
164 { 0x100002, 0x100003, input_port_1_word_r },
165 { 0x100004, 0x100005, input_port_2_word_r },
166 { 0x200000, 0x200fff, MRA16_RAM },
167 { 0x300000, 0x30ffff, MRA16_RAM },
168 { 0x800000, 0xb7ffff, heberpop_gfxrom_r },
169 MEMORY_END
170
171 static MEMORY_WRITE16_START( blocken_writemem )
172 { 0x000000, 0x0fffff, MWA16_ROM },
173 { 0x100008, 0x100009, shangha3_blitter_go_w },
174 { 0x10000a, 0x10000b, MWA16_NOP }, /* irq ack? */
175 { 0x10000c, 0x10000d, heberpop_coinctrl_w },
176 { 0x10000e, 0x10000f, heberpop_sound_command_w },
177 { 0x200000, 0x200fff, paletteram16_RRRRRGGGGGBBBBBx_word_w, &paletteram16 },
178 { 0x300000, 0x30ffff, MWA16_RAM, &shangha3_ram, &shangha3_ram_size }, /* gfx & work ram */
179 { 0x340000, 0x340001, shangha3_flipscreen_w },
180 { 0x360000, 0x360001, shangha3_gfxlist_addr_w },
181 MEMORY_END
182
183
184 static MEMORY_READ_START( heberpop_sound_readmem )
185 { 0x0000, 0xf7ff, MRA_ROM },
186 { 0xf800, 0xffff, MRA_RAM },
187 MEMORY_END
188
189 static MEMORY_WRITE_START( heberpop_sound_writemem )
190 { 0x0000, 0xf7ff, MWA_ROM },
191 { 0xf800, 0xffff, MWA_RAM },
192 MEMORY_END
193
194 static PORT_READ_START( heberpop_sound_readport )
195 { 0x00, 0x00, YM2612_status_port_0_A_r },
196 { 0x80, 0x80, OKIM6295_status_0_r },
197 { 0xc0, 0xc0, soundlatch_r },
198 PORT_END
199
200 static PORT_WRITE_START( heberpop_sound_writeport )
201 { 0x00, 0x00, YM2612_control_port_0_A_w },
202 { 0x01, 0x01, YM2612_data_port_0_A_w },
203 { 0x02, 0x02, YM2612_control_port_0_B_w },
204 { 0x03, 0x03, YM2612_data_port_0_B_w },
205 { 0x80, 0x80, OKIM6295_data_0_w },
206 PORT_END
207
208
209
210 INPUT_PORTS_START( shangha3 )
211 PORT_START
212 PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
213 PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER1 )
214 PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER1 )
215 PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER1 )
216 PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
217 PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
218 PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
219 PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
220 PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
221 PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
222 PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
223 PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
224 PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
225 PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
226 PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
227 PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
228
229 PORT_START
230 PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
231 PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
232 PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
233 PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1 )
234 PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START2 )
235 PORT_BITX(0x0020, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
236 PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
237 PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_VBLANK )
238
239 PORT_START
240 PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
241 PORT_DIPSETTING( 0x01, "Easy" )
242 PORT_DIPSETTING( 0x03, "Normal" )
243 PORT_DIPSETTING( 0x02, "Hard" )
244 PORT_DIPSETTING( 0x00, "Hardest" )
245 PORT_DIPNAME( 0x0c, 0x0c, "Base Time" )
246 PORT_DIPSETTING( 0x04, "70 sec" )
247 PORT_DIPSETTING( 0x0c, "80 sec" )
248 PORT_DIPSETTING( 0x08, "90 sec" )
249 PORT_DIPSETTING( 0x00, "100 sec" )
250 PORT_DIPNAME( 0x30, 0x30, "Additional Time" )
251 PORT_DIPSETTING( 0x10, "4 sec" )
252 PORT_DIPSETTING( 0x30, "5 sec" )
253 PORT_DIPSETTING( 0x20, "6 sec" )
254 PORT_DIPSETTING( 0x00, "7 sec" )
255 PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
256 PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
257 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
258 PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) )
259 PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
260 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
261
262 PORT_START
263 PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
264 PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) )
265 PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) )
266 PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) )
267 PORT_DIPSETTING( 0x06, DEF_STR( 2C_1C ) )
268 PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) )
269 PORT_DIPSETTING( 0x03, DEF_STR( 1C_2C ) )
270 PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) )
271 PORT_DIPSETTING( 0x01, DEF_STR( 1C_4C ) )
272 PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) )
273 PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) )
274 PORT_DIPSETTING( 0x20, DEF_STR( 4C_1C ) )
275 PORT_DIPSETTING( 0x10, DEF_STR( 3C_1C ) )
276 PORT_DIPSETTING( 0x30, DEF_STR( 2C_1C ) )
277 PORT_DIPSETTING( 0x38, DEF_STR( 1C_1C ) )
278 PORT_DIPSETTING( 0x18, DEF_STR( 1C_2C ) )
279 PORT_DIPSETTING( 0x28, DEF_STR( 1C_3C ) )
280 PORT_DIPSETTING( 0x08, DEF_STR( 1C_4C ) )
281 PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
282 PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
283 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
284 PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
285 PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
286 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
287 INPUT_PORTS_END
288
289 INPUT_PORTS_START( heberpop )
290 PORT_START
291 PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
292 PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER1 )
293 PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER1 )
294 PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER1 )
295 PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
296 PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
297 PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
298 PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_VBLANK ) /* vblank?? has to toggle */
299 PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
300 PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
301 PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
302 PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
303 PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
304 PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
305 PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
306 PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_VBLANK ) /* vblank?? has to toggle */
307
308 PORT_START
309 PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
310 PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
311 PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
312 PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1 )
313 PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START2 )
314 PORT_BITX(0x0020, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
315 PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
316 PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
317
318 PORT_START
319 PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )
320 PORT_DIPSETTING( 0x0002, "Very Easy" )
321 PORT_DIPSETTING( 0x0001, "Easy" )
322 PORT_DIPSETTING( 0x0003, "Normal" )
323 PORT_DIPSETTING( 0x0000, "Hard" )
324 PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
325 PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
326 PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
327 PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
328 PORT_DIPSETTING( 0x0008, DEF_STR( Off ) )
329 PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
330 PORT_DIPNAME( 0x0010, 0x0010, "Allow Diagonal Moves" )
331 PORT_DIPSETTING( 0x0000, DEF_STR( No ) )
332 PORT_DIPSETTING( 0x0010, DEF_STR( Yes ) )
333 PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) )
334 PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
335 PORT_DIPSETTING( 0x0020, DEF_STR( On ) )
336 PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) )
337 PORT_DIPSETTING( 0x0040, DEF_STR( Off ) )
338 PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
339 PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
340 PORT_DIPSETTING( 0x0080, DEF_STR( Off ) )
341 PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
342 PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coin_A ) )
343 PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) )
344 PORT_DIPSETTING( 0x0400, DEF_STR( 4C_1C ) )
345 PORT_DIPSETTING( 0x0200, DEF_STR( 3C_1C ) )
346 PORT_DIPSETTING( 0x0600, DEF_STR( 2C_1C ) )
347 PORT_DIPSETTING( 0x0700, DEF_STR( 1C_1C ) )
348 PORT_DIPSETTING( 0x0300, DEF_STR( 1C_2C ) )
349 PORT_DIPSETTING( 0x0500, DEF_STR( 1C_3C ) )
350 PORT_DIPSETTING( 0x0100, DEF_STR( 1C_4C ) )
351 PORT_DIPNAME( 0x3800, 0x3800, DEF_STR( Coin_B ) )
352 PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) )
353 PORT_DIPSETTING( 0x2000, DEF_STR( 4C_1C ) )
354 PORT_DIPSETTING( 0x1000, DEF_STR( 3C_1C ) )
355 PORT_DIPSETTING( 0x3000, DEF_STR( 2C_1C ) )
356 PORT_DIPSETTING( 0x3800, DEF_STR( 1C_1C ) )
357 PORT_DIPSETTING( 0x1800, DEF_STR( 1C_2C ) )
358 PORT_DIPSETTING( 0x2800, DEF_STR( 1C_3C ) )
359 PORT_DIPSETTING( 0x0800, DEF_STR( 1C_4C ) )
360 PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) )
361 PORT_DIPSETTING( 0x4000, DEF_STR( Off ) )
362 PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
363 PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) )
364 PORT_DIPSETTING( 0x8000, DEF_STR( Off ) )
365 PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
366 INPUT_PORTS_END
367
368 INPUT_PORTS_START( blocken )
369 PORT_START
370 PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
371 PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER1 )
372 PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER1 )
373 PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER1 )
374 PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
375 PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
376 PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
377 PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_VBLANK ) /* vblank?? has to toggle */
378 PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
379 PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_PLAYER2 )
380 PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_PLAYER2 )
381 PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_PLAYER2 )
382 PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
383 PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
384 PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
385 PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_VBLANK ) /* vblank?? has to toggle */
386
387 PORT_START
388 PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
389 PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
390 PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
391 PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1 )
392 PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START2 )
393 PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE ) /* keeping this pressed on boot generates "BAD DIPSW" */
394 PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
395 PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
396
397 PORT_START
398 PORT_SERVICE( 0x0001, IP_ACTIVE_LOW )
399 PORT_DIPNAME( 0x0006, 0x0006, DEF_STR( Difficulty ) )
400 PORT_DIPSETTING( 0x0004, "Easy" )
401 PORT_DIPSETTING( 0x0006, "Normal" )
402 PORT_DIPSETTING( 0x0002, "Hard" )
403 PORT_DIPSETTING( 0x0000, "Very Hard" )
404 PORT_DIPNAME( 0x0008, 0x0008, "Game Type" )
405 PORT_DIPSETTING( 0x0008, "A" )
406 PORT_DIPSETTING( 0x0000, "B" )
407 PORT_DIPNAME( 0x0030, 0x0030, "Players" )
408 PORT_DIPSETTING( 0x0030, "1" )
409 PORT_DIPSETTING( 0x0020, "2" )
410 PORT_DIPSETTING( 0x0010, "3" )
411 PORT_DIPSETTING( 0x0000, "4" )
412 PORT_DIPNAME( 0x0040, 0x0000, DEF_STR( Demo_Sounds ) )
413 PORT_DIPSETTING( 0x0040, DEF_STR( Off ) )
414 PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
415 PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) )
416 PORT_DIPSETTING( 0x0080, DEF_STR( Off ) )
417 PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
418 PORT_DIPNAME( 0x0f00, 0x0f00, DEF_STR( Coin_A ) )
419 PORT_DIPSETTING( 0x0200, DEF_STR( 4C_1C ) )
420 PORT_DIPSETTING( 0x0500, DEF_STR( 3C_1C ) )
421 PORT_DIPSETTING( 0x0800, DEF_STR( 2C_1C ) )
422 PORT_DIPSETTING( 0x0400, DEF_STR( 3C_2C ) )
423 PORT_DIPSETTING( 0x0100, DEF_STR( 4C_3C ) )
424 PORT_DIPSETTING( 0x0f00, DEF_STR( 1C_1C ) )
425 PORT_DIPSETTING( 0x0300, DEF_STR( 3C_4C ) )
426 PORT_DIPSETTING( 0x0700, DEF_STR( 2C_3C ) )
427 PORT_DIPSETTING( 0x0e00, DEF_STR( 1C_2C ) )
428 PORT_DIPSETTING( 0x0600, DEF_STR( 2C_5C ) )
429 PORT_DIPSETTING( 0x0d00, DEF_STR( 1C_3C ) )
430 PORT_DIPSETTING( 0x0c00, DEF_STR( 1C_4C ) )
431 PORT_DIPSETTING( 0x0b00, DEF_STR( 1C_5C ) )
432 PORT_DIPSETTING( 0x0a00, DEF_STR( 1C_6C ) )
433 PORT_DIPSETTING( 0x0900, DEF_STR( 1C_7C ) )
434 PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
435 PORT_DIPNAME( 0xf000, 0xf000, DEF_STR( Coin_B ) )
436 PORT_DIPSETTING( 0x2000, DEF_STR( 4C_1C ) )
437 PORT_DIPSETTING( 0x5000, DEF_STR( 3C_1C ) )
438 PORT_DIPSETTING( 0x8000, DEF_STR( 2C_1C ) )
439 PORT_DIPSETTING( 0x0000, DEF_STR( 5C_3C ) )
440 PORT_DIPSETTING( 0x4000, DEF_STR( 3C_2C ) )
441 PORT_DIPSETTING( 0x1000, DEF_STR( 4C_3C ) )
442 PORT_DIPSETTING( 0xf000, DEF_STR( 1C_1C ) )
443 PORT_DIPSETTING( 0x3000, DEF_STR( 3C_4C ) )
444 PORT_DIPSETTING( 0x7000, DEF_STR( 2C_3C ) )
445 PORT_DIPSETTING( 0xe000, DEF_STR( 1C_2C ) )
446 PORT_DIPSETTING( 0x6000, DEF_STR( 2C_5C ) )
447 PORT_DIPSETTING( 0xd000, DEF_STR( 1C_3C ) )
448 PORT_DIPSETTING( 0xc000, DEF_STR( 1C_4C ) )
449 PORT_DIPSETTING( 0xb000, DEF_STR( 1C_5C ) )
450 PORT_DIPSETTING( 0xa000, DEF_STR( 1C_6C ) )
451 PORT_DIPSETTING( 0x9000, DEF_STR( 1C_7C ) )
452 INPUT_PORTS_END
453
454
455
456 static struct GfxLayout charlayout =
457 {
458 16,16,
459 RGN_FRAC(1,1),
460 4,
461 { 0, 1, 2, 3 },
462 { 1*4, 0*4, 3*4, 2*4, 5*4, 4*4, 7*4, 6*4,
463 9*4, 8*4, 11*4, 10*4, 13*4, 12*4, 15*4, 14*4 },
464 { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64,
465 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
466 128*8
467 };
468
469 static struct GfxDecodeInfo gfxdecodeinfo[] =
470 {
471 { REGION_GFX1, 0, &charlayout, 0, 128 },
472 { -1 } /* end of array */
473 };
474
475
476
477 static struct AY8910interface ay8910_interface =
478 {
479 1, /* 1 chip */
480 1500000, /* 1.5 MHz */
481 { 30 },
482 { input_port_3_r },
483 { input_port_2_r },
484 { 0 },
485 { 0 }
486 };
487
irqhandler(int linestate)488 static void irqhandler(int linestate)
489 {
490 cpu_set_nmi_line(1,linestate);
491 }
492
493 static struct YM2612interface ym3438_interface =
494 {
495 1, /* 1 chip */
496 8000000, /* 8 MHz ?? */
497 { YM3012_VOL(40,MIXER_PAN_CENTER,40,MIXER_PAN_CENTER) }, /* Volume */
498 { 0 },
499 { 0 },
500 { 0 },
501 { 0 },
502 { irqhandler }
503 };
504
505 static struct OKIM6295interface okim6295_interface =
506 {
507 1, /* 1 chip */
508 { 8000 }, /* 8000Hz frequency ??? */
509 { REGION_SOUND1 }, /* memory region */
510 { 100 }
511 };
512
513
514
515 static MACHINE_DRIVER_START( shangha3 )
516
517 /* basic machine hardware */
518 MDRV_CPU_ADD(M68000, 16000000) /* 16 MHz ??? */
MDRV_CPU_MEMORY(shangha3_readmem,shangha3_writemem)519 MDRV_CPU_MEMORY(shangha3_readmem,shangha3_writemem)
520 MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
521
522 MDRV_FRAMES_PER_SECOND(60)
523 MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
524
525 /* video hardware */
526 MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_HAS_SHADOWS )
527 MDRV_SCREEN_SIZE(24*16, 16*16)
528 MDRV_VISIBLE_AREA(0*16, 24*16-1, 1*16, 15*16-1)
529 MDRV_GFXDECODE(gfxdecodeinfo)
530 MDRV_PALETTE_LENGTH(2048)
531
532 MDRV_VIDEO_START(shangha3)
533 MDRV_VIDEO_UPDATE(shangha3)
534
535 /* sound hardware */
536 MDRV_SOUND_ADD(AY8910, ay8910_interface)
537 MDRV_SOUND_ADD(OKIM6295, okim6295_interface)
538 MACHINE_DRIVER_END
539
540
541 static MACHINE_DRIVER_START( heberpop )
542
543 /* basic machine hardware */
544 MDRV_CPU_ADD(M68000, 16000000) /* 16 MHz ??? */
545 MDRV_CPU_MEMORY(heberpop_readmem,heberpop_writemem)
546 MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
547
548 MDRV_CPU_ADD(Z80, 6000000) /* 6 MHz ??? */
549 MDRV_CPU_MEMORY(heberpop_sound_readmem,heberpop_sound_writemem)
550 MDRV_CPU_PORTS(heberpop_sound_readport,heberpop_sound_writeport)
551 /* NMI triggered by YM3438 */
552 MDRV_FRAMES_PER_SECOND(60)
553 MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
554
555 /* video hardware */
556 MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_HAS_SHADOWS )
557 MDRV_SCREEN_SIZE(24*16, 16*16)
558 MDRV_VISIBLE_AREA(0*16, 24*16-1, 1*16, 15*16-1)
559 MDRV_GFXDECODE(gfxdecodeinfo)
560 MDRV_PALETTE_LENGTH(2048)
561
562 MDRV_VIDEO_START(shangha3)
563 MDRV_VIDEO_UPDATE(shangha3)
564
565 /* sound hardware */
566 MDRV_SOUND_ADD(YM3438, ym3438_interface)
567 MDRV_SOUND_ADD(OKIM6295, okim6295_interface)
568 MACHINE_DRIVER_END
569
570
571 static MACHINE_DRIVER_START( blocken )
572
573 /* basic machine hardware */
574 MDRV_CPU_ADD(M68000, 16000000) /* 16 MHz ??? */
575 MDRV_CPU_MEMORY(blocken_readmem,blocken_writemem)
576 MDRV_CPU_VBLANK_INT(irq4_line_hold,1)
577
578 MDRV_CPU_ADD(Z80, 6000000) /* 6 MHz ??? */
579 MDRV_CPU_MEMORY(heberpop_sound_readmem,heberpop_sound_writemem)
580 MDRV_CPU_PORTS(heberpop_sound_readport,heberpop_sound_writeport)
581 /* NMI triggered by YM3438 */
582 MDRV_FRAMES_PER_SECOND(60)
583 MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
584
585 /* video hardware */
586 MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER | VIDEO_HAS_SHADOWS)
587 MDRV_SCREEN_SIZE(24*16, 16*16)
588 MDRV_VISIBLE_AREA(0*16, 24*16-1, 1*16, 15*16-1)
589 MDRV_GFXDECODE(gfxdecodeinfo)
590 MDRV_PALETTE_LENGTH(2048)
591
592 MDRV_VIDEO_START(shangha3)
593 MDRV_VIDEO_UPDATE(shangha3)
594
595 /* sound hardware */
596 MDRV_SOUND_ADD(YM3438, ym3438_interface)
597 MDRV_SOUND_ADD(OKIM6295, okim6295_interface)
598 MACHINE_DRIVER_END
599
600
601
602 /***************************************************************************
603
604 Game driver(s)
605
606 ***************************************************************************/
607
608 ROM_START( shangha3 )
609 ROM_REGION( 0x80000, REGION_CPU1, 0 )
610 ROM_LOAD16_BYTE( "s3j_ic3.v11", 0x0000, 0x40000, CRC(e98ce9c8) SHA1(359e117aebb644d7b235add7e71ed6891243d451) )
611 ROM_LOAD16_BYTE( "s3j_ic2.v11", 0x0001, 0x40000, CRC(09174620) SHA1(1d1639c07895f715facfe153fbdb6ae0f3cdd876) )
612
613 ROM_REGION( 0x200000, REGION_GFX1, ROMREGION_DISPOSE )
614 ROM_LOAD( "s3j_ic43.chr", 0x0000, 0x200000, CRC(2dbf9d17) SHA1(dd94ddc4bb02ab544aa3f89b614afc46678cc48d) )
615
616 ROM_REGION( 0x40000, REGION_SOUND1, 0 ) /* samples for M6295 */
617 ROM_LOAD( "s3j_ic75.v10", 0x0000, 0x40000, CRC(f0cdc86a) SHA1(b1017a9841a56e0f5d2714f550f64ed1f4e238e6) )
618 ROM_END
619
620 ROM_START( heberpop )
621 ROM_REGION( 0x100000, REGION_CPU1, 0 )
622 ROM_LOAD16_BYTE( "hbpic31.bin", 0x0000, 0x80000, CRC(c430d264) SHA1(4be12b1fa90da09047db3a31171ffda8ab8bd851) )
623 ROM_LOAD16_BYTE( "hbpic32.bin", 0x0001, 0x80000, CRC(bfa555a8) SHA1(754f581554022b98ba8e78ee96f846faa2cedc69) )
624
625 ROM_REGION( 0x10000, REGION_CPU2, 0 )
626 ROM_LOAD( "hbpic34.bin", 0x0000, 0x10000, CRC(0cf056c6) SHA1(9992cd3879d9a57fcb784fc1e11d6b6d87e5a366) )
627
628 ROM_REGION( 0x380000, REGION_GFX1, 0 ) /* don't dispose, read during tests */
629 ROM_LOAD( "hbpic98.bin", 0x000000, 0x80000, CRC(a599100a) SHA1(f2e517256a42b3fa4a047bbe742d714f568cc117) )
630 ROM_LOAD( "hbpic99.bin", 0x080000, 0x80000, CRC(fb8bb12f) SHA1(78c1fec1371d312e113d92803dd59acc36604989) )
631 ROM_LOAD( "hbpic100.bin", 0x100000, 0x80000, CRC(05a0f765) SHA1(4f44cf367c3697eb6c245297c9d05160d7d94e24) )
632 ROM_LOAD( "hbpic101.bin", 0x180000, 0x80000, CRC(151ba025) SHA1(b6ebe60872957a2625e666d53a5a4bc941a1f21c) )
633 ROM_LOAD( "hbpic102.bin", 0x200000, 0x80000, CRC(2b5e341a) SHA1(c7ad2dafb3433296c117978434e1699290267891) )
634 ROM_LOAD( "hbpic103.bin", 0x280000, 0x80000, CRC(efa0e745) SHA1(fc1d52d35b3c902d8b25403b0e13f86a04039bc4) )
635 ROM_LOAD( "hbpic104.bin", 0x300000, 0x80000, CRC(bb896bbb) SHA1(4311876628beb82cbacdab4d055c3738e74241b0) )
636
637 ROM_REGION( 0x80000, REGION_SOUND1, 0 ) /* samples for M6295 */
638 ROM_LOAD( "hbpic53.bin", 0x0000, 0x80000, CRC(a4483aa0) SHA1(be301d8ac6d69f5c3fdbcb85bd557090e46da1ff) )
639 ROM_END
640
641 ROM_START( blocken )
642 ROM_REGION( 0x100000, REGION_CPU1, 0 )
643 ROM_LOAD16_BYTE( "ic31j.bin", 0x0000, 0x20000, CRC(ec8de2a3) SHA1(09a6b8c1b656b17ab3d1fc057902487e4f94cf02) )
644 ROM_LOAD16_BYTE( "ic32j.bin", 0x0001, 0x20000, CRC(79b96240) SHA1(c1246bd4b91fa45c581a8fdf90cc6beb85adf8ec) )
645
646 ROM_REGION( 0x10000, REGION_CPU2, 0 )
647 ROM_LOAD( "ic34.bin", 0x0000, 0x10000, CRC(23e446ff) SHA1(82c03b45b337696b0f8293c446544d7ee080d415) )
648
649 ROM_REGION( 0x380000, REGION_GFX1, 0 ) /* don't dispose, read during tests */
650 ROM_LOAD( "ic98j.bin", 0x000000, 0x80000, CRC(35dda273) SHA1(95850d12ca1557c14bc471ddf925aaf423313ff0) )
651 ROM_LOAD( "ic99j.bin", 0x080000, 0x80000, CRC(ce43762b) SHA1(e1c51ea0b54b5febdee127619e15f1cda650cb4c) )
652 /* 100000-1fffff empty */
653 ROM_LOAD( "ic100j.bin", 0x200000, 0x80000, CRC(a34786fd) SHA1(7d4879cbaa055c2ddbe6d20dd946bf0e3e069d4d) )
654 /* 280000-37ffff empty */
655
656 ROM_REGION( 0x80000, REGION_SOUND1, 0 ) /* samples for M6295 */
657 ROM_LOAD( "ic53.bin", 0x0000, 0x80000, CRC(86108c56) SHA1(aa405fa2eec5cc178ef6226f229a12dac09504f0) )
658 ROM_END
659
660
661
662 static DRIVER_INIT( shangha3 )
663 {
664 shangha3_do_shadows = 1;
665 }
DRIVER_INIT(heberpop)666 static DRIVER_INIT( heberpop )
667 {
668 shangha3_do_shadows = 0;
669 }
670
671 GAME( 1993, shangha3, 0, shangha3, shangha3, shangha3, ROT0, "Sunsoft", "Shanghai III (Japan)" )
672 GAME( 1994, heberpop, 0, heberpop, heberpop, heberpop, ROT0, "Sunsoft / Atlus", "Hebereke no Popoon (Japan)" )
673 GAME( 1994, blocken, 0, blocken, blocken, heberpop, ROT0, "KID / Visco", "Blocken (Japan)" )
674