From f6466f63f040b8cfb4f308e0db567d9010c3435d Mon Sep 17 00:00:00 2001 From: AnonymusRaccoon Date: Mon, 17 Feb 2020 11:26:46 +0100 Subject: [PATCH] Solving a bug with the ADC --- sources/CPU/Instructions/MathematicalOperations.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/CPU/Instructions/MathematicalOperations.cpp b/sources/CPU/Instructions/MathematicalOperations.cpp index 37a38e6..83455f8 100644 --- a/sources/CPU/Instructions/MathematicalOperations.cpp +++ b/sources/CPU/Instructions/MathematicalOperations.cpp @@ -12,7 +12,7 @@ namespace ComSquare::CPU unsigned value = this->_bus->read(valueAddr) + this->_registers.p.c; if (this->_registers.p.m) value += this->_bus->read(valueAddr + 1) << 8u; - unsigned negativeMask = this->_isEmulationMode ? 0xF0u : 0xF000u; + unsigned negativeMask = this->_isEmulationMode ? 0x80u : 0x8000u; unsigned maxValue = this->_isEmulationMode ? UINT8_MAX : UINT16_MAX; this->_registers.p.c = static_cast(this->_registers.a) + value > maxValue;