diff options
author | 2015-06-04 23:21:16 +0200 | |
---|---|---|
committer | 2015-06-04 23:21:16 +0200 | |
commit | cacb9bb1b5c45d4ec3bd885917fca04a298ba340 (patch) | |
tree | a1a717ed53db8d76ae369824284fe8fb05a8f1a9 | |
parent | 3a9f5f622a4799d67410f620b4c7fbbde1422fd5 (diff) |
added HLT line (it's used by alpha denshi protection mcu)
-rw-r--r-- | src/emu/cpu/hmcs40/hmcs40.c | 28 | ||||
-rw-r--r-- | src/emu/cpu/hmcs40/hmcs40.h | 10 |
2 files changed, 36 insertions, 2 deletions
diff --git a/src/emu/cpu/hmcs40/hmcs40.c b/src/emu/cpu/hmcs40/hmcs40.c index 1adef6ea242..1d44e7d97ce 100644 --- a/src/emu/cpu/hmcs40/hmcs40.c +++ b/src/emu/cpu/hmcs40/hmcs40.c @@ -215,6 +215,7 @@ void hmcs40_cpu_device::device_start() m_prev_op = 0; m_i = 0; m_eint_line = 0; + m_halt = 0; m_pc = 0; m_prev_pc = 0; m_page = 0; @@ -242,6 +243,8 @@ void hmcs40_cpu_device::device_start() save_item(NAME(m_prev_op)); save_item(NAME(m_i)); save_item(NAME(m_eint_line)); + save_item(NAME(m_halt)); + save_item(NAME(m_timer_halted_remain)); save_item(NAME(m_pc)); save_item(NAME(m_prev_pc)); save_item(NAME(m_page)); @@ -477,9 +480,25 @@ void hmcs40_cpu_device::do_interrupt() void hmcs40_cpu_device::execute_set_input(int line, int state) { + state = (state) ? 1 : 0; + + // halt/unhalt mcu + if (line == HMCS40_INPUT_LINE_HLT && state != m_halt) + { + if (state) + { + m_timer_halted_remain = m_timer->remaining(); + m_timer->reset(); + } + else + m_timer->adjust(m_timer_halted_remain); + + m_halt = state; + return; + } + if (line != 0 && line != 1) return; - state = (state) ? 1 : 0; // external interrupt request on rising edge if (state && !m_int[line]) @@ -551,6 +570,13 @@ inline void hmcs40_cpu_device::increment_pc() void hmcs40_cpu_device::execute_run() { + // in HLT state, the internal clock is not running + if (m_halt) + { + m_icount = 0; + return; + } + while (m_icount > 0) { // LPU is handled 1 cycle later diff --git a/src/emu/cpu/hmcs40/hmcs40.h b/src/emu/cpu/hmcs40/hmcs40.h index 9e722f595a6..8b912739541 100644 --- a/src/emu/cpu/hmcs40/hmcs40.h +++ b/src/emu/cpu/hmcs40/hmcs40.h @@ -26,7 +26,6 @@ #define MCFG_HMCS40_WRITE_D_CB(_devcb) \ hmcs40_cpu_device::set_write_d_callback(*device, DEVCB_##_devcb); - enum { HMCS40_PORT_R0X = 0, @@ -39,6 +38,13 @@ enum HMCS40_PORT_R7X }; +enum +{ + HMCS40_INPUT_LINE_INT0 = 0, + HMCS40_INPUT_LINE_INT1, + HMCS40_INPUT_LINE_HLT +}; + // pinout reference @@ -181,6 +187,8 @@ protected: UINT8 m_i; // 4-bit immediate opcode param int m_eint_line; // which input_line caused an interrupt emu_timer *m_timer; + int m_halt; // internal HLT state + attotime m_timer_halted_remain; int m_icount; UINT16 m_pc; // Program Counter |