Removed cb2 callback from mac drivers, you now have to push the data. [smf]

This commit is contained in:
smf- 2014-01-01 17:16:02 +00:00
parent 3044336dd0
commit c4c56cedee
9 changed files with 33 additions and 103 deletions

View File

@ -150,12 +150,11 @@ via6522_device::via6522_device(const machine_config &mconfig, const char *tag, d
: device_t(mconfig, VIA6522, "6522 VIA", tag, owner, clock, "via6522", __FILE__),
m_in_a_handler(*this),
m_in_b_handler(*this),
m_in_cb2_handler(*this),
m_out_a_handler(*this),
m_out_b_handler(*this),
m_ca1_handler(*this),
m_cb1_handler(*this),
m_ca2_handler(*this),
m_cb1_handler(*this),
m_cb2_handler(*this),
m_irq_handler(*this),
m_irq(CLEAR_LINE)
@ -171,7 +170,6 @@ void via6522_device::device_start()
{
m_in_a_handler.resolve();
m_in_b_handler.resolve();
m_in_cb2_handler.resolve();
m_out_a_handler.resolve_safe();
m_out_b_handler.resolve_safe();
m_ca1_handler.resolve();
@ -373,11 +371,6 @@ void via6522_device::shift()
m_cb1_handler(0);
m_cb1_handler(1);
if (!m_in_cb2_handler.isnull())
{
m_in_cb2 = m_in_cb2_handler();
}
m_sr = (m_sr << 1) | (m_in_cb2 & 1);
m_shift_counter = (m_shift_counter + 1) % 8;
@ -401,11 +394,6 @@ void via6522_device::shift()
if (SI_EXT_CONTROL(m_acr))
{
if (!m_in_cb2_handler.isnull())
{
m_in_cb2 = m_in_cb2_handler();
}
m_sr = (m_sr << 1) | (m_in_cb2 & 1);
m_shift_counter = (m_shift_counter + 1) % 8;

View File

@ -31,9 +31,6 @@
#define MCFG_VIA6522_READPB_HANDLER(_devcb) \
devcb = &via6522_device::set_readpb_handler(*device, DEVCB2_##_devcb);
#define MCFG_VIA6522_READCB2_HANDLER(_devcb) \
devcb = &via6522_device::set_readcb2_handler(*device, DEVCB2_##_devcb);
// TODO: CONVERT THESE TO WRITE LINE
#define MCFG_VIA6522_WRITEPA_HANDLER(_devcb) \
devcb = &via6522_device::set_writepa_handler(*device, DEVCB2_##_devcb);
@ -45,12 +42,12 @@
#define MCFG_VIA6522_CA1_HANDLER(_devcb) \
devcb = &via6522_device::set_ca1_handler(*device, DEVCB2_##_devcb);
#define MCFG_VIA6522_CB1_HANDLER(_devcb) \
devcb = &via6522_device::set_cb1_handler(*device, DEVCB2_##_devcb);
#define MCFG_VIA6522_CA2_HANDLER(_devcb) \
devcb = &via6522_device::set_ca2_handler(*device, DEVCB2_##_devcb);
#define MCFG_VIA6522_CB1_HANDLER(_devcb) \
devcb = &via6522_device::set_cb1_handler(*device, DEVCB2_##_devcb);
#define MCFG_VIA6522_CB2_HANDLER(_devcb) \
devcb = &via6522_device::set_cb2_handler(*device, DEVCB2_##_devcb);
@ -74,15 +71,14 @@ public:
// TODO: REMOVE THESE
template<class _Object> static devcb2_base &set_readpa_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_in_a_handler.set_callback(object); }
template<class _Object> static devcb2_base &set_readpb_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_in_b_handler.set_callback(object); }
template<class _Object> static devcb2_base &set_readcb2_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_in_cb2_handler.set_callback(object); }
// TODO: CONVERT THESE TO WRITE LINE
template<class _Object> static devcb2_base &set_writepa_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_out_a_handler.set_callback(object); }
template<class _Object> static devcb2_base &set_writepb_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_out_b_handler.set_callback(object); }
template<class _Object> static devcb2_base &set_ca1_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_ca1_handler.set_callback(object); }
template<class _Object> static devcb2_base &set_cb1_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_cb1_handler.set_callback(object); }
template<class _Object> static devcb2_base &set_ca2_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_ca2_handler.set_callback(object); }
template<class _Object> static devcb2_base &set_cb1_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_cb1_handler.set_callback(object); }
template<class _Object> static devcb2_base &set_cb2_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_cb2_handler.set_callback(object); }
template<class _Object> static devcb2_base &set_irq_handler(device_t &device, _Object object) { return downcast<via6522_device &>(device).m_irq_handler.set_callback(object); }
@ -155,15 +151,14 @@ private:
// TODO: REMOVE THESE
devcb2_read8 m_in_a_handler;
devcb2_read8 m_in_b_handler;
devcb2_read_line m_in_cb2_handler;
// TODO: CONVERT THESE TO WRITE LINE
devcb2_write8 m_out_a_handler;
devcb2_write8 m_out_b_handler;
devcb2_write_line m_ca1_handler;
devcb2_write_line m_cb1_handler;
devcb2_write_line m_ca2_handler;
devcb2_write_line m_cb1_handler;
devcb2_write_line m_cb2_handler;
devcb2_write_line m_irq_handler;

View File

@ -966,16 +966,16 @@ static MACHINE_CONFIG_START( mac512ke, mac_state )
MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000)
MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a))
MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b))
#ifdef MAC_USE_EMULATED_KBD
MCFG_VIA6522_READCB2_HANDLER(READLINE(mac_state,mac_via_in_cb2))
#endif
MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a))
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b))
MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_via_out_cb2))
MCFG_VIA6522_IRQ_HANDLER(WRITELINE(mac_state,mac_via_irq))
MCFG_MACKBD_ADD()
MCFG_DEVICE_ADD(MACKBD_TAG, MACKBD, 0)
#ifdef MAC_USE_EMULATED_KBD
MCFG_MACKBD_DATAOUT_HANDLER(DEVWRITELINE("via6522_0", via6522_device, write_cb2))
MCFG_MACKBD_CLKOUT_HANDLER(WRITELINE(mac_state, mac_kbd_clk_in))
#endif
/* internal ram */
MCFG_RAM_ADD(RAM_TAG)
@ -1019,7 +1019,6 @@ static MACHINE_CONFIG_DERIVED( macse, macplus )
MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000)
MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a))
MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b))
MCFG_VIA6522_READCB2_HANDLER(READLINE(mac_state,mac_adb_via_in_cb2))
MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a))
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b))
MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2))
@ -1030,7 +1029,7 @@ static MACHINE_CONFIG_DERIVED( macse, macplus )
MCFG_RAM_DEFAULT_SIZE("4M")
MCFG_RAM_EXTRA_OPTIONS("2M,2560K,4M")
MCFG_MACKBD_REMOVE()
MCFG_DEVICE_REMOVE(MACKBD_TAG)
MCFG_MACPDS_BUS_ADD("sepds", "maincpu", macpds_intf)
MCFG_MACPDS_SLOT_ADD("sepds", "pds", mac_sepds_cards, NULL)
@ -1044,7 +1043,6 @@ static MACHINE_CONFIG_DERIVED( macclasc, macplus )
MCFG_DEVICE_ADD("via6522_0", VIA6522, 1000000)
MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a))
MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b))
MCFG_VIA6522_READCB2_HANDLER(READLINE(mac_state,mac_adb_via_in_cb2))
MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a))
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b))
MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2))
@ -1055,7 +1053,7 @@ static MACHINE_CONFIG_DERIVED( macclasc, macplus )
MCFG_RAM_DEFAULT_SIZE("4M")
MCFG_RAM_EXTRA_OPTIONS("2M,2560K,4M")
MCFG_MACKBD_REMOVE()
MCFG_DEVICE_REMOVE(MACKBD_TAG)
MACHINE_CONFIG_END
static MACHINE_CONFIG_START( macprtb, mac_state )
@ -1099,9 +1097,6 @@ static MACHINE_CONFIG_START( macprtb, mac_state )
MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360)
MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a))
MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b))
#ifdef MAC_USE_EMULATED_KBD
MCFG_VIA6522_READCB2_HANDLER(READLINE(mac_state,mac_via_in_cb2))
#endif
MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a))
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b))
MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_via_out_cb2))
@ -1154,7 +1149,6 @@ static MACHINE_CONFIG_START( macii, mac_state )
MCFG_DEVICE_ADD("via6522_0", VIA6522, C7M/10)
MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a))
MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b))
MCFG_VIA6522_READCB2_HANDLER(READLINE(mac_state,mac_adb_via_in_cb2))
MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a))
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b))
MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2))
@ -1217,7 +1211,6 @@ static MACHINE_CONFIG_START( maciifx, mac_state )
MCFG_DEVICE_ADD("via6522_0", VIA6522, C7M/10)
MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a))
MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b))
MCFG_VIA6522_READCB2_HANDLER(READLINE(mac_state,mac_adb_via_in_cb2))
MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a))
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b))
MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2))
@ -1427,7 +1420,6 @@ static MACHINE_CONFIG_START( macse30, mac_state )
MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360)
MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a))
MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b))
MCFG_VIA6522_READCB2_HANDLER(READLINE(mac_state,mac_adb_via_in_cb2))
MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a))
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b))
MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2))
@ -1488,7 +1480,6 @@ static MACHINE_CONFIG_START( macpb140, mac_state )
MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360)
MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a))
MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b))
MCFG_VIA6522_READCB2_HANDLER(READLINE(mac_state,mac_adb_via_in_cb2))
MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a))
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b))
MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2))
@ -1569,7 +1560,6 @@ static MACHINE_CONFIG_START( macpb160, mac_state )
MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360)
MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a))
MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b))
MCFG_VIA6522_READCB2_HANDLER(READLINE(mac_state,mac_adb_via_in_cb2))
MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a))
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b))
MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2))
@ -1751,7 +1741,6 @@ static MACHINE_CONFIG_START( pwrmac, mac_state )
MCFG_DEVICE_ADD("via6522_0", VIA6522, 783360)
MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a))
MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b))
MCFG_VIA6522_READCB2_HANDLER(READLINE(mac_state,mac_adb_via_in_cb2))
MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a))
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b))
MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2))
@ -1809,7 +1798,6 @@ static MACHINE_CONFIG_START( macqd700, mac_state )
MCFG_DEVICE_ADD("via6522_0", VIA6522, C7M/10)
MCFG_VIA6522_READPA_HANDLER(READ8(mac_state,mac_via_in_a))
MCFG_VIA6522_READPB_HANDLER(READ8(mac_state,mac_via_in_b))
MCFG_VIA6522_READCB2_HANDLER(READLINE(mac_state,mac_adb_via_in_cb2))
MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(mac_state,mac_via_out_a))
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(mac_state,mac_via_out_b))
MCFG_VIA6522_CB2_HANDLER(WRITELINE(mac_state,mac_adb_via_out_cb2))

View File

@ -129,7 +129,6 @@ static MACHINE_CONFIG_START( pippin, macpci_state )
MCFG_DEVICE_ADD("via6522_0", VIA6522, C7M/10)
MCFG_VIA6522_READPA_HANDLER(READ8(macpci_state, mac_via_in_a))
MCFG_VIA6522_READPB_HANDLER(READ8(macpci_state, mac_via_in_b))
MCFG_VIA6522_READCB2_HANDLER(READLINE(macpci_state,mac_adb_via_in_cb2))
MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(macpci_state,mac_via_out_a))
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(macpci_state,mac_via_out_b))
MCFG_VIA6522_CB2_HANDLER(WRITELINE(macpci_state, mac_adb_via_out_cb2))

View File

@ -27,6 +27,7 @@
#define MAC_SCREEN_NAME "screen"
#define MAC_539X_1_TAG "scsi:539x_1"
#define MAC_539X_2_TAG "scsi:539x_2"
#define MACKBD_TAG "mackbd"
// uncomment to run i8021 keyboard in orignal Mac/512(e)/Plus
//#define MAC_USE_EMULATED_KBD (1)
@ -512,9 +513,7 @@ public:
TIMER_CALLBACK_MEMBER(mac_scanline_tick);
TIMER_CALLBACK_MEMBER(dafb_vbl_tick);
TIMER_CALLBACK_MEMBER(dafb_cursor_tick);
DECLARE_READ_LINE_MEMBER(mac_via_in_cb2);
DECLARE_WRITE_LINE_MEMBER(mac_via_out_cb2);
DECLARE_READ_LINE_MEMBER(mac_adb_via_in_cb2);
DECLARE_WRITE_LINE_MEMBER(mac_adb_via_out_cb2);
DECLARE_READ8_MEMBER(mac_via_in_a);
DECLARE_READ8_MEMBER(mac_via_in_b);

View File

@ -633,19 +633,14 @@ void mac_state::keyboard_init()
/******************* Keyboard <-> VIA communication ***********************/
#ifdef MAC_USE_EMULATED_KBD
WRITE_LINE_MEMBER(mac_state::mac_kbd_clk_in)
{
printf("CLK: %d\n", state^1);
m_via1->write_cb1(state ? 0 : 1);
}
#ifdef MAC_USE_EMULATED_KBD
READ_LINE_MEMBER(mac_state::mac_via_in_cb2)
{
printf("Read %d from keyboard (PC=%x)\n", (m_mackbd->data_r() == ASSERT_LINE) ? 1 : 0, m_maincpu->pc());
return (m_mackbd->data_r() == ASSERT_LINE) ? 1 : 0;
}
WRITE_LINE_MEMBER(mac_state::mac_via_out_cb2)
{
printf("Sending %d to kbd (PC=%x)\n", data, m_maincpu->pc());
@ -1128,34 +1123,6 @@ WRITE16_MEMBER ( mac_state::mac_iwm_w )
fdc->write((offset >> 8), data>>8);
}
READ_LINE_MEMBER(mac_state::mac_adb_via_in_cb2)
{
UINT8 ret;
if (ADB_IS_EGRET)
{
ret = m_egret->get_via_data();
#if LOG_ADB
printf("68K: Read VIA_DATA %x\n", ret);
#endif
}
else if (ADB_IS_CUDA)
{
ret = m_cuda->get_via_data();
#if LOG_ADB
printf("68K: Read VIA_DATA %x\n", ret);
#endif
}
else
{
ret = (m_adb_send & 0x80)>>7;
m_adb_send <<= 1;
}
// printf("VIA IN CB2 = %x\n", ret);
return ret;
}
WRITE_LINE_MEMBER(mac_state::mac_adb_via_out_cb2)
{
// printf("VIA OUT CB2 = %x\n", state);
@ -1169,8 +1136,10 @@ WRITE_LINE_MEMBER(mac_state::mac_adb_via_out_cb2)
}
else
{
m_adb_command <<= 1;
m_adb_command |= state & 1;
if (state)
m_adb_command |= 1;
else
m_adb_command &= ~1;
}
}

View File

@ -611,6 +611,13 @@ TIMER_CALLBACK(mac_adb_tick)
// do one clock transition on CB1 to advance the VIA shifter
mac->m_adb_extclock ^= 1;
mac->m_via1->write_cb1(mac->m_adb_extclock);
if (mac->m_adb_direction == 0)
{
mac->m_via1->write_cb2((m_adb_send & 0x80)>>7);
m_adb_send <<= 1;
}
mac->m_adb_extclock ^= 1;
mac->m_via1->write_cb1(mac->m_adb_extclock);

View File

@ -210,7 +210,8 @@ ioport_constructor mackbd_device::device_input_ports() const
mackbd_device::mackbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MACKBD, "Macintosh keyboard", tag, owner, clock, "mackbd", __FILE__),
m_maincpu(*this, MACKBD_CPU_TAG),
m_clkout_handler(*this)
m_clkout_handler(*this),
m_dataout_handler(*this)
{
}
@ -320,11 +321,6 @@ READ8_MEMBER(mackbd_device::t1_r)
return (ioport("MODS")->read() & 0x2) ? 0xff : 0x00;
}
READ_LINE_MEMBER(mackbd_device::data_r)
{
return data_to_mac ? ASSERT_LINE : CLEAR_LINE;
}
WRITE_LINE_MEMBER(mackbd_device::data_w)
{
data_from_mac = (state == ASSERT_LINE) ? 1 : 0;

View File

@ -7,28 +7,16 @@
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
#define MACKBD_TAG "mackbd"
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_MACKBD_ADD() \
MCFG_DEVICE_ADD(MACKBD_TAG, MACKBD, 0)
#define MCFG_MACKBD_REPLACE() \
MCFG_DEVICE_REPLACE(MACKBD_TAG, MACKBD, 0)
#define MCFG_MACKBD_REMOVE() \
MCFG_DEVICE_REMOVE(MACKBD_TAG)
#define MCFG_MACKBD_CLKOUT_HANDLER(_devcb) \
devcb = &mackbd_device::set_clkout_handler(*device, DEVCB2_##_devcb);
#define MCFG_MACKBD_DATAOUT_HANDLER(_devcb) \
devcb = &mackbd_device::set_dataout_handler(*device, DEVCB2_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@ -40,6 +28,7 @@ class mackbd_device : public device_t
public:
// static config helper
template<class _Object> static devcb2_base &set_clkout_handler(device_t &device, _Object object) { return downcast<mackbd_device &>(device).m_clkout_handler.set_callback(object); }
template<class _Object> static devcb2_base &set_dataout_handler(device_t &device, _Object object) { return downcast<mackbd_device &>(device).m_dataout_handler.set_callback(object); }
// construction/destruction
mackbd_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
@ -52,7 +41,6 @@ public:
DECLARE_WRITE8_MEMBER(p2_w);
DECLARE_READ8_MEMBER(t1_r);
DECLARE_READ_LINE_MEMBER(data_r);
DECLARE_WRITE_LINE_MEMBER(data_w);
protected:
@ -69,6 +57,7 @@ private:
UINT8 p0, p1, p2, data_from_mac, data_to_mac;
devcb2_write_line m_clkout_handler;
devcb2_write_line m_dataout_handler;
void scan_kbd_col(int col);
};