Skip to content

Commit

Permalink
Optimize the out (c),0 instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
agaxia committed Dec 6, 2022
1 parent f33e25c commit 8576bd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions API/Z80.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,17 +435,17 @@ typedef struct {
zuint8 halt_line;
} Z80;

/** @brief <tt>@ref Z80::options</tt> bitmask that enables emulation of the
* <tt>out (c),255</tt> instruction, specific to the Zilog Z80 CMOS. */

#define Z80_OPTION_OUT_VC_255 1

/** @brief <tt>@ref Z80::options</tt> bitmask that enables emulation of the bug
* affecting the Zilog Z80 NMOS, which causes the P/V flag to be reset when a
* maskable interrupt is accepted during the execution of the
* <tt>ld a,{i|r}</tt> instructions. */

#define Z80_OPTION_LD_A_IR_BUG 1

/** @brief <tt>@ref Z80::options</tt> bitmask that enables emulation of the
* <tt>out (c),255</tt> instruction, specific to the Zilog Z80 CMOS. */

#define Z80_OPTION_OUT_VC_255 2
#define Z80_OPTION_LD_A_IR_BUG 2

/** @brief <tt>@ref Z80::options</tt> bitmask that enables the XQ factor in the
* emulation of the @c ccf and @c scf instructions. */
Expand Down
2 changes: 1 addition & 1 deletion sources/Z80.c
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,7 @@ INSTRUCTION(out_vc_0)
Q_0
PC += 2;
MEMPTR = BC + 1;
OUT(BC, (OPTIONS & Z80_OPTION_OUT_VC_255) ? 255 : 0);
OUT(BC, (zuint8)0 - (OPTIONS & (zuint8)Z80_OPTION_OUT_VC_255));
return 12;
}

Expand Down

0 comments on commit 8576bd1

Please sign in to comment.