Skip to content

Commit

Permalink
[#15] Combine on_decode_dec_r().
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarev committed Aug 29, 2021
1 parent 8896f8f commit a2f8981
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions z80.h
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,16 @@ class internals::decoder_base : public B {
d = read_disp_or_null(r);
}
self().on_inc_r(r, d); }
void on_decode_dec_r(reg r) {
fast_u8 d;
if(!self().on_is_z80()) {
d = 0;
if(r != reg::at_hl)
self().on_fetch_cycle_extra_1t();
} else {
d = read_disp_or_null(r);
}
self().on_dec_r(r, d); }
void on_decode_inc_rp(regp rp) {
if(!self().on_is_z80())
self().on_fetch_cycle_extra_1t();
Expand Down Expand Up @@ -1223,10 +1233,6 @@ class i8080_decoder : public internals::decoder_base<B> {
self().on_decode_xcall_nn(0xdd); }
void on_decode_fd_prefix() {
self().on_decode_xcall_nn(0xfd); }
void on_decode_dec_r(reg r) {
if(r != reg::at_hl)
self().on_fetch_cycle_extra_1t();
self().on_dec_r(r); }

protected:
using base::self;
Expand Down Expand Up @@ -1257,8 +1263,6 @@ class z80_decoder : public internals::decoder_base<B> {
self().on_instr_prefix(iregp::ix); }
void on_decode_fd_prefix() {
self().on_instr_prefix(iregp::iy); }
void on_decode_dec_r(reg r) {
self().on_dec_r(r, read_disp_or_null(r)); }

protected:
using base::self;
Expand Down

0 comments on commit a2f8981

Please sign in to comment.