From ad0dbabc1f609a6b237d87cac0ff0c4c118323cf Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 19 Apr 2019 21:00:44 -0400 Subject: Specify a few of the unique aspects of the SCC68070 core (nw) --- src/devices/cpu/m68000/m68k_in.cpp | 8 +++--- src/devices/cpu/m68000/m68kcpu.cpp | 31 ++++++++++++++++++--- src/devices/cpu/m68000/m68kcpu.h | 55 +++++++++++++++++++++++++++++++++++--- 3 files changed, 84 insertions(+), 10 deletions(-) diff --git a/src/devices/cpu/m68000/m68k_in.cpp b/src/devices/cpu/m68000/m68k_in.cpp index 37572414d6b..cd5a6d071f3 100644 --- a/src/devices/cpu/m68000/m68k_in.cpp +++ b/src/devices/cpu/m68000/m68k_in.cpp @@ -3153,7 +3153,7 @@ M68KMAKE_OP(bkpt, 0, ., .) { if(CPU_TYPE_IS_EC020_PLUS()) { - (void)m_cpu_space->read_dword((m_ir & 7) << 2, 0xffffffff); + (void)m_cpu_space->read_word((m_ir & 7) << 2, 0xffff); } else if(CPU_TYPE_IS_010_PLUS()) { @@ -6513,7 +6513,7 @@ M68KMAKE_OP(move, 16, toc, .) M68KMAKE_OP(move, 16, frs, d) { - if(CPU_TYPE_IS_000() || m_s_flag) /* NS990408 */ + if(CPU_TYPE_IS_000() || CPU_TYPE_IS_070() || m_s_flag) /* NS990408 */ { DY() = MASK_OUT_BELOW_16(DY()) | m68ki_get_sr(); return; @@ -6524,7 +6524,7 @@ M68KMAKE_OP(move, 16, frs, d) M68KMAKE_OP(move, 16, frs, .) { - if(CPU_TYPE_IS_000() || m_s_flag) /* NS990408 */ + if(CPU_TYPE_IS_000() || CPU_TYPE_IS_070() || m_s_flag) /* NS990408 */ { uint32_t ea = M68KMAKE_GET_EA_AY_16; m68ki_write_16(ea, m68ki_get_sr()); @@ -9011,7 +9011,7 @@ M68KMAKE_OP(rte, 32, ., .) return; } - if(CPU_TYPE_IS_010()) + if(CPU_TYPE_IS_010() || CPU_TYPE_IS_070()) { format_word = m68ki_read_16(REG_A()[7]+6) >> 12; if(format_word == 0) diff --git a/src/devices/cpu/m68000/m68kcpu.cpp b/src/devices/cpu/m68000/m68kcpu.cpp index c2ac1556192..0ebcf6dc31e 100644 --- a/src/devices/cpu/m68000/m68kcpu.cpp +++ b/src/devices/cpu/m68000/m68kcpu.cpp @@ -614,7 +614,7 @@ const uint8_t m68000_base_device::m68ki_ea_idx_cycle_table[64] = CPU STATE DESCRIPTION ***************************************************************************/ -#define MASK_ALL (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_EC030 | CPU_TYPE_030 | CPU_TYPE_EC040 | CPU_TYPE_040 | CPU_TYPE_FSCPU32 ) +#define MASK_ALL (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_EC030 | CPU_TYPE_030 | CPU_TYPE_EC040 | CPU_TYPE_040 | CPU_TYPE_FSCPU32 | CPU_TYPE_SCC070 ) #define MASK_24BIT_SPACE (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_EC020) #define MASK_32BIT_SPACE (CPU_TYPE_020 | CPU_TYPE_EC030 | CPU_TYPE_030 | CPU_TYPE_EC040 | CPU_TYPE_040 | CPU_TYPE_FSCPU32 ) #define MASK_010_OR_LATER (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_030 | CPU_TYPE_EC030 | CPU_TYPE_040 | CPU_TYPE_EC040 | CPU_TYPE_FSCPU32 ) @@ -687,7 +687,7 @@ void m68000_base_device::m68k_cause_bus_error() m_run_mode = RUN_MODE_BERR_AERR_RESET_WSF; - if (!CPU_TYPE_IS_010_PLUS()) + if (CPU_TYPE_IS_000()) { /* Note: This is implemented for 68000 only! */ m68ki_stack_frame_buserr(sr); @@ -697,6 +697,11 @@ void m68000_base_device::m68k_cause_bus_error() /* only the 68010 throws this unique type-1000 frame */ m68ki_stack_frame_1000(m_ppc, sr, EXCEPTION_BUS_ERROR); } + else if (CPU_TYPE_IS_070()) + { + /* only the 68070 throws this unique type-1111 frame */ + m68ki_stack_frame_1111(m_ppc, sr, EXCEPTION_BUS_ERROR); + } else if (m_mmu_tmp_buserror_address == m_ppc) { m68ki_stack_frame_1010(sr, EXCEPTION_BUS_ERROR, m_ppc, m_mmu_tmp_buserror_address); @@ -1955,8 +1960,28 @@ void m68000_base_device::init_cpu_m68lc040(void) void m68000_base_device::init_cpu_scc68070(void) { - init_cpu_m68010(); + init_cpu_common(); m_cpu_type = CPU_TYPE_SCC070; + + // TODO: most of this is subtly different + init16(*m_program, *m_oprogram); + m_sr_mask = 0xa71f; /* T1 -- S -- -- I2 I1 I0 -- -- -- X N Z V C */ + m_jump_table = m68ki_instruction_jump_table[1]; + m_cyc_instruction = m68ki_cycles[1]; + m_cyc_exception = m68ki_exception_cycle_table[1]; + m_cyc_bcc_notake_b = -4; + m_cyc_bcc_notake_w = 0; + m_cyc_dbcc_f_noexp = 0; + m_cyc_dbcc_f_exp = 6; + m_cyc_scc_r_true = 0; + m_cyc_movem_w = 2; + m_cyc_movem_l = 3; + m_cyc_shift = 1; + m_cyc_reset = 130; + m_has_pmmu = 0; + m_has_fpu = 0; + + define_state(); } diff --git a/src/devices/cpu/m68000/m68kcpu.h b/src/devices/cpu/m68000/m68kcpu.h index 6fc049c0720..df409bd14c8 100644 --- a/src/devices/cpu/m68000/m68kcpu.h +++ b/src/devices/cpu/m68000/m68kcpu.h @@ -228,10 +228,12 @@ inline uint32_t CPU_TYPE_IS_EC020_LESS() const { return ((m_cpu_type) & (CPU_TY inline uint32_t CPU_TYPE_IS_010() const { return ((m_cpu_type) == CPU_TYPE_010); } inline uint32_t CPU_TYPE_IS_010_PLUS() const { return ((m_cpu_type) & (CPU_TYPE_010 | CPU_TYPE_EC020 | CPU_TYPE_020 | CPU_TYPE_EC030 | CPU_TYPE_030 | CPU_TYPE_040 | CPU_TYPE_EC040 | CPU_TYPE_FSCPU32 | CPU_TYPE_COLDFIRE)); } -inline uint32_t CPU_TYPE_IS_010_LESS() const { return ((m_cpu_type) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010)); } +inline uint32_t CPU_TYPE_IS_010_LESS() const { return ((m_cpu_type) & (CPU_TYPE_000 | CPU_TYPE_008 | CPU_TYPE_010 | CPU_TYPE_SCC070)); } inline uint32_t CPU_TYPE_IS_000() const { return ((m_cpu_type) == CPU_TYPE_000 || (m_cpu_type) == CPU_TYPE_008); } +inline uint32_t CPU_TYPE_IS_070() const { return ((m_cpu_type) == CPU_TYPE_SCC070); } + /* Initiates trace checking before each instruction (t1) */ inline void m68ki_trace_t1() { m_tracing = m_t1_flag; } @@ -1133,7 +1135,7 @@ inline void m68ki_stack_frame_3word(uint32_t pc, uint32_t sr) inline void m68ki_stack_frame_0000(uint32_t pc, uint32_t sr, uint32_t vector) { /* Stack a 3-word frame if we are 68000 */ - if(m_cpu_type == CPU_TYPE_000 || m_cpu_type == CPU_TYPE_008) + if(CPU_TYPE_IS_000()) { m68ki_stack_frame_3word(pc, sr); return; @@ -1233,6 +1235,48 @@ inline void m68ki_stack_frame_1000(uint32_t pc, uint32_t sr, uint32_t vector) m68ki_push_16(sr); } +/* Format 15 stack frame (68070). + * 68070 only. This is the 17 word bus/address error frame. + */ +inline void m68ki_stack_frame_1111(uint32_t pc, uint32_t sr, uint32_t vector) +{ + /* INTERNAL INFORMATION */ + m68ki_fake_push_16(); + + /* INSTRUCTION INPUT BUFFER */ + m68ki_push_16(0); + + /* INSTRUCTION REGISTER */ + m68ki_push_16(m_ir); + + /* DATA INPUT BUFFER */ + m68ki_push_32(0); + + /* FAULT ADDRESS */ + m68ki_push_32(0); + + /* DATA OUTPUT BUFFER */ + m68ki_push_32(0); + + /* INTERNAL INFORMATION */ + m68ki_fake_push_32(); + + /* CURRENT MOVE MULTIPLE MASK */ + m68ki_push_16(0); + + /* SPECIAL STATUS WORD */ + m68ki_push_16(0); + + /* 1111, VECTOR OFFSET */ + m68ki_push_16(0xf000 | (vector<<2)); + + /* PROGRAM COUNTER */ + m68ki_push_32(pc); + + /* STATUS REGISTER */ + m68ki_push_16(sr); +} + /* Format A stack frame (short bus fault). * This is used only by 68020 for bus fault and address error * if the error happens at an instruction boundary. @@ -1550,7 +1594,7 @@ inline void m68ki_exception_address_error() m_run_mode = RUN_MODE_BERR_AERR_RESET_WSF; - if (!CPU_TYPE_IS_010_PLUS()) + if (CPU_TYPE_IS_000()) { /* Note: This is implemented for 68000 only! */ m68ki_stack_frame_buserr(sr); @@ -1560,6 +1604,11 @@ inline void m68ki_exception_address_error() /* only the 68010 throws this unique type-1000 frame */ m68ki_stack_frame_1000(m_ppc, sr, EXCEPTION_BUS_ERROR); } + else if (CPU_TYPE_IS_070()) + { + /* only the 68070 throws this unique type-1111 frame */ + m68ki_stack_frame_1111(m_ppc, sr, EXCEPTION_BUS_ERROR); + } else if (m_mmu_tmp_buserror_address == m_ppc) { m68ki_stack_frame_1010(sr, EXCEPTION_BUS_ERROR, m_ppc, m_mmu_tmp_buserror_address); -- cgit v1.2.3