mirror of
https://github.com/holub/mame
synced 2025-06-07 13:23:50 +03:00
sm510: k input wakeup is not edge triggered
This commit is contained in:
parent
be0f235ad9
commit
758b08fa27
@ -32,8 +32,6 @@ enum
|
|||||||
|
|
||||||
void sm510_base_device::device_start()
|
void sm510_base_device::device_start()
|
||||||
{
|
{
|
||||||
assert(SM510_INPUT_LINE_K1 == 0);
|
|
||||||
|
|
||||||
m_program = &space(AS_PROGRAM);
|
m_program = &space(AS_PROGRAM);
|
||||||
m_data = &space(AS_DATA);
|
m_data = &space(AS_DATA);
|
||||||
m_prgmask = (1 << m_prgwidth) - 1;
|
m_prgmask = (1 << m_prgwidth) - 1;
|
||||||
@ -67,8 +65,7 @@ void sm510_base_device::device_start()
|
|||||||
m_div = 0;
|
m_div = 0;
|
||||||
m_1s = false;
|
m_1s = false;
|
||||||
m_1s_rise = false;
|
m_1s_rise = false;
|
||||||
m_k_rise = false;
|
m_ext_wakeup = false;
|
||||||
std::fill_n(m_k_input, std::size(m_k_input), 0);
|
|
||||||
m_l = 0;
|
m_l = 0;
|
||||||
m_x = 0;
|
m_x = 0;
|
||||||
m_y = 0;
|
m_y = 0;
|
||||||
@ -102,8 +99,7 @@ void sm510_base_device::device_start()
|
|||||||
save_item(NAME(m_div));
|
save_item(NAME(m_div));
|
||||||
save_item(NAME(m_1s));
|
save_item(NAME(m_1s));
|
||||||
save_item(NAME(m_1s_rise));
|
save_item(NAME(m_1s_rise));
|
||||||
save_item(NAME(m_k_rise));
|
save_item(NAME(m_ext_wakeup));
|
||||||
save_item(NAME(m_k_input));
|
|
||||||
save_item(NAME(m_l));
|
save_item(NAME(m_l));
|
||||||
save_item(NAME(m_x));
|
save_item(NAME(m_x));
|
||||||
save_item(NAME(m_y));
|
save_item(NAME(m_y));
|
||||||
@ -251,14 +247,10 @@ void sm510_base_device::init_divider()
|
|||||||
|
|
||||||
void sm510_base_device::execute_set_input(int line, int state)
|
void sm510_base_device::execute_set_input(int line, int state)
|
||||||
{
|
{
|
||||||
if (!valid_wakeup_line(line))
|
if (line != SM510_EXT_WAKEUP_LINE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// rising edge of any K input
|
m_ext_wakeup = bool(state);
|
||||||
if (state && !m_k_input[line])
|
|
||||||
m_k_rise = true;
|
|
||||||
|
|
||||||
m_k_input[line] = state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sm510_base_device::do_interrupt()
|
void sm510_base_device::do_interrupt()
|
||||||
@ -292,8 +284,7 @@ void sm510_base_device::execute_run()
|
|||||||
while (m_icount > 0)
|
while (m_icount > 0)
|
||||||
{
|
{
|
||||||
// in halt mode, wake up after 1S signal or K input
|
// in halt mode, wake up after 1S signal or K input
|
||||||
bool wakeup = m_k_rise || m_1s_rise;
|
bool wakeup = m_ext_wakeup || m_1s_rise;
|
||||||
m_k_rise = false;
|
|
||||||
m_1s_rise = false;
|
m_1s_rise = false;
|
||||||
|
|
||||||
if (m_halt)
|
if (m_halt)
|
||||||
|
@ -16,15 +16,9 @@
|
|||||||
|
|
||||||
// I/O ports setup
|
// I/O ports setup
|
||||||
|
|
||||||
// when in halt state, any K input going high can wake up the CPU,
|
// when in halt state, any active K input can wake up the CPU,
|
||||||
// driver is required to use set_input_line(SM510_INPUT_LINE_K1/K2/K3/K4, state)
|
// driver is required to use set_input_line(SM510_EXT_WAKEUP_LINE, state)
|
||||||
enum
|
#define SM510_EXT_WAKEUP_LINE 0
|
||||||
{
|
|
||||||
SM510_INPUT_LINE_K1 = 0,
|
|
||||||
SM510_INPUT_LINE_K2,
|
|
||||||
SM510_INPUT_LINE_K3,
|
|
||||||
SM510_INPUT_LINE_K4
|
|
||||||
};
|
|
||||||
|
|
||||||
// ACL input pin
|
// ACL input pin
|
||||||
#define SM510_INPUT_LINE_ACL INPUT_LINE_RESET
|
#define SM510_INPUT_LINE_ACL INPUT_LINE_RESET
|
||||||
@ -97,8 +91,7 @@ protected:
|
|||||||
virtual u64 execute_cycles_to_clocks(u64 cycles) const noexcept override { return (cycles * m_clk_div); } // "
|
virtual u64 execute_cycles_to_clocks(u64 cycles) const noexcept override { return (cycles * m_clk_div); } // "
|
||||||
virtual u32 execute_min_cycles() const noexcept override { return 1; }
|
virtual u32 execute_min_cycles() const noexcept override { return 1; }
|
||||||
virtual u32 execute_max_cycles() const noexcept override { return 3+1; }
|
virtual u32 execute_max_cycles() const noexcept override { return 3+1; }
|
||||||
virtual u32 execute_input_lines() const noexcept override { return 4; }
|
virtual u32 execute_input_lines() const noexcept override { return 1; }
|
||||||
virtual bool execute_input_edge_triggered(int inputnum) const noexcept override { return valid_wakeup_line(inputnum); }
|
|
||||||
virtual void execute_set_input(int line, int state) override;
|
virtual void execute_set_input(int line, int state) override;
|
||||||
virtual void execute_run() override;
|
virtual void execute_run() override;
|
||||||
|
|
||||||
@ -115,7 +108,6 @@ protected:
|
|||||||
|
|
||||||
virtual void reset_vector() { do_branch(3, 7, 0); }
|
virtual void reset_vector() { do_branch(3, 7, 0); }
|
||||||
virtual void wakeup_vector() { do_branch(1, 0, 0); } // after halt
|
virtual void wakeup_vector() { do_branch(1, 0, 0); } // after halt
|
||||||
virtual bool valid_wakeup_line(int line) const { return (line >= 0 && line < 4); }
|
|
||||||
|
|
||||||
int m_prgwidth;
|
int m_prgwidth;
|
||||||
int m_datawidth;
|
int m_datawidth;
|
||||||
@ -140,8 +132,7 @@ protected:
|
|||||||
u8 m_r;
|
u8 m_r;
|
||||||
u8 m_r_out;
|
u8 m_r_out;
|
||||||
int m_r_mask_option;
|
int m_r_mask_option;
|
||||||
int m_k_input[4];
|
bool m_ext_wakeup;
|
||||||
bool m_k_rise;
|
|
||||||
bool m_halt;
|
bool m_halt;
|
||||||
int m_clk_div;
|
int m_clk_div;
|
||||||
|
|
||||||
|
@ -12,12 +12,6 @@
|
|||||||
#include "sm510base.h"
|
#include "sm510base.h"
|
||||||
|
|
||||||
|
|
||||||
// I/O ports setup
|
|
||||||
|
|
||||||
// It does not have K pins, but can wake up after halt on R2.2
|
|
||||||
#define SM590_INPUT_LINE_R22 SM510_INPUT_LINE_K3
|
|
||||||
|
|
||||||
|
|
||||||
// pinout reference
|
// pinout reference
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -115,7 +109,6 @@ protected:
|
|||||||
|
|
||||||
virtual void reset_vector() override { do_branch(0, 0, 0); }
|
virtual void reset_vector() override { do_branch(0, 0, 0); }
|
||||||
virtual void wakeup_vector() override { do_branch(0, 1, 0); }
|
virtual void wakeup_vector() override { do_branch(0, 1, 0); }
|
||||||
virtual bool valid_wakeup_line(int line) const override { return (line == SM590_INPUT_LINE_R22); }
|
|
||||||
|
|
||||||
// opcode handlers
|
// opcode handlers
|
||||||
// 00-3f
|
// 00-3f
|
||||||
|
@ -291,9 +291,7 @@ u8 hh_sm510_state::read_inputs(int columns, int fixed)
|
|||||||
void hh_sm510_state::update_k_line()
|
void hh_sm510_state::update_k_line()
|
||||||
{
|
{
|
||||||
// this is necessary because the MCU can wake up on K input activity
|
// this is necessary because the MCU can wake up on K input activity
|
||||||
u8 input = input_r();
|
m_maincpu->set_input_line(0, input_r() ? ASSERT_LINE : CLEAR_LINE);
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
m_maincpu->set_input_line(i, BIT(input, i) ? ASSERT_LINE : CLEAR_LINE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INPUT_CHANGED_MEMBER(hh_sm510_state::input_changed)
|
INPUT_CHANGED_MEMBER(hh_sm510_state::input_changed)
|
||||||
|
Loading…
Reference in New Issue
Block a user