diff --git a/src/emu/cpu/amis2000/amis2000.h b/src/emu/cpu/amis2000/amis2000.h index 99ee23edb6f..2d70b6c887b 100644 --- a/src/emu/cpu/amis2000/amis2000.h +++ b/src/emu/cpu/amis2000/amis2000.h @@ -77,7 +77,7 @@ protected: UINT8 m_callstack_bits; // number of program counter bits held in callstack UINT16 m_callstack_mask; UINT8 m_callstack_depth; // callstack levels: 3 on 2000/2150, 5 on 2200/2400 - UINT16 m_callstack[5+1]; // max 5 + UINT16 m_callstack[5]; // max 5 int m_icount; UINT16 m_pc; // 13-bit program counter UINT8 m_ppr; // prepared page register (PP 1) diff --git a/src/emu/cpu/amis2000/amis2000op.inc b/src/emu/cpu/amis2000/amis2000op.inc index d211f5dac38..5859516124c 100644 --- a/src/emu/cpu/amis2000/amis2000op.inc +++ b/src/emu/cpu/amis2000/amis2000op.inc @@ -17,11 +17,8 @@ inline void amis2000_device::ram_w(UINT8 data) void amis2000_device::pop_callstack() { m_pc = (m_pc & ~m_callstack_mask) | (m_callstack[0] & m_callstack_mask); - for (int i = 0; i < m_callstack_depth; i++) - { + for (int i = 0; i < m_callstack_depth-1; i++) m_callstack[i] = m_callstack[i+1]; - m_callstack[i+1] = 0; - } } void amis2000_device::push_callstack() diff --git a/src/emu/cpu/ucom4/ucom4.h b/src/emu/cpu/ucom4/ucom4.h index 718937b235a..8535b57df99 100644 --- a/src/emu/cpu/ucom4/ucom4.h +++ b/src/emu/cpu/ucom4/ucom4.h @@ -133,7 +133,7 @@ protected: int m_datamask; int m_family; // MCU family (43/44/45) int m_stack_levels; // number of callstack levels - UINT16 m_stack[3+1]; // max 3 + UINT16 m_stack[3]; // max 3 UINT8 m_port_out[0x10]; // last value written to output port UINT8 m_op; UINT8 m_prev_op; // previous opcode diff --git a/src/emu/cpu/ucom4/ucom4op.inc b/src/emu/cpu/ucom4/ucom4op.inc index 82d54950e24..8de834438b5 100644 --- a/src/emu/cpu/ucom4/ucom4op.inc +++ b/src/emu/cpu/ucom4/ucom4op.inc @@ -17,11 +17,8 @@ inline void ucom4_cpu_device::ram_w(UINT8 data) void ucom4_cpu_device::pop_stack() { m_pc = m_stack[0] & m_prgmask; - for (int i = 0; i < m_stack_levels; i++) - { + for (int i = 0; i < m_stack_levels-1; i++) m_stack[i] = m_stack[i+1]; - m_stack[i+1] = 0; - } } void ucom4_cpu_device::push_stack()