Skip to content

Commit

Permalink
[#5] Unify computing HF.
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarev committed Nov 8, 2020
1 parent 773c075 commit aa34da3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions z80.h
Original file line number Diff line number Diff line change
Expand Up @@ -2412,10 +2412,6 @@ class i8080_executor : public internals::executor_base<B> {
return (hf_mask + (op1 & 0xf) - (op2 & 0xf) - cfv) & hf_mask; }
fast_u8 hf3(fast_u8 ops12) {
return (ops12 << (base::hf_bit - 3)) & hf_mask; }
fast_u8 hf4(fast_u8 op) {
return ((op & 0xf) + 0xf) & hf_mask; }
fast_u8 hf5(fast_u8 op) {
return ((op & 0xf) + 1) & hf_mask; }

enum class flag_set { f1, f2, f3, f4, f5, f6, f7 };

Expand Down Expand Up @@ -2447,12 +2443,12 @@ class i8080_executor : public internals::executor_base<B> {
fast_u8 t = mask8(w); // TODO: Can be just a cast?
fast_u8 n = b;
return cf(f) | yf(f) | xf(f) | nf(f) |
sf(t) | zf1(t) | hf4(n) | pf1(t); }
sf(t) | zf1(t) | hf2(n, 1, 0) | pf1(t); }
case flag_set::f6: {
fast_u8 t = mask8(w); // TODO: Can be just a cast?
fast_u8 n = b;
return cf(f) | yf(f) | xf(f) | nf(f) |
sf(t) | zf1(t) | hf5(n) | pf1(t); }
sf(t) | zf1(t) | hf1(n, 1, 0) | pf1(t); }
case flag_set::f7: {
fast_u8 t = b;
fast_u8 flags = static_cast<fast_u8>(w);
Expand Down

0 comments on commit aa34da3

Please sign in to comment.