mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
add some recognizable (but still awful) PSG output to the dphh8630 driver (#8704)
This commit is contained in:
parent
eca8831836
commit
559ba31243
@ -117,6 +117,9 @@ void st2205u_base_device::sound_stream_update(sound_stream &stream, std::vector<
|
||||
{
|
||||
s16 adpcm_contribution = m_adpcm_level[channel];
|
||||
outputs[channel].add_int(outpos, adpcm_contribution * 0x10, 32768);
|
||||
|
||||
auto psg_contribution = std::sin((double)m_psg_freqcntr[channel]/4096.0f);
|
||||
outputs[channel].add_int(outpos, psg_contribution * m_psg_amplitude[channel]*0x80,32768);
|
||||
}
|
||||
|
||||
outpos++;
|
||||
@ -160,6 +163,8 @@ void st2205u_base_device::base_init(std::unique_ptr<mi_st2xxx> &&intf)
|
||||
save_item(NAME(m_lvctr));
|
||||
|
||||
save_item(NAME(m_adpcm_level));
|
||||
save_item(NAME(m_psg_amplitude));
|
||||
save_item(NAME(m_psg_freqcntr));
|
||||
|
||||
mintf = std::move(intf);
|
||||
save_common_registers();
|
||||
@ -362,6 +367,8 @@ void st2205u_base_device::device_reset()
|
||||
m_lvctr = 0;
|
||||
|
||||
std::fill(std::begin(m_adpcm_level), std::end(m_adpcm_level), 0);
|
||||
std::fill(std::begin(m_psg_amplitude), std::end(m_psg_amplitude), 0);
|
||||
std::fill(std::begin(m_psg_freqcntr), std::end(m_psg_freqcntr), 0);
|
||||
}
|
||||
|
||||
void st2205u_device::device_reset()
|
||||
@ -782,6 +789,9 @@ void st2205u_base_device::timer_12bit_process(int t)
|
||||
{
|
||||
reset_adpcm_value(t);
|
||||
LOGDAC("Playing %s sample %02X on channel %d\n", BIT(m_psgm, 2 * t) ? "tone" : "DAC", psg_data & 0xff, t);
|
||||
|
||||
m_psg_amplitude[t] = psg_data & 0xff; // amplitude is controller by the data writes
|
||||
m_psg_freqcntr[t] += 0x80; // the frequency is determined by the timer speed (there must be a better way to do this?)
|
||||
}
|
||||
|
||||
--m_fifo_filled[t];
|
||||
|
@ -168,6 +168,8 @@ protected:
|
||||
u8 m_lvctr;
|
||||
|
||||
s16 m_adpcm_level[4];
|
||||
u8 m_psg_amplitude[4];
|
||||
u32 m_psg_freqcntr[4];
|
||||
};
|
||||
|
||||
class st2205u_device : public st2205u_base_device
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "cpu/m6502/st2205u.h"
|
||||
#include "video/bl_handhelds_lcdc.h"
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
|
||||
class st22xx_bbl338_state : public driver_device
|
||||
{
|
||||
@ -25,11 +26,12 @@ public:
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
|
||||
required_device<st2xxx_device> m_maincpu;
|
||||
required_device<st2205u_base_device> m_maincpu;
|
||||
|
||||
private:
|
||||
u8 porta_r();
|
||||
void portb_w(u8 data);
|
||||
void porta_w(u8 data);
|
||||
|
||||
void st22xx_bbl338_map(address_map &map);
|
||||
void st22xx_dphh8213_map(address_map &map);
|
||||
@ -248,11 +250,21 @@ u8 st22xx_bbl338_state::porta_r()
|
||||
|
||||
// TODO: bit 7 is I/O for some bitbanged SPI device (used for the menu)
|
||||
input |= 0xc0;
|
||||
|
||||
logerror("%s: port a read\n", machine().describe_context());
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
void st22xx_bbl338_state::porta_w(u8 data)
|
||||
{
|
||||
// Menu control writes?
|
||||
logerror("%s: port a write %02x\n", machine().describe_context(), data);
|
||||
}
|
||||
|
||||
void st22xx_bbl338_state::portb_w(u8 data)
|
||||
{
|
||||
// logerror("%s: port b write %02x\n", machine().describe_context(), data);
|
||||
m_portb = data;
|
||||
}
|
||||
|
||||
@ -306,9 +318,18 @@ void st22xx_bbl338_state::st22xx_dphh8213(machine_config &config)
|
||||
ST2302U(config, m_maincpu, 24000000);
|
||||
m_maincpu->set_addrmap(AS_DATA, &st22xx_bbl338_state::st22xx_dphh8213_map);
|
||||
m_maincpu->in_pa_callback().set(FUNC(st22xx_bbl338_state::porta_r));
|
||||
m_maincpu->out_pa_callback().set(FUNC(st22xx_bbl338_state::porta_w));
|
||||
|
||||
m_maincpu->out_pb_callback().set(FUNC(st22xx_bbl338_state::portb_w));
|
||||
m_maincpu->in_pc_callback().set_ioport("PORTC");
|
||||
|
||||
SPEAKER(config, "mono").front_center();
|
||||
m_maincpu->add_route(0, "mono", 1.00);
|
||||
m_maincpu->add_route(1, "mono", 1.00);
|
||||
m_maincpu->add_route(2, "mono", 1.00);
|
||||
m_maincpu->add_route(3, "mono", 1.00);
|
||||
|
||||
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_LCD);
|
||||
m_screen->set_refresh_hz(60);
|
||||
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
|
||||
|
Loading…
Reference in New Issue
Block a user