@@ -1525,7 +1525,7 @@ INSN(neg)
15251525| `ccf` and `scf` are the only instructions in which Q affects the flags. |
15261526| Patrik Rak cracked the behavior of YF and XF in 2012, confirming that they |
15271527| are taken, respectively, from bits 5 and 3 of the result of `(Q ^ F) | A` |
1528- | [1,2]. This applies to all Zilog Z80 models, both NMOS and CMOS. In 2018, |
1528+ | [1, 2]. This applies to all Zilog Z80 models, both NMOS and CMOS. In 2018, |
15291529| David Banks (AKA hoglet) discovered that at least some ST CMOS models do |
15301530| not set XF according to this formula and instead take this flag from bit 3 |
15311531| of A, whereas NEC NMOS models take both flags from A [3]. |
@@ -1994,19 +1994,19 @@ INSN(out_vBYTE_a)
19941994 }
19951995
19961996
1997- /*----------------------------------------------------------------------------.
1998- | The `out (c),0` instruction behaves as `out (c),255` on the Zilog Z80 CMOS. |
1999- | This was first discovered by Simon Cooke, who reported it on Usenet in 1996 |
2000- | [1,2]. Later, in 2004, Colin Piggot rediscovered it with his SAM Coupé when |
2001- | running a demo for SCPDU 6, coincidentally written by Simon Cooke [1]. In |
2002- | 2008, this was once again rediscovered by the MSX community [1,3]. |
2003- | |
2004- | References: |
2005- | 1. https://sinclair.wiki.zxnet.co.uk/wiki/Z80 |
2006- | 2. https://groups.google.com/g/comp.os.cpm/c/HfSTFpaIkuU/m/KotvMWu3bZoJ |
2007- | 3. https://msx.org/forum/development/msx-development/bug-z80-emulation-or- |
2008- | tr -hw |
2009- '============================================================================*/
1997+ /*----------------------------------------------------------------------------- .
1998+ | The `out (c),0` instruction behaves as `out (c),255` on the Zilog Z80 CMOS. |
1999+ | This was first discovered by Simon Cooke, who reported it on Usenet in 1996 |
2000+ | [1, 2]. Later, in 2004, Colin Piggot rediscovered it with his SAM Coupé when |
2001+ | running a demo for SCPDU 6, coincidentally written by Simon Cooke [1]. In |
2002+ | 2008, this was once again rediscovered by the MSX community [1, 3]. |
2003+ | |
2004+ | References: |
2005+ | 1. https://sinclair.wiki.zxnet.co.uk/wiki/Z80 |
2006+ | 2. https://groups.google.com/g/comp.os.cpm/c/HfSTFpaIkuU/m/KotvMWu3bZoJ |
2007+ | 3. https://msx.org/forum/development/msx-development/bug-z80-emulation-or-tr |
2008+ | -hw |
2009+ '============================================================================= */
20102010
20112011INSN (out_vc_0 )
20122012 {
@@ -2286,21 +2286,21 @@ INSN(hook)
22862286
22872287/* MARK: - Public Functions */
22882288
2289- /*----------------------------------------------------------------------.
2290- | On POWER-ON, the CPU zeroes PC, I and R, sets SP, IX, IY, AF, BC, DE, |
2291- | HL, AF', BC', DE' and HL' to FFFFh [1,2], resets the interrupt enable |
2292- | flip-flops (IFF1 and IFF2) and selects interrupt mode 0 [3]. On Zilog |
2293- | NMOS models, F is sometimes set to FDh (NF reset) [1]. |
2294- | |
2295- | There is no information about the initial state of MEMPTR and Q, so |
2296- | they are assumed to be 0. |
2297- | |
2298- | References: |
2299- | 1. https://baltazarstudios.com/webshare/Z80-undocumented-behavior.htm |
2300- | 2. https://worldofspectrum.org/forums/discussion/34574 |
2301- | 3. Young, Sean (2005-09-18). "Undocumented Z80 Documented, The" |
2302- | v0.91, p. 20. |
2303- '======================================================================*/
2289+ /*----------------------------------------------------------------------- .
2290+ | On POWER-ON, the CPU zeroes PC, I and R, sets SP, IX, IY, AF, BC, DE, |
2291+ | HL, AF', BC', DE' and HL' to FFFFh [1, 2], resets the interrupt enable |
2292+ | flip-flops (IFF1 and IFF2) and selects interrupt mode 0 [3]. On Zilog |
2293+ | NMOS models, F is sometimes set to FDh (NF reset) [1]. |
2294+ | |
2295+ | There is no information about the initial state of MEMPTR and Q, so |
2296+ | they are assumed to be 0. |
2297+ | |
2298+ | References: |
2299+ | 1. https://baltazarstudios.com/webshare/Z80-undocumented-behavior.htm |
2300+ | 2. https://worldofspectrum.org/forums/discussion/34574 |
2301+ | 3. Young, Sean (2005-09-18). "Undocumented Z80 Documented, The" v0.91, |
2302+ | p. 20. |
2303+ '======================================================================= */
23042304
23052305Z80_API void z80_power (Z80 * self , zboolean state )
23062306 {
@@ -2313,9 +2313,9 @@ Z80_API void z80_power(Z80 *self, zboolean state)
23132313
23142314
23152315/*-------------------------------------------------------------------------.
2316- | The normal RESET zeroes PC, I, and R [1,2,3,4,5, 6], resets the interrupt |
2317- | enable flip-flops (IFF1 and IFF2) [1,2,3,4, 5] and selects interrupt mode |
2318- | 0 [1,2,3,4, 7]. |
2316+ | The normal RESET zeroes PC, I, and R [1, 2, 3, 4, 5, 6], resets the |
2317+ | interrupt enable flip-flops (IFF1 and IFF2) [1, 2, 3, 4, 5] and selects |
2318+ | interrupt mode 0 [1, 2, 3, 4, 7]. |
23192319| |
23202320| References: |
23212321| 1. Zilog (2016-09). "Z80 CPU User Manual" rev. 11, p. 6. |
@@ -2512,7 +2512,7 @@ Z80_API zusize z80_run(Z80 *self, zusize cycles)
25122512 | simulations [3]. |
25132513 | |
25142514 | In 2022, Manuel Sainz de Baranda y Goñi discovered that the CPU does not |
2515- | accept a second NMI during the NMI response [4,5]. Therefore, it is not |
2515+ | accept a second NMI during the NMI response [4, 5]. Therefore, it is not |
25162516 | possible to chain two NMI responses in a row without executing at least |
25172517 | one instruction between them [3]. |
25182518 | |
@@ -2562,7 +2562,7 @@ Z80_API zusize z80_run(Z80 *self, zusize cycles)
25622562 | not accept the maskable interrupt if IFF1 and IFF2 do not have the same |
25632563 | state prior to the execution of the instruction, which can only be |
25642564 | caused by an earlier NMI response [1]. This behavior was rediscovered in |
2565- | 2022 by Manuel Sainz de Baranda y Goñi [2,3]. |
2565+ | 2022 by Manuel Sainz de Baranda y Goñi [2, 3]. |
25662566 | |
25672567 | References: |
25682568 | 1. Weissflog, Andre (2021-12-17). "New Cycle-Stepped Z80 Emulator, A". |
@@ -2637,10 +2637,10 @@ Z80_API zusize z80_run(Z80 *self, zusize cycles)
26372637 | the instruction is fetched [1]. Each INTA M-cycle takes as many T-states |
26382638 | as its normal M1 counterpart (the opcode fetch M-cycle) plus the 2 wait |
26392639 | T-states mentioned above [1]. Subsequent bytes of the instruction are |
2640- | fetched by using normal memory read M-cycles [1,2], during which the |
2640+ | fetched by using normal memory read M-cycles [1, 2], during which the |
26412641 | interrupting I/O device must still supply the data [2]. The PC register, |
26422642 | however, remains at its pre-interrupt state, not being incremented as a |
2643- | result of the instruction fetch [1,2]. |
2643+ | result of the instruction fetch [1, 2]. |
26442644 | |
26452645 | References: |
26462646 | 1. Checked with "Visual Z80 Remix". |
0 commit comments