Skip to content

Commit

Permalink
[#15] Combine on_decode_ld_sp_irp().
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarev committed Aug 29, 2021
1 parent 2793030 commit 5121090
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions z80.h
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,15 @@ class internals::decoder_base : public B {
public:
typedef B base;

// Transfers.
void on_decode_ld_sp_irp() {
if(!self().on_is_z80())
self().on_fetch_cycle_extra_1t();
else
self().on_fetch_cycle_extra_2t();
self().on_ld_sp_irp(); }

// Jumps.
void on_decode_xcall_nn(fast_u8 op) {
fast_u16 nn = self().on_imm16_read();
self().on_read_cycle_extra_1t();
Expand Down Expand Up @@ -1153,9 +1162,6 @@ class i8080_decoder : public internals::decoder_base<B> {
self().on_ld_r_n(r, /* d= */ 0, n); }
void on_decode_ld_r_r(reg rd, reg rs) {
self().on_ld_r_r(rd, rs); }
void on_decode_ld_sp_irp() {
self().on_fetch_cycle_extra_1t();
self().on_ld_sp_irp(); }

protected:
using base::self;
Expand Down Expand Up @@ -1226,9 +1232,6 @@ class z80_decoder : public internals::decoder_base<B> {
self().on_ld_r_n(r, d, n); }
void on_decode_ld_r_r(reg rd, reg rs) {
self().on_ld_r_r(rd, rs, read_disp_or_null(rd, rs)); }
void on_decode_ld_sp_irp() {
self().on_fetch_cycle_extra_2t();
self().on_ld_sp_irp(); }

protected:
using base::self;
Expand Down

0 comments on commit 5121090

Please sign in to comment.