1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-23 21:29:11 +00:00

Reduced LD[I/D}{R} repetition.

This commit is contained in:
Thomas Harte 2017-05-29 08:24:10 -04:00
parent 47845f8c19
commit 1f62cbe21a

View File

@ -1076,21 +1076,22 @@ template <class T> class Processor: public MicroOpScheduler<MicroOp> {
#pragma mark - Repetition #pragma mark - Repetition
#define LDxR_STEP(incr) \
bc_.full--; \
de_.full += (operation->type == incr) ? 1 : -1; \
hl_.full += (operation->type == incr) ? 1 : -1; \
bit3_result_ = bit5_result_ = a_ + temp8_; \
subtract_flag_ = 0; \
half_carry_flag_ = 0; \
parity_overflow_flag_ = bc_.full ? Flag::Parity : 0;
case MicroOp::LDDR: case MicroOp::LDDR:
case MicroOp::LDIR: { case MicroOp::LDIR: {
bc_.full--; LDxR_STEP(MicroOp::LDIR);
de_.full += (operation->type == MicroOp::LDIR) ? 1 : -1;
hl_.full += (operation->type == MicroOp::LDIR) ? 1 : -1;
bit3_result_ = bit5_result_ = a_ + temp8_; if(parity_overflow_flag_) {
subtract_flag_ = 0;
half_carry_flag_ = 0;
if(bc_.full) {
parity_overflow_flag_ = Flag::Parity;
pc_.full -= 2; pc_.full -= 2;
} else { } else {
parity_overflow_flag_ = 0;
move_to_next_program(); move_to_next_program();
checkSchedule(); checkSchedule();
} }
@ -1098,16 +1099,11 @@ template <class T> class Processor: public MicroOpScheduler<MicroOp> {
case MicroOp::LDD: case MicroOp::LDD:
case MicroOp::LDI: { case MicroOp::LDI: {
bc_.full--; LDxR_STEP(MicroOp::LDI);
de_.full += (operation->type == MicroOp::LDI) ? 1 : -1;
hl_.full += (operation->type == MicroOp::LDI) ? 1 : -1;
bit3_result_ = bit5_result_ = a_ + temp8_;
subtract_flag_ = 0;
half_carry_flag_ = 0;
parity_overflow_flag_ = bc_.full ? Flag::Parity : 0;
} break; } break;
#undef LDxR_STEP
case MicroOp::CPDR: case MicroOp::CPDR:
case MicroOp::CPIR: { case MicroOp::CPIR: {
bc_.full--; bc_.full--;