Skip to content

Commit 1050207

Browse files
authored
konami/firebeat.cpp: Added lamp outputs for Pop'n Music games. (#15234)
1 parent 25a10e0 commit 1050207

1 file changed

Lines changed: 124 additions & 42 deletions

File tree

src/mame/konami/firebeat.cpp

Lines changed: 124 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ void firebeat_extend_spectrum_analyzer_device::sound_stream_update(sound_stream
273273
double notch_max[TOTAL_BARS] = { -1, -1, -1, -1, -1, -1 };
274274
int cur_notch = 0;
275275

276-
for (int i = 0; i <= FFT_LENGTH / 2; i++) {
276+
for (int i = 0; i <= FFT_LENGTH / 2; i++)
277+
{
277278
const double freq = double(i) / FFT_LENGTH * srate;
278279

279280
if (freq < NOTCHES[cur_notch])
@@ -412,21 +413,20 @@ class firebeat_state : public driver_device
412413
m_io_inputs(*this, "IN%u", 0U)
413414
{ }
414415

415-
void firebeat(machine_config &config);
416-
417416
protected:
418417
virtual void machine_start() override ATTR_COLD;
419418
virtual void machine_reset() override ATTR_COLD;
420419
virtual void device_resolve_objects() override ATTR_COLD;
421420

421+
void firebeat(machine_config &config) ATTR_COLD;
422+
422423
uint32_t screen_update_firebeat_0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
423424

424-
void init_firebeat();
425+
void init_firebeat() ATTR_COLD;
425426

426427
void firebeat_map(address_map &map) ATTR_COLD;
427428
void ymz280b_map(address_map &map) ATTR_COLD;
428429

429-
void init_lights(write32s_delegate out1, write32s_delegate out2, write32s_delegate out3);
430430
void lamp_output_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
431431
void lamp_output2_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
432432
void lamp_output3_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
@@ -495,7 +495,7 @@ class firebeat_spu_state : public firebeat_state
495495
virtual void machine_reset() override ATTR_COLD;
496496
virtual void device_resolve_objects() override ATTR_COLD;
497497

498-
void firebeat_spu_base(machine_config &config);
498+
void firebeat_spu_base(machine_config &config) ATTR_COLD;
499499
void firebeat_spu_map(address_map &map) ATTR_COLD;
500500
void spu_map(address_map &map) ATTR_COLD;
501501
void rf5c400_map(address_map &map) ATTR_COLD;
@@ -550,15 +550,17 @@ class firebeat_ppp_state : public firebeat_state
550550
{ }
551551

552552
void firebeat_ppp(machine_config &config);
553-
void init_ppp_base();
554-
void init_ppp_jp();
555-
void init_ppp_overseas();
553+
554+
void init_ppp_jp() ATR_COLD;
555+
void init_ppp_overseas() ATTR_COLD;
556556

557557
private:
558558
virtual void device_resolve_objects() override ATTR_COLD;
559559

560560
void firebeat_ppp_map(address_map &map) ATTR_COLD;
561561

562+
void init_ppp_base() ATTR_COLD;
563+
562564
uint16_t sensor_r(offs_t offset);
563565

564566
void lamp_output_ppp_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
@@ -592,19 +594,20 @@ class firebeat_kbm_state : public firebeat_state
592594
m_io_wheels(*this, "WHEEL_P%u", 1U)
593595
{ }
594596

595-
uint32_t screen_update_firebeat_1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
597+
void firebeat_kbm(machine_config &config) ATTR_COLD;
596598

597-
void init_kbm_base();
598-
void init_kbm_jp();
599-
void init_kbm_overseas();
600-
void firebeat_kbm(machine_config &config);
599+
void init_kbm_jp() ATTR_COLD;
600+
void init_kbm_overseas() ATTR_COLD;
601601

602602
private:
603603
virtual void device_resolve_objects() override ATTR_COLD;
604604

605+
uint32_t screen_update_firebeat_1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
606+
605607
void firebeat_kbm_map(address_map &map) ATTR_COLD;
606608

607-
void init_keyboard();
609+
void init_kbm_base() ATTR_COLD;
610+
void init_keyboard() ATTR_COLD;
608611

609612
uint8_t keyboard_wheel_r(offs_t offset);
610613

@@ -647,7 +650,8 @@ class firebeat_bm3_state : public firebeat_spu_state
647650
{ }
648651

649652
void firebeat_bm3(machine_config &config);
650-
void init_bm3();
653+
654+
void init_bm3() ATTR_COLD;
651655

652656
private:
653657
void firebeat_bm3_map(address_map &map) ATTR_COLD;
@@ -660,6 +664,8 @@ class firebeat_bm3_state : public firebeat_spu_state
660664

661665
void midi_st224_irq_callback(int state);
662666

667+
void floppy_irq_callback(int state);
668+
663669
required_device<fdc37c665gt_device> m_fdc;
664670
required_device<floppy_connector> m_floppy;
665671
required_device<firebeat_extend_spectrum_analyzer_device> m_spectrum_analyzer;
@@ -668,27 +674,50 @@ class firebeat_bm3_state : public firebeat_spu_state
668674
required_ioport_array<4> m_io;
669675
required_ioport_array<2> m_io_turntables;
670676
required_ioport_array<7> m_io_effects;
671-
672-
void floppy_irq_callback(int state);
673677
};
674678

675679
class firebeat_popn_state : public firebeat_spu_state
676680
{
677681
public:
678682
firebeat_popn_state(const machine_config &mconfig, device_type type, const char *tag) :
679-
firebeat_spu_state(mconfig, type, tag)
683+
firebeat_spu_state(mconfig, type, tag),
684+
m_button_leds(*this, "button_led_%u", 0U),
685+
m_side_leds(*this, "side_led_%u", 0U),
686+
m_top_leds(*this, "top_led_%u", 0U)
680687
{ }
681688

682-
void firebeat_popn(machine_config &config);
683-
void init_popn_base();
684-
void init_popn_jp();
685-
void init_popn_rental();
689+
void firebeat_popn(machine_config &config) ATTR_COLD;
690+
691+
void init_popn_jp() ATTR_COLD;
692+
void init_popn_rental() ATTR_COLD;
693+
694+
private:
695+
virtual void device_resolve_objects() override ATTR_COLD;
696+
697+
void firebeat_popn_map(address_map &map) ATTR_COLD;
698+
699+
void init_popn_base() ATTR_COLD;
700+
701+
void lamp_output_popn_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
702+
703+
output_finder<9> m_button_leds;
704+
output_finder<4> m_side_leds;
705+
output_finder<5> m_top_leds;
686706
};
687707

708+
void firebeat_popn_state::device_resolve_objects()
709+
{
710+
firebeat_spu_state::device_resolve_objects();
711+
712+
m_button_leds.resolve();
713+
m_side_leds.resolve();
714+
m_top_leds.resolve();
715+
}
716+
688717
/*****************************************************************************/
689718

690-
uint32_t firebeat_state::screen_update_firebeat_0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return m_gcu->draw(screen, bitmap, cliprect); }
691-
uint32_t firebeat_kbm_state::screen_update_firebeat_1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return m_gcu_sub->draw(screen, bitmap, cliprect); }
719+
uint32_t firebeat_state::screen_update_firebeat_0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return m_gcu->draw(screen, bitmap, cliprect); }
720+
uint32_t firebeat_kbm_state::screen_update_firebeat_1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return m_gcu_sub->draw(screen, bitmap, cliprect); }
692721

693722
void firebeat_state::machine_start()
694723
{
@@ -727,8 +756,6 @@ void firebeat_state::init_firebeat()
727756
m_cabinet_info = 0;
728757

729758
m_maincpu->ppc4xx_spu_set_tx_handler(write8smo_delegate(*this, FUNC(firebeat_state::security_w)));
730-
731-
init_lights(write32s_delegate(*this), write32s_delegate(*this), write32s_delegate(*this));
732759
}
733760

734761
void firebeat_state::firebeat(machine_config &config)
@@ -780,9 +807,12 @@ void firebeat_state::firebeat_map(address_map &map)
780807
map(0x7000a000, 0x7000a003).r(FUNC(firebeat_state::extend_board_irq_r));
781808
map(0x74000000, 0x740003ff).noprw(); // SPU shared RAM
782809
map(0x7d000200, 0x7d00021f).r(FUNC(firebeat_state::cabinet_r));
810+
map(0x7d000320, 0x7d000323).w(FUNC(firebeat_state::lamp_output2_w));
811+
map(0x7d000324, 0x7d000327).w(FUNC(firebeat_state::lamp_output3_w));
783812
map(0x7d000400, 0x7d000401).rw("ymz", FUNC(ymz280b_device::read), FUNC(ymz280b_device::write));
784813
map(0x7d000500, 0x7d000501).w(FUNC(firebeat_state::control_w));
785814
map(0x7d000800, 0x7d000803).r(FUNC(firebeat_state::input_r));
815+
map(0x7d000804, 0x7d000807).w(FUNC(firebeat_state::lamp_output_w));
786816
map(0x7d400000, 0x7d5fffff).rw("flash_main", FUNC(fujitsu_29f016a_device::read), FUNC(fujitsu_29f016a_device::write));
787817
map(0x7d800000, 0x7d9fffff).rw("flash_snd1", FUNC(fujitsu_29f016a_device::read), FUNC(fujitsu_29f016a_device::write));
788818
map(0x7da00000, 0x7dbfffff).rw("flash_snd2", FUNC(fujitsu_29f016a_device::read), FUNC(fujitsu_29f016a_device::write));
@@ -1114,17 +1144,6 @@ static void comm_uart_irq_callback(running_machine &machine, int channel, int va
11141144

11151145
/*****************************************************************************/
11161146

1117-
void firebeat_state::init_lights(write32s_delegate out1, write32s_delegate out2, write32s_delegate out3)
1118-
{
1119-
if (out1.isnull()) out1 = write32s_delegate(*this, FUNC(firebeat_state::lamp_output_w));
1120-
if (out2.isnull()) out2 = write32s_delegate(*this, FUNC(firebeat_state::lamp_output2_w));
1121-
if (out3.isnull()) out3 = write32s_delegate(*this, FUNC(firebeat_state::lamp_output3_w));
1122-
1123-
m_maincpu->space(AS_PROGRAM).install_write_handler(0x7d000804, 0x7d000807, out1);
1124-
m_maincpu->space(AS_PROGRAM).install_write_handler(0x7d000320, 0x7d000323, out2);
1125-
m_maincpu->space(AS_PROGRAM).install_write_handler(0x7d000324, 0x7d000327, out3);
1126-
}
1127-
11281147
void firebeat_state::lamp_output_w(offs_t offset, uint32_t data, uint32_t mem_mask)
11291148
{
11301149
// -------- -------- -------- xxxxxxxx Status LEDs (active low)
@@ -1462,7 +1481,6 @@ void firebeat_bm3_state::firebeat_bm3(machine_config &config)
14621481
void firebeat_bm3_state::init_bm3()
14631482
{
14641483
init_firebeat();
1465-
init_lights(write32s_delegate(*this), write32s_delegate(*this), write32s_delegate(*this));
14661484

14671485
// No cabinet info changes for BMIII are needed at this point. All sourced data is for JP region
14681486
// non-rental firebeat stacks. So, no region-specific overrides are present for BMIII. If we
@@ -1533,6 +1551,8 @@ void firebeat_popn_state::firebeat_popn(machine_config &config)
15331551
{
15341552
firebeat_spu_base(config);
15351553

1554+
m_maincpu->set_addrmap(AS_PROGRAM, &firebeat_popn_state::firebeat_popn_map);
1555+
15361556
ATA_INTERFACE(config, m_spuata).options(firebeat_ata_devices, "dvdrom", nullptr, true);
15371557
m_spuata->irq_handler().set(FUNC(firebeat_popn_state::spu_ata_interrupt));
15381558
m_spuata->dmarq_handler().set(FUNC(firebeat_popn_state::spu_ata_dmarq));
@@ -1552,7 +1572,6 @@ void firebeat_popn_state::firebeat_popn(machine_config &config)
15521572
void firebeat_popn_state::init_popn_base()
15531573
{
15541574
init_firebeat();
1555-
init_lights(write32s_delegate(*this), write32s_delegate(*this), write32s_delegate(*this));
15561575
}
15571576

15581577
void firebeat_popn_state::init_popn_jp()
@@ -1573,13 +1592,72 @@ void firebeat_popn_state::init_popn_rental()
15731592
m_cabinet_info = 0x6;
15741593
}
15751594

1595+
void firebeat_popn_state::firebeat_popn_map(address_map &map)
1596+
{
1597+
firebeat_spu_map(map);
1598+
map(0x7d000804, 0x7d000807).w(FUNC(firebeat_popn_state::lamp_output_popn_w));
1599+
}
1600+
1601+
void firebeat_popn_state::lamp_output_popn_w(offs_t offset, uint32_t data, uint32_t mem_mask)
1602+
{
1603+
lamp_output_w(offset, data, mem_mask);
1604+
1605+
// 0x00010000 Marquee Lamp?
1606+
// 0x00080000 Top Led 0 (Topmost)
1607+
// 0x00100000 Top Led 1
1608+
// 0x00200000 Top Led 2
1609+
// 0x00400000 Top Led 3
1610+
// 0x00800000 Top Led 4
1611+
// 0x08000000 Pillar Lamp 0 (Left Red?)
1612+
// 0x10000000 Pillar Lamp 1 (Left Blue?)
1613+
// 0x20000000 Pillar Lamp 2 (Right Blue?)
1614+
// 0x40000000 Pillar Lamp 3 (Right Red?)
1615+
// 0x00000100 Button LED 0
1616+
// 0x00000200 Button LED 1
1617+
// 0x00000400 Button LED 2
1618+
// 0x00000800 Button LED 3
1619+
// 0x00001000 Button LED 4
1620+
// 0x00002000 Button LED 5
1621+
// 0x00004000 Button LED 6
1622+
// 0x00008000 Button LED 7
1623+
// 0x80000000 Button LED 8
1624+
if (ACCESSING_BITS_8_15)
1625+
{
1626+
m_button_leds[0] = BIT(data, 8);
1627+
m_button_leds[1] = BIT(data, 9);
1628+
m_button_leds[2] = BIT(data, 10);
1629+
m_button_leds[3] = BIT(data, 11);
1630+
m_button_leds[4] = BIT(data, 12);
1631+
m_button_leds[5] = BIT(data, 13);
1632+
m_button_leds[6] = BIT(data, 14);
1633+
m_button_leds[7] = BIT(data, 15);
1634+
}
1635+
if (ACCESSING_BITS_16_23)
1636+
{
1637+
m_top_leds[0] = BIT(data, 19);
1638+
m_top_leds[1] = BIT(data, 20);
1639+
m_top_leds[2] = BIT(data, 21);
1640+
m_top_leds[3] = BIT(data, 22);
1641+
m_top_leds[4] = BIT(data, 23);
1642+
}
1643+
if (ACCESSING_BITS_24_31)
1644+
{
1645+
m_side_leds[0] = BIT(data, 27);
1646+
m_side_leds[1] = BIT(data, 28);
1647+
m_side_leds[2] = BIT(data, 29);
1648+
m_side_leds[3] = BIT(data, 30);
1649+
m_button_leds[8] = BIT(data, 31);
1650+
}
1651+
}
1652+
15761653

15771654
/*****************************************************************************
15781655
* ParaParaParadise / ParaParaDancing
15791656
******************************************************************************/
15801657
void firebeat_ppp_state::device_resolve_objects()
15811658
{
15821659
firebeat_state::device_resolve_objects();
1660+
15831661
m_stage_leds.resolve();
15841662
m_top_leds.resolve();
15851663
m_lamps.resolve();
@@ -1593,13 +1671,13 @@ void firebeat_ppp_state::device_resolve_objects()
15931671
void firebeat_ppp_state::firebeat_ppp(machine_config &config)
15941672
{
15951673
firebeat(config);
1674+
15961675
m_maincpu->set_addrmap(AS_PROGRAM, &firebeat_ppp_state::firebeat_ppp_map);
15971676
}
15981677

15991678
void firebeat_ppp_state::init_ppp_base()
16001679
{
16011680
init_firebeat();
1602-
init_lights(write32s_delegate(*this, FUNC(firebeat_ppp_state::lamp_output_ppp_w)), write32s_delegate(*this, FUNC(firebeat_ppp_state::lamp_output2_ppp_w)), write32s_delegate(*this, FUNC(firebeat_ppp_state::lamp_output3_ppp_w)));
16031681
}
16041682

16051683
void firebeat_ppp_state::init_ppp_jp()
@@ -1623,7 +1701,11 @@ void firebeat_ppp_state::init_ppp_overseas()
16231701
void firebeat_ppp_state::firebeat_ppp_map(address_map &map)
16241702
{
16251703
firebeat_map(map);
1704+
1705+
map(0x7d000320, 0x7d000323).w(FUNC(firebeat_ppp_state::lamp_output2_ppp_w));
1706+
map(0x7d000324, 0x7d000327).w(FUNC(firebeat_ppp_state::lamp_output3_ppp_w));
16261707
map(0x7d000340, 0x7d00035f).r(FUNC(firebeat_ppp_state::sensor_r));
1708+
map(0x7d000804, 0x7d000807).w(FUNC(firebeat_ppp_state::lamp_output_ppp_w));
16271709
}
16281710

16291711
uint16_t firebeat_ppp_state::sensor_r(offs_t offset)
@@ -1745,7 +1827,6 @@ void firebeat_kbm_state::device_resolve_objects()
17451827
void firebeat_kbm_state::init_kbm_base()
17461828
{
17471829
init_firebeat();
1748-
init_lights(write32s_delegate(*this, FUNC(firebeat_kbm_state::lamp_output_kbm_w)), write32s_delegate(*this), write32s_delegate(*this));
17491830
init_keyboard();
17501831

17511832
// pc16552d_init(machine(), 1, 24000000, midi_uart_irq_callback, 0); // MIDI UART
@@ -1849,6 +1930,7 @@ void firebeat_kbm_state::firebeat_kbm_map(address_map &map)
18491930
firebeat_map(map);
18501931
map(0x70000000, 0x70000fff).rw(FUNC(firebeat_kbm_state::midi_uart_r), FUNC(firebeat_kbm_state::midi_uart_w)).umask32(0xff000000);
18511932
map(0x70008000, 0x7000800f).r(FUNC(firebeat_kbm_state::keyboard_wheel_r));
1933+
map(0x7d000804, 0x7d000807).w(FUNC(firebeat_kbm_state::lamp_output_kbm_w));
18521934
map(0x7e800100, 0x7e8001ff).rw(m_gcu_sub, FUNC(k057714_device::read), FUNC(k057714_device::write));
18531935
}
18541936

0 commit comments

Comments
 (0)