summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-06-22 14:12:22 -0400
committer AJR <ajrhacker@users.noreply.github.com>2019-06-22 14:12:22 -0400
commitfadfd46b2e43c006868ae266403bb787dbfa4962 (patch)
tree58f4428857b9008c2f6d25b270daa112d5735074
parent98fe9fc6938b0de114c79adc9452f3c705b56994 (diff)
i8x9x: Add baud rate register (nw)
-rw-r--r--src/devices/cpu/mcs96/i8x9x.cpp11
-rw-r--r--src/devices/cpu/mcs96/i8x9x.h3
2 files changed, 13 insertions, 1 deletions
diff --git a/src/devices/cpu/mcs96/i8x9x.cpp b/src/devices/cpu/mcs96/i8x9x.cpp
index 92a6a3db873..b550c422642 100644
--- a/src/devices/cpu/mcs96/i8x9x.cpp
+++ b/src/devices/cpu/mcs96/i8x9x.cpp
@@ -67,6 +67,7 @@ void i8x9x_device::device_start()
state_add(I8X9X_SBUF_TX, "SBUF_TX", serial_send_buf);
state_add(I8X9X_SP_CON, "SP_CON", sp_con).mask(0x1f);
state_add(I8X9X_SP_STAT, "SP_STAT", sp_stat).mask(0xe0);
+ state_add(I8X9X_BAUD_RATE, "BAUD_RATE", baud_reg);
state_add(I8X9X_IOC0, "IOC0", ioc0).mask(0xfd);
state_add(I8X9X_IOC1, "IOC1", ioc1);
state_add(I8X9X_IOS0, "IOS0", ios0);
@@ -99,6 +100,8 @@ void i8x9x_device::device_start()
save_item(NAME(sp_stat));
save_item(NAME(serial_send_buf));
save_item(NAME(serial_send_timer));
+ save_item(NAME(baud_reg));
+ save_item(NAME(brh));
}
void i8x9x_device::device_reset()
@@ -119,6 +122,7 @@ void i8x9x_device::device_reset()
sp_con &= 0x17;
sp_stat &= 0x80;
serial_send_timer = 0;
+ brh = false;
m_hso_cb(0);
}
@@ -267,7 +271,12 @@ u16 i8x9x_device::timer2_r()
void i8x9x_device::baud_rate_w(u8 data)
{
- logerror("baud rate %02x (%04x)\n", data, PPC);
+ if (brh)
+ baud_reg = (baud_reg & 0x00ff) | u16(data) << 8;
+ else
+ baud_reg = (baud_reg & 0xff00) | data;
+ if (!machine().side_effects_disabled())
+ brh = !brh;
}
u8 i8x9x_device::port0_r()
diff --git a/src/devices/cpu/mcs96/i8x9x.h b/src/devices/cpu/mcs96/i8x9x.h
index 97c4e3a7ccc..2d88877016e 100644
--- a/src/devices/cpu/mcs96/i8x9x.h
+++ b/src/devices/cpu/mcs96/i8x9x.h
@@ -26,6 +26,7 @@ public:
I8X9X_SBUF_TX,
I8X9X_SP_CON,
I8X9X_SP_STAT,
+ I8X9X_BAUD_RATE,
I8X9X_IOC0,
I8X9X_IOC1,
I8X9X_IOS0,
@@ -132,6 +133,8 @@ private:
u8 sbuf, sp_con, sp_stat;
u8 serial_send_buf;
u64 serial_send_timer;
+ u16 baud_reg;
+ bool brh;
u16 timer_value(int timer, u64 current_time) const;
u64 timer_time_until(int timer, u64 current_time, u16 timer_value) const;