Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scripts/src/bus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,8 @@ if (BUSES["BK_PARALLEL"]~=null) then
MAME_DIR .. "src/devices/bus/bk/joystick.h",
MAME_DIR .. "src/devices/bus/bk/loopback.cpp",
MAME_DIR .. "src/devices/bus/bk/loopback.h",
MAME_DIR .. "src/devices/bus/bk/menestrel.cpp",
MAME_DIR .. "src/devices/bus/bk/menestrel.h",
MAME_DIR .. "src/devices/bus/bk/printer.cpp",
MAME_DIR .. "src/devices/bus/bk/printer.h",
}
Expand Down
2 changes: 1 addition & 1 deletion src/devices/bus/bk/ay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ void bk_ay_device::io_w(uint16_t data, bool word)
// DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE_PRIVATE(BK_AY, device_qbus_card_interface, bk_ay_device, "bk_ay", "BK Single AY Interface")
DEFINE_DEVICE_TYPE_PRIVATE(BK_AY, device_bk_parallel_interface, bk_ay_device, "bk_ay", "BK Single AY Interface")
2 changes: 1 addition & 1 deletion src/devices/bus/bk/ay.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
#include "parallel.h"


DECLARE_DEVICE_TYPE(BK_AY, device_qbus_card_interface)
DECLARE_DEVICE_TYPE(BK_AY, device_bk_parallel_interface)

#endif
3 changes: 3 additions & 0 deletions src/devices/bus/bk/carts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@
#include "covox.h"
#include "joystick.h"
#include "loopback.h"
#include "menestrel.h"
#include "printer.h"


void bk_parallel_devices(device_slot_interface &device)
{
device.option_add("ay", BK_AY);
device.option_add("covox", BK_COVOX);
device.option_add("covox_stereo", BK_COVOX_STEREO);
device.option_add("joystick", BK_JOYSTICK);
device.option_add("loopback", BK_LOOPBACK);
device.option_add("menestrel", BK_MENESTREL);
device.option_add("printer", BK_PRINTER);
}
74 changes: 72 additions & 2 deletions src/devices/bus/bk/covox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// copyright-holders:Sergey Svishchev
/***************************************************************************

Mono Covox interface with passthrough for loopback cart
BK Covox interfaces with passthrough for loopback cart
(used by "In Your Space" demo.)

***************************************************************************/
Expand Down Expand Up @@ -81,11 +81,81 @@ void bk_covox_device::io_w(uint16_t data, bool word)
m_up->write(0, data ^ 0xffff, word);
}


//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************

class bk_covox_stereo_device : public device_t, public device_bk_parallel_interface
{
public:
// construction/destruction
bk_covox_stereo_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

protected:
virtual void device_start() override ATTR_COLD {};

virtual uint16_t io_r() override;
virtual void io_w(uint16_t data, bool word) override;

private:
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;

required_device<dac_byte_interface> m_ldac;
required_device<dac_byte_interface> m_rdac;
required_device<bk_parallel_slot_device> m_up;
};

//**************************************************************************
// LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
// bk_covox_stereo_device - constructor
//-------------------------------------------------

bk_covox_stereo_device::bk_covox_stereo_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, BK_COVOX_STEREO, tag, owner, clock)
, device_bk_parallel_interface(mconfig, *this)
, m_ldac(*this, "ldac")
, m_rdac(*this, "rdac")
, m_up(*this, "up")
{
}


//**************************************************************************
// IMPLEMENTATION
//**************************************************************************

void bk_covox_stereo_device::device_add_mconfig(machine_config &config)
{
SPEAKER(config, "covox", 2).front();
DAC_8BIT_R2R(config, m_ldac, 0).add_route(ALL_OUTPUTS, "covox", 0.5, 0); // unknown DAC
DAC_8BIT_R2R(config, m_rdac, 0).add_route(ALL_OUTPUTS, "covox", 0.5, 1); // unknown DAC

BK_PARALLEL_SLOT(config, m_up, DERIVED_CLOCK(1, 1), bk_parallel_devices, nullptr);
}

uint16_t bk_covox_stereo_device::io_r()
{
return m_up->read() ^ 0xffff;
}

void bk_covox_stereo_device::io_w(uint16_t data, bool word)
{
m_ldac->write(data);
m_rdac->write(data >> 8);
m_up->write(0, data ^ 0xffff, word);
}


} // anonymous namespace


//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE_PRIVATE(BK_COVOX, device_qbus_card_interface, bk_covox_device, "bk_covox", "BK Mono Covox Interface")
DEFINE_DEVICE_TYPE_PRIVATE(BK_COVOX, device_bk_parallel_interface, bk_covox_device, "bk_covox", "BK Mono Covox Interface")
DEFINE_DEVICE_TYPE_PRIVATE(BK_COVOX_STEREO, device_bk_parallel_interface, bk_covox_stereo_device, "bk_covox_stereo", "BK Stereo Covox Interface")
5 changes: 3 additions & 2 deletions src/devices/bus/bk/covox.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// copyright-holders:Sergey Svishchev
/***************************************************************************

Mono Covox interface
BK Covox interface

***************************************************************************/

Expand All @@ -14,6 +14,7 @@
#include "parallel.h"


DECLARE_DEVICE_TYPE(BK_COVOX, device_qbus_card_interface)
DECLARE_DEVICE_TYPE(BK_COVOX, device_bk_parallel_interface)
DECLARE_DEVICE_TYPE(BK_COVOX_STEREO, device_bk_parallel_interface)

#endif
2 changes: 1 addition & 1 deletion src/devices/bus/bk/joystick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ uint16_t bk_joystick_device::io_r()
// DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE_PRIVATE(BK_JOYSTICK, device_qbus_card_interface, bk_joystick_device, "bk_joystick", "BK Joystick Interface")
DEFINE_DEVICE_TYPE_PRIVATE(BK_JOYSTICK, device_bk_parallel_interface, bk_joystick_device, "bk_joystick", "BK Joystick Interface")
2 changes: 1 addition & 1 deletion src/devices/bus/bk/joystick.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
#include "parallel.h"


DECLARE_DEVICE_TYPE(BK_JOYSTICK, device_qbus_card_interface)
DECLARE_DEVICE_TYPE(BK_JOYSTICK, device_bk_parallel_interface)

#endif
2 changes: 1 addition & 1 deletion src/devices/bus/bk/loopback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ void bk_loopback_device::io_w(uint16_t data, bool word)
// DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE_PRIVATE(BK_LOOPBACK, device_qbus_card_interface, bk_loopback_device, "bk_loopback", "BK Loopback")
DEFINE_DEVICE_TYPE_PRIVATE(BK_LOOPBACK, device_bk_parallel_interface, bk_loopback_device, "bk_loopback", "BK Loopback")
2 changes: 1 addition & 1 deletion src/devices/bus/bk/loopback.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
#include "parallel.h"


DECLARE_DEVICE_TYPE(BK_LOOPBACK, device_qbus_card_interface)
DECLARE_DEVICE_TYPE(BK_LOOPBACK, device_bk_parallel_interface)

#endif
209 changes: 209 additions & 0 deletions src/devices/bus/bk/menestrel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
/***************************************************************************

BK "Menestrel" sound interface.

Six channels of filtered square wave output from two 8253 timers.
Stereo output via DIN connector, no balance or volume controls.

Has software support in ROM 370.

Not implemented: filter, clock phase offset.

***************************************************************************/

#include "emu.h"
#include "menestrel.h"

#include "machine/pit8253.h"
#include "sound/spkrdev.h"
#include "speaker.h"


namespace {

//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************

// ======================> bk_menestrel_device

class bk_menestrel_device : public device_t, public device_bk_parallel_interface
{
public:
// construction/destruction
bk_menestrel_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

protected:
virtual void device_start() override ATTR_COLD;
virtual void device_reset() override ATTR_COLD;

virtual ioport_constructor device_input_ports() const override ATTR_COLD;

virtual void io_w(uint16_t data, bool word) override;

private:
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;

required_device_array<pit8253_device, 2> m_timer;
required_ioport m_config;
required_device<speaker_sound_device> m_lspeaker;
required_device<speaker_sound_device> m_rspeaker;

uint16_t m_data;

int m_out[6];

template <int channel> void lspeaker_changed(int state);
template <int channel> void rspeaker_changed(int state);
void out5_changed(int state);
};


//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************

static INPUT_PORTS_START(config)
PORT_START("CONFIG")
PORT_DIPNAME(0x01, 0x00, "Timer interrupt")
PORT_DIPSETTING(0x01, DEF_STR(Yes) )
PORT_DIPSETTING(0x00, DEF_STR(No) )
INPUT_PORTS_END

ioport_constructor bk_menestrel_device::device_input_ports() const
{
return INPUT_PORTS_NAME(config);
}

static const double speaker_levels[] = {-1.0, -0.33333, 0.33333, 1.0};


//**************************************************************************
// LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
// bk_menestrel_device - constructor
//-------------------------------------------------

bk_menestrel_device::bk_menestrel_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, BK_MENESTREL, tag, owner, clock)
, device_bk_parallel_interface(mconfig, *this)
, m_timer(*this, "timer%u", 0U)
, m_config(*this, "CONFIG")
, m_lspeaker(*this, "lspeaker")
, m_rspeaker(*this, "rspeaker")
{
}


//**************************************************************************
// IMPLEMENTATION
//**************************************************************************

void bk_menestrel_device::device_add_mconfig(machine_config &config)
{
PIT8253(config, m_timer[0], 0);
m_timer[0]->set_clk<0>(XTAL(1'000'000));
m_timer[0]->out_handler<0>().set(FUNC(bk_menestrel_device::lspeaker_changed<0>));
m_timer[0]->set_clk<1>(XTAL(1'000'000));
m_timer[0]->out_handler<1>().set(FUNC(bk_menestrel_device::lspeaker_changed<1>));
m_timer[0]->set_clk<2>(XTAL(1'000'000));
m_timer[0]->out_handler<2>().set(FUNC(bk_menestrel_device::lspeaker_changed<2>));

PIT8253(config, m_timer[1], 0);
m_timer[1]->set_clk<0>(XTAL(1'000'000));
m_timer[1]->out_handler<0>().set(FUNC(bk_menestrel_device::rspeaker_changed<0>));
m_timer[1]->set_clk<1>(XTAL(1'000'000));
m_timer[1]->out_handler<1>().set(FUNC(bk_menestrel_device::rspeaker_changed<1>));
m_timer[1]->set_clk<2>(XTAL(1'000'000));
m_timer[1]->out_handler<2>().set(FUNC(bk_menestrel_device::out5_changed));

SPEAKER(config, "dd1").front_left();
SPEAKER_SOUND(config, m_lspeaker);
m_lspeaker->set_levels(4, speaker_levels);
m_lspeaker->add_route(ALL_OUTPUTS, "dd1", 0.25);

SPEAKER(config, "dd2").front_right();
SPEAKER_SOUND(config, m_rspeaker);
m_rspeaker->set_levels(4, speaker_levels);
m_rspeaker->add_route(ALL_OUTPUTS, "dd2", 0.25);
}


template <int channel> void bk_menestrel_device::lspeaker_changed(int state)
{
if (state > 1) return;
m_out[channel] = state;
m_lspeaker->level_w(m_out[0] + m_out[1] + m_out[2]);
}

template <int channel> void bk_menestrel_device::rspeaker_changed(int state)
{
if (state > 1) return;
m_out[3 + channel] = state;
m_rspeaker->level_w(m_out[3] + m_out[4] + m_out[5]);
}

void bk_menestrel_device::out5_changed(int state)
{
if (state > 1) return;
if (m_config->read())
{
m_slot->irq2_w(!state);
}
else
{
m_out[5] = state;
m_rspeaker->level_w(m_out[3] + m_out[4] + m_out[5]);
}
}


void bk_menestrel_device::device_start()
{
save_item(NAME(m_data));
save_item(NAME(m_out));

std::fill(std::begin(m_out), std::end(m_out), 0);
}

void bk_menestrel_device::device_reset()
{
m_slot->irq2_w(0);
m_lspeaker->level_w(0);
m_rspeaker->level_w(0);
}

void bk_menestrel_device::io_w(uint16_t data, bool word)
{
if (BIT(data ^ m_data, 12) && !BIT(data, 12)) // ~WR edge
{
if (!BIT(data, 10)) m_timer[0]->write(bitswap<2>(data, 9, 8), data & 255);
if (!BIT(data, 11)) m_timer[1]->write(bitswap<2>(data, 9, 8), data & 255);
}

if (BIT(data ^ m_data, 15))
{
const int gate = BIT(data, 15);
m_timer[0]->write_gate0(gate);
m_timer[0]->write_gate1(gate);
m_timer[0]->write_gate2(gate);
m_timer[1]->write_gate0(gate);
m_timer[1]->write_gate1(gate);
m_timer[1]->write_gate2(gate);
}

m_data = data;
}

} // anonymous namespace


//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE_PRIVATE(BK_MENESTREL, device_bk_parallel_interface, bk_menestrel_device, "bk_menestrel", "Menestrel Interface")
Loading
Loading