Illegal instructions handling; Doxygen comments; Documentation.

This commit is contained in:
redcode
2022-05-27 02:56:12 +02:00
parent d57635fd38
commit 3f7db2b756
6 changed files with 479 additions and 347 deletions

View File

@@ -2,53 +2,111 @@
API reference
=============
Macros
------
Library version macros
----------------------
.. doxygendefine:: Z80_LIBRARY_VERSION_MAJOR
.. doxygendefine:: Z80_LIBRARY_VERSION_MINOR
.. doxygendefine:: Z80_LIBRARY_VERSION_MICRO
.. doxygendefine:: Z80_LIBRARY_VERSION_STRING
.. doxygendefine:: Z80_CYCLE_LIMIT
.. doxygendefine:: Z80_HOOK
.. doxygendefine:: Z80_MODEL_ZILOG_NMOS
.. doxygendefine:: Z80_MODEL_ZILOG_CMOS
.. doxygendefine:: Z80_REQUEST_SPECIAL_RESET
.. doxygendefine:: Z80_REQUEST_RESET
.. doxygendefine:: Z80_REQUEST_NMI
.. doxygendefine:: Z80_REQUEST_INT
.. doxygendefine:: Z80_RESUME_HALT
.. doxygendefine:: Z80_RESUME_XY
.. doxygendefine:: Z80_RESUME_IM0_XY
Callback Types
Callback types
--------------
.. doxygentypedef:: Z80Read
.. doxygentypedef:: Z80Write
.. doxygentypedef:: Z80HALT
.. doxygentypedef:: Z80Notify
.. doxygentypedef:: Z80Illegal
.. doxygentypedef:: Z80Reset
Objects
-------
Emulator object
---------------
.. doxygenstruct:: Z80
:members:
:members:
Emulation options
-----------------
.. doxygendefine:: Z80_OPTION_HALT_SKIP
.. doxygendefine:: Z80_OPTION_LD_A_IR_BUG
.. doxygendefine:: Z80_OPTION_OUT_VC_255
.. doxygendefine:: Z80_OPTION_XQ
.. doxygendefine:: Z80_OPTION_YQ
.. doxygendefine:: Z80_MODEL_ZILOG_NMOS
.. doxygendefine:: Z80_MODEL_ZILOG_CMOS
.. doxygendefine:: Z80_MODEL_NEC_NMOS
.. doxygendefine:: Z80_MODEL_ST_CMOS
Register accessors
------------------
.. doxygendefine:: Z80_MEMPTR
.. doxygendefine:: Z80_PC
.. doxygendefine:: Z80_SP
.. doxygendefine:: Z80_XY
.. doxygendefine:: Z80_IX
.. doxygendefine:: Z80_IY
.. doxygendefine:: Z80_AF
.. doxygendefine:: Z80_BC
.. doxygendefine:: Z80_DE
.. doxygendefine:: Z80_HL
.. doxygendefine:: Z80_AF_
.. doxygendefine:: Z80_BC_
.. doxygendefine:: Z80_DE_
.. doxygendefine:: Z80_HL_
.. doxygendefine:: Z80_MEMPTRH
.. doxygendefine:: Z80_MEMPTRL
.. doxygendefine:: Z80_PCH
.. doxygendefine:: Z80_PCL
.. doxygendefine:: Z80_SPH
.. doxygendefine:: Z80_SPL
.. doxygendefine:: Z80_XYH
.. doxygendefine:: Z80_XYL
.. doxygendefine:: Z80_IXH
.. doxygendefine:: Z80_IXL
.. doxygendefine:: Z80_IYH
.. doxygendefine:: Z80_IYL
.. doxygendefine:: Z80_A
.. doxygendefine:: Z80_F
.. doxygendefine:: Z80_B
.. doxygendefine:: Z80_C
.. doxygendefine:: Z80_D
.. doxygendefine:: Z80_E
.. doxygendefine:: Z80_H
.. doxygendefine:: Z80_L
.. doxygendefine:: Z80_A_
.. doxygendefine:: Z80_F_
.. doxygendefine:: Z80_B_
.. doxygendefine:: Z80_C_
.. doxygendefine:: Z80_D_
.. doxygendefine:: Z80_E_
.. doxygendefine:: Z80_H_
.. doxygendefine:: Z80_L_
Limits
------
.. doxygendefine:: Z80_CYCLE_LIMIT
Hooking
-------
.. doxygendefine:: Z80_HOOK
Functions
---------
.. doxygenfunction:: z80_in_offset
.. doxygenfunction:: z80_in_cycle
.. doxygenfunction:: z80_instant_reset
.. doxygenfunction:: z80_out_offset
.. doxygenfunction:: z80_out_cycle
.. doxygenfunction:: z80_execute
.. doxygenfunction:: z80_int
.. doxygenfunction:: z80_nmi
.. doxygenfunction:: z80_normal_reset
.. doxygenfunction:: z80_power
.. doxygenfunction:: z80_refresh_address
.. doxygenfunction:: z80_reset
.. doxygenfunction:: z80_run
.. doxygenfunction:: z80_special_reset

View File

@@ -33,7 +33,7 @@ Changes:
22. Fixed the clock cycles of the ``dec XY`` and ``in (c)`` instructions.
23. Fixed the ``read_16`` function so that the order in which the compiler evaluates expressions does not affect the order of the memory read operations.
24. 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,WORD`` and ``rst N``.
25. Fixed the handling of illegal instructions to avoid stack overflows in long sequences of ``DDh`` / ``FDh`` prefixes.
25. Fixed the handling of illegal instructions to avoid stack overflows in long sequences of ``DDh/FDh`` prefixes.
26. Fixed several implicit conversions to avoid warnings about loss of sign and precision.
27. Fixed some bitwise operations to avoid undefined behavior and arithmetic right shifts on signed integers.
28. Fixed violations of the C standard in several identifiers.
@@ -43,27 +43,28 @@ Changes:
32. Replaced all ``ld {J,K|O,P}`` instructions that have the same destination and source register with NOPs.
33. Reimplemented the HALT state. The emulation should now be fully accurate. HALTskip is also supported.
34. Added optional emulation of the normal and special RESET signals, along with the new ``z80_reset`` and ``z80_special_reset`` functions to emit them. The old ``z80_reset`` function is now called ``z80_instant_reset``.
35. Added emulation of the NMI acknowledge M-cycle through the new ``Z80::nmia`` callback.
36. Added emulation of the INT acknowledge M-cycle through the new ``Z80::inta`` callback, which replaces ``Z80::int_data``.
37. Added optional full emulation of the interrupt mode 0, along with the new ``Z80::int_fetch`` callback to perform 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.
38. Added accurate flag behavior in the following instructions: ``ldir``, ``lddr``, ``cpir``, ``cpdr``, ``inir``, ``indr``, ``otir`` and ``otdr``.
39. Added emulation of the interrupt acceptance deferral that occurs during the ``reti`` and ``retn`` instructions.
40. Added MEMPTR emulation. The ``bit N,(hl)`` instruction now produces a correct value of F.
41. Added optional emulation of the Q "register". If enabled at compile-time, the ``ccf`` and ``scf`` instructions produce a correct value of F.
42. Added emulation options that can be configured at runtime.
43. Added emulation of the ``out (c),255`` instruction (Zilog Z80 CMOS).
44. Added optional emulation of the bug affecting the ``ld a,{i|r}`` instructions (Zilog Z80 NMOS). If enabled at compile-time, the P/V flag is reset when an INT is accepted during the execution of these instructions.
45. Added the ``Z80::fetch_opcode`` and ``Z80::fetch`` callbacks to perform opcode fetch operations and memory read operations on instruction data respectively.
46. Added hooking functionality through the ``ld h,h`` instruction and the new ``Z80::hook`` callback.
47. Added the ``Z80::nop`` callback to perform disregarded opcode fetch operations during internal NOP M-cycles.
48. Added four callbacks to notify the execution of important instructions: ``Z80::ld_i_a``, ``Z80::ld_r_a``, ``Z80::reti`` and ``Z80::retn``.
49. Removed ``Z80::state``. Replaced with individual members for the registers, the interrupt enable flip-flops and the interrupt mode.
50. Removed the superfluous EI flag. The previous opcode is checked instead, which is faster and makes the ``Z80`` object smaller.
51. Removed all module-related stuff.
52. Optimizations in flag computation and condition evaluation.
53. New source code comments and improvements to existing ones.
54. Improved code aesthetics.
55. Other improvements, optimizations and minor changes.
35. Added the ``Z80::fetch_opcode`` and ``Z80::fetch`` callbacks to perform opcode fetch operations and memory read operations on instruction data respectively.
36. Added the ``Z80::nop callback`` to perform disregarded opcode fetch operations during internal NOP M-cycles.
37. Added emulation of the NMI acknowledge M-cycle through the new ``Z80::nmia`` callback.
38. Added emulation of the INT acknowledge M-cycle through the new ``Z80::inta`` callback, which replaces ``Z80::int_data``.
39. Added optional full emulation of the interrupt mode 0, along with the new ``Z80::int_fetch`` callback to perform 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.
40. Added four callbacks to notify the execution of important instructions: ``Z80::ld_i_a``, ``Z80::ld_r_a``, ``Z80::reti`` and ``Z80::retn``.
41. Added hooking functionality through the ``ld h,h`` instruction and the new ``Z80::hook`` callback.
42. Added the ``Z80::illegal`` callback to delegate the emulation of illegal instructions.
43. Added accurate flag behavior in the following instructions: ``ldir``, ``lddr``, ``cpir``, ``cpdr``, ``inir``, ``indr``, ``otir`` and ``otdr``.
44. Added emulation of the interrupt acceptance deferral that occurs during the ``reti`` and ``retn`` instructions.
45. Added MEMPTR emulation. The ``bit N,(hl)`` instruction now produces a correct value of F.
46. Added optional emulation of the Q "register". If enabled at compile-time, the ``ccf`` and ``scf`` instructions produce a correct value of F.
47. Added emulation options that can be configured at runtime.
48. Added emulation of the ``out (c),255`` instruction (Zilog Z80 CMOS).
49. Added optional emulation of the bug affecting the ``ld a,{i|r}`` instructions (Zilog Z80 NMOS). If enabled at compile-time, the P/V flag is reset when an INT is accepted during the execution of these instructions.
50. Removed ``Z80::state``. Replaced with individual members for the registers, the interrupt enable flip-flops and the interrupt mode.
51. Removed the superfluous EI flag. The previous opcode is checked instead, which is faster and makes the ``Z80`` object smaller.
52. Removed all module-related stuff.
53. Optimizations in flag computation and condition evaluation.
54. New source code comments and improvements to existing ones.
55. Improved code aesthetics.
56. Other improvements, optimizations and minor changes.
v0.1 (2018-11-10)
=================