trunk/src/mame/drivers/nightgal.c
| r20917 | r20918 | |
| 31 | 31 | { |
| 32 | 32 | public: |
| 33 | 33 | nightgal_state(const machine_config &mconfig, device_type type, const char *tag) |
| 34 | | : driver_device(mconfig, type, tag) , |
| 35 | | m_comms_ram(*this, "comms_ram"){ } |
| 34 | : driver_device(mconfig, type, tag) |
| 35 | , m_comms_ram(*this, "comms_ram") |
| 36 | , m_region_gfx1(*this, "gfx1") |
| 37 | , m_io_cr_clear(*this, "CR_CLEAR") |
| 38 | , m_io_coins(*this, "COINS") |
| 39 | , m_io_pl1_1(*this, "PL1_1") |
| 40 | , m_io_pl1_2(*this, "PL1_2") |
| 41 | , m_io_pl1_3(*this, "PL1_3") |
| 42 | , m_io_pl1_4(*this, "PL1_4") |
| 43 | , m_io_pl1_5(*this, "PL1_5") |
| 44 | , m_io_pl1_6(*this, "PL1_6") |
| 45 | , m_io_pl2_1(*this, "PL2_1") |
| 46 | , m_io_pl2_2(*this, "PL2_2") |
| 47 | , m_io_pl2_3(*this, "PL2_3") |
| 48 | , m_io_pl2_4(*this, "PL2_4") |
| 49 | , m_io_pl2_5(*this, "PL2_5") |
| 50 | , m_io_pl2_6(*this, "PL2_6") |
| 51 | , m_io_system(*this, "SYSTEM") |
| 52 | , m_io_sysa(*this, "SYSA") |
| 53 | , m_io_dswa(*this, "DSWA") |
| 54 | , m_io_dswb(*this, "DSWB") |
| 55 | , m_io_dswc(*this, "DSWC") |
| 36 | 56 | |
| 57 | { } |
| 58 | |
| 37 | 59 | /* video-related */ |
| 38 | 60 | UINT8 m_blit_raw_data[3]; |
| 39 | 61 | UINT8 m_true_blit[7]; |
| r20917 | r20918 | |
| 81 | 103 | virtual void video_start(); |
| 82 | 104 | virtual void palette_init(); |
| 83 | 105 | UINT32 screen_update_nightgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 106 | |
| 107 | protected: |
| 108 | required_memory_region m_region_gfx1; |
| 109 | required_ioport m_io_cr_clear; |
| 110 | required_ioport m_io_coins; |
| 111 | required_ioport m_io_pl1_1; |
| 112 | required_ioport m_io_pl1_2; |
| 113 | required_ioport m_io_pl1_3; |
| 114 | required_ioport m_io_pl1_4; |
| 115 | required_ioport m_io_pl1_5; |
| 116 | required_ioport m_io_pl1_6; |
| 117 | required_ioport m_io_pl2_1; |
| 118 | required_ioport m_io_pl2_2; |
| 119 | required_ioport m_io_pl2_3; |
| 120 | required_ioport m_io_pl2_4; |
| 121 | required_ioport m_io_pl2_5; |
| 122 | required_ioport m_io_pl2_6; |
| 123 | required_ioport m_io_system; |
| 124 | required_ioport m_io_sysa; |
| 125 | required_ioport m_io_dswa; |
| 126 | required_ioport m_io_dswb; |
| 127 | required_ioport m_io_dswc; |
| 128 | |
| 129 | UINT8 nightgal_gfx_nibble( int niboffset ); |
| 84 | 130 | }; |
| 85 | 131 | |
| 86 | 132 | |
| r20917 | r20918 | |
| 116 | 162 | return 0; |
| 117 | 163 | } |
| 118 | 164 | |
| 119 | | static UINT8 nightgal_gfx_nibble( running_machine &machine, int niboffset ) |
| 165 | UINT8 nightgal_state::nightgal_gfx_nibble( int niboffset ) |
| 120 | 166 | { |
| 121 | | UINT8 *blit_rom = machine.root_device().memregion("gfx1")->base(); |
| 167 | UINT8 *blit_rom = m_region_gfx1->base(); |
| 122 | 168 | |
| 123 | 169 | if (niboffset & 1) |
| 124 | 170 | { |
| r20917 | r20918 | |
| 178 | 224 | { |
| 179 | 225 | int drawx = (x + xcount) & 0xff; |
| 180 | 226 | int drawy = (y + ycount) & 0xff; |
| 181 | | UINT8 dat = nightgal_gfx_nibble(machine(), src + count); |
| 227 | UINT8 dat = nightgal_gfx_nibble(src + count); |
| 182 | 228 | UINT8 cur_pen_hi = m_pen_data[(dat & 0xf0) >> 4]; |
| 183 | 229 | UINT8 cur_pen_lo = m_pen_data[(dat & 0x0f) >> 0]; |
| 184 | 230 | |
| r20917 | r20918 | |
| 233 | 279 | { |
| 234 | 280 | int drawx = (x + xcount) & 0xff; |
| 235 | 281 | int drawy = (y + ycount) & 0xff; |
| 236 | | UINT8 dat = nightgal_gfx_nibble(machine(), src + count); |
| 282 | UINT8 dat = nightgal_gfx_nibble(src + count); |
| 237 | 283 | UINT8 cur_pen_hi = m_pen_data[(dat & 0xf0) >> 4]; |
| 238 | 284 | UINT8 cur_pen_lo = m_pen_data[(dat & 0x0f) >> 0]; |
| 239 | 285 | |
| r20917 | r20918 | |
| 421 | 467 | |
| 422 | 468 | READ8_MEMBER(nightgal_state::input_1p_r) |
| 423 | 469 | { |
| 424 | | UINT8 cr_clear = ioport("CR_CLEAR")->read(); |
| 470 | UINT8 cr_clear = m_io_cr_clear->read(); |
| 425 | 471 | |
| 426 | 472 | switch (m_mux_data) |
| 427 | 473 | { |
| 428 | | case 0x01: return ioport("PL1_1")->read() | cr_clear; |
| 429 | | case 0x02: return ioport("PL1_2")->read() | cr_clear; |
| 430 | | case 0x04: return ioport("PL1_3")->read() | cr_clear; |
| 431 | | case 0x08: return ioport("PL1_4")->read() | cr_clear; |
| 432 | | case 0x10: return ioport("PL1_5")->read() | cr_clear; |
| 433 | | case 0x20: return ioport("PL1_6")->read() | cr_clear; |
| 474 | case 0x01: return m_io_pl1_1->read() | cr_clear; |
| 475 | case 0x02: return m_io_pl1_2->read() | cr_clear; |
| 476 | case 0x04: return m_io_pl1_3->read() | cr_clear; |
| 477 | case 0x08: return m_io_pl1_4->read() | cr_clear; |
| 478 | case 0x10: return m_io_pl1_5->read() | cr_clear; |
| 479 | case 0x20: return m_io_pl1_6->read() | cr_clear; |
| 434 | 480 | } |
| 435 | 481 | //printf("%04x\n", m_mux_data); |
| 436 | 482 | |
| 437 | | return (ioport("PL1_1")->read() & ioport("PL1_2")->read() & ioport("PL1_3")->read() & |
| 438 | | ioport("PL1_4")->read() & ioport("PL1_5")->read() & ioport("PL1_6")->read()) | cr_clear; |
| 483 | return (m_io_pl1_1->read() & m_io_pl1_2->read() & m_io_pl1_3->read() & |
| 484 | m_io_pl1_4->read() & m_io_pl1_5->read() & m_io_pl1_6->read()) | cr_clear; |
| 439 | 485 | } |
| 440 | 486 | |
| 441 | 487 | READ8_MEMBER(nightgal_state::input_2p_r) |
| 442 | 488 | { |
| 443 | | UINT8 coin_port = ioport("COINS")->read(); |
| 489 | UINT8 coin_port = m_io_coins->read(); |
| 444 | 490 | |
| 445 | 491 | switch (m_mux_data) |
| 446 | 492 | { |
| 447 | | case 0x01: return ioport("PL2_1")->read() | coin_port; |
| 448 | | case 0x02: return ioport("PL2_2")->read() | coin_port; |
| 449 | | case 0x04: return ioport("PL2_3")->read() | coin_port; |
| 450 | | case 0x08: return ioport("PL2_4")->read() | coin_port; |
| 451 | | case 0x10: return ioport("PL2_5")->read() | coin_port; |
| 452 | | case 0x20: return ioport("PL2_6")->read() | coin_port; |
| 493 | case 0x01: return m_io_pl2_1->read() | coin_port; |
| 494 | case 0x02: return m_io_pl2_2->read() | coin_port; |
| 495 | case 0x04: return m_io_pl2_3->read() | coin_port; |
| 496 | case 0x08: return m_io_pl2_4->read() | coin_port; |
| 497 | case 0x10: return m_io_pl2_5->read() | coin_port; |
| 498 | case 0x20: return m_io_pl2_6->read() | coin_port; |
| 453 | 499 | } |
| 454 | 500 | //printf("%04x\n", m_mux_data); |
| 455 | 501 | |
| 456 | | return (ioport("PL2_1")->read() & ioport("PL2_2")->read() & ioport("PL2_3")->read() & |
| 457 | | ioport("PL2_4")->read() & ioport("PL2_5")->read() & ioport("PL2_6")->read()) | coin_port; |
| 502 | return (m_io_pl2_1->read() & m_io_pl2_2->read() & m_io_pl2_3->read() & |
| 503 | m_io_pl2_4->read() & m_io_pl2_5->read() & m_io_pl2_6->read()) | coin_port; |
| 458 | 504 | } |
| 459 | 505 | |
| 460 | 506 | /******************************************** |