From 67174d74af55de37daf0b9d1dff5a6b50983aa96 Mon Sep 17 00:00:00 2001 From: "Adrian.Conlon" Date: Fri, 23 Jun 2017 21:23:20 +0100 Subject: [PATCH] Correct some memory access issues in LR35902 Signed-off-by: Adrian.Conlon --- LR35902/src/LR35902.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/LR35902/src/LR35902.cpp b/LR35902/src/LR35902.cpp index 376eda9..8b8f4a2 100644 --- a/LR35902/src/LR35902.cpp +++ b/LR35902/src/LR35902.cpp @@ -538,23 +538,23 @@ void EightBit::LR35902::executeOther(int x, int y, int z, int p, int q) { case 0: switch (p) { case 0: // LD (BC),A - MEMPTR() = BC(); - MEMPTR().high = memptrReference() = A(); + m_memory.ADDRESS() = BC(); + m_memory.reference() = A(); cycles += 2; break; case 1: // LD (DE),A - MEMPTR() = DE(); - MEMPTR().high = memptrReference() = A(); + m_memory.ADDRESS() = DE(); + m_memory.reference() = A(); cycles += 2; break; case 2: // GB: LDI (HL),A - MEMPTR().word = HL().word++; - MEMPTR().high = memptrReference() = A(); + m_memory.ADDRESS().word = HL().word++; + m_memory.reference() = A(); cycles += 2; break; case 3: // GB: LDD (HL),A - MEMPTR().word = HL().word--; - MEMPTR().high = memptrReference() = A(); + m_memory.ADDRESS().word = HL().word--; + m_memory.reference() = A(); cycles += 2; break; } @@ -562,22 +562,22 @@ void EightBit::LR35902::executeOther(int x, int y, int z, int p, int q) { case 1: switch (p) { case 0: // LD A,(BC) - MEMPTR() = BC(); - A() = memptrReference(); + m_memory.ADDRESS() = BC(); + A() = m_memory.reference(); cycles += 2; break; case 1: // LD A,(DE) - MEMPTR() = DE(); - A() = memptrReference(); + m_memory.ADDRESS() = DE(); + A() = m_memory.reference(); cycles += 2; break; case 2: // GB: LDI A,(HL) - MEMPTR().word = HL().word++; + m_memory.ADDRESS().word = HL().word++; A() = m_memory.reference(); cycles += 2; break; case 3: // GB: LDD A,(HL) - MEMPTR().word = HL().word--; + m_memory.ADDRESS().word = HL().word--; A() = m_memory.reference(); cycles += 2; break;