mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
(MESS) ti99: Fixed dropouts in RS232, caused by sdlsocket/corefile
wiping the input buffer on next write.
This commit is contained in:
parent
af2b8f15ba
commit
784a36b87f
@ -684,7 +684,6 @@ void ti_rs232_pio_device::receive_data_or_line_state(int uartind)
|
||||
{
|
||||
device_image_interface *serial;
|
||||
UINT8 buffer;
|
||||
int len = 0;
|
||||
|
||||
serial = dynamic_cast<device_image_interface *>(m_serdev[uartind]);
|
||||
|
||||
@ -700,8 +699,15 @@ void ti_rs232_pio_device::receive_data_or_line_state(int uartind)
|
||||
// elapsed, we can get a new value.
|
||||
if (m_time_hold[uartind] > 1.0)
|
||||
{
|
||||
len = serial->fread(&buffer, 1);
|
||||
if (len==0) return;
|
||||
// Buffer empty?
|
||||
if (m_bufpos[uartind] == m_buflen[uartind])
|
||||
{
|
||||
// Get all out of sdlsocket
|
||||
m_buflen[uartind] = serial->fread(m_recvbuf[uartind], 512);
|
||||
m_bufpos[uartind] = 0;
|
||||
if (m_buflen[uartind]==0) return;
|
||||
}
|
||||
buffer = m_recvbuf[uartind][m_bufpos[uartind]++];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1030,6 +1036,15 @@ void ti_rs232_pio_device::device_start()
|
||||
m_serdev[0] = subdevice<ti_rs232_attached_device>("serdev0");
|
||||
m_serdev[1] = subdevice<ti_rs232_attached_device>("serdev1");
|
||||
m_piodev = subdevice<ti_pio_attached_device>("piodev");
|
||||
// Prepare the receive buffers
|
||||
m_recvbuf[0] = (UINT8*)malloc(512);
|
||||
m_recvbuf[1] = (UINT8*)malloc(512);
|
||||
}
|
||||
|
||||
void ti_rs232_pio_device::device_stop()
|
||||
{
|
||||
if (m_recvbuf[0] != NULL) free(m_recvbuf[0]);
|
||||
if (m_recvbuf[1] != NULL) free(m_recvbuf[1]);
|
||||
}
|
||||
|
||||
void ti_rs232_pio_device::device_reset()
|
||||
@ -1047,6 +1062,8 @@ void ti_rs232_pio_device::device_reset()
|
||||
m_recv_mode[0] = RECV_MODE_NORMAL;
|
||||
m_recv_mode[1] = RECV_MODE_NORMAL;
|
||||
|
||||
m_bufpos[0] = m_bufpos[1] = m_buflen[0] = m_buflen[1] = 0;
|
||||
|
||||
if (m_genmod)
|
||||
{
|
||||
m_select_mask = 0x1fe000;
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
protected:
|
||||
virtual void device_start(void);
|
||||
virtual void device_reset(void);
|
||||
virtual void device_stop(void);
|
||||
virtual const rom_entry *device_rom_region(void) const;
|
||||
virtual machine_config_constructor device_mconfig_additions() const;
|
||||
virtual ioport_constructor device_input_ports() const;
|
||||
@ -66,13 +67,24 @@ private:
|
||||
void output_exception(int uartind, int param, UINT8 value);
|
||||
void ctrl_callback(int uartind, int type, UINT8 data);
|
||||
|
||||
// UART chips
|
||||
tms9902_device* m_uart[2];
|
||||
// Connected images (file or socket connection) that represent the
|
||||
// devices that are connected to the serial adapters
|
||||
ti_rs232_attached_device* m_serdev[2];
|
||||
// Connected image (file) that represents the device connected to the
|
||||
// parallel interface
|
||||
ti_pio_attached_device* m_piodev;
|
||||
address_space* m_space;
|
||||
UINT8* m_dsrrom;
|
||||
|
||||
UINT8 m_signals[2]; // Latches the state of the output lines for UART0/UART1
|
||||
// Input buffer for each UART. We have to copy the contents of sdlsocket here
|
||||
// because the buffer in corefile will be lost on the next write operation
|
||||
UINT8* m_recvbuf[2];
|
||||
int m_bufpos[2], m_buflen[2];
|
||||
|
||||
// Latches the state of the output lines for UART0/UART1
|
||||
UINT8 m_signals[2];
|
||||
int m_recv_mode[2]; // May be NORMAL or ESC
|
||||
|
||||
// Baud rate management
|
||||
|
Loading…
Reference in New Issue
Block a user