mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Corrects CMP, CPX, CPY carry flags.
This commit is contained in:
parent
1ba0a117e7
commit
19aea85184
@ -29,11 +29,12 @@ template <Type type> 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);
|
||||
}
|
||||
|
||||
|
@ -622,15 +622,15 @@ template <typename BusHandler> void Processor<BusHandler>::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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user