rainbow: keyboard works for a few seconds (nw)

This commit is contained in:
cracyc 2016-06-03 14:41:33 -05:00
parent fe95f89b73
commit c8e60167f4
3 changed files with 49 additions and 2 deletions

View File

@ -903,7 +903,7 @@ void rainbow_state::machine_reset()
INT88 = false;
m_kbd_tx_ready = m_kbd_rx_ready = false;
m_kbd8251->write_cts(1);
m_kbd8251->write_cts(0);
m_KBD = 0;
m_irq_high = 0;

View File

@ -192,6 +192,7 @@ static ADDRESS_MAP_START( lk201_map, AS_PROGRAM, 8, lk201_device )
AM_RANGE(0x0004, 0x0006) AM_READWRITE(ddr_r, ddr_w)
AM_RANGE(0x000a, 0x000c) AM_READWRITE(spi_r, spi_w)
AM_RANGE(0x000d, 0x0011) AM_READWRITE(sci_r, sci_w)
AM_RANGE(0x0012, 0x001b) AM_READWRITE(timer_r, timer_w)
AM_RANGE(0x0050, 0x00ff) AM_RAM
AM_RANGE(0x0100, 0x1fff) AM_ROM AM_REGION(LK201_CPU_TAG, 0x100)
ADDRESS_MAP_END
@ -495,6 +496,7 @@ lk201_device::lk201_device(const machine_config &mconfig, const char *tag, devic
void lk201_device::device_start()
{
m_count = timer_alloc(1);
m_tx_handler.resolve_safe();
}
@ -507,6 +509,8 @@ void lk201_device::device_reset()
{
set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
set_rate(4800);
m_count->adjust(attotime::from_hz(1200), 0, attotime::from_hz(1200));
memset(m_timer.regs, 0, sizeof(m_timer.regs));
sci_status = (SCSR_TC | SCSR_TDRE);
@ -522,7 +526,14 @@ void lk201_device::device_reset()
void lk201_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
device_serial_interface::device_timer(timer, id, param, ptr);
if(id == 1)
{
if(m_timer.tcr & 0x40)
m_maincpu->set_input_line(M68HC05EG_INT_TIMER, ASSERT_LINE);
m_timer.tsr |= 0x40;
}
else
device_serial_interface::device_timer(timer, id, param, ptr);
}
void lk201_device::rcv_complete()
@ -556,6 +567,22 @@ void lk201_device::update_interrupts()
}
}
READ8_MEMBER( lk201_device::timer_r )
{
UINT8 ret = m_timer.regs[offset];
if(m_timer.tsr)
{
m_timer.tsr = 0;
m_maincpu->set_input_line(M68HC05EG_INT_TIMER, CLEAR_LINE);
}
return ret;
}
WRITE8_MEMBER( lk201_device::timer_w )
{
m_timer.regs[offset] = data;
}
READ8_MEMBER( lk201_device::ddr_r )
{
return ddrs[offset];

View File

@ -53,6 +53,8 @@ public:
DECLARE_WRITE8_MEMBER( sci_w );
DECLARE_READ8_MEMBER( spi_r );
DECLARE_WRITE8_MEMBER( spi_w );
DECLARE_READ8_MEMBER( timer_r );
DECLARE_WRITE8_MEMBER( timer_w );
template<class _Object> static devcb_base &set_tx_handler(device_t &device, _Object wr) { return downcast<lk201_device &>(device).m_tx_handler.set_callback(wr); }
@ -76,6 +78,24 @@ private:
UINT8 led_data;
UINT8 kbd_data;
union {
struct {
UINT8 tcr;
UINT8 tsr;
UINT8 icrh;
UINT8 icrl;
UINT8 ocrh;
UINT8 ocrl;
UINT8 crh;
UINT8 crl;
UINT8 acrh;
UINT8 acrl;
};
UINT8 regs[10];
} m_timer;
emu_timer *m_count;
UINT8 sci_ctl2;
UINT8 sci_status;
//UINT8 sci_data;