mirror of
https://github.com/holub/mame
synced 2025-07-01 00:09:18 +03:00
h8: fix standby time travel problem
This commit is contained in:
parent
3c3bfa7883
commit
88e1a2adb0
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
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
|
||||
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();
|
||||
|
@ -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 {
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user