mirror of
https://github.com/holub/mame
synced 2025-04-24 09:20:02 +03:00
diserial: add attotime and clock-div forms of set_rate and rename check_for_start to rx_w (nw)
debugqt: don't hide cursor while in debugger (nw) (mess) ibmpc: xt floppies for the xt (nw)
This commit is contained in:
parent
a46daa5a15
commit
285531623a
@ -40,8 +40,8 @@ device_serial_interface::device_serial_interface(const machine_config &mconfig,
|
||||
}
|
||||
m_rcv_clock = NULL;
|
||||
m_tra_clock = NULL;
|
||||
m_tra_baud = 0;
|
||||
m_rcv_baud = 0;
|
||||
m_tra_rate = attotime::never;
|
||||
m_rcv_rate = attotime::never;
|
||||
m_tra_flags = 0;
|
||||
m_rcv_register_data = 0x8000;
|
||||
m_rcv_bit_count = 0;
|
||||
@ -67,14 +67,42 @@ void device_serial_interface::interface_pre_start()
|
||||
|
||||
void device_serial_interface::set_rcv_rate(int baud)
|
||||
{
|
||||
m_rcv_baud = baud;
|
||||
m_rcv_rate = baud ? attotime::from_hz(baud) : attotime::never;
|
||||
receive_register_reset();
|
||||
m_rcv_clock->adjust(attotime::never);
|
||||
}
|
||||
|
||||
void device_serial_interface::set_tra_rate(int baud)
|
||||
{
|
||||
m_tra_baud = baud;
|
||||
m_tra_rate = baud ? attotime::from_hz(baud) : attotime::never;
|
||||
transmit_register_reset();
|
||||
m_tra_clock->adjust(attotime::never);
|
||||
}
|
||||
|
||||
void device_serial_interface::set_rcv_rate(attotime rate)
|
||||
{
|
||||
m_rcv_rate = rate;
|
||||
receive_register_reset();
|
||||
m_rcv_clock->adjust(attotime::never);
|
||||
}
|
||||
|
||||
void device_serial_interface::set_tra_rate(attotime rate)
|
||||
{
|
||||
m_tra_rate = rate;
|
||||
transmit_register_reset();
|
||||
m_tra_clock->adjust(attotime::never);
|
||||
}
|
||||
|
||||
void device_serial_interface::set_rcv_rate(UINT32 clock, int div)
|
||||
{
|
||||
m_rcv_rate = attotime::from_hz(clock) / div;
|
||||
receive_register_reset();
|
||||
m_rcv_clock->adjust(attotime::never);
|
||||
}
|
||||
|
||||
void device_serial_interface::set_tra_rate(UINT32 clock, int div)
|
||||
{
|
||||
m_tra_rate = attotime::from_hz(clock) / div;
|
||||
transmit_register_reset();
|
||||
m_tra_clock->adjust(attotime::never);
|
||||
}
|
||||
@ -131,20 +159,19 @@ void device_serial_interface::receive_register_reset()
|
||||
m_rcv_flags |= RECEIVE_REGISTER_WAITING_FOR_START_BIT;
|
||||
}
|
||||
|
||||
UINT8 device_serial_interface::check_for_start(UINT8 bit)
|
||||
WRITE_LINE_MEMBER(device_serial_interface::rx_w)
|
||||
{
|
||||
m_rcv_line = bit;
|
||||
m_rcv_line = state;
|
||||
if(m_rcv_flags & RECEIVE_REGISTER_SYNCHRONISED)
|
||||
return 0;
|
||||
receive_register_update_bit(bit);
|
||||
return;
|
||||
receive_register_update_bit(state);
|
||||
if(m_rcv_flags & RECEIVE_REGISTER_SYNCHRONISED)
|
||||
{
|
||||
if(m_rcv_clock && m_rcv_baud)
|
||||
if(m_rcv_clock && !(m_rcv_rate.is_never()))
|
||||
// make start delay just a bit longer to make sure we are called after the sender
|
||||
m_rcv_clock->adjust(attotime::from_hz((m_rcv_baud*2)/3), 0, attotime::from_hz(m_rcv_baud));
|
||||
return 1;
|
||||
m_rcv_clock->adjust(((m_rcv_rate*3)/2), 0, m_rcv_rate);
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* this is generic code to be used in serial chip implementations */
|
||||
@ -283,8 +310,8 @@ void device_serial_interface::transmit_register_setup(UINT8 data_byte)
|
||||
int i;
|
||||
unsigned char transmit_data;
|
||||
|
||||
if(m_tra_clock && m_tra_baud)
|
||||
m_tra_clock->adjust(attotime::from_hz(m_tra_baud), 0, attotime::from_hz(m_tra_baud));
|
||||
if(m_tra_clock && !m_tra_rate.is_never())
|
||||
m_tra_clock->adjust(m_tra_rate, 0, m_tra_rate);
|
||||
|
||||
m_tra_bit_count_transmitted = 0;
|
||||
m_tra_bit_count = 0;
|
||||
|
@ -91,6 +91,10 @@ public:
|
||||
void receive_register_update_bit(int bit);
|
||||
void receive_register_extract();
|
||||
|
||||
void set_rcv_rate(attotime baud);
|
||||
void set_tra_rate(attotime baud);
|
||||
void set_rcv_rate(UINT32 clock, int div);
|
||||
void set_tra_rate(UINT32 clock, int div);
|
||||
void set_rcv_rate(int baud);
|
||||
void set_tra_rate(int baud);
|
||||
void tra_clock();
|
||||
@ -117,7 +121,7 @@ public:
|
||||
void set_other_connection(device_serial_interface *other_connection);
|
||||
|
||||
void connect(device_serial_interface *other_connection);
|
||||
UINT8 check_for_start(UINT8 bit);
|
||||
DECLARE_WRITE_LINE_MEMBER(rx_w);
|
||||
protected:
|
||||
UINT8 m_input_state;
|
||||
UINT8 m_connection_state;
|
||||
@ -166,8 +170,8 @@ private:
|
||||
|
||||
emu_timer *m_rcv_clock;
|
||||
emu_timer *m_tra_clock;
|
||||
int m_rcv_baud;
|
||||
int m_tra_baud;
|
||||
attotime m_rcv_rate;
|
||||
attotime m_tra_rate;
|
||||
UINT8 m_rcv_line;
|
||||
|
||||
device_serial_interface *m_other_connection;
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
virtual bool core_opens_image_file() const { return FALSE; }
|
||||
virtual const option_guide *create_option_guide() const { return NULL; }
|
||||
|
||||
virtual void tx(UINT8 state) { check_for_start(state); }
|
||||
virtual void tx(UINT8 state) { rx_w(state); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER( dsr_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( ri_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( cts_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( rx_w ) { check_for_start(state); }
|
||||
DECLARE_WRITE_LINE_MEMBER( rx_w ) { device_serial_interface::rx_w(state); }
|
||||
void input_callback(UINT8 state) { m_input_state = state; }
|
||||
|
||||
protected:
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
microtouch_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
template<class _Object> static devcb2_base &static_set_stx_callback(device_t &device, _Object object) { return downcast<microtouch_serial_device &>(device).m_out_stx_func.set_callback(object); }
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(rx) { check_for_start(state); }
|
||||
DECLARE_WRITE_LINE_MEMBER(rx) { device_serial_interface::rx_w(state); }
|
||||
protected:
|
||||
virtual void device_start();
|
||||
virtual void tx(UINT8 data);
|
||||
|
@ -354,7 +354,7 @@ void mos6551_device::set_rxc(int clock)
|
||||
|
||||
WRITE_LINE_MEMBER( mos6551_device::rxd_w )
|
||||
{
|
||||
check_for_start(state);
|
||||
device_serial_interface::rx_w(state);
|
||||
}
|
||||
|
||||
|
||||
|
@ -106,8 +106,8 @@ public:
|
||||
DECLARE_WRITE8_HANDLER(write);
|
||||
UINT8 get_irq_vector() { return IVR; }
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( rx_a_w ) { m_chanA->check_for_start((UINT8)state); }
|
||||
DECLARE_WRITE_LINE_MEMBER( rx_b_w ) { m_chanB->check_for_start((UINT8)state); }
|
||||
DECLARE_WRITE_LINE_MEMBER( rx_a_w ) { m_chanA->device_serial_interface::rx_w((UINT8)state); }
|
||||
DECLARE_WRITE_LINE_MEMBER( rx_b_w ) { m_chanB->device_serial_interface::rx_w((UINT8)state); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
|
@ -309,7 +309,7 @@ static MACHINE_CONFIG_START( ibm5150, ibmpc_state )
|
||||
|
||||
MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false)
|
||||
MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false)
|
||||
MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc", false)
|
||||
MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false)
|
||||
MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false)
|
||||
MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, NULL, false)
|
||||
|
||||
@ -343,7 +343,7 @@ static MACHINE_CONFIG_START( ibm5160, ibmpc_state )
|
||||
|
||||
MCFG_ISA8_SLOT_ADD("mb:isa", "isa1", pc_isa8_cards, "cga", false)
|
||||
MCFG_ISA8_SLOT_ADD("mb:isa", "isa2", pc_isa8_cards, "com", false)
|
||||
MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc", false)
|
||||
MCFG_ISA8_SLOT_ADD("mb:isa", "isa3", pc_isa8_cards, "fdc_xt", false)
|
||||
MCFG_ISA8_SLOT_ADD("mb:isa", "isa4", pc_isa8_cards, "hdc", false)
|
||||
MCFG_ISA8_SLOT_ADD("mb:isa", "isa5", pc_isa8_cards, NULL, false)
|
||||
MCFG_ISA8_SLOT_ADD("mb:isa", "isa6", pc_isa8_cards, NULL, false)
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
// construction/destruction
|
||||
esqpanel_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( rx_w ) { check_for_start(state); }
|
||||
DECLARE_WRITE_LINE_MEMBER( rx_w ) { device_serial_interface::rx_w(state); }
|
||||
|
||||
virtual void send_to_display(UINT8 data) = 0;
|
||||
|
||||
|
@ -117,7 +117,7 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(dsp_rbuf_status_w);
|
||||
DECLARE_WRITE8_MEMBER(dsp_cmd_w);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( midi_rx_w ) { check_for_start((UINT8)state); }
|
||||
DECLARE_WRITE_LINE_MEMBER( midi_rx_w ) { device_serial_interface::rx_w((UINT8)state); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
serial_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
serial_keyboard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(rx_w) { m_tbit = state; check_for_start(state); }
|
||||
DECLARE_WRITE_LINE_MEMBER(rx_w) { m_tbit = state; device_serial_interface::rx_w(state); }
|
||||
DECLARE_READ_LINE_MEMBER(tx_r);
|
||||
virtual ioport_constructor device_input_ports() const;
|
||||
|
||||
|
@ -94,7 +94,7 @@ class serial_terminal_device :
|
||||
public:
|
||||
serial_terminal_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(rx_w) { m_tbit = state; check_for_start(state); }
|
||||
DECLARE_WRITE_LINE_MEMBER(rx_w) { m_tbit = state; device_serial_interface::rx_w(state); }
|
||||
DECLARE_READ_LINE_MEMBER(tx_r);
|
||||
virtual void tx(UINT8 state) { rx_w(state); }
|
||||
virtual ioport_constructor device_input_ports() const;
|
||||
|
@ -242,6 +242,8 @@ void xxx_osd_interface::init_debugger()
|
||||
|
||||
#if defined(SDLMAME_UNIX) || defined(SDLMAME_WIN32)
|
||||
extern int sdl_entered_debugger;
|
||||
#elif defined(WIN32)
|
||||
void winwindow_update_cursor_state(running_machine &machine);
|
||||
#endif
|
||||
|
||||
void xxx_osd_interface::wait_for_debugger(device_t &device, bool firststop)
|
||||
@ -307,6 +309,9 @@ void xxx_osd_interface::wait_for_debugger(device_t &device, bool firststop)
|
||||
gather_save_configurations();
|
||||
break;
|
||||
}
|
||||
#if defined(WIN32) && !defined(SDLMAME_WIN32)
|
||||
winwindow_update_cursor_state(machine()); // make sure the cursor isn't hidden while in debugger
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user