6502-emulator/test/test-utils.cpp
2019-04-23 21:19:00 +01:00

20 lines
672 B
C++

#include "test-utils.h"
unique_ptr<Machine> create_machine(vector<uint8_t> code) {
auto machine = make_unique<Machine>(false);
machine->load(code, CODE_LOAD_ADDR);
return machine;
}
bool are_flags_set(const StatusRegister& reg, const RegisterFlagSet& flags) {
return
flags.carry == reg.is_carry_set() &&
flags.zero == reg.is_zero_set() &&
flags.interupt_disable == reg.is_interupt_disable_set() &&
flags.decimal == reg.is_interupt_disable_set() &&
flags.brk == reg.is_break_set() &&
flags.overflow == reg.is_overflow_set() &&
flags.negative == reg.is_negative_set();
}