trunk/src/mame/drivers/cobra.cpp
| r252962 | r252963 | |
| 493 | 493 | public: |
| 494 | 494 | cobra_jvs(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 495 | 495 | |
| 496 | DECLARE_WRITE_LINE_MEMBER(coin_1_w); |
| 497 | DECLARE_WRITE_LINE_MEMBER(coin_2_w); |
| 498 | |
| 496 | 499 | protected: |
| 497 | 500 | virtual bool switches(UINT8 *&buf, UINT8 count_players, UINT8 bytes_per_switch) override; |
| 498 | 501 | virtual bool coin_counters(UINT8 *&buf, UINT8 count) override; |
| 502 | virtual void function_list(UINT8 *&buf) override; |
| 503 | |
| 504 | private: |
| 505 | int m_coin_counter[2]; |
| 499 | 506 | }; |
| 500 | 507 | |
| 501 | 508 | const device_type COBRA_JVS = &device_creator<cobra_jvs>; |
| r252962 | r252963 | |
| 503 | 510 | cobra_jvs::cobra_jvs(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 504 | 511 | : jvs_device(mconfig, COBRA_JVS, "JVS (COBRA)", tag, owner, clock, "cobra_jvs", __FILE__) |
| 505 | 512 | { |
| 513 | m_coin_counter[0] = 0; |
| 514 | m_coin_counter[1] = 0; |
| 506 | 515 | } |
| 507 | 516 | |
| 517 | WRITE_LINE_MEMBER(cobra_jvs::coin_1_w) |
| 518 | { |
| 519 | if(state) |
| 520 | m_coin_counter[0]++; |
| 521 | } |
| 522 | |
| 523 | WRITE_LINE_MEMBER(cobra_jvs::coin_2_w) |
| 524 | { |
| 525 | if(state) |
| 526 | m_coin_counter[1]++; |
| 527 | } |
| 528 | |
| 529 | void cobra_jvs::function_list(UINT8 *&buf) |
| 530 | { |
| 531 | // SW input - 2 players, 13 bits |
| 532 | *buf++ = 0x01; *buf++ = 2; *buf++ = 13; *buf++ = 0; |
| 533 | |
| 534 | // Coin input - 2 slots |
| 535 | *buf++ = 0x02; *buf++ = 2; *buf++ = 0; *buf++ = 0; |
| 536 | |
| 537 | // Analog input - 8 channels |
| 538 | *buf++ = 0x03; *buf++ = 8; *buf++ = 16; *buf++ = 0; |
| 539 | |
| 540 | // Driver out - 6 channels |
| 541 | *buf++ = 0x12; *buf++ = 6; *buf++ = 0; *buf++ = 0; |
| 542 | } |
| 543 | |
| 508 | 544 | bool cobra_jvs::switches(UINT8 *&buf, UINT8 count_players, UINT8 bytes_per_switch) |
| 509 | 545 | { |
| 510 | 546 | #if LOG_JVS |
| r252962 | r252963 | |
| 538 | 574 | if (count > 2) |
| 539 | 575 | return false; |
| 540 | 576 | |
| 541 | | *buf++ = 0x00; |
| 542 | | *buf++ = 0x01; |
| 577 | *buf++ = m_coin_counter[0] >> 8; *buf++ = m_coin_counter[0]; |
| 543 | 578 | |
| 579 | if(count > 1) |
| 580 | *buf++ = m_coin_counter[1] >> 8; *buf++ = m_coin_counter[1]; |
| 581 | |
| 544 | 582 | return true; |
| 545 | 583 | } |
| 546 | 584 | |
| r252962 | r252963 | |
| 744 | 782 | DECLARE_DRIVER_INIT(racjamdx); |
| 745 | 783 | DECLARE_DRIVER_INIT(bujutsu); |
| 746 | 784 | DECLARE_DRIVER_INIT(cobra); |
| 785 | virtual void machine_start() override; |
| 747 | 786 | virtual void machine_reset() override; |
| 748 | 787 | virtual void video_start() override; |
| 749 | 788 | UINT32 screen_update_cobra(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| r252962 | r252963 | |
| 2249 | 2288 | // GFX register select |
| 2250 | 2289 | m_gfx_register_select = w[3]; |
| 2251 | 2290 | |
| 2252 | | printf("GFX: register select %08X\n", m_gfx_register_select); |
| 2291 | // printf("GFX: register select %08X\n", m_gfx_register_select); |
| 2253 | 2292 | } |
| 2254 | 2293 | else if (w2 == 0x10500018) |
| 2255 | 2294 | { |
| 2256 | 2295 | // register write to the register selected above? |
| 2257 | 2296 | // 64-bit registers, top 32-bits in word 2, low 32-bit in word 3 |
| 2258 | | printf("GFX: register write %08X: %08X %08X\n", m_gfx_register_select, w[2], w[3]); |
| 2297 | // printf("GFX: register write %08X: %08X %08X\n", m_gfx_register_select, w[2], w[3]); |
| 2259 | 2298 | |
| 2260 | 2299 | gfx_write_reg(((UINT64)(w[2]) << 32) | w[3]); |
| 2261 | 2300 | } |
| r252962 | r252963 | |
| 3096 | 3135 | |
| 3097 | 3136 | INPUT_PORTS_START( cobra ) |
| 3098 | 3137 | PORT_START("TEST") |
| 3099 | | PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW) /* Test Button */ |
| 3100 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service") PORT_CODE(KEYCODE_7) |
| 3101 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 ) |
| 3102 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 3103 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 3104 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 3105 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 3106 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 3138 | PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_HIGH) /* Test Button */ |
| 3139 | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 3140 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 3141 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 3142 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 3143 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 3144 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 3145 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 3107 | 3146 | |
| 3108 | 3147 | PORT_START("P1") |
| 3109 | | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START1 ) |
| 3110 | | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_PLAYER(1) |
| 3111 | | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 3112 | | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 3113 | | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) |
| 3114 | | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| 3115 | | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 3116 | | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 3117 | | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) |
| 3118 | | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) |
| 3119 | | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1) |
| 3120 | | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1) |
| 3148 | PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_START1 ) |
| 3149 | PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("P1 Service") PORT_CODE(KEYCODE_7) |
| 3150 | PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) |
| 3151 | PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) |
| 3152 | PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) |
| 3153 | PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) |
| 3154 | PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 3155 | PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 3156 | PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(1) |
| 3157 | PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) |
| 3158 | PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(1) |
| 3159 | PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(1) |
| 3121 | 3160 | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(1) |
| 3122 | 3161 | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(1) |
| 3123 | 3162 | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(1) |
| 3124 | 3163 | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(1) |
| 3125 | 3164 | |
| 3126 | 3165 | PORT_START("P2") |
| 3127 | | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) |
| 3128 | | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_PLAYER(2) |
| 3129 | | PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) |
| 3130 | | PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) |
| 3131 | | PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) |
| 3132 | | PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) |
| 3133 | | PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 3134 | | PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 3135 | | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 3136 | | PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) |
| 3137 | | PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2) |
| 3138 | | PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2) |
| 3139 | | PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(2) |
| 3140 | | PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(2) |
| 3141 | | PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(2) |
| 3142 | | PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(2) |
| 3166 | PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_START2 ) |
| 3167 | PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("P2 Service") PORT_CODE(KEYCODE_8) |
| 3168 | PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) |
| 3169 | PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) |
| 3170 | PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) |
| 3171 | PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) |
| 3172 | PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 3173 | PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 3174 | PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(2) |
| 3175 | PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 3176 | PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(2) |
| 3177 | PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(2) |
| 3178 | PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(2) |
| 3179 | PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(2) |
| 3180 | PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(2) |
| 3181 | PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_PLAYER(2) |
| 3182 | |
| 3183 | PORT_START("COINS") |
| 3184 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_WRITE_LINE_DEVICE_MEMBER("cobra_jvs1", cobra_jvs, coin_1_w) |
| 3185 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_COIN2) PORT_WRITE_LINE_DEVICE_MEMBER("cobra_jvs1", cobra_jvs, coin_2_w) |
| 3143 | 3186 | INPUT_PORTS_END |
| 3144 | 3187 | |
| 3145 | 3188 | WRITE_LINE_MEMBER(cobra_state::ide_interrupt) |
| r252962 | r252963 | |
| 3164 | 3207 | } |
| 3165 | 3208 | } |
| 3166 | 3209 | |
| 3210 | void cobra_state::machine_start() |
| 3211 | { |
| 3212 | /* configure fast RAM regions for DRC */ |
| 3213 | m_maincpu->ppcdrc_add_fastram(0x00000000, 0x003fffff, FALSE, m_main_ram); |
| 3214 | |
| 3215 | m_subcpu->ppcdrc_add_fastram(0x00000000, 0x003fffff, FALSE, m_sub_ram); |
| 3216 | |
| 3217 | m_gfxcpu->ppcdrc_add_fastram(0x00000000, 0x003fffff, FALSE, m_gfx_ram0); |
| 3218 | m_gfxcpu->ppcdrc_add_fastram(0x07c00000, 0x07ffffff, FALSE, m_gfx_ram1); |
| 3219 | } |
| 3220 | |
| 3167 | 3221 | void cobra_state::machine_reset() |
| 3168 | 3222 | { |
| 3169 | 3223 | m_sub_interrupt = 0xff; |
| r252962 | r252963 | |
| 3246 | 3300 | MCFG_K001604_PALETTE("palette") |
| 3247 | 3301 | |
| 3248 | 3302 | MCFG_DEVICE_ADD("cobra_jvs_host", COBRA_JVS_HOST, 4000000) |
| 3249 | | MCFG_JVS_DEVICE_ADD("cobra_jvs", COBRA_JVS, "cobra_jvs_host") |
| 3303 | MCFG_JVS_DEVICE_ADD("cobra_jvs1", COBRA_JVS, "cobra_jvs_host") |
| 3304 | MCFG_JVS_DEVICE_ADD("cobra_jvs2", COBRA_JVS, "cobra_jvs_host") |
| 3305 | MCFG_JVS_DEVICE_ADD("cobra_jvs3", COBRA_JVS, "cobra_jvs_host") |
| 3250 | 3306 | |
| 3251 | 3307 | MACHINE_CONFIG_END |
| 3252 | 3308 | |