mirror of
https://github.com/holub/mame
synced 2025-07-02 16:49:22 +03:00
bus/bbc/joyport: CB lines are bi-directional.
This commit is contained in:
parent
c515982156
commit
a15e7a29c4
@ -40,12 +40,12 @@ device_bbc_joyport_interface::device_bbc_joyport_interface(const machine_config
|
||||
// bbcmc_joyport_slot_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
bbc_joyport_slot_device::bbc_joyport_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, BBC_JOYPORT_SLOT, tag, owner, clock),
|
||||
device_single_card_slot_interface(mconfig, *this),
|
||||
m_device(nullptr),
|
||||
m_cb1_handler(*this),
|
||||
m_cb2_handler(*this)
|
||||
bbc_joyport_slot_device::bbc_joyport_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, BBC_JOYPORT_SLOT, tag, owner, clock)
|
||||
, device_single_card_slot_interface(mconfig, *this)
|
||||
, m_device(nullptr)
|
||||
, m_cb1_handler(*this)
|
||||
, m_cb2_handler(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@ -70,7 +70,6 @@ void bbc_joyport_slot_device::device_start()
|
||||
|
||||
uint8_t bbc_joyport_slot_device::pb_r()
|
||||
{
|
||||
// TODO: Joyport connected to PB0-PB4 only. PB5-PB7 are expansion port.
|
||||
if (m_device)
|
||||
return 0xe0 | m_device->pb_r();
|
||||
else
|
||||
@ -89,6 +88,28 @@ void bbc_joyport_slot_device::pb_w(uint8_t data)
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// write_cb1
|
||||
//-------------------------------------------------
|
||||
|
||||
void bbc_joyport_slot_device::write_cb1(int state)
|
||||
{
|
||||
if (m_device)
|
||||
m_device->write_cb1(state);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// write_cb2
|
||||
//-------------------------------------------------
|
||||
|
||||
void bbc_joyport_slot_device::write_cb2(int state)
|
||||
{
|
||||
if (m_device)
|
||||
m_device->write_cb2(state);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// SLOT_INTERFACE( bbc_joyport_devices )
|
||||
//-------------------------------------------------
|
||||
|
@ -61,11 +61,15 @@ public:
|
||||
auto cb1_handler() { return m_cb1_handler.bind(); }
|
||||
auto cb2_handler() { return m_cb2_handler.bind(); }
|
||||
|
||||
// from slot
|
||||
DECLARE_WRITE_LINE_MEMBER(cb1_w) { m_cb1_handler(state); }
|
||||
DECLARE_WRITE_LINE_MEMBER(cb2_w) { m_cb2_handler(state); }
|
||||
|
||||
// from host
|
||||
uint8_t pb_r();
|
||||
void pb_w(uint8_t data);
|
||||
void write_cb1(int state);
|
||||
void write_cb2(int state);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -86,6 +90,8 @@ class device_bbc_joyport_interface : public device_interface
|
||||
public:
|
||||
virtual uint8_t pb_r() { return 0xff; }
|
||||
virtual void pb_w(uint8_t data) { }
|
||||
virtual void write_cb1(int state) { };
|
||||
virtual void write_cb2(int state) { };
|
||||
|
||||
protected:
|
||||
device_bbc_joyport_interface(const machine_config &mconfig, device_t &device);
|
||||
|
@ -1978,6 +1978,8 @@ void bbcm_state::bbcmc(machine_config &config)
|
||||
m_via6522_1->readpb_handler().append(m_exp, FUNC(bbc_exp_slot_device::pb_r)).mask(0xe0);
|
||||
m_via6522_1->writepb_handler().set(m_joyport, FUNC(bbc_joyport_slot_device::pb_w)).mask(0x1f);
|
||||
m_via6522_1->writepb_handler().append(m_exp, FUNC(bbc_exp_slot_device::pb_w)).mask(0xe0);
|
||||
m_via6522_1->cb1_handler().set(m_joyport, FUNC(bbc_joyport_slot_device::write_cb1));
|
||||
m_via6522_1->cb2_handler().set(m_joyport, FUNC(bbc_joyport_slot_device::write_cb2));
|
||||
|
||||
/* cartridge sockets */
|
||||
config.device_remove("cartslot1");
|
||||
|
Loading…
Reference in New Issue
Block a user