From 232f6e5448097b6b8959b98db0dfd3565f7736a3 Mon Sep 17 00:00:00 2001 From: MURAOKA Taro Date: Sat, 20 Apr 2024 21:41:40 +0900 Subject: [PATCH] revert redundant function: fetchM1x2 --- cpu.go | 15 +-------------- operation.go | 4 ++-- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/cpu.go b/cpu.go index 26f6cb9..834c47b 100644 --- a/cpu.go +++ b/cpu.go @@ -135,7 +135,7 @@ func (cpu *CPU) fetch16() uint16 { return (uint16(h) << 8) | uint16(l) } -// fetchM1 fetches a byte for M1 cycle +// fetchM1 fetches a byte for M1 cycle. func (cpu *CPU) fetchM1() uint8 { c := cpu.Memory.Get(cpu.PC) cpu.PC++ @@ -145,19 +145,6 @@ func (cpu *CPU) fetchM1() uint8 { return c } -// fetchM1x2 fetches two bytes for M1 cycle. -// First one is a data, second one is a part of opcode. -func (cpu *CPU) fetchM1x2() (d, c uint8) { - d = cpu.Memory.Get(cpu.PC) - cpu.PC++ - c = cpu.Memory.Get(cpu.PC) - cpu.PC++ - // increment refresh counter - rc := cpu.IR.Lo - cpu.IR.Lo = rc&0x80 | (rc+1)&0x7f - return d, c -} - func (cpu *CPU) ioIn(addr uint8) uint8 { if cpu.IO == nil { return 0 diff --git a/operation.go b/operation.go index 8e8d0b5..d33c34a 100644 --- a/operation.go +++ b/operation.go @@ -1537,7 +1537,7 @@ func (cpu *CPU) executeOne() { oopLDSPIX(cpu) case 0xcb: - switch d, c3 := cpu.fetchM1x2(); c3 { + switch d, c3 := cpu.fetch(), cpu.fetchM1(); c3 { case 0x06: oopRLCIXdP(cpu, d) @@ -2144,7 +2144,7 @@ func (cpu *CPU) executeOne() { oopLDSPIY(cpu) case 0xcb: - switch d, c3 := cpu.fetchM1x2(); c3 { + switch d, c3 := cpu.fetch(), cpu.fetchM1(); c3 { case 0x06: oopRLCIYdP(cpu, d)