Previous 199869 Revisions Next

r44451 Monday 25th January, 2016 at 01:44:01 UTC by Ville Linde
cobra: fix JVS handling (nw)
[src/mame/drivers]cobra.cpp

trunk/src/mame/drivers/cobra.cpp
r252962r252963
493493public:
494494   cobra_jvs(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
495495
496   DECLARE_WRITE_LINE_MEMBER(coin_1_w);
497   DECLARE_WRITE_LINE_MEMBER(coin_2_w);
498
496499protected:
497500   virtual bool switches(UINT8 *&buf, UINT8 count_players, UINT8 bytes_per_switch) override;
498501   virtual bool coin_counters(UINT8 *&buf, UINT8 count) override;
502   virtual void function_list(UINT8 *&buf) override;
503
504private:
505   int m_coin_counter[2];
499506};
500507
501508const device_type COBRA_JVS = &device_creator<cobra_jvs>;
r252962r252963
503510cobra_jvs::cobra_jvs(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
504511   : jvs_device(mconfig, COBRA_JVS, "JVS (COBRA)", tag, owner, clock, "cobra_jvs", __FILE__)
505512{
513   m_coin_counter[0] = 0;
514   m_coin_counter[1] = 0;
506515}
507516
517WRITE_LINE_MEMBER(cobra_jvs::coin_1_w)
518{
519   if(state)
520      m_coin_counter[0]++;
521}
522
523WRITE_LINE_MEMBER(cobra_jvs::coin_2_w)
524{
525   if(state)
526      m_coin_counter[1]++;
527}
528
529void 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
508544bool cobra_jvs::switches(UINT8 *&buf, UINT8 count_players, UINT8 bytes_per_switch)
509545{
510546#if LOG_JVS
r252962r252963
538574   if (count > 2)
539575      return false;
540576
541   *buf++ = 0x00;
542   *buf++ = 0x01;
577   *buf++ = m_coin_counter[0] >> 8; *buf++ = m_coin_counter[0];
543578
579   if(count > 1)
580      *buf++ = m_coin_counter[1] >> 8; *buf++ = m_coin_counter[1];
581
544582   return true;
545583}
546584
r252962r252963
744782   DECLARE_DRIVER_INIT(racjamdx);
745783   DECLARE_DRIVER_INIT(bujutsu);
746784   DECLARE_DRIVER_INIT(cobra);
785   virtual void machine_start() override;
747786   virtual void machine_reset() override;
748787   virtual void video_start() override;
749788   UINT32 screen_update_cobra(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
r252962r252963
22492288               // GFX register select
22502289               m_gfx_register_select = w[3];
22512290
2252               printf("GFX: register select %08X\n", m_gfx_register_select);
2291            //   printf("GFX: register select %08X\n", m_gfx_register_select);
22532292            }
22542293            else if (w2 == 0x10500018)
22552294            {
22562295               // register write to the register selected above?
22572296               // 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]);
22592298
22602299               gfx_write_reg(((UINT64)(w[2]) << 32) | w[3]);
22612300            }
r252962r252963
30963135
30973136INPUT_PORTS_START( cobra )
30983137   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 )
31073146
31083147   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)
31213160   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(1)
31223161   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(1)
31233162   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(1)
31243163   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_PLAYER(1)
31253164
31263165   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)
31433186INPUT_PORTS_END
31443187
31453188WRITE_LINE_MEMBER(cobra_state::ide_interrupt)
r252962r252963
31643207   }
31653208}
31663209
3210void 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
31673221void cobra_state::machine_reset()
31683222{
31693223   m_sub_interrupt = 0xff;
r252962r252963
32463300   MCFG_K001604_PALETTE("palette")
32473301
32483302   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")
32503306
32513307MACHINE_CONFIG_END
32523308


Previous 199869 Revisions Next


© 1997-2024 The MAME Team