Version history¶
Z80 v0.2-pre¶
Released on 2025-05-02
This is an important update that addresses a number of issues and also includes new features. Please note that the changes introduced in this release break the binary compatibility with the previous version.
Changes:
Changed the license from GPL to LGPL (by popular request).
Moved the public header from
<emulation/CPU/Z80.h>to<Z80.h>.Removed the Xcode project.
Switched the build system from Premake to CMake.
Switched to Zeta v0.1.
Added pkg-config support.
Added the following files to the project:
.vimrc,CITATION.cffandTHANKS.Added detailed documentation.
Added Pascal binding, courtesy of Zoran Vučenović.
Added
test-Z80, a tool that runs various Z80-specific tests for CP/M and ZX Spectrum.Added
step-test-Z80, a tool for unit tests in JSON format.Renamed the macros
CPU_Z80_DEPENDENCIES_HandCPU_Z80_STATICtoZ80_EXTERNAL_HEADERandZ80_STATIC, respectively.Added public macros for checking the library version, working with flags, accessing the 16-bit registers and other purposes.
Added the ability to end the emulation loop immediately, and the
z80_break()function.Added the
z80_execute()function for running a simplified emulation without RESET and interrupts.Added the
z80_in_cycle()andz80_out_cycle()functions for obtaining the clock cycle at which the I/O M-cycle begins, relative to the start of the instruction.Added the
z80_refresh_address()function for getting the refresh address of the current M1 cycle.Renamed the
z80_resetfunction toz80_instant_reset().Added optional emulation of the special RESET, and the
z80_special_reset()function.Added the
Z80::fetch_opcodeandZ80::fetchcallbacks for performing, respectively, opcode fetch operations and memory read operations on instruction data.Added the
Z80::nopcallback for performing disregarded opcode fetch operations during internal NOP M-cycles.Added emulation of the NMI acknowledge M-cycle through the new
Z80::nmiacallback.Added emulation of the INT acknowledge M-cycle through the new
Z80::intacallback, which replacesZ80::int_data.Added optional full emulation of the interrupt mode 0, along with the new
Z80::int_fetchcallback for performing bus read operations on instruction data. If not enabled at compile-time, the old simplified emulation is built, which supports only the most typical instructions.Added four callbacks for notifying the execution of important instructions:
Z80::ld_i_a,Z80::ld_r_a,Z80::retiandZ80::retn.Added hooking functionality through the
ld h,hinstruction and the newZ80::hookcallback.Added the
Z80::illegalcallback for delegating the emulation of illegal instructions.Added emulation options that can be configured at runtime.
Removed
Z80::state. Replaced with individual members for the registers, the interrupt enable flip-flops and the interrupt mode.Removed the superfluous EI flag. The previous opcode is checked instead, which is faster and makes the
Z80object smaller.Removed all module-related stuff.
Added emulation of the additional flag changes performed during the extra 5 clock cycles of the following instructions:
ldir,lddr,cpir,cpdr,inir,indr,otirandotdr.Added emulation of the interrupt acceptance deferral that occurs during the
retiandretninstructions.Added MEMPTR emulation. The
bit N,(hl)instruction now produces a correct value of F.Added optional emulation of Q. If enabled at compile-time, the
ccfandscfinstructions will produce a correct value of F.Added emulation of the
out (c),255instruction (Zilog Z80 CMOS).Added optional emulation of the bug affecting the
ld a,{i|r}instructions (Zilog Z80 NMOS). If enabled at compile-time and configured at runtime, the P/V flag will be reset if an INT is accepted during the execution of these instructions.Added an optional implementation of the parity calculation for the P/V flag that performs the actual computation instead of using a table of precomputed values.
Added an optional implementation of the
daainstruction that uses a table of precomputed values.Increased granularity. The emulator can now stop directly after fetching a prefix
DDhorFDhif it runs out of clock cycles. This also works during the INT response in mode 0.Reimplemented the HALT state. The emulation should now be fully accurate. HALTskip optimization is also supported.
Fixed a bug in the
sllinstruction.Fixed a bug in the
INXandOUTXmacros affecting the S and N flags.Fixed a bug in the
OUTXmacro affecting the MSByte of the port number.Fixed the clock cycles of the
dec XYandin (c)instructions.Fixed the
read_16function so that the order of the memory read operations is not determined by the order in which the compiler evaluates expressions.Fixed the order in which the memory write operations are performed when the SP register is involved. This affects the NMI response, the INT response in modes 1 and 2, and the following instructions:
ex (sp),{hl|XY},push TT,push XY,call WORD,call Z,WORDandrst N.Fixed the handling of illegal instructions to avoid stack overflows in long sequences of
DDh/FDhprefixes.Fixed several implicit conversions to avoid warnings about loss of sign and precision.
Fixed some bitwise operations to avoid undefined behavior and arithmetic right shifts on signed integers.
Fixed violations of the C standard in several identifiers.
Renamed the 8-bit register lists:
X/YtoJ/K;J/KandP/QtoO/P.Replaced all P/V overflow computation functions with a single, faster macro.
Replaced all register resolution functions with macros.
Replaced all
ld {J,K|O,P}instructions that have the same destination and source register with NOPs. In addition, the “illegal” forms of the following instructions are now executed without using the illegal instruction handler:ld O,P,ld O,BYTE,U [a,]PandV O.Optimizations in flag computation and condition evaluation.
New source code comments and improvements to existing ones.
Improved code aesthetics.
Other improvements, optimizations and minor changes.
Z80 v0.1¶
Released on 2018-11-10
Initial public release.