From 815e02b86575d916a50037dd79ce0614d6788b01 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 23 Dec 2023 21:18:39 +0100 Subject: hd6301x/y: ddr1/ddr3 is 1-bit --- src/devices/cpu/m6800/m6801.cpp | 29 +++++++++++++++++------------ src/devices/cpu/m6800/m6801.h | 2 ++ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/devices/cpu/m6800/m6801.cpp b/src/devices/cpu/m6800/m6801.cpp index b6f5af38196..95befdbdf38 100644 --- a/src/devices/cpu/m6800/m6801.cpp +++ b/src/devices/cpu/m6800/m6801.cpp @@ -317,7 +317,7 @@ void hd6301x_cpu_device::hd6301x_io(address_map &map) { hd6303x_io(map); map(0x0002, 0x0002).rw(FUNC(hd6301x_cpu_device::p1_data_r), FUNC(hd6301x_cpu_device::p1_data_w)); // external except in single-chip mode - map(0x0004, 0x0004).rw(FUNC(hd6301x_cpu_device::ff_r), FUNC(hd6301x_cpu_device::p3_ddr_w)); // external except in single-chip mode + map(0x0004, 0x0004).rw(FUNC(hd6301x_cpu_device::ff_r), FUNC(hd6301x_cpu_device::p3_ddr_1bit_w)); // external except in single-chip mode map(0x0006, 0x0006).rw(FUNC(hd6301x_cpu_device::p3_data_r), FUNC(hd6301x_cpu_device::p3_data_w)); // external except in single-chip mode map(0x0007, 0x0007).rw(FUNC(hd6301x_cpu_device::p4_data_r), FUNC(hd6301x_cpu_device::p4_data_w)); // external except in single-chip mode map(0x0018, 0x0018).rw(FUNC(hd6301x_cpu_device::p7_data_r), FUNC(hd6301x_cpu_device::p7_data_w)); // external except in single-chip mode @@ -350,9 +350,9 @@ void hd6301y_cpu_device::hd6303y_io(address_map &map) void hd6301y_cpu_device::hd6301y_io(address_map &map) { hd6303y_io(map); - map(0x0000, 0x0000).rw(FUNC(hd6301y_cpu_device::ff_r), FUNC(hd6301y_cpu_device::p1_ddr_w)); // external except in single-chip mode + map(0x0000, 0x0000).rw(FUNC(hd6301y_cpu_device::ff_r), FUNC(hd6301y_cpu_device::p1_ddr_1bit_w)); // external except in single-chip mode map(0x0002, 0x0002).rw(FUNC(hd6301y_cpu_device::p1_data_r), FUNC(hd6301y_cpu_device::p1_data_w)); // external except in single-chip mode - map(0x0004, 0x0004).rw(FUNC(hd6301y_cpu_device::ff_r), FUNC(hd6301y_cpu_device::p3_ddr_w)); // external except in single-chip mode + map(0x0004, 0x0004).rw(FUNC(hd6301y_cpu_device::ff_r), FUNC(hd6301y_cpu_device::p3_ddr_1bit_w)); // external except in single-chip mode map(0x0005, 0x0005).rw(FUNC(hd6301y_cpu_device::ff_r), FUNC(hd6301y_cpu_device::p4_ddr_w)); // external except in single-chip mode map(0x0006, 0x0006).rw(FUNC(hd6301y_cpu_device::p3_data_r), FUNC(hd6301y_cpu_device::p3_data_w)); // external except in single-chip mode map(0x0007, 0x0007).rw(FUNC(hd6301y_cpu_device::p4_data_r), FUNC(hd6301y_cpu_device::p4_data_w)); // external except in single-chip mode @@ -1567,6 +1567,12 @@ void m6801_cpu_device::p1_ddr_w(uint8_t data) } } +void hd6301y_cpu_device::p1_ddr_1bit_w(uint8_t data) +{ + // HD6301Y DDR1 is 1-bit (HD6301X does not have DDR1) + hd6301_cpu_device::p1_ddr_w((BIT(data, 0) ? 0xff : 0x00)); +} + uint8_t m6801_cpu_device::p1_data_r() { if (m_port_ddr[0] == 0xff) @@ -1594,17 +1600,10 @@ void m6801_cpu_device::p2_ddr_w(uint8_t data) } } -// HD6301X0/HD63701X0/HD6303X only void hd6301x_cpu_device::p2_ddr_2bit_w(uint8_t data) { - LOGPORT("Port 2 Data Direction Register: %02x\n", data); - - data = (BIT(data, 1) ? 0xfe : 0x00) | (data & 0x01); - if (m_port_ddr[1] != data) - { - m_port_ddr[1] = data; - write_port2(); - } + // HD6301X DDR2 is 2-bit (it is 8-bit again on HD6301Y) + hd6301_cpu_device::p2_ddr_w((BIT(data, 1) ? 0xfe : 0x00) | (data & 0x01)); } uint8_t m6801_cpu_device::p2_data_r() @@ -1635,6 +1634,12 @@ void m6801_cpu_device::p3_ddr_w(uint8_t data) } } +void hd6301x_cpu_device::p3_ddr_1bit_w(uint8_t data) +{ + // HD6301X/Y DDR3 is 1-bit + hd6301_cpu_device::p3_ddr_w((BIT(data, 0) ? 0xff : 0x00)); +} + uint8_t m6801_cpu_device::p3_data_r() { uint8_t data; diff --git a/src/devices/cpu/m6800/m6801.h b/src/devices/cpu/m6800/m6801.h index 499aae2dc6f..12531d80bc9 100644 --- a/src/devices/cpu/m6800/m6801.h +++ b/src/devices/cpu/m6800/m6801.h @@ -332,6 +332,7 @@ protected: virtual void write_port2() override; void p2_ddr_2bit_w(uint8_t data); + void p3_ddr_1bit_w(uint8_t data); virtual uint8_t p3_data_r() override; virtual void p3_data_w(uint8_t data) override; virtual uint8_t p5_data_r(); @@ -436,6 +437,7 @@ protected: // device_execute_interface overrides virtual void execute_set_input(int inputnum, int state) override; + void p1_ddr_1bit_w(uint8_t data); void p5_ddr_w(uint8_t data); virtual uint8_t p5_data_r() override; void p5_data_w(uint8_t data); -- cgit v1.2.3