From 844e69607172242308670f67bb069bd6b5d0d40c Mon Sep 17 00:00:00 2001 From: David Haywood Date: Wed, 21 Aug 2013 06:56:57 +0000 Subject: [PATCH] a regular 68000 processor will generate a read operation when using the clr.b/.w/.l opcodes, this was fixed / changed on the 020. I'm not aware of any software explicitly requiring this right now, but it would be detectable if you have read-triggered hardware and various 68k documents advise caution when using the opcodes / porting code using said opcodes to a 020 based machine for that reason. There was some private discussion with Charles before doing this, apparently it is detectable on the Genesis where a read from the VDP port will increment the internal address counter. --- src/emu/cpu/m68000/m68k_in.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/emu/cpu/m68000/m68k_in.c b/src/emu/cpu/m68000/m68k_in.c index 31b499fef1e..793137fa1e7 100644 --- a/src/emu/cpu/m68000/m68k_in.c +++ b/src/emu/cpu/m68000/m68k_in.c @@ -3895,7 +3895,14 @@ M68KMAKE_OP(clr, 8, ., d) M68KMAKE_OP(clr, 8, ., .) { - m68ki_write_8((mc68kcpu), M68KMAKE_GET_EA_AY_8, 0); + UINT32 ea = M68KMAKE_GET_EA_AY_8; + + if(CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type)) + { + m68ki_read_8((mc68kcpu), ea); /* the 68000 (and 010?) does a dummy read, the value is discarded */ + } + + m68ki_write_8((mc68kcpu), ea, 0); (mc68kcpu)->n_flag = NFLAG_CLEAR; (mc68kcpu)->v_flag = VFLAG_CLEAR; @@ -3917,7 +3924,14 @@ M68KMAKE_OP(clr, 16, ., d) M68KMAKE_OP(clr, 16, ., .) { - m68ki_write_16((mc68kcpu), M68KMAKE_GET_EA_AY_16, 0); + UINT32 ea = M68KMAKE_GET_EA_AY_16; + + if(CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type)) + { + m68ki_read_16((mc68kcpu), ea); /* the 68000 (and 010?) does a dummy read, the value is discarded */ + } + + m68ki_write_16((mc68kcpu), ea, 0); (mc68kcpu)->n_flag = NFLAG_CLEAR; (mc68kcpu)->v_flag = VFLAG_CLEAR; @@ -3939,7 +3953,14 @@ M68KMAKE_OP(clr, 32, ., d) M68KMAKE_OP(clr, 32, ., .) { - m68ki_write_32((mc68kcpu), M68KMAKE_GET_EA_AY_32, 0); + UINT32 ea = M68KMAKE_GET_EA_AY_32; + + if(CPU_TYPE_IS_010_LESS((mc68kcpu)->cpu_type)) + { + m68ki_read_32((mc68kcpu), ea); /* the 68000 (and 010?) does a dummy read, the value is discarded */ + } + + m68ki_write_32((mc68kcpu), ea, 0); (mc68kcpu)->n_flag = NFLAG_CLEAR; (mc68kcpu)->v_flag = VFLAG_CLEAR;