Skip to content

Commit

Permalink
[#18] Move the generic implementations of index register handlers to …
Browse files Browse the repository at this point in the history
…the root module.
  • Loading branch information
kosarev committed Jul 4, 2021
1 parent e7aead6 commit b1cc451
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions z80.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,24 @@ class root {
unreachable("Unknown register.");
}

fast_u16 on_get_iregp(iregp irp) {
switch(irp) {
case iregp::hl: return self().on_get_hl();
case iregp::ix: return self().on_get_ix();
case iregp::iy: return self().on_get_iy();
}
unreachable("Unknown index register.");
}

void on_set_iregp(iregp irp, fast_u16 nn) {
switch(irp) {
case iregp::hl: return self().on_set_hl(nn);
case iregp::ix: return self().on_set_ix(nn);
case iregp::iy: return self().on_set_iy(nn);
}
unreachable("Unknown index register.");
}

// No dummy implementations for the following handlers as
// being forgotten to be implemented, they would lead to
// problems that are hard to diagnose.
Expand Down Expand Up @@ -2958,24 +2976,6 @@ class z80_executor : public internals::executor_base<B> {
unreachable("Unknown register.");
}

fast_u16 on_get_iregp(iregp irp) {
switch(irp) {
case iregp::hl: return self().on_get_hl();
case iregp::ix: return self().on_get_ix();
case iregp::iy: return self().on_get_iy();
}
unreachable("Unknown index register.");
}

void on_set_iregp(iregp irp, fast_u16 nn) {
switch(irp) {
case iregp::hl: return self().on_set_hl(nn);
case iregp::ix: return self().on_set_ix(nn);
case iregp::iy: return self().on_set_iy(nn);
}
unreachable("Unknown index register.");
}

bool check_condition(condition cc) {
// TODO: Would it make sense to store flags in a different order?
auto n = static_cast<unsigned>(cc);
Expand Down

0 comments on commit b1cc451

Please sign in to comment.