changed pmd85 driver to use callbacks instead of diserial connect() [smf]

This commit is contained in:
smf- 2013-12-26 19:20:59 +00:00
parent d463ad4bb1
commit bf1cc07a28
3 changed files with 22 additions and 23 deletions

View File

@ -542,6 +542,17 @@ static const cassette_interface pmd85_cassette_interface =
NULL
};
const i8251_interface pmd85_i8251_interface =
{
DEVCB_DRIVER_LINE_MEMBER(pmd85_state, write_cas_tx),
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL,
DEVCB_NULL
};
/* machine definition */
static MACHINE_CONFIG_START( pmd85, pmd85_state )
@ -574,8 +585,7 @@ static MACHINE_CONFIG_START( pmd85, pmd85_state )
MCFG_CASSETTE_ADD( "cassette", pmd85_cassette_interface )
/* uart */
MCFG_I8251_ADD("uart", default_i8251_interface)
MCFG_SERIAL_SOURCE_ADD("sercas")
MCFG_I8251_ADD("uart", pmd85_i8251_interface)
/* internal ram */
MCFG_RAM_ADD(RAM_TAG)

View File

@ -20,8 +20,7 @@ public:
enum
{
TIMER_CASSETTE,
TIMER_RESET,
TIMER_SETUP_MACHINE_STATE
TIMER_RESET
};
pmd85_state(const machine_config &mconfig, device_type type, const char *tag)
@ -29,7 +28,6 @@ public:
m_maincpu(*this, "maincpu"),
m_ram(*this, RAM_TAG),
m_cassette(*this, "cassette"),
m_sercas(*this, "sercas"),
m_pit8253(*this, "pit8253"),
m_uart(*this, "uart"),
m_ppi8255_0(*this, "ppi8255_0"),
@ -83,7 +81,7 @@ public:
UINT32 screen_update_pmd85(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(pmd85_cassette_timer_callback);
TIMER_CALLBACK_MEMBER(pmd_reset);
TIMER_CALLBACK_MEMBER(setup_machine_state);
DECLARE_WRITE_LINE_MEMBER(write_cas_tx);
DECLARE_READ8_MEMBER(pmd85_ppi_0_porta_r);
DECLARE_READ8_MEMBER(pmd85_ppi_0_portb_r);
DECLARE_READ8_MEMBER(pmd85_ppi_0_portc_r);
@ -116,7 +114,6 @@ protected:
required_device<cpu_device> m_maincpu;
required_device<ram_device> m_ram;
required_device<cassette_image_device> m_cassette;
required_device<serial_source_device> m_sercas;
required_device<pit8253_device> m_pit8253;
optional_device<i8251_device> m_uart;
optional_device<i8255_device> m_ppi8255_0;
@ -153,6 +150,8 @@ protected:
void pmd85_common_driver_init();
void pmd85_draw_scanline(bitmap_ind16 &bitmap, int pmd85_scanline);
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
int m_cas_tx;
};

View File

@ -762,14 +762,15 @@ void pmd85_state::device_timer(emu_timer &timer, device_timer_id id, int param,
case TIMER_RESET:
pmd_reset(ptr, param);
break;
case TIMER_SETUP_MACHINE_STATE:
setup_machine_state(ptr, param);
break;
default:
assert_always(FALSE, "Unknown id in pmd85_state::device_timer");
}
}
WRITE_LINE_MEMBER(pmd85_state::write_cas_tx)
{
m_cas_tx = state;
}
TIMER_CALLBACK_MEMBER(pmd85_state::pmd85_cassette_timer_callback)
{
@ -797,7 +798,7 @@ TIMER_CALLBACK_MEMBER(pmd85_state::pmd85_cassette_timer_callback)
{
data = (!m_previous_level && current_level) ? 1 : 0;
m_sercas->send_bit(data);
m_uart->write_rx(data);
m_uart->receive_clock();
m_clk_level_tape = 1;
@ -817,7 +818,7 @@ TIMER_CALLBACK_MEMBER(pmd85_state::pmd85_cassette_timer_callback)
/* tape writing */
if (m_cassette->get_state()&CASSETTE_RECORD)
{
data = m_sercas->get_in_data_bit();
data = m_cas_tx;
data ^= m_clk_level_tape;
m_cassette->output(data&0x01 ? 1 : -1);
@ -921,15 +922,6 @@ DRIVER_INIT_MEMBER(pmd85_state,c2717)
pmd85_common_driver_init();
}
TIMER_CALLBACK_MEMBER(pmd85_state::setup_machine_state)
{
if (m_model != MATO)
{
m_uart->connect(m_sercas);
}
}
void pmd85_state::machine_reset()
{
int i, j;
@ -958,7 +950,5 @@ void pmd85_state::machine_reset()
m_startup_mem_map = 1;
(this->*update_memory)();
timer_set(attotime::zero, TIMER_SETUP_MACHINE_STATE);
m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(pmd85_state::pmd85_opbaseoverride), this));
}