(MESS) Start removing usage of deprecated 68681 INPORT_CALLBACK. [R. Belmont]

cat: Removed hacks required by the old 68681 implementation; keyboard works again. [R. Belmont]
This commit is contained in:
R. Belmont 2014-02-23 04:44:23 +00:00
parent fd2692ec44
commit 66421f650a
7 changed files with 40 additions and 69 deletions

View File

@ -97,7 +97,7 @@ void duartn68681_device::device_start()
write_irq.resolve_safe(); write_irq.resolve_safe();
write_a_tx.resolve_safe(); write_a_tx.resolve_safe();
write_b_tx.resolve_safe(); write_b_tx.resolve_safe();
read_inport.resolve_safe(0); read_inport.resolve();
write_outport.resolve_safe(); write_outport.resolve_safe();
duart_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(duartn68681_device::duart_timer_callback),this), NULL); duart_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(duartn68681_device::duart_timer_callback),this), NULL);
@ -298,7 +298,14 @@ READ8_MEMBER( duartn68681_device::read )
break; break;
case 0x0d: /* IP */ case 0x0d: /* IP */
r = read_inport(); // TODO: go away if (!read_inport.isnull())
{
r = read_inport(); // TODO: go away
}
else
{
r = IP_last_state;
}
break; break;
case 0x0e: /* Start counter command */ case 0x0e: /* Start counter command */

View File

@ -17,6 +17,7 @@
#define MCFG_DUARTN68681_B_TX_CALLBACK(_cb) \ #define MCFG_DUARTN68681_B_TX_CALLBACK(_cb) \
devcb = &duartn68681_device::set_b_tx_cb(*device, DEVCB2_##_cb); devcb = &duartn68681_device::set_b_tx_cb(*device, DEVCB2_##_cb);
// deprecated: use ipX_w() instead
#define MCFG_DUARTN68681_INPORT_CALLBACK(_cb) \ #define MCFG_DUARTN68681_INPORT_CALLBACK(_cb) \
devcb = &duartn68681_device::set_inport_cb(*device, DEVCB2_##_cb); devcb = &duartn68681_device::set_inport_cb(*device, DEVCB2_##_cb);

View File

@ -406,7 +406,6 @@ public:
optional_device<via6522_device> m_via1; // only swyft uses this optional_device<via6522_device> m_via1; // only swyft uses this
DECLARE_WRITE_LINE_MEMBER(cat_duart_irq_handler); DECLARE_WRITE_LINE_MEMBER(cat_duart_irq_handler);
DECLARE_WRITE_LINE_MEMBER(cat_duart_txa); DECLARE_WRITE_LINE_MEMBER(cat_duart_txa);
DECLARE_READ8_MEMBER(cat_duart_input);
DECLARE_WRITE8_MEMBER(cat_duart_output); DECLARE_WRITE8_MEMBER(cat_duart_output);
//required_device<speaker_sound_device> m_speaker; //required_device<speaker_sound_device> m_speaker;
optional_shared_ptr<UINT16> m_svram; optional_shared_ptr<UINT16> m_svram;
@ -993,11 +992,10 @@ TIMER_CALLBACK_MEMBER(cat_state::counter_6ms_callback)
{ {
// This is effectively also the KTOBF line 'clock' output to the d-latch before the duart // This is effectively also the KTOBF line 'clock' output to the d-latch before the duart
// Hence, invert the d-latch on the duart's input ports. // Hence, invert the d-latch on the duart's input ports.
// is there some way to 'strobe' the duart to tell it that its input ports just changed? // n68681 now properly generates interrupts when this bit changes, the previous hack is no longer necessary.
// with the devcb stuff, there definitely should be!
m_duart_inp ^= 0x04; m_duart_inp ^= 0x04;
m_duart->ip2_w((m_duart_inp>>2)&1);
m_6ms_counter++; m_6ms_counter++;
m_maincpu->set_input_line(M68K_IRQ_1, ASSERT_LINE); // hack until duart ints work; as of march 2013 they do not work correctly here (they fire at the wrong rate)
} }
IRQ_CALLBACK_MEMBER(cat_state::cat_int_ack) IRQ_CALLBACK_MEMBER(cat_state::cat_int_ack)
@ -1066,11 +1064,13 @@ UINT32 cat_state::screen_update_cat(screen_device &screen, bitmap_ind16 &bitmap,
*/ */
WRITE_LINE_MEMBER(cat_state::cat_duart_irq_handler) WRITE_LINE_MEMBER(cat_state::cat_duart_irq_handler)
{ {
int irqvector = m_duart->get_irq_vector();
#ifdef DEBUG_DUART_IRQ_HANDLER #ifdef DEBUG_DUART_IRQ_HANDLER
fprintf(stderr, "Duart IRQ handler called: state: %02X, vector: %06X\n", state, vector); fprintf(stderr, "Duart IRQ handler called: state: %02X, vector: %06X\n", state, irqvector);
#endif #endif
m_duart_irq_state = state; m_duart_irq_state = state;
//device->m_maincpu->set_input_line_and_vector(M68K_IRQ_1, state, vector); m_maincpu->set_input_line_and_vector(M68K_IRQ_1, state, irqvector);
} }
WRITE_LINE_MEMBER(cat_state::cat_duart_txa) WRITE_LINE_MEMBER(cat_state::cat_duart_txa)
@ -1088,13 +1088,6 @@ WRITE_LINE_MEMBER(cat_state::cat_duart_txa)
* IP4: Centronics BUSY * IP4: Centronics BUSY
* IP5: DSR * IP5: DSR
*/ */
READ8_MEMBER(cat_state::cat_duart_input)
{
#ifdef DEBUG_DUART_INPUT_LINES
fprintf(stderr, "Duart input lines read!\n");
#endif
return m_duart_inp;
}
/* mc68681 DUART Output pins: /* mc68681 DUART Output pins:
* OP0: RTS [using the duart builtin hardware-RTS feature?] * OP0: RTS [using the duart builtin hardware-RTS feature?]
@ -1138,7 +1131,6 @@ static MACHINE_CONFIG_START( cat, cat_state )
MCFG_DUARTN68681_ADD( "duartn68681", XTAL_19_968MHz*2/11 ) // duart is normally clocked by 3.6864mhz xtal, but cat seemingly uses a divider from the main xtal instead which probably yields 3.63054545Mhz. There is a trace to cut and a mounting area to allow using an actual 3.6864mhz xtal if you so desire MCFG_DUARTN68681_ADD( "duartn68681", XTAL_19_968MHz*2/11 ) // duart is normally clocked by 3.6864mhz xtal, but cat seemingly uses a divider from the main xtal instead which probably yields 3.63054545Mhz. There is a trace to cut and a mounting area to allow using an actual 3.6864mhz xtal if you so desire
MCFG_DUARTN68681_IRQ_CALLBACK(WRITELINE(cat_state, cat_duart_irq_handler)) MCFG_DUARTN68681_IRQ_CALLBACK(WRITELINE(cat_state, cat_duart_irq_handler))
MCFG_DUARTN68681_A_TX_CALLBACK(WRITELINE(cat_state, cat_duart_txa)) MCFG_DUARTN68681_A_TX_CALLBACK(WRITELINE(cat_state, cat_duart_txa))
MCFG_DUARTN68681_INPORT_CALLBACK(READ8(cat_state, cat_duart_input))
MCFG_DUARTN68681_OUTPORT_CALLBACK(WRITE8(cat_state, cat_duart_output)) MCFG_DUARTN68681_OUTPORT_CALLBACK(WRITE8(cat_state, cat_duart_output))
MCFG_NVRAM_ADD_0FILL("nvram") MCFG_NVRAM_ADD_0FILL("nvram")

View File

@ -409,7 +409,6 @@ public:
DECLARE_WRITE_LINE_MEMBER(duart_irq_handler); DECLARE_WRITE_LINE_MEMBER(duart_irq_handler);
DECLARE_WRITE_LINE_MEMBER(duart_tx_a); DECLARE_WRITE_LINE_MEMBER(duart_tx_a);
DECLARE_WRITE_LINE_MEMBER(duart_tx_b); DECLARE_WRITE_LINE_MEMBER(duart_tx_b);
DECLARE_READ8_MEMBER(duart_input);
DECLARE_WRITE8_MEMBER(duart_output); DECLARE_WRITE8_MEMBER(duart_output);
int m_mapper_state; int m_mapper_state;
@ -537,11 +536,6 @@ WRITE_LINE_MEMBER(esq1_state::duart_irq_handler)
m_maincpu->set_input_line(M6809_IRQ_LINE, state); m_maincpu->set_input_line(M6809_IRQ_LINE, state);
}; };
READ8_MEMBER(esq1_state::duart_input)
{
return 0;
}
WRITE8_MEMBER(esq1_state::duart_output) WRITE8_MEMBER(esq1_state::duart_output)
{ {
int bank = ((data >> 1) & 0x7); int bank = ((data >> 1) & 0x7);
@ -606,7 +600,6 @@ static MACHINE_CONFIG_START( esq1, esq1_state )
MCFG_DUARTN68681_IRQ_CALLBACK(WRITELINE(esq1_state, duart_irq_handler)) MCFG_DUARTN68681_IRQ_CALLBACK(WRITELINE(esq1_state, duart_irq_handler))
MCFG_DUARTN68681_A_TX_CALLBACK(WRITELINE(esq1_state, duart_tx_a)) MCFG_DUARTN68681_A_TX_CALLBACK(WRITELINE(esq1_state, duart_tx_a))
MCFG_DUARTN68681_B_TX_CALLBACK(WRITELINE(esq1_state, duart_tx_b)) MCFG_DUARTN68681_B_TX_CALLBACK(WRITELINE(esq1_state, duart_tx_b))
MCFG_DUARTN68681_INPORT_CALLBACK(READ8(esq1_state, duart_input))
MCFG_DUARTN68681_OUTPORT_CALLBACK(WRITE8(esq1_state, duart_output)) MCFG_DUARTN68681_OUTPORT_CALLBACK(WRITE8(esq1_state, duart_output))
MCFG_ESQPANEL2x40_ADD("panel", esqpanel_config) MCFG_ESQPANEL2x40_ADD("panel", esqpanel_config)

View File

@ -196,7 +196,6 @@ public:
DECLARE_WRITE_LINE_MEMBER(duart_irq_handler); DECLARE_WRITE_LINE_MEMBER(duart_irq_handler);
DECLARE_WRITE_LINE_MEMBER(duart_tx_a); DECLARE_WRITE_LINE_MEMBER(duart_tx_a);
DECLARE_WRITE_LINE_MEMBER(duart_tx_b); DECLARE_WRITE_LINE_MEMBER(duart_tx_b);
DECLARE_READ8_MEMBER(duart_input);
DECLARE_WRITE8_MEMBER(duart_output); DECLARE_WRITE8_MEMBER(duart_output);
int m_system_type; int m_system_type;
@ -269,6 +268,9 @@ void esq5505_state::machine_start()
void esq5505_state::machine_reset() void esq5505_state::machine_reset()
{ {
floppy_connector *con = machine().device<floppy_connector>("wd1772:0");
floppy_image_device *floppy = con ? con->get_device() : 0;
m_rom = (UINT16 *)(void *)memregion("osrom")->base(); m_rom = (UINT16 *)(void *)memregion("osrom")->base();
m_ram = (UINT16 *)(void *)memshare("osram")->ptr(); m_ram = (UINT16 *)(void *)memshare("osram")->ptr();
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(esq5505_state::maincpu_irq_acknowledge_callback),this)); m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(esq5505_state::maincpu_irq_acknowledge_callback),this));
@ -282,6 +284,27 @@ void esq5505_state::machine_reset()
m_analog_values[5] = 0xffff; // Volume control: full on. m_analog_values[5] = 0xffff; // Volume control: full on.
m_analog_values[6] = 0x7fc0; // Battery voltage: something reasonable. m_analog_values[6] = 0x7fc0; // Battery voltage: something reasonable.
m_analog_values[7] = 0x5540; // vRef to check battery. m_analog_values[7] = 0x5540; // vRef to check battery.
// on VFX, bit 0 is 1 for 'cartridge present'.
// on VFX-SD and later, bit 0 is 1 for floppy present, bit 1 is 1 for cartridge present
if (mame_stricmp(machine().system().name, "vfx") == 0)
{
// todo: handle VFX cart-in when we support cartridges
m_duart->ip0_w(ASSERT_LINE);
}
else
{
m_duart->ip1_w(CLEAR_LINE);
if (floppy)
{
m_duart->ip0_w(ASSERT_LINE);
}
else
{
m_duart->ip0_w(CLEAR_LINE);
}
}
} }
void esq5505_state::update_irq_to_maincpu() { void esq5505_state::update_irq_to_maincpu() {
@ -420,33 +443,6 @@ WRITE_LINE_MEMBER(esq5505_state::duart_irq_handler)
update_irq_to_maincpu(); update_irq_to_maincpu();
}; };
READ8_MEMBER(esq5505_state::duart_input)
{
floppy_connector *con = machine().device<floppy_connector>("wd1772:0");
floppy_image_device *floppy = con ? con->get_device() : 0;
UINT8 result = 0; // DUART input lines are separate from the output lines
// on VFX, bit 0 is 1 for 'cartridge present'.
// on VFX-SD and later, bit 0 is 1 for floppy present, bit 1 is 1 for cartridge present
if (mame_stricmp(machine().system().name, "vfx") == 0)
{
// todo: handle VFX cart-in when we support cartridges
}
else
{
if (floppy)
{
// ready_r returns true if the drive is *not* ready, false if it is
// if (!floppy->ready_r())
{
result |= 1;
}
}
}
return result;
}
WRITE8_MEMBER(esq5505_state::duart_output) WRITE8_MEMBER(esq5505_state::duart_output)
{ {
floppy_connector *con = machine().device<floppy_connector>("wd1772:0"); floppy_connector *con = machine().device<floppy_connector>("wd1772:0");
@ -655,7 +651,6 @@ static MACHINE_CONFIG_START( vfx, esq5505_state )
MCFG_DUARTN68681_IRQ_CALLBACK(WRITELINE(esq5505_state, duart_irq_handler)) MCFG_DUARTN68681_IRQ_CALLBACK(WRITELINE(esq5505_state, duart_irq_handler))
MCFG_DUARTN68681_A_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_a)) MCFG_DUARTN68681_A_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_a))
MCFG_DUARTN68681_B_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_b)) MCFG_DUARTN68681_B_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_b))
MCFG_DUARTN68681_INPORT_CALLBACK(READ8(esq5505_state, duart_input))
MCFG_DUARTN68681_OUTPORT_CALLBACK(WRITE8(esq5505_state, duart_output)) MCFG_DUARTN68681_OUTPORT_CALLBACK(WRITE8(esq5505_state, duart_output))
MCFG_DUARTN68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) MCFG_DUARTN68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000)
@ -717,7 +712,6 @@ static MACHINE_CONFIG_START(vfx32, esq5505_state)
MCFG_DUARTN68681_IRQ_CALLBACK(WRITELINE(esq5505_state, duart_irq_handler)) MCFG_DUARTN68681_IRQ_CALLBACK(WRITELINE(esq5505_state, duart_irq_handler))
MCFG_DUARTN68681_A_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_a)) MCFG_DUARTN68681_A_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_a))
MCFG_DUARTN68681_B_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_b)) MCFG_DUARTN68681_B_TX_CALLBACK(WRITELINE(esq5505_state, duart_tx_b))
MCFG_DUARTN68681_INPORT_CALLBACK(READ8(esq5505_state, duart_input))
MCFG_DUARTN68681_OUTPORT_CALLBACK(WRITE8(esq5505_state, duart_output)) MCFG_DUARTN68681_OUTPORT_CALLBACK(WRITE8(esq5505_state, duart_output))
MCFG_DUARTN68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) MCFG_DUARTN68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000)

View File

@ -56,7 +56,6 @@ public:
DECLARE_WRITE_LINE_MEMBER(duart_irq_handler); DECLARE_WRITE_LINE_MEMBER(duart_irq_handler);
DECLARE_WRITE_LINE_MEMBER(duart_tx_a); DECLARE_WRITE_LINE_MEMBER(duart_tx_a);
DECLARE_WRITE_LINE_MEMBER(duart_tx_b); DECLARE_WRITE_LINE_MEMBER(duart_tx_b);
DECLARE_READ8_MEMBER(duart_input);
DECLARE_WRITE8_MEMBER(duart_output); DECLARE_WRITE8_MEMBER(duart_output);
UINT8 m_duart_io; UINT8 m_duart_io;
@ -172,13 +171,6 @@ WRITE_LINE_MEMBER(esqkt_state::duart_irq_handler)
m_maincpu->set_input_line(M68K_IRQ_3, state); m_maincpu->set_input_line(M68K_IRQ_3, state);
}; };
READ8_MEMBER(esqkt_state::duart_input)
{
UINT8 result = 0; // DUART input lines are separate from the output lines
return result;
}
WRITE8_MEMBER(esqkt_state::duart_output) WRITE8_MEMBER(esqkt_state::duart_output)
{ {
m_duart_io = data; m_duart_io = data;
@ -244,7 +236,6 @@ static MACHINE_CONFIG_START( kt, esqkt_state )
MCFG_DUARTN68681_IRQ_CALLBACK(WRITELINE(esqkt_state, duart_irq_handler)) MCFG_DUARTN68681_IRQ_CALLBACK(WRITELINE(esqkt_state, duart_irq_handler))
MCFG_DUARTN68681_A_TX_CALLBACK(WRITELINE(esqkt_state, duart_tx_a)) MCFG_DUARTN68681_A_TX_CALLBACK(WRITELINE(esqkt_state, duart_tx_a))
MCFG_DUARTN68681_B_TX_CALLBACK(WRITELINE(esqkt_state, duart_tx_b)) MCFG_DUARTN68681_B_TX_CALLBACK(WRITELINE(esqkt_state, duart_tx_b))
MCFG_DUARTN68681_INPORT_CALLBACK(READ8(esqkt_state, duart_input))
MCFG_DUARTN68681_OUTPORT_CALLBACK(WRITE8(esqkt_state, duart_output)) MCFG_DUARTN68681_OUTPORT_CALLBACK(WRITE8(esqkt_state, duart_output))
MCFG_DUARTN68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) MCFG_DUARTN68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000)
MCFG_DUARTN68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000) MCFG_DUARTN68681_SET_EXTERNAL_CLOCKS(500000, 500000, 1000000, 1000000)

View File

@ -58,7 +58,6 @@ public:
floppy_image_device *m_floppy; floppy_image_device *m_floppy;
DECLARE_WRITE_LINE_MEMBER(duart_irq_handler); DECLARE_WRITE_LINE_MEMBER(duart_irq_handler);
DECLARE_WRITE_LINE_MEMBER(duart_txb); DECLARE_WRITE_LINE_MEMBER(duart_txb);
DECLARE_READ8_MEMBER(duart_input);
DECLARE_WRITE8_MEMBER(duart_output); DECLARE_WRITE8_MEMBER(duart_output);
required_shared_ptr<UINT16> m_p_ram; required_shared_ptr<UINT16> m_p_ram;
virtual void machine_reset(); virtual void machine_reset();
@ -101,11 +100,6 @@ WRITE_LINE_MEMBER(ht68k_state::duart_txb)
//This is the second serial channel named AUX, for modem or other serial devices. //This is the second serial channel named AUX, for modem or other serial devices.
} }
READ8_MEMBER(ht68k_state::duart_input)
{
return 0;
}
WRITE8_MEMBER(ht68k_state::duart_output) WRITE8_MEMBER(ht68k_state::duart_output)
{ {
m_floppy = NULL; m_floppy = NULL;
@ -136,7 +130,6 @@ static MACHINE_CONFIG_START( ht68k, ht68k_state )
MCFG_DUARTN68681_IRQ_CALLBACK(WRITELINE(ht68k_state, duart_irq_handler)) MCFG_DUARTN68681_IRQ_CALLBACK(WRITELINE(ht68k_state, duart_irq_handler))
MCFG_DUARTN68681_A_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd)) MCFG_DUARTN68681_A_TX_CALLBACK(DEVWRITELINE("rs232", rs232_port_device, write_txd))
MCFG_DUARTN68681_B_TX_CALLBACK(WRITELINE(ht68k_state, duart_txb)) MCFG_DUARTN68681_B_TX_CALLBACK(WRITELINE(ht68k_state, duart_txb))
MCFG_DUARTN68681_INPORT_CALLBACK(READ8(ht68k_state, duart_input))
MCFG_DUARTN68681_OUTPORT_CALLBACK(WRITE8(ht68k_state, duart_output)) MCFG_DUARTN68681_OUTPORT_CALLBACK(WRITE8(ht68k_state, duart_output))
MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "serial_terminal") MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "serial_terminal")