From d7a9a968409d146435b393499956c4c46c46f7ee Mon Sep 17 00:00:00 2001 From: "fabio.olimpieri" Date: Sat, 9 Jun 2012 06:37:22 +0000 Subject: [PATCH] Fixed Flag emulation for some opcodes: RRD, RLD, DAA, CCF (bit 3,5) BIT n, (IX/IY + d) (bit 3,5) IN BC, r (bit 3,5) INI, OUTI, IND, OUTD (all flag bits) CPIR, CPDR (bit 3,5) INIR, OTIR, INDR, OTDR (all flag bits) --- src/z80free/Z80free.c | 5 +- src/z80free/Z80free_codes.c | 1 + src/z80free/Z80free_codesDDCB.c | 257 ++++++++++++++++++++++++-------- src/z80free/Z80free_codesED.c | 94 ++++++++++-- src/z80free/Z80free_codesFDCB.c | 257 ++++++++++++++++++++++++-------- src/z80free/z80free_tester.c | 2 +- 6 files changed, 473 insertions(+), 143 deletions(-) diff --git a/src/z80free/Z80free.c b/src/z80free/Z80free.c index 99b9ae0..6ae5a0d 100644 --- a/src/z80free/Z80free.c +++ b/src/z80free/Z80free.c @@ -214,7 +214,7 @@ inline int Z80free_getFlag(Z80FREE *processor, byte flag) { * --------------------------------------------------------- */ -static int Z80free_parityBit[256] = { +int Z80free_parityBit[256] = { 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, @@ -560,6 +560,7 @@ void Z80free_doRLD(Z80FREE *processor) { Z80free_resFlag(processor,F_H | F_N); Z80free_adjustFlagSZP(processor, processor->Rm.br.A); + Z80free_adjustFlags(processor, processor->Rm.br.A); } @@ -575,6 +576,7 @@ void Z80free_doRRD(Z80FREE *processor) { Z80free_resFlag(processor,F_H | F_N); Z80free_adjustFlagSZP(processor, processor->Rm.br.A); + Z80free_adjustFlags(processor, processor->Rm.br.A); } @@ -708,6 +710,7 @@ void Z80free_doDAA (Z80FREE *processor) { Z80free_setFlag(processor,F_Z); } Z80free_valFlag(processor,F_PV, Z80free_parityBit[processor->Rm.br.A]); + Z80free_adjustFlags(processor, processor->Rm.br.A); } diff --git a/src/z80free/Z80free_codes.c b/src/z80free/Z80free_codes.c index 0e2cd82..1bfe54d 100644 --- a/src/z80free/Z80free_codes.c +++ b/src/z80free/Z80free_codes.c @@ -311,6 +311,7 @@ int Z80free_codes (Z80FREE *processor,byte opcode) { return (7); break; case 63: // CCF + Z80free_valFlag(processor,F_H,(processor->Rm.br.F)&F_C); Z80free_valFlag(processor,F_C,(~processor->Rm.br.F)&F_C); Z80free_resFlag(processor,F_N); Z80free_adjustFlags(processor,processor->Rm.br.A); diff --git a/src/z80free/Z80free_codesDDCB.c b/src/z80free/Z80free_codesDDCB.c index 564699c..8baecb3 100644 --- a/src/z80free/Z80free_codesDDCB.c +++ b/src/z80free/Z80free_codesDDCB.c @@ -21,6 +21,7 @@ int Z80free_codesDDCB (Z80FREE *processor,byte d1) { static byte tmp1; + static word tmp2; static byte opcode; opcode=Z80free_Rd(processor->PC++); @@ -394,259 +395,387 @@ int Z80free_codesDDCB (Z80FREE *processor,byte d1) { return (19); break; case 64: // BIT 0,(IX+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 65: // BIT 0,(IX+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 66: // BIT 0,(IX+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 67: // BIT 0,(IX+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 68: // BIT 0,(IX+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 69: // BIT 0,(IX+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 70: // BIT 0,(IX+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 71: // BIT 0,(IX+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 72: // BIT 1,(IX+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 73: // BIT 1,(IX+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 74: // BIT 1,(IX+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 75: // BIT 1,(IX+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 76: // BIT 1,(IX+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 77: // BIT 1,(IX+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 78: // BIT 1,(IX+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 79: // BIT 1,(IX+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 80: // BIT 2,(IX+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 81: // BIT 2,(IX+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 82: // BIT 2,(IX+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 83: // BIT 2,(IX+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 84: // BIT 2,(IX+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 85: // BIT 2,(IX+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 86: // BIT 2,(IX+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 87: // BIT 2,(IX+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 88: // BIT 3,(IX+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 89: // BIT 3,(IX+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 90: // BIT 3,(IX+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 91: // BIT 3,(IX+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 92: // BIT 3,(IX+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 93: // BIT 3,(IX+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 94: // BIT 3,(IX+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 95: // BIT 3,(IX+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 96: // BIT 4,(IX+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 97: // BIT 4,(IX+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 98: // BIT 4,(IX+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 99: // BIT 4,(IX+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 100: // BIT 4,(IX+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 101: // BIT 4,(IX+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 102: // BIT 4,(IX+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 103: // BIT 4,(IX+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 104: // BIT 5,(IX+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 105: // BIT 5,(IX+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 106: // BIT 5,(IX+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 107: // BIT 5,(IX+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 108: // BIT 5,(IX+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 109: // BIT 5,(IX+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 110: // BIT 5,(IX+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 111: // BIT 5,(IX+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 112: // BIT 6,(IX+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 113: // BIT 6,(IX+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 114: // BIT 6,(IX+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 115: // BIT 6,(IX+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 116: // BIT 6,(IX+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 117: // BIT 6,(IX+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 118: // BIT 6,(IX+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 119: // BIT 6,(IX+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 120: // BIT 7,(IX+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 121: // BIT 7,(IX+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 122: // BIT 7,(IX+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 123: // BIT 7,(IX+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 124: // BIT 7,(IX+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 125: // BIT 7,(IX+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 126: // BIT 7,(IX+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 127: // BIT 7,(IX+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IX,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 128: // LD_RES B,0,(IX+d) diff --git a/src/z80free/Z80free_codesED.c b/src/z80free/Z80free_codesED.c index aeec1ce..4b60564 100644 --- a/src/z80free/Z80free_codesED.c +++ b/src/z80free/Z80free_codesED.c @@ -19,9 +19,12 @@ #include "Z80free.h" +extern int Z80free_parityBit[256]; + int Z80free_codesED (Z80FREE *processor,byte opcode) { static byte tmp1; static byte tmp2; + static word tmp3; switch(opcode) { case 0: // NOP @@ -220,6 +223,7 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { processor->Rm.br.B=Z80free_In(processor->Rm.wr.BC); Z80free_adjustFlagSZP (processor,processor->Rm.br.B); Z80free_resFlag(processor,F_H|F_N); + Z80free_adjustFlags (processor, processor->Rm.br.B); return (8); break; case 65: // OUT_BC B @@ -255,6 +259,7 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { processor->Rm.br.C=Z80free_In(processor->Rm.wr.BC); Z80free_adjustFlagSZP (processor,processor->Rm.br.C); Z80free_resFlag(processor,F_H|F_N); + Z80free_adjustFlags (processor, processor->Rm.br.C); return (8); break; case 73: // OUT_BC C @@ -291,6 +296,7 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { processor->Rm.br.D=Z80free_In(processor->Rm.wr.BC); Z80free_adjustFlagSZP (processor,processor->Rm.br.D); Z80free_resFlag(processor,F_H|F_N); + Z80free_adjustFlags (processor, processor->Rm.br.D); return (8); break; case 81: // OUT_BC D @@ -326,6 +332,7 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { processor->Rm.br.E=Z80free_In(processor->Rm.wr.BC); Z80free_adjustFlagSZP (processor,processor->Rm.br.E); Z80free_resFlag(processor,F_H|F_N); + Z80free_adjustFlags (processor, processor->Rm.br.E); return (8); break; case 89: // OUT_BC E @@ -361,6 +368,7 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { processor->Rm.br.H=Z80free_In(processor->Rm.wr.BC); Z80free_adjustFlagSZP (processor,processor->Rm.br.H); Z80free_resFlag(processor,F_H|F_N); + Z80free_adjustFlags (processor, processor->Rm.br.H); return (8); break; case 97: // OUT_BC H @@ -396,6 +404,7 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { processor->Rm.br.L=Z80free_In(processor->Rm.wr.BC); Z80free_adjustFlagSZP (processor,processor->Rm.br.L); Z80free_resFlag(processor,F_H|F_N); + Z80free_adjustFlags (processor, processor->Rm.br.L); return (8); break; case 105: // OUT_BC L @@ -431,6 +440,7 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { tmp1=Z80free_In(processor->Rm.wr.BC); Z80free_adjustFlagSZP (processor,tmp1); Z80free_resFlag(processor,F_H|F_N); + Z80free_adjustFlags (processor, tmp1); return (8); break; case 113: // OUT_BC 0 @@ -465,6 +475,7 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { processor->Rm.br.A=Z80free_In(processor->Rm.wr.BC); Z80free_adjustFlagSZP (processor,processor->Rm.br.A); Z80free_resFlag(processor,F_H|F_N); + Z80free_adjustFlags (processor, processor->Rm.br.A); return (8); break; case 121: // OUT_BC A @@ -623,18 +634,29 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { break; case 162: // INI /*INI, IND, INIR and INDR first decrement B and then uses it*/ - Z80free_Wr(processor->Rm.wr.HL,Z80free_In(processor->Rm.wr.BC)); + tmp1=Z80free_In(processor->Rm.wr.BC); + Z80free_Wr(processor->Rm.wr.HL,tmp1); processor->Rm.wr.HL++; processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1); - Z80free_valFlag(processor,F_N, 1); + Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0)); + tmp3=((((word) processor->Rm.br.C)+1)&0xFF)+(word) tmp1; + Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B])); Z80free_valFlag(processor,F_Z, (processor->Rm.br.B == 0)); return (12); break; case 163: // OUTI /*OUTI, OUTD, OTIR and OTDR first decrements B and then uses it*/ processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1); - Z80free_Out(processor->Rm.wr.BC,Z80free_Rd(processor->Rm.wr.HL)); + tmp1=Z80free_Rd(processor->Rm.wr.HL); + Z80free_Out(processor->Rm.wr.BC,tmp1); processor->Rm.wr.HL++; + Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0)); + tmp3=(word) processor->Rm.br.L+(word)tmp1; + Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B])); return (12); break; case 164: // NOP @@ -680,15 +702,27 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { return (12); break; case 170: // IND - Z80free_Wr(processor->Rm.wr.HL,Z80free_In(processor->Rm.wr.BC)); + tmp1=Z80free_In(processor->Rm.wr.BC); + Z80free_Wr(processor->Rm.wr.HL,tmp1); processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1); processor->Rm.wr.HL--; + Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0)); + tmp3=((((word) processor->Rm.br.C)-1)&0xFF)+(word) tmp1; + Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B])); return (12); break; case 171: // OUTD processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1); - Z80free_Out(processor->Rm.wr.BC,Z80free_Rd(processor->Rm.wr.HL)); + tmp1=Z80free_Rd(processor->Rm.wr.HL); + Z80free_Out(processor->Rm.wr.BC,tmp1); processor->Rm.wr.HL--; + Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0)); + tmp3=(word) processor->Rm.br.L+(word)tmp1; + Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B])); return (12); break; case 172: // NOP @@ -720,14 +754,19 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { break; case 177: // CPIR tmp2=F_C&processor->Rm.br.F; - Z80free_doArithmetic(processor,processor->Rm.br.A,Z80free_Rd(processor->Rm.wr.HL++),0,1); + tmp1=Z80free_doArithmetic(processor,processor->Rm.br.A,Z80free_Rd(processor->Rm.wr.HL++),0,1); processor->Rm.wr.BC--; if ((processor->Rm.wr.BC)&&(!(processor->Rm.br.F&F_Z))) { processor->PC-=2; Z80free_valFlag(processor,F_C,tmp2); return (17); } else { - Z80free_resFlag(processor,F_H|F_PV|F_3|F_5); + //Bit3 and bit 5 are set only at the end of the loop to save cpu time + if (processor->Rm.br.F&F_H) + tmp1--; + Z80free_valFlag(processor,F_3,tmp1&0x08); + Z80free_valFlag(processor,F_5,tmp1&0x02); + Z80free_resFlag(processor,F_PV); Z80free_setFlag(processor,F_N); Z80free_valFlag(processor,F_C,tmp2); if (processor->Rm.wr.BC) @@ -735,24 +774,36 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { } break; case 178: // INIR - Z80free_Wr(processor->Rm.wr.HL,Z80free_In(processor->Rm.wr.BC)); + tmp1=Z80free_In(processor->Rm.wr.BC); + Z80free_Wr(processor->Rm.wr.HL,tmp1); processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1); processor->Rm.wr.HL++; if (processor->Rm.br.B) { processor->PC-=2; return (17); } else { + Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0)); + tmp3=((((word) processor->Rm.br.C)+1)&0xFF)+(word) tmp1; + Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B])); return (12); } break; case 179: // OTIR processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1); - Z80free_Out(processor->Rm.wr.BC,Z80free_Rd(processor->Rm.wr.HL)); + tmp1=Z80free_Rd(processor->Rm.wr.HL); + Z80free_Out(processor->Rm.wr.BC,tmp1); processor->Rm.wr.HL++; if (processor->Rm.br.B) { processor->PC-=2; return (17); } else { + Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0)); + tmp3=(word) processor->Rm.br.L+(word)tmp1; + Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B])); return (12); } break; @@ -785,14 +836,19 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { break; case 185: // CPDR tmp2=F_C&processor->Rm.br.F; - Z80free_doArithmetic(processor,processor->Rm.br.A,Z80free_Rd(processor->Rm.wr.HL--),0,1); + tmp1=Z80free_doArithmetic(processor,processor->Rm.br.A,Z80free_Rd(processor->Rm.wr.HL--),0,1); processor->Rm.wr.BC--; if ((processor->Rm.wr.BC)&&(!(processor->Rm.br.F&F_Z))) { processor->PC-=2; Z80free_valFlag(processor,F_C,tmp2); return (17); } else { - Z80free_resFlag(processor,F_H|F_PV|F_3|F_5); + //Bit3 and bit 5 are set only at the end of the loop to save cpu time + if (processor->Rm.br.F&F_H) + tmp1--; + Z80free_valFlag(processor,F_3,tmp1&0x08); + Z80free_valFlag(processor,F_5,tmp1&0x02); + Z80free_resFlag(processor,F_PV); Z80free_setFlag(processor,F_N); Z80free_valFlag(processor,F_C,tmp2); if (processor->Rm.wr.BC) @@ -800,24 +856,36 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) { } break; case 186: // INDR - Z80free_Wr(processor->Rm.wr.HL,Z80free_In(processor->Rm.wr.BC)); + tmp1=Z80free_In(processor->Rm.wr.BC); + Z80free_Wr(processor->Rm.wr.HL,tmp1); processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1); processor->Rm.wr.HL--; if (processor->Rm.br.B) { processor->PC-=2; return (17); } else { + Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0)); + tmp3=((((word) processor->Rm.br.C)-1)&0xFF)+(word) tmp1; + Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B])); return (12); } break; case 187: // OTDR processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1); - Z80free_Out(processor->Rm.wr.BC,Z80free_Rd(processor->Rm.wr.HL)); + tmp1=Z80free_Rd(processor->Rm.wr.HL); + Z80free_Out(processor->Rm.wr.BC,tmp1); processor->Rm.wr.HL--; if (processor->Rm.br.B) { processor->PC-=2; return (17); } else { + Z80free_valFlag(processor,F_N,((tmp1&0x80)!=0)); + tmp3=(word) processor->Rm.br.L+(word)tmp1; + Z80free_valFlag(processor,F_C,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_H,((tmp3&0x100)!=0)); + Z80free_valFlag(processor,F_PV,(Z80free_parityBit[(((byte)tmp3)&0x07)^processor->Rm.br.B])); return (12); } break; diff --git a/src/z80free/Z80free_codesFDCB.c b/src/z80free/Z80free_codesFDCB.c index 0891a84..cd07d8f 100644 --- a/src/z80free/Z80free_codesFDCB.c +++ b/src/z80free/Z80free_codesFDCB.c @@ -21,6 +21,7 @@ int Z80free_codesFDCB (Z80FREE *processor,byte d1) { static byte tmp1; + static word tmp2; static byte opcode; opcode=Z80free_Rd(processor->PC++); @@ -394,259 +395,387 @@ int Z80free_codesFDCB (Z80FREE *processor,byte d1) { return (19); break; case 64: // BIT 0,(IY+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 65: // BIT 0,(IY+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 66: // BIT 0,(IY+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 67: // BIT 0,(IY+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 68: // BIT 0,(IY+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 69: // BIT 0,(IY+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 70: // BIT 0,(IY+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 71: // BIT 0,(IY+d) - Z80free_doBIT(processor,0,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,0,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 72: // BIT 1,(IY+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 73: // BIT 1,(IY+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 74: // BIT 1,(IY+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 75: // BIT 1,(IY+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 76: // BIT 1,(IY+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 77: // BIT 1,(IY+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 78: // BIT 1,(IY+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 79: // BIT 1,(IY+d) - Z80free_doBIT(processor,1,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,1,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 80: // BIT 2,(IY+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 81: // BIT 2,(IY+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 82: // BIT 2,(IY+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 83: // BIT 2,(IY+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 84: // BIT 2,(IY+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 85: // BIT 2,(IY+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 86: // BIT 2,(IY+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 87: // BIT 2,(IY+d) - Z80free_doBIT(processor,2,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,2,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 88: // BIT 3,(IY+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 89: // BIT 3,(IY+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 90: // BIT 3,(IY+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 91: // BIT 3,(IY+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 92: // BIT 3,(IY+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 93: // BIT 3,(IY+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 94: // BIT 3,(IY+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 95: // BIT 3,(IY+d) - Z80free_doBIT(processor,3,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,3,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 96: // BIT 4,(IY+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 97: // BIT 4,(IY+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 98: // BIT 4,(IY+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 99: // BIT 4,(IY+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 100: // BIT 4,(IY+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 101: // BIT 4,(IY+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 102: // BIT 4,(IY+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 103: // BIT 4,(IY+d) - Z80free_doBIT(processor,4,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,4,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 104: // BIT 5,(IY+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 105: // BIT 5,(IY+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 106: // BIT 5,(IY+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 107: // BIT 5,(IY+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 108: // BIT 5,(IY+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 109: // BIT 5,(IY+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 110: // BIT 5,(IY+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 111: // BIT 5,(IY+d) - Z80free_doBIT(processor,5,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,5,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 112: // BIT 6,(IY+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 113: // BIT 6,(IY+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 114: // BIT 6,(IY+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 115: // BIT 6,(IY+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 116: // BIT 6,(IY+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 117: // BIT 6,(IY+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 118: // BIT 6,(IY+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 119: // BIT 6,(IY+d) - Z80free_doBIT(processor,6,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,6,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 120: // BIT 7,(IY+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 121: // BIT 7,(IY+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 122: // BIT 7,(IY+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 123: // BIT 7,(IY+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 124: // BIT 7,(IY+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 125: // BIT 7,(IY+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 126: // BIT 7,(IY+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 127: // BIT 7,(IY+d) - Z80free_doBIT(processor,7,Z80free_Rd(Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1))); + tmp2=Z80free_addr_relativeXDCB(processor,processor->Rm.wr.IY,d1); + Z80free_doBIT(processor,7,Z80free_Rd(tmp2)); + Z80free_adjustFlags (processor, ((byte) (tmp2>>8))); return (16); break; case 128: // LD_RES B,0,(IY+d) diff --git a/src/z80free/z80free_tester.c b/src/z80free/z80free_tester.c index 43f4608..318e680 100644 --- a/src/z80free/z80free_tester.c +++ b/src/z80free/z80free_tester.c @@ -38,7 +38,7 @@ byte ports[256]; word portdirs[256]; int portpos=0,elements=0; -#define NO35 +//#define NO35 int compare_processors() {