1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-28 09:54:49 +00:00

Corrects BIT. All 65816-applicable Wolfgang Lorenz tests now pass.

This commit is contained in:
Thomas Harte 2020-10-10 17:47:33 -04:00
parent 340ad093a6
commit 6892ac13e8
4 changed files with 11 additions and 4 deletions

View File

@ -45,14 +45,14 @@ template <Type type> class ConcreteAllRAMProcessor: public AllRAMProcessor, publ
*value = memory_[address];
#ifdef BE_NOISY
// if((address&0xff00) == 0x100) {
printf("%04x -> %02x\n", address, *value);
// printf("%04x -> %02x\n", address, *value);
// }
#endif
} else {
memory_[address] = *value;
#ifdef BE_NOISY
// if((address&0xff00) == 0x100) {
printf("%04x <- %02x\n", address, *value);
// printf("%04x <- %02x\n", address, *value);
// }
#endif
}

View File

@ -49,6 +49,11 @@ struct LazyFlags {
zero_result = uint8_t(value | (value >> shift));
}
/// Sets the N flag per the 8- or 16-bit value @c value; @c shift should be 0 to indicate an 8-bit value or 8 to indicate a 16-bit value.
void set_n(uint16_t value, int shift) {
negative_result = uint8_t(value >> shift);
}
void set(uint8_t flags) {
carry = flags & Flag::Carry;
negative_result = flags & Flag::Sign;

View File

@ -629,7 +629,8 @@ template <typename BusHandler> void Processor<BusHandler>::run_for(const Cycles
break;
case BIT:
flags_.set_nz(data_buffer_.value & a_.full, m_shift_);
flags_.set_n(data_buffer_.value, m_shift_);
flags_.set_z(data_buffer_.value & a_.full, m_shift_);
flags_.overflow = data_buffer_.value & Flag::Overflow;
break;

View File

@ -556,7 +556,8 @@ struct CPU::WDC65816::ProcessorStorageConstructor {
target(OperationPerform); // The branch instructions will all skip one or three
// of the next cycles, depending on the effect of
// the jump.
// the jump. It'll also calculate the correct target
// address, placing it into the data buffer.
target(CycleFetchPCThrowaway); // IO
target(CycleFetchPCThrowaway); // IO