diff --git a/Processors/6502/AllRAM/6502AllRAM.cpp b/Processors/6502/AllRAM/6502AllRAM.cpp index cc7d6f8b5..793fb5eff 100644 --- a/Processors/6502/AllRAM/6502AllRAM.cpp +++ b/Processors/6502/AllRAM/6502AllRAM.cpp @@ -29,11 +29,12 @@ template class ConcreteAllRAMProcessor: public AllRAMProcessor, publ if(operation == BusOperation::ReadOpcode) { // TEMPORARY LOGGING. TODO: remove. - printf("[%04x] %02x a:%04x x:%04x y:%04x p:%02x\n", address, memory_[address], + printf("[%04x] %02x a:%04x x:%04x y:%04x p:%02x s:%02x\n", address, memory_[address], mos6502_.get_value_of_register(Register::A), mos6502_.get_value_of_register(Register::X), mos6502_.get_value_of_register(Register::Y), - mos6502_.get_value_of_register(Register::Flags)); + mos6502_.get_value_of_register(Register::Flags) & 0xff, + mos6502_.get_value_of_register(Register::StackPointer) & 0xff); check_address_for_trap(address); } diff --git a/Processors/65816/Implementation/65816Implementation.hpp b/Processors/65816/Implementation/65816Implementation.hpp index ab94aa5a7..50c924489 100644 --- a/Processors/65816/Implementation/65816Implementation.hpp +++ b/Processors/65816/Implementation/65816Implementation.hpp @@ -622,15 +622,15 @@ template void Processor::run_for(const Cycles // Arithmetic. // -#define cp(v, shift) {\ - const uint32_t temp32 = v.full - data_buffer_.value; \ +#define cp(v, shift, masks) {\ + const uint32_t temp32 = (v.full & masks[1]) - (data_buffer_.value & masks[1]); \ flags_.set_nz(uint16_t(temp32), shift); \ flags_.carry = ((~temp32) >> (8 + shift))&1; \ } - case CMP: cp(a_, m_shift_); break; - case CPX: cp(x_, x_shift_); break; - case CPY: cp(y_, x_shift_); break; + case CMP: cp(a_, m_shift_, m_masks_); break; + case CPX: cp(x_, x_shift_, x_masks_); break; + case CPY: cp(y_, x_shift_, x_masks_); break; #undef cp