trunk/src/mame/drivers/cops.c
| r31530 | r31531 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | Atari Games Cops |
| 3 | Nova 'LaserMax'/Atari Games Cops |
| 4 | 4 | (hardware developed by Nova Productions Limited) |
| 5 | Preliminary driver by Mariusz Wojcieszek, James Wallace |
| 5 | 6 | |
| 6 | | Preliminary driver by Mariusz Wojcieszek |
| 7 | Cops uses a Sony CD-ROM in addition to the regular setup, purely to play |
| 8 | Bad Boys by Inner Circle, so there is muscial accompaniment to areas |
| 9 | where the laserdisc audio is muted. |
| 7 | 10 | |
| 11 | TODO: There are probably more ROMs for Revelations, the disc contains |
| 12 | full data for a picture based memory game called 'Vision Quest'. |
| 13 | |
| 14 | LaserMax memory map needs sorting out, Cops uses a subset of what's |
| 15 | actually available |
| 16 | |
| 17 | The UK version COPS appears to want to communicate with the LDP in a |
| 18 | different way. |
| 8 | 19 | ***************************************************************************/ |
| 9 | 20 | |
| 10 | 21 | |
| 11 | 22 | #include "emu.h" |
| 12 | 23 | #include "cpu/m6502/m6502.h" |
| 13 | 24 | #include "machine/6522via.h" |
| 25 | #include "sound/sn76496.h" |
| 26 | |
| 14 | 27 | //#include "machine/mos6551.h" |
| 15 | 28 | |
| 16 | 29 | #include "cops.lh" |
| r31530 | r31531 | |
| 26 | 39 | cops_state(const machine_config &mconfig, device_type type, const char *tag) |
| 27 | 40 | : driver_device(mconfig, type, tag), |
| 28 | 41 | m_maincpu(*this, "maincpu"), |
| 42 | m_sn(*this, "snsnd"), |
| 29 | 43 | m_irq(0) |
| 30 | 44 | { } |
| 31 | 45 | |
| 32 | 46 | // devices |
| 33 | 47 | required_device<cpu_device> m_maincpu; |
| 48 | required_device<sn76489_device> m_sn; |
| 34 | 49 | |
| 35 | 50 | // screen updates |
| 36 | 51 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| r31530 | r31531 | |
| 52 | 67 | void dacia_receive(UINT8 data); |
| 53 | 68 | DECLARE_WRITE8_MEMBER(dacia_w); |
| 54 | 69 | DECLARE_READ8_MEMBER(dacia_r); |
| 70 | DECLARE_WRITE8_MEMBER(via1_b_w); |
| 71 | DECLARE_WRITE8_MEMBER(via1_cb1_w); |
| 55 | 72 | DECLARE_WRITE8_MEMBER(cdrom_data_w); |
| 56 | 73 | DECLARE_WRITE8_MEMBER(cdrom_ctrl_w); |
| 57 | 74 | DECLARE_READ8_MEMBER(cdrom_data_r); |
| 58 | | |
| 75 | DECLARE_DRIVER_INIT(cops); |
| 59 | 76 | int m_irq; |
| 60 | 77 | |
| 61 | 78 | UINT8 m_lcd_addr_l, m_lcd_addr_h; |
| r31530 | r31531 | |
| 67 | 84 | UINT8 m_cdrom_ctrl; |
| 68 | 85 | UINT8 m_cdrom_data; |
| 69 | 86 | |
| 87 | UINT8 m_sn_data; |
| 88 | UINT8 m_sn_cb1; |
| 89 | |
| 70 | 90 | // LDP-1450 |
| 71 | 91 | UINT8 m_ld_command_to_send[5]; |
| 72 | 92 | UINT8 m_ld_command_total_bytes; |
| r31530 | r31531 | |
| 97 | 117 | |
| 98 | 118 | UINT32 cops_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) |
| 99 | 119 | { |
| 100 | | char ledtext[16 + 1]; |
| 101 | | for ( int i = 0; i < 16; i++ ) |
| 102 | | { |
| 103 | | ledtext[i] = m_maincpu->space(AS_PROGRAM).read_byte(0x64 + i); |
| 104 | | } |
| 105 | | ledtext[16] = 0; |
| 106 | | popmessage("%s",ledtext); |
| 107 | 120 | return 0; |
| 108 | 121 | } |
| 109 | 122 | |
| r31530 | r31531 | |
| 386 | 399 | { |
| 387 | 400 | sprintf(output_name, "digit%d", i); |
| 388 | 401 | display_data = m_lcd_data_l | (m_lcd_data_h << 8); |
| 389 | | display_data = BITSWAP16(display_data, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); // todo: |
| 402 | display_data = BITSWAP16(display_data, 4, 5, 12, 1, 0, 11, 10, 6, 7, 2, 9, 3, 15, 8, 14, 13); |
| 390 | 403 | output_set_value(output_name, display_data); |
| 391 | 404 | } |
| 392 | 405 | } |
| r31530 | r31531 | |
| 494 | 507 | m_maincpu->set_input_line(M6502_IRQ_LINE, m_irq ? ASSERT_LINE : CLEAR_LINE); |
| 495 | 508 | } |
| 496 | 509 | |
| 510 | WRITE8_MEMBER(cops_state::via1_b_w) |
| 511 | { |
| 512 | m_sn_data = BITSWAP8(data,0,1,2,3,4,5,6,7); |
| 513 | if (m_sn_cb1) |
| 514 | { |
| 515 | m_sn->write(space,0,m_sn_data); |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | WRITE8_MEMBER(cops_state::via1_cb1_w) |
| 520 | { |
| 521 | m_sn_cb1 = data; |
| 522 | } |
| 523 | |
| 497 | 524 | /************************************* |
| 498 | 525 | * |
| 499 | 526 | * VIA 2 (U27) |
| r31530 | r31531 | |
| 534 | 561 | // AM_RANGE(0xd004, 0xd007) AM_DEVREADWRITE("acia6551_2", mos6551_device, read, write ) |
| 535 | 562 | AM_RANGE(0xd000, 0xd007) AM_READWRITE(dacia_r, dacia_w) |
| 536 | 563 | AM_RANGE(0xd800, 0xd80f) AM_DEVREADWRITE("via6522_3", via6522_device, read, write) /* VIA 3 */ |
| 537 | | AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("system", 0) |
| 564 | AM_RANGE(0xe000, 0xffff) AM_ROMBANK("sysbank1") |
| 538 | 565 | ADDRESS_MAP_END |
| 539 | 566 | |
| 540 | | |
| 541 | 567 | static INPUT_PORTS_START( cops ) |
| 542 | 568 | PORT_START("SW0") |
| 543 | 569 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Switch A") PORT_CODE(KEYCODE_A) PORT_IMPULSE(1) |
| r31530 | r31531 | |
| 587 | 613 | { |
| 588 | 614 | } |
| 589 | 615 | |
| 616 | DRIVER_INIT_MEMBER(cops_state,cops) |
| 617 | { |
| 618 | //The hardware is designed and programmed to use multiple system ROM banks, but for some reason it's hardwired to bank 2. |
| 619 | //For documentation's sake, here's the init |
| 620 | UINT8 *rom = memregion("system")->base(); |
| 621 | membank("sysbank1")->configure_entries(0, 4, &rom[0x0000], 0x2000); |
| 622 | membank("sysbank1")->set_entry(2); |
| 623 | } |
| 624 | |
| 590 | 625 | static MACHINE_CONFIG_START( cops, cops_state ) |
| 591 | 626 | |
| 592 | 627 | /* basic machine hardware */ |
| r31530 | r31531 | |
| 608 | 643 | /* via */ |
| 609 | 644 | MCFG_DEVICE_ADD("via6522_1", VIA6522, 0) |
| 610 | 645 | MCFG_VIA6522_IRQ_HANDLER(WRITELINE(cops_state, via1_irq)) |
| 646 | MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(cops_state, via1_b_w)) |
| 647 | MCFG_VIA6522_CB1_HANDLER(WRITE8(cops_state, via1_cb1_w)) |
| 611 | 648 | |
| 612 | 649 | MCFG_DEVICE_ADD("via6522_2", VIA6522, 0) |
| 613 | 650 | MCFG_VIA6522_IRQ_HANDLER(WRITELINE(cops_state, via2_irq)) |
| r31530 | r31531 | |
| 623 | 660 | |
| 624 | 661 | /* sound hardware */ |
| 625 | 662 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 663 | |
| 664 | /* TODO: Verify clock */ |
| 665 | MCFG_SOUND_ADD("snsnd", SN76489, MAIN_CLOCK/2) |
| 666 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 667 | |
| 626 | 668 | MACHINE_CONFIG_END |
| 627 | 669 | |
| 628 | 670 | |
| r31530 | r31531 | |
| 640 | 682 | ROM_LOAD( "cops_sys.dat", 0x0000, 0x8000, CRC(0060e5d0) SHA1(b8c9f6fde6a315e33fa7946e5d3bb4ea2fbe76a8) ) |
| 641 | 683 | ROM_END |
| 642 | 684 | |
| 643 | | GAMEL( 1994, cops, 0, cops, cops, driver_device, 0, ROT0, "Atari Games", "Cops", GAME_NOT_WORKING | GAME_NO_SOUND, layout_cops ) |
| 685 | ROM_START( copsuk ) |
| 686 | ROM_REGION( 0x8000, "program", 0 ) |
| 687 | ROM_LOAD( "cops1b_uk.bin", 0x0000, 0x8000, CRC(f095ee95) SHA1(86bb517331d81ae3a8f3b87df67c321013c6aae4) ) |
| 688 | |
| 689 | ROM_REGION( 0x8000, "system", 0 ) |
| 690 | ROM_LOAD( "cops_sys.dat", 0x0000, 0x8000, CRC(0060e5d0) SHA1(b8c9f6fde6a315e33fa7946e5d3bb4ea2fbe76a8) ) |
| 691 | ROM_END |
| 692 | |
| 693 | ROM_START( revlatns ) |
| 694 | ROM_REGION( 0x8000, "program", 0 ) |
| 695 | ROM_LOAD( "revelations_prog.bin", 0x0000, 0x8000, CRC(5ab41ac3) SHA1(0f7027551da17011576cf077e2f199729bb10482) ) |
| 696 | |
| 697 | ROM_REGION( 0x8000, "system", 0 ) |
| 698 | ROM_LOAD( "revelations_sys.bin", 0x0000, 0x8000, CRC(43e5e3ec) SHA1(fa44b102b5aa7ad2421c575abdc67f1c29f23bc1) ) |
| 699 | ROM_END |
| 700 | |
| 701 | |
| 702 | GAMEL( 1994, cops, 0, cops, cops, cops_state, cops, ROT0, "Atari Games", "Cops (USA)", GAME_NOT_WORKING | GAME_NO_SOUND, layout_cops ) |
| 703 | GAMEL( 1994, copsuk, cops,cops, cops, cops_state, cops, ROT0, "Nova Productions / Deith Leisure","Cops (UK)", GAME_NOT_WORKING | GAME_NO_SOUND, layout_cops ) |
| 704 | GAMEL( 1994, revlatns, 0, cops, cops, cops_state, cops, ROT0, "Nova Productions", "Revelations", GAME_NOT_WORKING | GAME_NO_SOUND, layout_cops ) |