summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2024-03-04 22:07:02 +0100
committer hap <happppp@users.noreply.github.com>2024-03-04 22:07:12 +0100
commit88e1a2adb05bbd87e400de446cb3e61e929560b0 (patch)
tree2106d4ef9337d4814857d0d0135eedd04238e228
parent3c3bfa7883447a03b674057b3561c2739685924d (diff)
h8: fix standby time travel problem
-rw-r--r--src/devices/cpu/h8/gt913.cpp6
-rw-r--r--src/devices/cpu/h8/gt913.h1
-rw-r--r--src/devices/cpu/h8/h8.cpp8
-rw-r--r--src/devices/cpu/h8/h8.h31
-rw-r--r--src/devices/cpu/h8/h8.lst2
-rw-r--r--src/devices/cpu/h8/h83002.cpp13
-rw-r--r--src/devices/cpu/h8/h83002.h1
-rw-r--r--src/devices/cpu/h8/h83003.cpp13
-rw-r--r--src/devices/cpu/h8/h83003.h1
-rw-r--r--src/devices/cpu/h8/h83006.cpp16
-rw-r--r--src/devices/cpu/h8/h83006.h1
-rw-r--r--src/devices/cpu/h8/h83008.cpp15
-rw-r--r--src/devices/cpu/h8/h83008.h1
-rw-r--r--src/devices/cpu/h8/h83032.cpp12
-rw-r--r--src/devices/cpu/h8/h83032.h1
-rw-r--r--src/devices/cpu/h8/h83042.cpp13
-rw-r--r--src/devices/cpu/h8/h83042.h1
-rw-r--r--src/devices/cpu/h8/h83048.cpp13
-rw-r--r--src/devices/cpu/h8/h83048.h1
-rw-r--r--src/devices/cpu/h8/h83217.cpp19
-rw-r--r--src/devices/cpu/h8/h83217.h1
-rw-r--r--src/devices/cpu/h8/h8325.cpp9
-rw-r--r--src/devices/cpu/h8/h8325.h1
-rw-r--r--src/devices/cpu/h8/h83337.cpp11
-rw-r--r--src/devices/cpu/h8/h83337.h1
-rw-r--r--src/devices/cpu/h8/h8_adc.cpp6
-rw-r--r--src/devices/cpu/h8/h8_adc.h1
-rw-r--r--src/devices/cpu/h8/h8_sci.cpp30
-rw-r--r--src/devices/cpu/h8/h8_sci.h3
-rw-r--r--src/devices/cpu/h8/h8_timer16.cpp15
-rw-r--r--src/devices/cpu/h8/h8_timer16.h1
-rw-r--r--src/devices/cpu/h8/h8_timer8.cpp15
-rw-r--r--src/devices/cpu/h8/h8_timer8.h1
-rw-r--r--src/devices/cpu/h8/h8_watchdog.cpp8
-rw-r--r--src/devices/cpu/h8/h8_watchdog.h1
-rw-r--r--src/devices/cpu/h8/h8s2245.cpp14
-rw-r--r--src/devices/cpu/h8/h8s2245.h1
-rw-r--r--src/devices/cpu/h8/h8s2319.cpp14
-rw-r--r--src/devices/cpu/h8/h8s2319.h1
-rw-r--r--src/devices/cpu/h8/h8s2329.cpp6
-rw-r--r--src/devices/cpu/h8/h8s2329.h1
-rw-r--r--src/devices/cpu/h8/h8s2357.cpp17
-rw-r--r--src/devices/cpu/h8/h8s2357.h1
-rw-r--r--src/devices/cpu/h8/h8s2655.cpp17
-rw-r--r--src/devices/cpu/h8/h8s2655.h1
-rw-r--r--src/devices/cpu/h8/swx00.cpp19
-rw-r--r--src/devices/cpu/h8/swx00.h1
47 files changed, 328 insertions, 38 deletions
diff --git a/src/devices/cpu/h8/gt913.cpp b/src/devices/cpu/h8/gt913.cpp
index 8b2de950f5e..e32ad3f679e 100644
--- a/src/devices/cpu/h8/gt913.cpp
+++ b/src/devices/cpu/h8/gt913.cpp
@@ -253,6 +253,12 @@ void gt913_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void gt913_device::notify_standby(int state)
+{
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+}
+
void gt913_device::execute_set_input(int inputnum, int state)
{
m_intc->set_input(inputnum, state);
diff --git a/src/devices/cpu/h8/gt913.h b/src/devices/cpu/h8/gt913.h
index 5686915bafc..878dbc48ebe 100644
--- a/src/devices/cpu/h8/gt913.h
+++ b/src/devices/cpu/h8/gt913.h
@@ -56,6 +56,7 @@ protected:
virtual void update_irq_filter() override;
virtual void interrupt_taken() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void irq_setup() override;
virtual void execute_set_input(int inputnum, int state) override;
diff --git a/src/devices/cpu/h8/h8.cpp b/src/devices/cpu/h8/h8.cpp
index 4e9b43d3bb5..2816dd25e2d 100644
--- a/src/devices/cpu/h8/h8.cpp
+++ b/src/devices/cpu/h8/h8.cpp
@@ -13,10 +13,6 @@
mode) and the power button triggers an IRQ to wake up instead of RES.
Obviously, MAME always starts at reset-phase at power-on, so it's more
like a 'known issue' instead of a TODO since it can't really be fixed.
- - SSBY is supposed to halt the clock. But in MAME, peripherals remember
- the last update time and will try to catch up (a lot) after the CPU
- wakes up. For example, if h8_watchdog was enabled, it will immediately
- trigger a reset after wake up.
- add STBY pin (hardware standby mode, can only wake up with reset)
***************************************************************************/
@@ -43,7 +39,7 @@ h8_device::h8_device(const machine_config &mconfig, device_type type, const char
m_PPC(0), m_NPC(0), m_PC(0), m_PIR(0), m_EXR(0), m_CCR(0), m_MAC(0), m_MACF(0),
m_TMP1(0), m_TMP2(0), m_TMPR(0), m_inst_state(0), m_inst_substate(0), m_icount(0), m_bcount(0),
m_irq_vector(0), m_taken_irq_vector(0), m_irq_level(0), m_taken_irq_level(0), m_irq_required(false), m_irq_nmi(false),
- m_standby_pending(false), m_nvram_defval(0), m_nvram_battery(true)
+ m_standby_pending(false), m_standby_time(0), m_nvram_defval(0), m_nvram_battery(true)
{
m_supports_advanced = false;
m_mode_advanced = false;
@@ -169,6 +165,7 @@ void h8_device::device_start()
save_item(NAME(m_irq_nmi));
save_item(NAME(m_current_dma));
save_item(NAME(m_standby_pending));
+ save_item(NAME(m_standby_time));
save_item(NAME(m_nvram_battery));
set_icountptr(m_icount);
@@ -583,6 +580,7 @@ void h8_device::set_irq(int irq_vector, int irq_level, bool irq_nmi)
// wake up from software standby with an external interrupt
if(standby() && m_irq_vector) {
+ notify_standby(0);
resume(SUSPEND_REASON_CLOCK);
m_standby_cb(0);
take_interrupt();
diff --git a/src/devices/cpu/h8/h8.h b/src/devices/cpu/h8/h8.h
index 6a7ac788035..bf6b9540b73 100644
--- a/src/devices/cpu/h8/h8.h
+++ b/src/devices/cpu/h8/h8.h
@@ -49,6 +49,7 @@ public:
void nvram_set_default_value(u16 val) { m_nvram_defval = val; } // default is 0
auto standby_cb() { return m_standby_cb.bind(); } // notifier (not an output pin)
int standby() { return suspended(SUSPEND_REASON_CLOCK) ? 1 : 0; }
+ u64 standby_time() { return m_standby_time; }
void internal_update();
void set_irq(int irq_vector, int irq_level, bool irq_nmi);
@@ -155,20 +156,20 @@ protected:
h8_dma_state *m_dma_channel[8];
int m_current_dma;
h8_dtc_state *m_current_dtc;
- u64 m_cycles_base;
-
- u32 m_PPC; // previous program counter
- u32 m_NPC; // next start-of-instruction program counter
- u32 m_PC; // program counter
- u16 m_PIR; // Prefetched word
- u16 m_IR[5]; // Fetched instruction
- u16 m_R[16]; // Rn (0-7), En (8-15, h8-300h+)
- u8 m_EXR; // Interrupt/trace register (h8s/2000+)
- u8 m_CCR; // Condition-code register
- s64 m_MAC; // Multiply accumulator (h8s/2600+)
- u8 m_MACF; // MAC flags (h8s/2600+)
- u32 m_TMP1, m_TMP2;
- u32 m_TMPR; // For debugger ER register import
+ u64 m_cycles_base;
+
+ u32 m_PPC; // previous program counter
+ u32 m_NPC; // next start-of-instruction program counter
+ u32 m_PC; // program counter
+ u16 m_PIR; // Prefetched word
+ u16 m_IR[5]; // Fetched instruction
+ u16 m_R[16]; // Rn (0-7), En (8-15, h8-300h+)
+ u8 m_EXR; // Interrupt/trace register (h8s/2000+)
+ u8 m_CCR; // Condition-code register
+ s64 m_MAC; // Multiply accumulator (h8s/2600+)
+ u8 m_MACF; // MAC flags (h8s/2600+)
+ u32 m_TMP1, m_TMP2;
+ u32 m_TMPR; // For debugger ER register import
bool m_has_exr, m_has_mac, m_has_trace, m_supports_advanced, m_mode_advanced, m_mode_a20, m_mac_saturating;
bool m_has_hc; // GT913's CCR bit 5 is I, not H
@@ -179,6 +180,7 @@ protected:
int m_irq_level, m_taken_irq_level;
bool m_irq_required, m_irq_nmi;
bool m_standby_pending;
+ u64 m_standby_time;
u16 m_nvram_defval;
bool m_nvram_battery;
@@ -189,6 +191,7 @@ protected:
virtual void update_irq_filter() = 0;
virtual void interrupt_taken() = 0;
virtual void internal_update(u64 current_time) = 0;
+ virtual void notify_standby(int state) = 0;
void recompute_bcount(u64 event_time);
virtual int trace_setup();
virtual int trapa_setup();
diff --git a/src/devices/cpu/h8/h8.lst b/src/devices/cpu/h8/h8.lst
index 20b01bf0e62..d1ddf51cdf8 100644
--- a/src/devices/cpu/h8/h8.lst
+++ b/src/devices/cpu/h8/h8.lst
@@ -742,6 +742,8 @@ macro jsr32 %opc %spreg
0180 ffff 0 sleep - -
prefetch_start
if(m_standby_pending) {
+ m_standby_time = total_cycles();
+ notify_standby(1);
suspend(SUSPEND_REASON_CLOCK, true);
m_standby_cb(1);
} else {
diff --git a/src/devices/cpu/h8/h83002.cpp b/src/devices/cpu/h8/h83002.cpp
index d29b7e8ef5a..f6215e62e40 100644
--- a/src/devices/cpu/h8/h83002.cpp
+++ b/src/devices/cpu/h8/h83002.cpp
@@ -233,6 +233,19 @@ void h83002_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void h83002_device::notify_standby(int state)
+{
+ m_adc->notify_standby(state);
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+ m_timer16_0->notify_standby(state);
+ m_timer16_1->notify_standby(state);
+ m_timer16_2->notify_standby(state);
+ m_timer16_3->notify_standby(state);
+ m_timer16_4->notify_standby(state);
+ m_watchdog->notify_standby(state);
+}
+
void h83002_device::device_start()
{
h8h_device::device_start();
diff --git a/src/devices/cpu/h8/h83002.h b/src/devices/cpu/h8/h83002.h
index c45fad83711..19bbbc12bc0 100644
--- a/src/devices/cpu/h8/h83002.h
+++ b/src/devices/cpu/h8/h83002.h
@@ -86,6 +86,7 @@ protected:
virtual int trapa_setup() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/h83003.cpp b/src/devices/cpu/h8/h83003.cpp
index ba9c8aabafa..505d9887d29 100644
--- a/src/devices/cpu/h8/h83003.cpp
+++ b/src/devices/cpu/h8/h83003.cpp
@@ -260,6 +260,19 @@ void h83003_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void h83003_device::notify_standby(int state)
+{
+ m_adc->notify_standby(state);
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+ m_timer16_0->notify_standby(state);
+ m_timer16_1->notify_standby(state);
+ m_timer16_2->notify_standby(state);
+ m_timer16_3->notify_standby(state);
+ m_timer16_4->notify_standby(state);
+ m_watchdog->notify_standby(state);
+}
+
void h83003_device::device_start()
{
h8h_device::device_start();
diff --git a/src/devices/cpu/h8/h83003.h b/src/devices/cpu/h8/h83003.h
index a10ec7e8241..34597c07048 100644
--- a/src/devices/cpu/h8/h83003.h
+++ b/src/devices/cpu/h8/h83003.h
@@ -96,6 +96,7 @@ protected:
virtual int trapa_setup() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/h83006.cpp b/src/devices/cpu/h8/h83006.cpp
index 586b9d1f720..9da44a6a85e 100644
--- a/src/devices/cpu/h8/h83006.cpp
+++ b/src/devices/cpu/h8/h83006.cpp
@@ -227,6 +227,22 @@ void h83006_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void h83006_device::notify_standby(int state)
+{
+ m_adc->notify_standby(state);
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+ m_sci[2]->notify_standby(state);
+ m_timer8_0->notify_standby(state);
+ m_timer8_1->notify_standby(state);
+ m_timer8_2->notify_standby(state);
+ m_timer8_3->notify_standby(state);
+ m_timer16_0->notify_standby(state);
+ m_timer16_1->notify_standby(state);
+ m_timer16_2->notify_standby(state);
+ m_watchdog->notify_standby(state);
+}
+
void h83006_device::device_start()
{
h8h_device::device_start();
diff --git a/src/devices/cpu/h8/h83006.h b/src/devices/cpu/h8/h83006.h
index 5271d357446..883452ce23c 100644
--- a/src/devices/cpu/h8/h83006.h
+++ b/src/devices/cpu/h8/h83006.h
@@ -79,6 +79,7 @@ protected:
virtual int trapa_setup() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/h83008.cpp b/src/devices/cpu/h8/h83008.cpp
index 96aa5b9546e..a1a6ee12ebe 100644
--- a/src/devices/cpu/h8/h83008.cpp
+++ b/src/devices/cpu/h8/h83008.cpp
@@ -204,6 +204,21 @@ void h83008_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void h83008_device::notify_standby(int state)
+{
+ m_adc->notify_standby(state);
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+ m_timer8_0->notify_standby(state);
+ m_timer8_1->notify_standby(state);
+ m_timer8_2->notify_standby(state);
+ m_timer8_3->notify_standby(state);
+ m_timer16_0->notify_standby(state);
+ m_timer16_1->notify_standby(state);
+ m_timer16_2->notify_standby(state);
+ m_watchdog->notify_standby(state);
+}
+
void h83008_device::device_start()
{
h8h_device::device_start();
diff --git a/src/devices/cpu/h8/h83008.h b/src/devices/cpu/h8/h83008.h
index bd23cca64b9..30f62b539d0 100644
--- a/src/devices/cpu/h8/h83008.h
+++ b/src/devices/cpu/h8/h83008.h
@@ -76,6 +76,7 @@ protected:
virtual int trapa_setup() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/h83032.cpp b/src/devices/cpu/h8/h83032.cpp
index 269158d4f87..d47f7958dac 100644
--- a/src/devices/cpu/h8/h83032.cpp
+++ b/src/devices/cpu/h8/h83032.cpp
@@ -228,6 +228,18 @@ void h83032_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void h83032_device::notify_standby(int state)
+{
+ m_adc->notify_standby(state);
+ m_sci[0]->notify_standby(state);
+ m_timer16_0->notify_standby(state);
+ m_timer16_1->notify_standby(state);
+ m_timer16_2->notify_standby(state);
+ m_timer16_3->notify_standby(state);
+ m_timer16_4->notify_standby(state);
+ m_watchdog->notify_standby(state);
+}
+
void h83032_device::device_start()
{
h8h_device::device_start();
diff --git a/src/devices/cpu/h8/h83032.h b/src/devices/cpu/h8/h83032.h
index fcd03d02728..0075625b325 100644
--- a/src/devices/cpu/h8/h83032.h
+++ b/src/devices/cpu/h8/h83032.h
@@ -86,6 +86,7 @@ protected:
virtual int trapa_setup() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/h83042.cpp b/src/devices/cpu/h8/h83042.cpp
index f0f35a0ea77..70f74bc9479 100644
--- a/src/devices/cpu/h8/h83042.cpp
+++ b/src/devices/cpu/h8/h83042.cpp
@@ -263,6 +263,19 @@ void h83042_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void h83042_device::notify_standby(int state)
+{
+ m_adc->notify_standby(state);
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+ m_timer16_0->notify_standby(state);
+ m_timer16_1->notify_standby(state);
+ m_timer16_2->notify_standby(state);
+ m_timer16_3->notify_standby(state);
+ m_timer16_4->notify_standby(state);
+ m_watchdog->notify_standby(state);
+}
+
void h83042_device::device_start()
{
h8h_device::device_start();
diff --git a/src/devices/cpu/h8/h83042.h b/src/devices/cpu/h8/h83042.h
index 7bec2bceccf..c14bb217232 100644
--- a/src/devices/cpu/h8/h83042.h
+++ b/src/devices/cpu/h8/h83042.h
@@ -94,6 +94,7 @@ protected:
virtual int trapa_setup() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/h83048.cpp b/src/devices/cpu/h8/h83048.cpp
index be0fdc0936c..2443b7a58cd 100644
--- a/src/devices/cpu/h8/h83048.cpp
+++ b/src/devices/cpu/h8/h83048.cpp
@@ -268,6 +268,19 @@ void h83048_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void h83048_device::notify_standby(int state)
+{
+ m_adc->notify_standby(state);
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+ m_timer16_0->notify_standby(state);
+ m_timer16_1->notify_standby(state);
+ m_timer16_2->notify_standby(state);
+ m_timer16_3->notify_standby(state);
+ m_timer16_4->notify_standby(state);
+ m_watchdog->notify_standby(state);
+}
+
void h83048_device::device_start()
{
h8h_device::device_start();
diff --git a/src/devices/cpu/h8/h83048.h b/src/devices/cpu/h8/h83048.h
index bb14b78e108..668e7996446 100644
--- a/src/devices/cpu/h8/h83048.h
+++ b/src/devices/cpu/h8/h83048.h
@@ -98,6 +98,7 @@ protected:
virtual int trapa_setup() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/h83217.cpp b/src/devices/cpu/h8/h83217.cpp
index 225fd6888fb..f82a77f8fec 100644
--- a/src/devices/cpu/h8/h83217.cpp
+++ b/src/devices/cpu/h8/h83217.cpp
@@ -186,16 +186,27 @@ void h83217_device::internal_update(u64 current_time)
add_event(event_time, m_sci[0]->internal_update(current_time));
add_event(event_time, m_sci[1]->internal_update(current_time));
-
- for (auto & timer8 : m_timer8)
- add_event(event_time, timer8->internal_update(current_time));
-
+ add_event(event_time, m_timer8[0]->internal_update(current_time));
+ add_event(event_time, m_timer8[1]->internal_update(current_time));
+ add_event(event_time, m_timer8[2]->internal_update(current_time));
add_event(event_time, m_timer16_0->internal_update(current_time));
add_event(event_time, m_watchdog->internal_update(current_time));
recompute_bcount(event_time);
}
+void h83217_device::notify_standby(int state)
+{
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+
+ for (auto & timer8 : m_timer8)
+ timer8->notify_standby(state);
+
+ m_timer16_0->notify_standby(state);
+ m_watchdog->notify_standby(state);
+}
+
void h83217_device::device_start()
{
h8_device::device_start();
diff --git a/src/devices/cpu/h8/h83217.h b/src/devices/cpu/h8/h83217.h
index aba652de119..a0274b0e9bd 100644
--- a/src/devices/cpu/h8/h83217.h
+++ b/src/devices/cpu/h8/h83217.h
@@ -81,6 +81,7 @@ protected:
virtual void interrupt_taken() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/h8325.cpp b/src/devices/cpu/h8/h8325.cpp
index ff566aae1a2..40cc6b53d84 100644
--- a/src/devices/cpu/h8/h8325.cpp
+++ b/src/devices/cpu/h8/h8325.cpp
@@ -179,6 +179,15 @@ void h8325_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void h8325_device::notify_standby(int state)
+{
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+ m_timer8[0]->notify_standby(state);
+ m_timer8[1]->notify_standby(state);
+ m_timer16_0->notify_standby(state);
+}
+
void h8325_device::device_start()
{
h8_device::device_start();
diff --git a/src/devices/cpu/h8/h8325.h b/src/devices/cpu/h8/h8325.h
index 43c3a575ad6..8f4ca3356a6 100644
--- a/src/devices/cpu/h8/h8325.h
+++ b/src/devices/cpu/h8/h8325.h
@@ -81,6 +81,7 @@ protected:
virtual void interrupt_taken() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/h83337.cpp b/src/devices/cpu/h8/h83337.cpp
index aeca8aee4ee..09a9482f4af 100644
--- a/src/devices/cpu/h8/h83337.cpp
+++ b/src/devices/cpu/h8/h83337.cpp
@@ -193,6 +193,17 @@ void h83337_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void h83337_device::notify_standby(int state)
+{
+ m_adc->notify_standby(state);
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+ m_timer8_0->notify_standby(state);
+ m_timer8_1->notify_standby(state);
+ m_timer16_0->notify_standby(state);
+ m_watchdog->notify_standby(state);
+}
+
void h83337_device::device_start()
{
h8_device::device_start();
diff --git a/src/devices/cpu/h8/h83337.h b/src/devices/cpu/h8/h83337.h
index 27fda6cfd0f..0a732b2e11a 100644
--- a/src/devices/cpu/h8/h83337.h
+++ b/src/devices/cpu/h8/h83337.h
@@ -92,6 +92,7 @@ protected:
virtual void interrupt_taken() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/h8_adc.cpp b/src/devices/cpu/h8/h8_adc.cpp
index 116f20f5b83..c1ad3f4b048 100644
--- a/src/devices/cpu/h8/h8_adc.cpp
+++ b/src/devices/cpu/h8/h8_adc.cpp
@@ -149,6 +149,12 @@ u64 h8_adc_device::internal_update(u64 current_time)
return m_next_event;
}
+void h8_adc_device::notify_standby(int state)
+{
+ if(!state && m_next_event)
+ m_next_event += m_cpu->total_cycles() - m_cpu->standby_time();
+}
+
void h8_adc_device::conversion_wait(bool first, bool poweron, u64 current_time)
{
if(current_time)
diff --git a/src/devices/cpu/h8/h8_adc.h b/src/devices/cpu/h8/h8_adc.h
index 0cc37a34e3b..2ea510e6c4a 100644
--- a/src/devices/cpu/h8/h8_adc.h
+++ b/src/devices/cpu/h8/h8_adc.h
@@ -35,6 +35,7 @@ public:
void set_suspend(bool suspend);
u64 internal_update(u64 current_time);
+ void notify_standby(int state);
protected:
h8_adc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
diff --git a/src/devices/cpu/h8/h8_sci.cpp b/src/devices/cpu/h8/h8_sci.cpp
index 9c6448d64d9..f11e8239805 100644
--- a/src/devices/cpu/h8/h8_sci.cpp
+++ b/src/devices/cpu/h8/h8_sci.cpp
@@ -136,7 +136,7 @@ void h8_sci_device::scr_w(u8 data)
data & SCR_TEIE ? " tei" : "",
data & SCR_CKE,
m_cpu->pc());
-
+
u8 delta = m_scr ^ data;
m_scr = data;
clock_update();
@@ -208,7 +208,8 @@ u8 h8_sci_device::ssr_r()
u8 h8_sci_device::rdr_r()
{
LOGMASKED(LOG_RREGS, "rdr_r %02x (%06x)\n", m_rdr, m_cpu->pc());
- if(m_cpu->access_is_dma())
+
+ if(!machine().side_effects_disabled() && m_cpu->access_is_dma())
m_ssr &= ~SSR_RDRF;
return m_rdr;
}
@@ -292,7 +293,6 @@ void h8_sci_device::device_start()
m_internal_to_external_ratio = 1/m_external_to_internal_ratio;
}
-
save_item(NAME(m_rdr));
save_item(NAME(m_tdr));
save_item(NAME(m_smr));
@@ -315,7 +315,6 @@ void h8_sci_device::device_start()
save_item(NAME(m_ext_clock_value));
save_item(NAME(m_tx_clock_counter));
save_item(NAME(m_rx_clock_counter));
- save_item(NAME(m_cur_sync_time));
}
void h8_sci_device::device_reset()
@@ -350,12 +349,17 @@ TIMER_CALLBACK_MEMBER(h8_sci_device::sync_tick)
void h8_sci_device::do_rx_w(int state)
{
+ if(m_cpu->standby()) {
+ m_rx_value = state;
+ return;
+ }
+
if(state != m_rx_value && (m_clock_state & CLK_RX))
if(m_rx_clock_counter == 1 || m_rx_clock_counter == 15)
m_rx_clock_counter = 0;
m_rx_value = state;
- if(!m_rx_value && !(m_clock_state & CLK_RX) && m_rx_state != ST_IDLE && !m_cpu->standby())
+ if(!m_rx_value && !(m_clock_state & CLK_RX) && m_rx_state != ST_IDLE)
clock_start(CLK_RX);
}
@@ -377,7 +381,7 @@ void h8_sci_device::do_clk_w(int state)
if(m_clock_state & CLK_TX)
tx_sync_tick();
if(m_clock_state & CLK_RX)
- rx_sync_tick();
+ rx_sync_tick();
}
}
@@ -395,7 +399,7 @@ u64 h8_sci_device::internal_update(u64 current_time)
if(m_clock_state & CLK_TX)
tx_sync_tick();
if(m_clock_state & CLK_RX)
- rx_sync_tick();
+ rx_sync_tick();
}
if(m_clock_state) {
@@ -420,6 +424,12 @@ u64 h8_sci_device::internal_update(u64 current_time)
return m_clock_event;
}
+void h8_sci_device::notify_standby(int state)
+{
+ if(!state && m_clock_event)
+ m_clock_event += m_cpu->total_cycles() - m_cpu->standby_time();
+}
+
void h8_sci_device::clock_start(int mode)
{
// Happens when back-to-back
@@ -509,7 +519,7 @@ void h8_sci_device::tx_async_tick()
m_cpu->do_sci_clk(m_id, 0);
} else if(m_tx_clock_counter == 8 && m_clock_mode == INTERNAL_ASYNC_OUT)
- m_cpu->do_sci_clk(m_id, 1);
+ m_cpu->do_sci_clk(m_id, 1);
}
void h8_sci_device::tx_async_step()
@@ -597,7 +607,7 @@ void h8_sci_device::tx_sync_tick()
m_cpu->do_sci_clk(m_id, 0);
} else if(m_tx_clock_counter == 1 && m_clock_mode == INTERNAL_SYNC_OUT)
- m_cpu->do_sci_clk(m_id, 1);
+ m_cpu->do_sci_clk(m_id, 1);
}
void h8_sci_device::tx_sync_step()
@@ -610,7 +620,7 @@ void h8_sci_device::tx_sync_step()
m_ssr |= SSR_TEND;
if(m_scr & SCR_TEIE)
m_intc->internal_interrupt(m_tei_int);
-
+
// if there's more to send, start the transmitter
if((m_scr & SCR_TE) && !(m_ssr & SSR_TDRE))
tx_start();
diff --git a/src/devices/cpu/h8/h8_sci.h b/src/devices/cpu/h8/h8_sci.h
index 5e5cda3db33..5a3671e63ab 100644
--- a/src/devices/cpu/h8/h8_sci.h
+++ b/src/devices/cpu/h8/h8_sci.h
@@ -52,6 +52,7 @@ public:
void do_clk_w(int state);
u64 internal_update(u64 current_time);
+ void notify_standby(int state);
protected:
enum {
@@ -106,7 +107,7 @@ protected:
required_device<h8_device> m_cpu;
required_device<h8_intc_device> m_intc;
- attotime m_external_clock_period, m_cur_sync_time;
+ attotime m_external_clock_period;
double m_external_to_internal_ratio, m_internal_to_external_ratio;
emu_timer *m_sync_timer;
diff --git a/src/devices/cpu/h8/h8_timer16.cpp b/src/devices/cpu/h8/h8_timer16.cpp
index 059cb8b9a39..13dca54a9f5 100644
--- a/src/devices/cpu/h8/h8_timer16.cpp
+++ b/src/devices/cpu/h8/h8_timer16.cpp
@@ -123,7 +123,8 @@ void h8_timer16_channel_device::tier_w(u8 data)
u8 h8_timer16_channel_device::tsr_r()
{
- update_counter();
+ if(!machine().side_effects_disabled())
+ update_counter();
return isr_to_sr();
}
@@ -137,7 +138,8 @@ void h8_timer16_channel_device::tsr_w(u8 data)
u16 h8_timer16_channel_device::tcnt_r()
{
- update_counter();
+ if(!machine().side_effects_disabled())
+ update_counter();
return m_tcnt;
}
@@ -224,6 +226,15 @@ u64 h8_timer16_channel_device::internal_update(u64 current_time)
return m_event_time;
}
+void h8_timer16_channel_device::notify_standby(int state)
+{
+ if(!state && m_event_time) {
+ u64 delta = m_cpu->total_cycles() - m_cpu->standby_time();
+ m_event_time += delta;
+ m_last_clock_update += delta;
+ }
+}
+
void h8_timer16_channel_device::update_counter(u64 cur_time)
{
if(m_clock_type != DIV_1)
diff --git a/src/devices/cpu/h8/h8_timer16.h b/src/devices/cpu/h8/h8_timer16.h
index 61501fec9ad..2051bbe59fd 100644
--- a/src/devices/cpu/h8/h8_timer16.h
+++ b/src/devices/cpu/h8/h8_timer16.h
@@ -91,6 +91,7 @@ public:
void tbr_w(offs_t offset, u16 data, u16 mem_mask = ~0);
u64 internal_update(u64 current_time);
+ void notify_standby(int state);
void set_ier(u8 value);
void set_enable(bool enable);
void tisr_w(int offset, u8 data);
diff --git a/src/devices/cpu/h8/h8_timer8.cpp b/src/devices/cpu/h8/h8_timer8.cpp
index fe458e0922b..6525e8ce6c5 100644
--- a/src/devices/cpu/h8/h8_timer8.cpp
+++ b/src/devices/cpu/h8/h8_timer8.cpp
@@ -169,8 +169,10 @@ void h8_timer8_channel_device::tcor_w(offs_t offset, u8 data)
u8 h8_timer8_channel_device::tcnt_r()
{
- update_counter();
- recalc_event();
+ if(!machine().side_effects_disabled()) {
+ update_counter();
+ recalc_event();
+ }
return m_tcnt;
}
@@ -212,6 +214,15 @@ u64 h8_timer8_channel_device::internal_update(u64 current_time)
return m_event_time;
}
+void h8_timer8_channel_device::notify_standby(int state)
+{
+ if(!state && m_event_time) {
+ u64 delta = m_cpu->total_cycles() - m_cpu->standby_time();
+ m_event_time += delta;
+ m_last_clock_update += delta;
+ }
+}
+
void h8_timer8_channel_device::update_counter(u64 cur_time, u64 delta)
{
if(m_clock_type == DIV) {
diff --git a/src/devices/cpu/h8/h8_timer8.h b/src/devices/cpu/h8/h8_timer8.h
index c791892a3ce..65468a76a5d 100644
--- a/src/devices/cpu/h8/h8_timer8.h
+++ b/src/devices/cpu/h8/h8_timer8.h
@@ -56,6 +56,7 @@ public:
void tcnt_w(u8 data);
u64 internal_update(u64 current_time);
+ void notify_standby(int state);
void set_extra_clock_bit(bool bit);
void chained_timer_overflow();
diff --git a/src/devices/cpu/h8/h8_watchdog.cpp b/src/devices/cpu/h8/h8_watchdog.cpp
index 0569b1bf7ee..a23033e86be 100644
--- a/src/devices/cpu/h8/h8_watchdog.cpp
+++ b/src/devices/cpu/h8/h8_watchdog.cpp
@@ -28,6 +28,14 @@ u64 h8_watchdog_device::internal_update(u64 current_time)
return 0;
}
+void h8_watchdog_device::notify_standby(int state)
+{
+ if(state)
+ tcnt_update();
+ else
+ m_tcnt_cycle_base = m_cpu->total_cycles();
+}
+
void h8_watchdog_device::tcnt_update(u64 cur_time)
{
if(m_tcsr & TCSR_TME) {
diff --git a/src/devices/cpu/h8/h8_watchdog.h b/src/devices/cpu/h8/h8_watchdog.h
index c6882fb1d5b..1ac5a42e91f 100644
--- a/src/devices/cpu/h8/h8_watchdog.h
+++ b/src/devices/cpu/h8/h8_watchdog.h
@@ -31,6 +31,7 @@ public:
}
u64 internal_update(u64 current_time);
+ void notify_standby(int state);
u16 wd_r();
void wd_w(offs_t offset, u16 data, u16 mem_mask = ~0);
diff --git a/src/devices/cpu/h8/h8s2245.cpp b/src/devices/cpu/h8/h8s2245.cpp
index 3d6e63b7483..a7a51c26f3a 100644
--- a/src/devices/cpu/h8/h8s2245.cpp
+++ b/src/devices/cpu/h8/h8s2245.cpp
@@ -299,6 +299,20 @@ void h8s2245_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void h8s2245_device::notify_standby(int state)
+{
+ m_adc->notify_standby(state);
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+ m_sci[2]->notify_standby(state);
+ m_timer8_0->notify_standby(state);
+ m_timer8_1->notify_standby(state);
+ m_timer16_0->notify_standby(state);
+ m_timer16_1->notify_standby(state);
+ m_timer16_2->notify_standby(state);
+ m_watchdog->notify_standby(state);
+}
+
void h8s2245_device::device_start()
{
h8s2000_device::device_start();
diff --git a/src/devices/cpu/h8/h8s2245.h b/src/devices/cpu/h8/h8s2245.h
index 14744418a4e..fd01c71b928 100644
--- a/src/devices/cpu/h8/h8s2245.h
+++ b/src/devices/cpu/h8/h8s2245.h
@@ -102,6 +102,7 @@ protected:
virtual int trapa_setup() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/h8s2319.cpp b/src/devices/cpu/h8/h8s2319.cpp
index a0ec66e212e..8a439404f42 100644
--- a/src/devices/cpu/h8/h8s2319.cpp
+++ b/src/devices/cpu/h8/h8s2319.cpp
@@ -385,6 +385,20 @@ void h8s2319_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void h8s2319_device::notify_standby(int state)
+{
+ m_adc->notify_standby(state);
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+ m_timer8[0]->notify_standby(state);
+ m_timer8[1]->notify_standby(state);
+
+ for (auto & timer16c : m_timer16c)
+ timer16c->notify_standby(state);
+
+ m_watchdog->notify_standby(state);
+}
+
void h8s2319_device::device_start()
{
h8s2000_device::device_start();
diff --git a/src/devices/cpu/h8/h8s2319.h b/src/devices/cpu/h8/h8s2319.h
index ab1ba0bb264..a782d03d33b 100644
--- a/src/devices/cpu/h8/h8s2319.h
+++ b/src/devices/cpu/h8/h8s2319.h
@@ -96,6 +96,7 @@ protected:
virtual int trapa_setup() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/h8s2329.cpp b/src/devices/cpu/h8/h8s2329.cpp
index f816a6ba4d6..e7908131039 100644
--- a/src/devices/cpu/h8/h8s2329.cpp
+++ b/src/devices/cpu/h8/h8s2329.cpp
@@ -135,6 +135,12 @@ void h8s2320_device::map_2320(address_map &map)
map(0xffff06, 0xffff07).rw(m_dma, FUNC(h8s_dma_device::dmabcr_r), FUNC(h8s_dma_device::dmabcr_w));
}
+void h8s2321_device::notify_standby(int state)
+{
+ h8s2319_device::notify_standby(state);
+ m_sci[2]->notify_standby(state);
+}
+
void h8s2321_device::device_add_mconfig(machine_config &config)
{
h8s2319_device::device_add_mconfig(config);
diff --git a/src/devices/cpu/h8/h8s2329.h b/src/devices/cpu/h8/h8s2329.h
index a03755f3e16..fcee3b2b007 100644
--- a/src/devices/cpu/h8/h8s2329.h
+++ b/src/devices/cpu/h8/h8s2329.h
@@ -46,6 +46,7 @@ protected:
required_device<h8_port_device> m_port5;
required_device<h8_port_device> m_port6;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map_2321(address_map &map);
};
diff --git a/src/devices/cpu/h8/h8s2357.cpp b/src/devices/cpu/h8/h8s2357.cpp
index 50bb908f0d9..1f0baa0e1d1 100644
--- a/src/devices/cpu/h8/h8s2357.cpp
+++ b/src/devices/cpu/h8/h8s2357.cpp
@@ -394,6 +394,23 @@ void h8s2357_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void h8s2357_device::notify_standby(int state)
+{
+ m_adc->notify_standby(state);
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+ m_sci[2]->notify_standby(state);
+ m_timer8_0->notify_standby(state);
+ m_timer8_1->notify_standby(state);
+ m_timer16_0->notify_standby(state);
+ m_timer16_1->notify_standby(state);
+ m_timer16_2->notify_standby(state);
+ m_timer16_3->notify_standby(state);
+ m_timer16_4->notify_standby(state);
+ m_timer16_5->notify_standby(state);
+ m_watchdog->notify_standby(state);
+}
+
void h8s2357_device::device_start()
{
h8s2000_device::device_start();
diff --git a/src/devices/cpu/h8/h8s2357.h b/src/devices/cpu/h8/h8s2357.h
index a328e948868..3217f8dbf87 100644
--- a/src/devices/cpu/h8/h8s2357.h
+++ b/src/devices/cpu/h8/h8s2357.h
@@ -110,6 +110,7 @@ protected:
virtual int trapa_setup() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/h8s2655.cpp b/src/devices/cpu/h8/h8s2655.cpp
index d6657ff3ce3..ab4fb1fc8eb 100644
--- a/src/devices/cpu/h8/h8s2655.cpp
+++ b/src/devices/cpu/h8/h8s2655.cpp
@@ -406,6 +406,23 @@ void h8s2655_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void h8s2655_device::notify_standby(int state)
+{
+ m_adc->notify_standby(state);
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+ m_sci[2]->notify_standby(state);
+ m_timer8_0->notify_standby(state);
+ m_timer8_1->notify_standby(state);
+ m_timer16_0->notify_standby(state);
+ m_timer16_1->notify_standby(state);
+ m_timer16_2->notify_standby(state);
+ m_timer16_3->notify_standby(state);
+ m_timer16_4->notify_standby(state);
+ m_timer16_5->notify_standby(state);
+ m_watchdog->notify_standby(state);
+}
+
void h8s2655_device::device_start()
{
h8s2600_device::device_start();
diff --git a/src/devices/cpu/h8/h8s2655.h b/src/devices/cpu/h8/h8s2655.h
index cd393b38dee..d92a1e8c5bc 100644
--- a/src/devices/cpu/h8/h8s2655.h
+++ b/src/devices/cpu/h8/h8s2655.h
@@ -101,6 +101,7 @@ protected:
virtual int trapa_setup() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
void map(address_map &map);
diff --git a/src/devices/cpu/h8/swx00.cpp b/src/devices/cpu/h8/swx00.cpp
index 7ddb1c85f10..50cd3baf051 100644
--- a/src/devices/cpu/h8/swx00.cpp
+++ b/src/devices/cpu/h8/swx00.cpp
@@ -412,6 +412,25 @@ void swx00_device::internal_update(u64 current_time)
recompute_bcount(event_time);
}
+void swx00_device::notify_standby(int state)
+{
+#if 0
+ m_adc->notify_standby(state);
+ m_sci[0]->notify_standby(state);
+ m_sci[1]->notify_standby(state);
+ m_sci[2]->notify_standby(state);
+ m_timer8_0->notify_standby(state);
+ m_timer8_1->notify_standby(state);
+ m_timer16_0->notify_standby(state);
+ m_timer16_1->notify_standby(state);
+ m_timer16_2->notify_standby(state);
+ m_timer16_3->notify_standby(state);
+ m_timer16_4->notify_standby(state);
+ m_timer16_5->notify_standby(state);
+ m_watchdog->notify_standby(state);
+#endif
+}
+
void swx00_device::device_start()
{
h8s2000_device::device_start();
diff --git a/src/devices/cpu/h8/swx00.h b/src/devices/cpu/h8/swx00.h
index aad63bcfced..7b15a5cc6f1 100644
--- a/src/devices/cpu/h8/swx00.h
+++ b/src/devices/cpu/h8/swx00.h
@@ -125,6 +125,7 @@ protected:
virtual int trapa_setup() override;
virtual void irq_setup() override;
virtual void internal_update(u64 current_time) override;
+ virtual void notify_standby(int state) override;
virtual void device_add_mconfig(machine_config &config) override;
virtual space_config_vector memory_space_config() const override;