diff --git a/src/emu/cpu/m37710/m37710.c b/src/emu/cpu/m37710/m37710.c index add2eabaf14..9fe24b0fa15 100644 --- a/src/emu/cpu/m37710/m37710.c +++ b/src/emu/cpu/m37710/m37710.c @@ -528,40 +528,24 @@ static void m37710_internal_w(m37710i_cpu_struct *cpustate, int offset, UINT8 da static READ16_HANDLER( m37710_internal_word_r ) { m37710i_cpu_struct *cpustate = get_safe_token(&space->device()); + UINT16 ret = 0; - if (mem_mask == 0xffff) - { - return (m37710_internal_r(cpustate, offset*2) | m37710_internal_r(cpustate, (offset*2)+1)<<8); - } - else if (mem_mask == 0xff00) - { - return m37710_internal_r(cpustate, (offset*2)+1)<<8; - } - else if (mem_mask == 0x00ff) - { - return m37710_internal_r(cpustate, (offset*2)); - } + if (mem_mask & 0x00ff) + ret |= m37710_internal_r(cpustate, offset*2); + if (mem_mask & 0xff00) + ret |= m37710_internal_r(cpustate, offset*2+1)<<8; - return 0; + return ret; } static WRITE16_HANDLER( m37710_internal_word_w ) { m37710i_cpu_struct *cpustate = get_safe_token(&space->device()); - if (mem_mask == 0xffff) - { - m37710_internal_w(cpustate, (offset*2), data & 0xff); - m37710_internal_w(cpustate, (offset*2)+1, data>>8); - } - else if (mem_mask == 0xff00) - { - m37710_internal_w(cpustate, (offset*2)+1, data>>8); - } - else if (mem_mask == 0x00ff) - { - m37710_internal_w(cpustate, (offset*2), data & 0xff); - } + if (mem_mask & 0x00ff) + m37710_internal_w(cpustate, offset*2, data & 0xff); + if (mem_mask & 0xff00) + m37710_internal_w(cpustate, offset*2+1, data>>8); } extern void (*const m37710i_opcodes_M0X0[])(m37710i_cpu_struct *cpustate);