Skip to content

Commit

Permalink
[#15] Combine on_decode_inc_r().
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarev committed Aug 29, 2021
1 parent b8d8140 commit f715732
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 @@ -657,6 +657,16 @@ class internals::decoder_base : public B {
self().on_ld_sp_irp(); }

// Arithmetic.
void on_decode_inc_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_inc_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 @@ -1191,10 +1201,6 @@ class i8080_decoder : public internals::decoder_base<B> {
void on_decode_halt() {
self().on_fetch_cycle_extra_3t();
self().on_halt(); }
void on_decode_inc_r(reg r) {
if(r != reg::at_hl)
self().on_fetch_cycle_extra_1t();
self().on_inc_r(r); }
void on_decode_jp_irp() {
self().on_fetch_cycle_extra_1t();
self().on_jp_irp(); }
Expand Down Expand Up @@ -1250,8 +1256,6 @@ class z80_decoder : public internals::decoder_base<B> {
self().on_halt(); }
void on_decode_jp_irp() {
self().on_jp_irp(); }
void on_decode_inc_r(reg r) {
self().on_inc_r(r, read_disp_or_null(r)); }

protected:
using base::self;
Expand Down

0 comments on commit f715732

Please sign in to comment.