Skip to content

Commit d513632

Browse files
committed
[Z80A] Correct Tw cycles for IO
The Z80 should only be sampling the /WAIT pin during the 3rd cycle T of an IO REQ M Cycle. Instruction timing tests verified on CPCHawk using WinAPE plustest.dsk. Note: CPCHawk is the only core to currently use the Z80A /WAIT pin (FlagW), so other core exposure is 0.
1 parent 2193c0a commit d513632

3 files changed

Lines changed: 7 additions & 31 deletions

File tree

src/BizHawk.Emulation.Cores/CPUs/Z80A/Tables_Direct.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ private void OUT_()
515515
WAIT,
516516
RD_INC, Z, PCl, PCh,
517517
TR, ALU, A,
518-
WAIT,
518+
IDLE,
519519
WAIT,
520520
OUT_INC, Z, ALU, A);
521521

@@ -530,7 +530,7 @@ private void OUT_REG_(ushort dest, ushort src)
530530
(IDLE,
531531
TR16, Z, W, C, B,
532532
IDLE,
533-
IDLE,
533+
WAIT,
534534
OUT_INC, Z, W, src);
535535

536536
PopulateBUSRQ(0, BIO1, BIO2, BIO3, BIO4);
@@ -546,7 +546,7 @@ private void IN_()
546546
WAIT,
547547
RD_INC, Z, PCl, PCh,
548548
IDLE,
549-
WAIT,
549+
IDLE,
550550
WAIT,
551551
IN_A_N_INC, A, Z, W);
552552

@@ -560,7 +560,7 @@ private void IN_REG_(ushort dest, ushort src)
560560
PopulateCURINSTR
561561
(IDLE,
562562
TR16, Z, W, C, B,
563-
WAIT,
563+
IDLE,
564564
WAIT,
565565
IN_INC, dest, Z, W);
566566

src/BizHawk.Emulation.Cores/CPUs/Z80A/Tables_Indirect.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ private void IN_OP_R(ushort operation, ushort repeat_instr)
461461
(IDLE,
462462
IDLE,
463463
IDLE,
464-
WAIT,
464+
IDLE,
465465
WAIT,
466466
IN, ALU, C, B,
467467
IDLE,
@@ -482,7 +482,7 @@ private void OUT_OP_R(ushort operation, ushort repeat_instr)
482482
WAIT,
483483
RD, ALU, L, H,
484484
IDLE,
485-
WAIT,
485+
IDLE,
486486
WAIT,
487487
REP_OP_O, C, B, ALU, operation, 3, operation, repeat_instr);
488488

src/BizHawk.Emulation.Cores/Computers/AmstradCPC/readme.md

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,7 @@ Unknown
5252

5353
#### Test 5: Instruction timing test
5454

55-
| Prefix | OPC | Inst. | Comments |
56-
|:----:|:----:|:-----:|:------------:|
57-
|NONE| D3:4 | OUT A | |
58-
|NONE| DB:4 | IN A | |
59-
|NONE| D3:5 | OUT A | |
60-
|NONE| DB:5 | IN A | |
61-
|ED| 41:3 | OUT (C), B | |
62-
|ED| 49:3 | OUT (C), C | |
63-
|ED| 51:3 | OUT (C), D | |
64-
|ED| 59:3 | OUT (C), E | |
65-
|ED| 61:3 | OUT (C), H | |
66-
|ED| 69:3 | OUT (C), L | |
67-
|ED| 71:3 | OUT (C), 0 | |
68-
|ED| 79:3 | OUT (C), A | |
69-
|ED| A2:6 | INI | |
70-
|ED| A3:6 | OUTI | |
71-
|ED| AA:6 | IND | |
72-
|ED| B2:7/6| INIR | |
73-
|ED| B3:7/6| OTIR | |
74-
|ED| BA:7/6| INDR | |
75-
|ED| BB:7/6| OTDR | |
76-
|DD CB| D3:5| SET 2, (ix+d), e | |
77-
|DD CB| DB:5| SET 3, (ix+d), e | |
78-
79-
Everything else passes. Almost certainly the problems observed relate to IO timing.
55+
All tests passing
8056

8157
#### Test 6: Register 0 test
8258
Unknown

0 commit comments

Comments
 (0)