From 88783963392734c7dec820f109bb3725aa7a7b97 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 26 Feb 2020 21:42:31 -0500 Subject: [PATCH] Corrects DJNZ memptr behaviour. --- OSBindings/Mac/Clock SignalTests/FUSETests.swift | 2 +- Processors/Z80/Implementation/Z80Implementation.hpp | 3 +-- Processors/Z80/Implementation/Z80Storage.cpp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/FUSETests.swift b/OSBindings/Mac/Clock SignalTests/FUSETests.swift index 14c331634..3cf824546 100644 --- a/OSBindings/Mac/Clock SignalTests/FUSETests.swift +++ b/OSBindings/Mac/Clock SignalTests/FUSETests.swift @@ -172,7 +172,7 @@ class FUSETests: XCTestCase { let name = itemDictionary["name"] as! String -// if name != "01" { +// if name != "10" { // continue; // } // print("\(name)") diff --git a/Processors/Z80/Implementation/Z80Implementation.hpp b/Processors/Z80/Implementation/Z80Implementation.hpp index 1e40f2ed4..517cc57ea 100644 --- a/Processors/Z80/Implementation/Z80Implementation.hpp +++ b/Processors/Z80/Implementation/Z80Implementation.hpp @@ -181,7 +181,6 @@ template < class T, case MicroOp::DJNZ: bc_.halves.high--; if(!bc_.halves.high) { - memptr_.full = pc_.full; advance_operation(); } break; @@ -873,7 +872,7 @@ template < class T, break; case MicroOp::CalculateIndexAddress: - memptr_.full = static_cast(*static_cast(operation->source) + (int8_t)temp8_); + memptr_.full = static_cast(*static_cast(operation->source) + int8_t(temp8_)); break; case MicroOp::SetAddrAMemptr: diff --git a/Processors/Z80/Implementation/Z80Storage.cpp b/Processors/Z80/Implementation/Z80Storage.cpp index 0dc59eec4..3878b3be2 100644 --- a/Processors/Z80/Implementation/Z80Storage.cpp +++ b/Processors/Z80/Implementation/Z80Storage.cpp @@ -371,7 +371,7 @@ void ProcessorStorage::assemble_base_page(InstructionPage &target, RegisterPair1 DEC_INC_DEC_LD(bc_, bc_.halves.low), /* 0x0f RRCA */ StdInstr({MicroOp::RRCA}), - /* 0x10 DJNZ */ Instr(6, ReadInc(pc_, temp8_), {MicroOp::Move16, &pc_.full, &memptr_.full}, {MicroOp::DJNZ}, InternalOperation(10), {MicroOp::CalculateIndexAddress, &pc_.full}, {MicroOp::Move16, &memptr_.full, &pc_.full}), + /* 0x10 DJNZ */ Instr(6, ReadInc(pc_, temp8_), {MicroOp::DJNZ}, InternalOperation(10), {MicroOp::CalculateIndexAddress, &pc_.full}, {MicroOp::Move16, &memptr_.full, &pc_.full}), /* 0x11 LD DE, nn */ StdInstr(Read16Inc(pc_, de_)), /* 0x12 LD (DE), A */ StdInstr({MicroOp::SetAddrAMemptr, &de_.full}, Write3(de_, a_)),