Skip to content

Commit

Permalink
[#6] Support enabling lazy flags for the benchmark example.
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarev committed Jul 2, 2021
1 parent 87f4883 commit 71f64ff
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions examples/benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ class memory_watcher : public B {

#define WATCHER default_watcher

#define USE_LAZY_FLAGS 0

template<typename B>
class emulator : public WATCHER<B> {
public:
Expand Down Expand Up @@ -380,10 +382,37 @@ class emulator : public WATCHER<B> {
self().on_report();
}

#if USE_LAZY_FLAGS
bool on_is_to_use_lazy_flags() {
return true;
}

fast_u16 on_get_flags() {
return flags;
}

void on_set_flags(fast_u16 new_flags) {
flags = new_flags;
}

fast_u8 on_get_f() {
abort();
}

void on_set_f(fast_u8 n) {
unused(n);
abort();
}
#endif

protected:
using base::self;

private:
#if USE_LAZY_FLAGS
fast_u16 flags = 0;
#endif

least_u8 memory[z80::address_space_size] = {};
};

Expand Down

0 comments on commit 71f64ff

Please sign in to comment.