trunk/src/mame/drivers/segas18.c
r241794 | r241795 | |
150 | 150 | m_vdp->set_vdp_pal(FALSE); |
151 | 151 | m_vdp->set_framerate(60); |
152 | 152 | m_vdp->set_total_scanlines(262); |
153 | | m_vdp->stop_timers(); // 315-5124 timers |
| 153 | m_vdp->stop_timers(); // 315-5124 timers |
154 | 154 | |
155 | 155 | // save state |
156 | 156 | save_item(NAME(m_mcu_data)); |
157 | 157 | save_item(NAME(m_lghost_value)); |
158 | 158 | save_item(NAME(m_lghost_select)); |
159 | | save_item(NAME(m_misc_io_data)); |
160 | 159 | save_item(NAME(m_wwally_last_x)); |
161 | 160 | save_item(NAME(m_wwally_last_y)); |
162 | 161 | } |
r241794 | r241795 | |
199 | 198 | * |
200 | 199 | *************************************/ |
201 | 200 | |
202 | | READ16_MEMBER( segas18_state::io_chip_r ) |
| 201 | WRITE8_MEMBER( segas18_state::misc_outputs_w ) |
203 | 202 | { |
204 | | static const char *const portnames[] = { "P1", "P2", "PORTC", "PORTD", "SERVICE", "COINAGE", "DSW", "PORTH" }; |
205 | | offset &= 0x1f/2; |
206 | | |
207 | | switch (offset) |
208 | | { |
209 | | // I/O ports |
210 | | case 0x00/2: |
211 | | case 0x02/2: |
212 | | case 0x04/2: |
213 | | case 0x06/2: |
214 | | case 0x08/2: |
215 | | case 0x0a/2: |
216 | | case 0x0c/2: |
217 | | case 0x0e/2: |
218 | | // if the port is configured as an output, return the last thing written |
219 | | if (m_misc_io_data[0x1e/2] & (1 << offset)) |
220 | | return m_misc_io_data[offset]; |
221 | | |
222 | | // otherwise, return an input port |
223 | | return ioport(portnames[offset])->read(); |
224 | | |
225 | | // 'SEGA' protection |
226 | | case 0x10/2: |
227 | | return 'S'; |
228 | | case 0x12/2: |
229 | | return 'E'; |
230 | | case 0x14/2: |
231 | | return 'G'; |
232 | | case 0x16/2: |
233 | | return 'A'; |
234 | | |
235 | | // CNT register & mirror |
236 | | case 0x18/2: |
237 | | case 0x1c/2: |
238 | | return m_misc_io_data[0x1c/2]; |
239 | | |
240 | | // port direction register & mirror |
241 | | case 0x1a/2: |
242 | | case 0x1e/2: |
243 | | return m_misc_io_data[0x1e/2]; |
244 | | } |
245 | | return 0xffff; |
| 203 | // miscellaneous output |
| 204 | set_grayscale(~data & 0x40); |
| 205 | m_segaic16vid->segaic16_tilemap_set_flip(0, data & 0x20); |
| 206 | m_sprites->set_flip(data & 0x20); |
| 207 | // These are correct according to cgfm's docs, but mwalker and ddcrew both |
| 208 | // enable the lockout and never turn it off |
| 209 | // coin_lockout_w(machine(), 1, data & 0x08); |
| 210 | // coin_lockout_w(machine(), 0, data & 0x04); |
| 211 | coin_counter_w(machine(), 1, data & 0x02); |
| 212 | coin_counter_w(machine(), 0, data & 0x01); |
246 | 213 | } |
247 | 214 | |
248 | 215 | |
249 | | WRITE16_MEMBER( segas18_state::io_chip_w ) |
250 | | { |
251 | | // generic implementation |
252 | | offset &= 0x1f/2; |
253 | | UINT8 old = m_misc_io_data[offset]; |
254 | | m_misc_io_data[offset] = data; |
255 | | |
256 | | switch (offset) |
257 | | { |
258 | | // I/O ports |
259 | | case 0x00/2: |
260 | | case 0x02/2: |
261 | | case 0x04/2: |
262 | | case 0x08/2: |
263 | | case 0x0a/2: |
264 | | case 0x0c/2: |
265 | | if (m_has_guns) |
266 | | { |
267 | | // outputs for lghost only |
268 | | output_set_value("P1_Gun_Recoil",(~data & 0x01)); |
269 | | output_set_value("P2_Gun_Recoil",(~data & 0x02)>>1); |
270 | | output_set_value("P3_Gun_Recoil",(~data & 0x04)>>2); |
271 | | } |
272 | | break; |
273 | | |
274 | | // miscellaneous output |
275 | | case 0x06/2: |
276 | | set_grayscale(~data & 0x40); |
277 | | m_segaic16vid->segaic16_tilemap_set_flip(0, data & 0x20); |
278 | | m_sprites->set_flip(data & 0x20); |
279 | | // These are correct according to cgfm's docs, but mwalker and ddcrew both |
280 | | // enable the lockout and never turn it off |
281 | | // coin_lockout_w(machine(), 1, data & 0x08); |
282 | | // coin_lockout_w(machine(), 0, data & 0x04); |
283 | | coin_counter_w(machine(), 1, data & 0x02); |
284 | | coin_counter_w(machine(), 0, data & 0x01); |
285 | | break; |
286 | | |
287 | | // tile banking |
288 | | case 0x0e/2: |
289 | | if (m_romboard == ROM_BOARD_171_5874 || m_romboard == ROM_BOARD_171_SHADOW) |
290 | | for (int i = 0; i < 4; i++) |
291 | | { |
292 | | m_segaic16vid->segaic16_tilemap_set_bank(0, 0 + i, (data & 0xf) * 4 + i); |
293 | | m_segaic16vid->segaic16_tilemap_set_bank(0, 4 + i, ((data >> 4) & 0xf) * 4 + i); |
294 | | } |
295 | | break; |
296 | | |
297 | | // CNT register |
298 | | case 0x1c/2: |
299 | | m_segaic16vid->segaic16_set_display_enable(data & 2); |
300 | | if ((old ^ data) & 4) |
301 | | set_vdp_enable(data & 4); |
302 | | break; |
303 | | } |
304 | | } |
305 | | |
306 | | |
307 | 216 | READ16_MEMBER( segas18_state::misc_io_r ) |
308 | 217 | { |
309 | | static const char *const portnames[] = { "SERVICE", "COINAGE" }; |
310 | | |
311 | 218 | offset &= 0x1fff; |
312 | | |
313 | 219 | switch (offset & (0x3000/2)) |
314 | 220 | { |
315 | 221 | // I/O chip |
316 | 222 | case 0x0000/2: |
317 | 223 | case 0x1000/2: |
318 | | return io_chip_r(space, offset, mem_mask); |
| 224 | return m_io->read(space, offset) | (open_bus_r(space, 0, mem_mask) & 0xff00); |
319 | 225 | |
320 | 226 | // video control latch |
321 | 227 | case 0x2000/2: |
| 228 | { |
| 229 | static const char *const portnames[] = { "SERVICE", "COINAGE" }; |
322 | 230 | return ioport(portnames[offset & 1])->read(); |
| 231 | } |
323 | 232 | } |
| 233 | |
324 | 234 | if (!m_custom_io_r.isnull()) |
325 | 235 | return m_custom_io_r(space, offset, mem_mask); |
326 | 236 | logerror("%06X:misc_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2); |
327 | 237 | return open_bus_r(space, 0, mem_mask); |
328 | 238 | } |
329 | 239 | |
330 | | |
331 | 240 | WRITE16_MEMBER( segas18_state::misc_io_w ) |
332 | 241 | { |
333 | 242 | offset &= 0x1fff; |
r241794 | r241795 | |
338 | 247 | case 0x1000/2: |
339 | 248 | if (ACCESSING_BITS_0_7) |
340 | 249 | { |
341 | | io_chip_w(space, offset, data, mem_mask); |
| 250 | m_io->write(space, offset, data); |
342 | 251 | return; |
343 | 252 | } |
344 | 253 | break; |
r241794 | r241795 | |
352 | 261 | } |
353 | 262 | break; |
354 | 263 | } |
| 264 | |
355 | 265 | if (!m_custom_io_w.isnull()) |
356 | 266 | { |
357 | 267 | m_custom_io_w(space, offset, data, mem_mask); |
r241794 | r241795 | |
368 | 278 | * |
369 | 279 | *************************************/ |
370 | 280 | |
| 281 | WRITE8_MEMBER( segas18_state::rom_5874_bank_w ) |
| 282 | { |
| 283 | if (m_romboard == ROM_BOARD_171_5874 || m_romboard == ROM_BOARD_171_SHADOW) |
| 284 | { |
| 285 | for (int i = 0; i < 4; i++) |
| 286 | { |
| 287 | m_segaic16vid->segaic16_tilemap_set_bank(0, 0 + i, (data & 0xf) * 4 + i); |
| 288 | m_segaic16vid->segaic16_tilemap_set_bank(0, 4 + i, ((data >> 4) & 0xf) * 4 + i); |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | |
371 | 294 | WRITE16_MEMBER( segas18_state::rom_5987_bank_w ) |
372 | 295 | { |
373 | 296 | if (!ACCESSING_BITS_0_7) |
374 | 297 | return; |
| 298 | |
375 | 299 | offset &= 0xf; |
376 | 300 | data &= 0xff; |
377 | 301 | |
r241794 | r241795 | |
406 | 330 | // tile banking |
407 | 331 | if (offset < 8) |
408 | 332 | { |
409 | | // int maxbanks = m_gfxdecode->gfx(0)->elements() / 1024; |
410 | 333 | data &= 0x9f; |
411 | 334 | |
412 | 335 | if (data & 0x80) data += 0x20; |
r241794 | r241795 | |
435 | 358 | switch (offset) |
436 | 359 | { |
437 | 360 | case 0x3020/2: |
438 | | return ioport("P3")->read(); |
| 361 | return ioport("EXP3")->read(); |
439 | 362 | |
440 | 363 | case 0x3022/2: |
441 | | return ioport("P4")->read(); |
| 364 | return ioport("EXP4")->read(); |
442 | 365 | |
443 | 366 | case 0x3024/2: |
444 | | return ioport("P34START")->read(); |
| 367 | return ioport("EXSERVICE")->read(); |
445 | 368 | } |
446 | 369 | return open_bus_r(space, 0, mem_mask); |
447 | 370 | } |
r241794 | r241795 | |
470 | 393 | return open_bus_r(space, 0, mem_mask); |
471 | 394 | } |
472 | 395 | |
473 | | |
474 | 396 | WRITE16_MEMBER( segas18_state::lghost_custom_io_w ) |
475 | 397 | { |
476 | 398 | switch (offset) |
r241794 | r241795 | |
498 | 420 | } |
499 | 421 | |
500 | 422 | |
| 423 | WRITE8_MEMBER( segas18_state::lghost_gun_recoil_w ) |
| 424 | { |
| 425 | output_set_value("P1_Gun_Recoil", (~data & 0x01)); |
| 426 | output_set_value("P2_Gun_Recoil", (~data & 0x02)>>1); |
| 427 | output_set_value("P3_Gun_Recoil", (~data & 0x04)>>2); |
| 428 | } |
501 | 429 | |
| 430 | |
| 431 | |
502 | 432 | /************************************* |
503 | 433 | * |
504 | 434 | * Where's Wally Custom I/O |
r241794 | r241795 | |
575 | 505 | m_mcu->set_input_line(MCS51_INT1_LINE, HOLD_LINE); |
576 | 506 | } |
577 | 507 | |
578 | | /************************************* |
579 | | * |
580 | | * VDP memory handlers |
581 | | * |
582 | | *************************************/ |
583 | 508 | |
584 | | READ16_MEMBER( segas18_state::genesis_vdp_r ) |
585 | | { |
586 | | return m_vdp->vdp_r(space, offset, mem_mask); |
587 | | } |
588 | 509 | |
589 | | WRITE16_MEMBER( segas18_state::genesis_vdp_w ) |
590 | | { |
591 | | m_vdp->vdp_w(space, offset, data, mem_mask); |
592 | | } |
593 | | |
594 | | |
595 | | |
596 | 510 | /************************************* |
597 | 511 | * |
598 | 512 | * Main CPU memory handlers |
r241794 | r241795 | |
681 | 595 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL |
682 | 596 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL |
683 | 597 | |
684 | | PORT_START("PORTC") |
| 598 | PORT_START("P3") |
685 | 599 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
686 | 600 | |
687 | | PORT_START("PORTD") |
688 | | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
689 | | |
690 | 601 | PORT_START("SERVICE") |
691 | 602 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) |
692 | 603 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) |
r241794 | r241795 | |
709 | 620 | PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW2:6" ) |
710 | 621 | PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW2:7" ) |
711 | 622 | PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:8" ) |
712 | | |
713 | | PORT_START("PORTH") |
714 | | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
715 | 623 | INPUT_PORTS_END |
716 | 624 | |
717 | 625 | |
r241794 | r241795 | |
725 | 633 | static INPUT_PORTS_START( astorm ) |
726 | 634 | PORT_INCLUDE( system18_generic ) |
727 | 635 | |
728 | | PORT_MODIFY("PORTC") |
| 636 | PORT_MODIFY("P3") |
729 | 637 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) |
730 | 638 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) |
731 | 639 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) |
r241794 | r241795 | |
877 | 785 | PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) |
878 | 786 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
879 | 787 | |
880 | | PORT_START("P3") |
| 788 | PORT_START("EXP3") |
881 | 789 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) |
882 | 790 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) |
883 | 791 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) |
r241794 | r241795 | |
887 | 795 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) |
888 | 796 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) |
889 | 797 | |
890 | | PORT_START("P4") |
| 798 | PORT_START("EXP4") |
891 | 799 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) |
892 | 800 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) |
893 | 801 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4) |
r241794 | r241795 | |
897 | 805 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4) |
898 | 806 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4) |
899 | 807 | |
900 | | PORT_START("P34START") |
| 808 | PORT_START("EXSERVICE") |
901 | 809 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START3 ) |
902 | 810 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START4 ) |
903 | 811 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) // individual mode |
r241794 | r241795 | |
936 | 844 | static INPUT_PORTS_START( ddcrew3p ) |
937 | 845 | PORT_INCLUDE( ddcrew2p ) |
938 | 846 | |
939 | | PORT_MODIFY("PORTC") |
| 847 | PORT_MODIFY("P3") |
940 | 848 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) |
941 | 849 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) |
942 | 850 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) |
r241794 | r241795 | |
955 | 863 | static INPUT_PORTS_START( desertbr ) |
956 | 864 | PORT_INCLUDE( system18_generic ) |
957 | 865 | |
958 | | PORT_MODIFY("PORTC") |
| 866 | PORT_MODIFY("P3") |
959 | 867 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) |
960 | 868 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) |
961 | 869 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) |
r241794 | r241795 | |
1101 | 1009 | static INPUT_PORTS_START( mwalk ) |
1102 | 1010 | PORT_INCLUDE( system18_generic ) |
1103 | 1011 | |
1104 | | PORT_MODIFY("PORTC") |
| 1012 | PORT_MODIFY("P3") |
1105 | 1013 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) |
1106 | 1014 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) |
1107 | 1015 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) |
r241794 | r241795 | |
1281 | 1189 | |
1282 | 1190 | WRITE_LINE_MEMBER(segas18_state::ym3438_irq_handler) |
1283 | 1191 | { |
1284 | | if (state) |
1285 | | m_soundcpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE ); |
1286 | | else |
1287 | | m_soundcpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE ); |
| 1192 | m_soundcpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); |
1288 | 1193 | } |
1289 | 1194 | |
1290 | 1195 | |
r241794 | r241795 | |
1303 | 1208 | |
1304 | 1209 | MCFG_SEGA_315_5195_MAPPER_ADD("mapper", "maincpu", segas18_state, memory_mapper, mapper_sound_r, mapper_sound_w) |
1305 | 1210 | |
| 1211 | MCFG_DEVICE_ADD("io", SEGA_315_5296, 16000000) |
| 1212 | MCFG_315_5296_IN_PORTA_CB(IOPORT("P1")) |
| 1213 | MCFG_315_5296_IN_PORTB_CB(IOPORT("P2")) |
| 1214 | MCFG_315_5296_IN_PORTC_CB(IOPORT("P3")) |
| 1215 | MCFG_315_5296_OUT_PORTD_CB(WRITE8(segas18_state, misc_outputs_w)) |
| 1216 | MCFG_315_5296_IN_PORTE_CB(IOPORT("SERVICE")) |
| 1217 | MCFG_315_5296_IN_PORTF_CB(IOPORT("COINAGE")) |
| 1218 | MCFG_315_5296_IN_PORTG_CB(IOPORT("DSW")) |
| 1219 | MCFG_315_5296_OUT_PORTH_CB(WRITE8(segas18_state, rom_5874_bank_w)) |
| 1220 | MCFG_315_5296_OUT_CNT1_CB(DEVWRITELINE("segaic16vid", segaic16_video_device, segaic16_set_display_enable)) |
| 1221 | MCFG_315_5296_OUT_CNT2_CB(WRITELINE(segas18_state, set_vdp_enable)) |
1306 | 1222 | |
1307 | 1223 | MCFG_DEVICE_ADD("gen_vdp", SEGA315_5313, 0) |
1308 | 1224 | MCFG_SEGA315_5313_IS_PAL(false) |
r241794 | r241795 | |
1315 | 1231 | |
1316 | 1232 | MCFG_TIMER_DEVICE_ADD_SCANLINE("scantimer", "gen_vdp", sega315_5313_device, megadriv_scanline_timer_callback_alt_timing, "screen", 0, 1) |
1317 | 1233 | |
1318 | | |
1319 | 1234 | // video hardware |
1320 | 1235 | MCFG_SCREEN_ADD("screen", RASTER) |
1321 | | MCFG_SCREEN_REFRESH_RATE(57.23) // verified on pcb |
| 1236 | MCFG_SCREEN_REFRESH_RATE(57.23) // verified on pcb |
1322 | 1237 | MCFG_SCREEN_SIZE(342,262) |
1323 | 1238 | MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1) |
1324 | 1239 | MCFG_SCREEN_UPDATE_DRIVER(segas18_state, screen_update) |
r241794 | r241795 | |
1347 | 1262 | |
1348 | 1263 | |
1349 | 1264 | static MACHINE_CONFIG_DERIVED( system18_fd1094, system18 ) |
| 1265 | |
| 1266 | // basic machine hardware |
1350 | 1267 | MCFG_CPU_REPLACE("maincpu", FD1094, 10000000) |
1351 | 1268 | MCFG_CPU_PROGRAM_MAP(system18_map) |
1352 | 1269 | MCFG_CPU_VBLANK_INT_DRIVER("screen", segas18_state, irq4_line_hold) |
1353 | 1270 | MACHINE_CONFIG_END |
1354 | 1271 | |
| 1272 | static MACHINE_CONFIG_DERIVED( lghost, system18_fd1094 ) |
| 1273 | |
| 1274 | // basic machine hardware |
| 1275 | MCFG_DEVICE_MODIFY("io") |
| 1276 | MCFG_315_5296_OUT_PORTC_CB(WRITE8(segas18_state, lghost_gun_recoil_w)) |
| 1277 | MACHINE_CONFIG_END |
| 1278 | |
| 1279 | |
1355 | 1280 | static MACHINE_CONFIG_DERIVED( system18_fd1094_i8751, system18_fd1094 ) |
| 1281 | |
| 1282 | // basic machine hardware |
1356 | 1283 | MCFG_CPU_MODIFY("maincpu") |
1357 | 1284 | MCFG_CPU_VBLANK_INT_REMOVE() |
1358 | 1285 | |
r241794 | r241795 | |
2403 | 2330 | |
2404 | 2331 | DRIVER_INIT_MEMBER(segas18_state,lghost) |
2405 | 2332 | { |
2406 | | m_has_guns = true; |
2407 | 2333 | init_generic_5987(); |
2408 | 2334 | m_custom_io_r = read16_delegate(FUNC(segas18_state::lghost_custom_io_r), this); |
2409 | 2335 | m_custom_io_w = write16_delegate(FUNC(segas18_state::lghost_custom_io_w), this); |
r241794 | r241795 | |
2440 | 2366 | GAME( 1991, ddcrewj, ddcrew, system18_fd1094, ddcrew, segas18_state, ddcrew, ROT0, "Sega", "D. D. Crew (Japan, 4 Players, FD1094 317-0185)", 0 ) |
2441 | 2367 | GAME( 1991, ddcrewj2, ddcrew, system18_fd1094, ddcrew2p, segas18_state, ddcrew, ROT0, "Sega", "D. D. Crew (Japan, 2 Players, FD1094 317-0182)", 0 ) |
2442 | 2368 | GAME( 1991, hamaway, 0, system18, hamaway, segas18_state, hamaway, ROT90, "Sega / Santos", "Hammer Away (Japan, prototype)", 0 ) |
2443 | | GAME( 1990, lghost, 0, system18_fd1094, lghost, segas18_state, lghost, ROT0, "Sega", "Laser Ghost (World, FD1094 317-0166)", 0 ) |
2444 | | GAME( 1990, lghostu, lghost, system18_fd1094, lghost, segas18_state, lghost, ROT0, "Sega", "Laser Ghost (US, FD1094 317-0165)", 0 ) |
| 2369 | GAME( 1990, lghost, 0, lghost, lghost, segas18_state, lghost, ROT0, "Sega", "Laser Ghost (World, FD1094 317-0166)", 0 ) |
| 2370 | GAME( 1990, lghostu, lghost, lghost, lghost, segas18_state, lghost, ROT0, "Sega", "Laser Ghost (US, FD1094 317-0165)", 0 ) |
2445 | 2371 | GAME( 1990, mwalk, 0, system18_fd1094_i8751,mwalk, segas18_state, generic_5874, ROT0, "Sega", "Michael Jackson's Moonwalker (World, FD1094/8751 317-0159)", 0 ) |
2446 | 2372 | GAME( 1990, mwalku, mwalk, system18_fd1094_i8751,mwalka, segas18_state, generic_5874, ROT0, "Sega", "Michael Jackson's Moonwalker (US, FD1094/8751 317-0158)", 0 ) |
2447 | 2373 | GAME( 1990, mwalkj, mwalk, system18_fd1094_i8751,mwalk, segas18_state, generic_5874, ROT0, "Sega", "Michael Jackson's Moonwalker (Japan, FD1094/8751 317-0157)", 0 ) |
r241794 | r241795 | |
2449 | 2375 | GAME( 1989, shdancer, 0, system18, shdancer, segas18_state, generic_shad, ROT0, "Sega", "Shadow Dancer (World)", 0 ) |
2450 | 2376 | GAME( 1989, shdancerj, shdancer, system18, shdancer, segas18_state, generic_shad, ROT0, "Sega", "Shadow Dancer (Japan)", 0 ) |
2451 | 2377 | GAME( 1989, shdancer1, shdancer, system18, shdancer, segas18_state, generic_shad, ROT0, "Sega", "Shadow Dancer (US)", 0 ) |
2452 | | GAME( 1992, wwallyj, 0, system18_fd1094, wwally, segas18_state, wwally, ROT0, "Sega", "Wally wo Sagase! (rev B, Japan, FD1094 317-0197B)", 0) // the roms do contain an english logo so maybe there is a world / us set too |
| 2378 | GAME( 1992, wwallyj, 0, system18_fd1094, wwally, segas18_state, wwally, ROT0, "Sega", "Wally wo Sagase! (rev B, Japan, FD1094 317-0197B)", 0 ) // the roms do contain an english logo so maybe there is a world / us set too |
2453 | 2379 | GAME( 1992, wwallyja, wwallyj, system18_fd1094, wwally, segas18_state, wwally, ROT0, "Sega", "Wally wo Sagase! (rev A, Japan, FD1094 317-0197A)", 0 ) |
trunk/src/mame/includes/segas18.h
r241794 | r241795 | |
11 | 11 | #include "cpu/z80/z80.h" |
12 | 12 | #include "machine/nvram.h" |
13 | 13 | #include "machine/segaic16.h" |
| 14 | #include "machine/315_5296.h" |
14 | 15 | #include "video/315_5313.h" |
15 | 16 | #include "video/segaic16.h" |
16 | 17 | #include "video/sega16sp.h" |
r241794 | r241795 | |
29 | 30 | m_soundcpu(*this, "soundcpu"), |
30 | 31 | m_mcu(*this, "mcu"), |
31 | 32 | m_vdp(*this, "gen_vdp"), |
| 33 | m_io(*this, "io"), |
32 | 34 | m_nvram(*this, "nvram"), |
33 | 35 | m_sprites(*this, "sprites"), |
34 | 36 | m_segaic16vid(*this, "segaic16vid"), |
| 37 | m_gfxdecode(*this, "gfxdecode"), |
35 | 38 | m_workram(*this, "workram"), |
36 | 39 | m_romboard(ROM_BOARD_INVALID), |
37 | | m_has_guns(false), |
38 | 40 | m_grayscale_enable(false), |
39 | 41 | m_vdp_enable(false), |
40 | 42 | m_vdp_mixing(0), |
41 | 43 | m_mcu_data(0), |
42 | 44 | m_lghost_value(0), |
43 | | m_lghost_select(0), |
44 | | m_gfxdecode(*this, "gfxdecode") |
| 45 | m_lghost_select(0) |
45 | 46 | { |
46 | | memset(m_misc_io_data, 0, sizeof(m_misc_io_data)); |
47 | 47 | memset(m_wwally_last_x, 0, sizeof(m_wwally_last_x)); |
48 | 48 | memset(m_wwally_last_y, 0, sizeof(m_wwally_last_y)); |
49 | 49 | } |
r241794 | r241795 | |
63 | 63 | void mapper_sound_w(UINT8 data); |
64 | 64 | |
65 | 65 | // read/write handlers |
| 66 | DECLARE_WRITE8_MEMBER( rom_5874_bank_w ); |
66 | 67 | DECLARE_WRITE16_MEMBER( rom_5987_bank_w ); |
67 | 68 | DECLARE_WRITE16_MEMBER( rom_837_7525_bank_w ); |
68 | | DECLARE_READ16_MEMBER( io_chip_r ); |
69 | | DECLARE_WRITE16_MEMBER( io_chip_w ); |
| 69 | DECLARE_WRITE8_MEMBER( misc_outputs_w ); |
70 | 70 | DECLARE_READ16_MEMBER( misc_io_r ); |
71 | 71 | DECLARE_WRITE16_MEMBER( misc_io_w ); |
72 | 72 | DECLARE_WRITE8_MEMBER( soundbank_w ); |
73 | 73 | DECLARE_WRITE8_MEMBER( mcu_data_w ); |
74 | 74 | |
75 | | DECLARE_READ16_MEMBER( genesis_vdp_r ); |
76 | | DECLARE_WRITE16_MEMBER( genesis_vdp_w ); |
| 75 | DECLARE_WRITE_LINE_MEMBER(ym3438_irq_handler); |
77 | 76 | |
78 | | DECLARE_WRITE_LINE_MEMBER(vdp_sndirqline_callback_s18); |
79 | | DECLARE_WRITE_LINE_MEMBER(vdp_lv6irqline_callback_s18); |
80 | | DECLARE_WRITE_LINE_MEMBER(vdp_lv4irqline_callback_s18); |
81 | | |
82 | | |
83 | 77 | // custom I/O |
84 | 78 | DECLARE_READ16_MEMBER( ddcrew_custom_io_r ); |
85 | 79 | DECLARE_READ16_MEMBER( lghost_custom_io_r ); |
| 80 | DECLARE_WRITE8_MEMBER( lghost_gun_recoil_w ); |
86 | 81 | DECLARE_WRITE16_MEMBER( lghost_custom_io_w ); |
87 | 82 | DECLARE_READ16_MEMBER( wwally_custom_io_r ); |
88 | 83 | DECLARE_WRITE16_MEMBER( wwally_custom_io_w ); |
r241794 | r241795 | |
90 | 85 | // video rendering |
91 | 86 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
92 | 87 | |
93 | | DECLARE_WRITE16_MEMBER( sega_tileram_0_w ) { m_segaic16vid->segaic16_tileram_0_w(space,offset,data,mem_mask); }; |
94 | | DECLARE_WRITE16_MEMBER( sega_textram_0_w ) { m_segaic16vid->segaic16_textram_0_w(space,offset,data,mem_mask); }; |
95 | | |
96 | | DECLARE_WRITE_LINE_MEMBER(ym3438_irq_handler); |
| 88 | DECLARE_WRITE_LINE_MEMBER(vdp_sndirqline_callback_s18); |
| 89 | DECLARE_WRITE_LINE_MEMBER(vdp_lv6irqline_callback_s18); |
| 90 | DECLARE_WRITE_LINE_MEMBER(vdp_lv4irqline_callback_s18); |
97 | 91 | |
| 92 | DECLARE_READ16_MEMBER( genesis_vdp_r ) { return m_vdp->vdp_r(space, offset, mem_mask); } |
| 93 | DECLARE_WRITE16_MEMBER( genesis_vdp_w ) { m_vdp->vdp_w(space, offset, data, mem_mask); } |
| 94 | DECLARE_WRITE16_MEMBER( sega_tileram_0_w ) { m_segaic16vid->segaic16_tileram_0_w(space, offset, data, mem_mask); } |
| 95 | DECLARE_WRITE16_MEMBER( sega_textram_0_w ) { m_segaic16vid->segaic16_textram_0_w(space, offset, data, mem_mask); } |
| 96 | |
| 97 | DECLARE_WRITE_LINE_MEMBER(set_grayscale); |
| 98 | DECLARE_WRITE_LINE_MEMBER(set_vdp_enable); |
| 99 | |
98 | 100 | protected: |
99 | 101 | // timer IDs |
100 | 102 | enum |
r241794 | r241795 | |
110 | 112 | ROM_BOARD_171_5874, // 171-5874 |
111 | 113 | ROM_BOARD_171_5987, // 171-5987 |
112 | 114 | ROM_BOARD_837_7525 // Hammer Away proto |
113 | | |
114 | 115 | }; |
115 | 116 | |
116 | 117 | // device overrides |
r241794 | r241795 | |
120 | 121 | |
121 | 122 | // internal helpers |
122 | 123 | void init_generic(segas18_rom_board rom_board); |
123 | | void set_grayscale(bool enable); |
124 | | void set_vdp_enable(bool enable); |
125 | 124 | void set_vdp_mixing(UINT8 mixing); |
126 | 125 | void draw_vdp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority); |
127 | 126 | |
r241794 | r241795 | |
131 | 130 | required_device<z80_device> m_soundcpu; |
132 | 131 | optional_device<i8751_device> m_mcu; |
133 | 132 | required_device<sega315_5313_device> m_vdp; |
| 133 | required_device<sega_315_5296_device> m_io; |
134 | 134 | required_device<nvram_device> m_nvram; |
135 | 135 | required_device<sega_sys16b_sprite_device> m_sprites; |
136 | 136 | required_device<segaic16_video_device> m_segaic16vid; |
| 137 | required_device<gfxdecode_device> m_gfxdecode; |
137 | 138 | |
138 | 139 | // memory pointers |
139 | 140 | required_shared_ptr<UINT16> m_workram; |
r241794 | r241795 | |
142 | 143 | segas18_rom_board m_romboard; |
143 | 144 | read16_delegate m_custom_io_r; |
144 | 145 | write16_delegate m_custom_io_w; |
145 | | bool m_has_guns; |
146 | 146 | |
147 | 147 | // internal state |
148 | | bool m_grayscale_enable; |
149 | | bool m_vdp_enable; |
| 148 | int m_grayscale_enable; |
| 149 | int m_vdp_enable; |
150 | 150 | UINT8 m_vdp_mixing; |
151 | 151 | bitmap_ind16 m_temp_bitmap; |
152 | 152 | UINT8 m_mcu_data; |
153 | | UINT8 m_misc_io_data[0x10]; |
154 | 153 | |
155 | 154 | // game-specific state |
156 | 155 | UINT8 m_wwally_last_x[3]; |
157 | 156 | UINT8 m_wwally_last_y[3]; |
158 | 157 | UINT8 m_lghost_value; |
159 | 158 | UINT8 m_lghost_select; |
160 | | |
161 | | required_device<gfxdecode_device> m_gfxdecode; |
162 | 159 | }; |