44/* Bellfruit SWP (Skill With Prizes) Video hardware
55 aka Cobra 3
66
7- TODO: MPEG decoding currently not implemented
7+ MPEG audio decoding is preliminary.
8+ TODO: MPEG video decoding is not implemented.
89*/
910
1011
1718#include " machine/ncr5380.h"
1819#include " machine/nscsi_bus.h"
1920#include " machine/nvram.h"
20- #include " video/ramdac.h"
2121#include " machine/rescap.h"
2222#include " machine/scc66470.h"
2323#include " machine/watchdog.h"
24+ #include " sound/tms320av110.h"
2425#include " sound/ymz280b.h"
26+ #include " video/ramdac.h"
2527
2628#include " screen.h"
2729#include " speaker.h"
@@ -37,6 +39,7 @@ class bfm_cobra3_state : public driver_device
3739 m_maincpu (*this , " maincpu" ),
3840 m_cpuregion (*this , " maincpu" ),
3941 m_nvram (*this , " nvram" ),
42+ m_av110 (*this , " av110" ),
4043 m_ymz (*this , " ymz280b" ),
4144 m_palette (*this , " palette" ),
4245 m_ramdac (*this , " ramdac" ),
@@ -56,6 +59,7 @@ class bfm_cobra3_state : public driver_device
5659 required_device<m68340_cpu_device> m_maincpu;
5760 required_region_ptr<uint16_t > m_cpuregion;
5861 required_device<nvram_device> m_nvram;
62+ required_device<tms320av110_device> m_av110;
5963 required_device<ymz280b_device> m_ymz;
6064 required_device<palette_device> m_palette;
6165 required_device<ramdac_device> m_ramdac;
@@ -77,6 +81,7 @@ class bfm_cobra3_state : public driver_device
7781 virtual void machine_start () override ATTR_COLD;
7882
7983 void volume_control (uint8_t direction, uint8_t clock);
84+ void av110_reset_strobe_w (u8 data);
8085 uint16_t mem_r (offs_t offset, uint16_t mem_mask = ~0 );
8186 void mem_w (offs_t offset, uint16_t data, uint16_t mem_mask = ~0 );
8287
@@ -91,7 +96,7 @@ class bfm_cobra3_state : public driver_device
9196
9297void bfm_cobra3_state::volume_control (uint8_t direction, uint8_t clock)
9398{
94- int clock_changed = m_vol_clock ^ clock;
99+ uint8_t const clock_changed = m_vol_clock ^ clock;
95100
96101 m_vol_clock = clock;
97102 if (clock_changed)
@@ -109,14 +114,23 @@ void bfm_cobra3_state::volume_control(uint8_t direction, uint8_t clock)
109114 m_volume--;
110115 }
111116
112- float fraction = (64 - m_volume) / 64 .0f ;
117+ float const fraction = (32 - m_volume) / 32 .0f ;
113118
114119 m_ymz->set_output_gain (0 , fraction);
115120 m_ymz->set_output_gain (1 , fraction);
121+ m_av110->set_output_gain (0 , fraction);
122+ m_av110->set_output_gain (1 , fraction);
116123 }
117124 }
118125}
119126
127+ void bfm_cobra3_state::av110_reset_strobe_w (u8 )
128+ {
129+ // This decoded write pulses the AV110's active-low RESET input.
130+ m_av110->reset_w (0 );
131+ m_av110->reset_w (1 );
132+ }
133+
120134uint16_t bfm_cobra3_state::mem_r (offs_t offset, uint16_t mem_mask)
121135{
122136 int cs = m_maincpu->get_cs (offset * 2 );
@@ -305,6 +319,8 @@ void bfm_cobra3_state::bfm_cobra3_map(address_map &map)
305319{
306320 map (0x00000000 , 0xffffffff ).rw (FUNC (bfm_cobra3_state::mem_r), FUNC (bfm_cobra3_state::mem_w));
307321 map (0x00800000 , 0x009fffff ).m (m_scc66470, FUNC (scc66470_device::map)).cswidth (16 );
322+ map (0x00a80000 , 0x00a80001 ).w (FUNC (bfm_cobra3_state::av110_reset_strobe_w)).umask16 (0x00ff );
323+ map (0x00a81000 , 0x00a810ff ).rw (m_av110, FUNC (tms320av110_device::read), FUNC (tms320av110_device::write)).umask16 (0x00ff );
308324}
309325
310326void bfm_cobra3_state::ramdac_map (address_map &map)
@@ -375,8 +391,13 @@ INPUT_PORTS_END
375391void bfm_cobra3_state::machine_start()
376392{
377393 m_active_strobe = 0 ;
394+ m_vol_clock = 0 ;
395+ m_volume = 0 ;
378396 m_mainram = make_unique_clear<uint16_t []>((1024 * 16 ) / 2 );
379397 m_nvram->set_base (m_mainram.get (), 1024 * 16 );
398+
399+ save_item (NAME (m_vol_clock));
400+ save_item (NAME (m_volume));
380401}
381402
382403
@@ -472,6 +493,12 @@ void bfm_cobra3_state::bfm_cobra3(machine_config &config)
472493 m_ymz->add_route (0 , " lspeaker" , 1.0 );
473494 m_ymz->add_route (1 , " rspeaker" , 1.0 );
474495
496+ TMS320AV110 (config, m_av110, 0 );
497+ // AV110 REQ and MC68340 DREQ2 are both active low.
498+ m_av110->req ().set (m_maincpu, FUNC (m68340_cpu_device::dma_dreq2_w));
499+ m_av110->add_route (0 , " lspeaker" , 1.0 );
500+ m_av110->add_route (1 , " rspeaker" , 1.0 );
501+
475502 SCC66470 (config,m_scc66470,30000000 );
476503 m_scc66470->set_addrmap (0 , &bfm_cobra3_state::scc66470_map);
477504 m_scc66470->set_screen (" screen" );
0 commit comments