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)
This commit is contained in:
fabio.olimpieri 2012-06-09 06:37:22 +00:00
parent 7114b4e8e1
commit d7a9a96840
6 changed files with 473 additions and 143 deletions

View File

@ -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, 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, 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_resFlag(processor,F_H | F_N);
Z80free_adjustFlagSZP(processor, processor->Rm.br.A); 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_resFlag(processor,F_H | F_N);
Z80free_adjustFlagSZP(processor, processor->Rm.br.A); 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_setFlag(processor,F_Z);
} }
Z80free_valFlag(processor,F_PV, Z80free_parityBit[processor->Rm.br.A]); Z80free_valFlag(processor,F_PV, Z80free_parityBit[processor->Rm.br.A]);
Z80free_adjustFlags(processor, processor->Rm.br.A);
} }

View File

@ -311,6 +311,7 @@ int Z80free_codes (Z80FREE *processor,byte opcode) {
return (7); return (7);
break; break;
case 63: // CCF 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_valFlag(processor,F_C,(~processor->Rm.br.F)&F_C);
Z80free_resFlag(processor,F_N); Z80free_resFlag(processor,F_N);
Z80free_adjustFlags(processor,processor->Rm.br.A); Z80free_adjustFlags(processor,processor->Rm.br.A);

View File

@ -21,6 +21,7 @@
int Z80free_codesDDCB (Z80FREE *processor,byte d1) { int Z80free_codesDDCB (Z80FREE *processor,byte d1) {
static byte tmp1; static byte tmp1;
static word tmp2;
static byte opcode; static byte opcode;
opcode=Z80free_Rd(processor->PC++); opcode=Z80free_Rd(processor->PC++);
@ -394,259 +395,387 @@ int Z80free_codesDDCB (Z80FREE *processor,byte d1) {
return (19); return (19);
break; break;
case 64: // BIT 0,(IX+d) 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); return (16);
break; break;
case 65: // BIT 0,(IX+d) 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); return (16);
break; break;
case 66: // BIT 0,(IX+d) 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); return (16);
break; break;
case 67: // BIT 0,(IX+d) 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); return (16);
break; break;
case 68: // BIT 0,(IX+d) 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); return (16);
break; break;
case 69: // BIT 0,(IX+d) 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); return (16);
break; break;
case 70: // BIT 0,(IX+d) 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); return (16);
break; break;
case 71: // BIT 0,(IX+d) 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); return (16);
break; break;
case 72: // BIT 1,(IX+d) 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); return (16);
break; break;
case 73: // BIT 1,(IX+d) 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); return (16);
break; break;
case 74: // BIT 1,(IX+d) 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); return (16);
break; break;
case 75: // BIT 1,(IX+d) 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); return (16);
break; break;
case 76: // BIT 1,(IX+d) 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); return (16);
break; break;
case 77: // BIT 1,(IX+d) 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); return (16);
break; break;
case 78: // BIT 1,(IX+d) 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); return (16);
break; break;
case 79: // BIT 1,(IX+d) 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); return (16);
break; break;
case 80: // BIT 2,(IX+d) 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); return (16);
break; break;
case 81: // BIT 2,(IX+d) 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); return (16);
break; break;
case 82: // BIT 2,(IX+d) 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); return (16);
break; break;
case 83: // BIT 2,(IX+d) 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); return (16);
break; break;
case 84: // BIT 2,(IX+d) 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); return (16);
break; break;
case 85: // BIT 2,(IX+d) 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); return (16);
break; break;
case 86: // BIT 2,(IX+d) 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); return (16);
break; break;
case 87: // BIT 2,(IX+d) 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); return (16);
break; break;
case 88: // BIT 3,(IX+d) 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); return (16);
break; break;
case 89: // BIT 3,(IX+d) 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); return (16);
break; break;
case 90: // BIT 3,(IX+d) 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); return (16);
break; break;
case 91: // BIT 3,(IX+d) 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); return (16);
break; break;
case 92: // BIT 3,(IX+d) 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); return (16);
break; break;
case 93: // BIT 3,(IX+d) 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); return (16);
break; break;
case 94: // BIT 3,(IX+d) 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); return (16);
break; break;
case 95: // BIT 3,(IX+d) 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); return (16);
break; break;
case 96: // BIT 4,(IX+d) 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); return (16);
break; break;
case 97: // BIT 4,(IX+d) 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); return (16);
break; break;
case 98: // BIT 4,(IX+d) 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); return (16);
break; break;
case 99: // BIT 4,(IX+d) 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); return (16);
break; break;
case 100: // BIT 4,(IX+d) 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); return (16);
break; break;
case 101: // BIT 4,(IX+d) 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); return (16);
break; break;
case 102: // BIT 4,(IX+d) 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); return (16);
break; break;
case 103: // BIT 4,(IX+d) 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); return (16);
break; break;
case 104: // BIT 5,(IX+d) 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); return (16);
break; break;
case 105: // BIT 5,(IX+d) 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); return (16);
break; break;
case 106: // BIT 5,(IX+d) 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); return (16);
break; break;
case 107: // BIT 5,(IX+d) 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); return (16);
break; break;
case 108: // BIT 5,(IX+d) 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); return (16);
break; break;
case 109: // BIT 5,(IX+d) 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); return (16);
break; break;
case 110: // BIT 5,(IX+d) 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); return (16);
break; break;
case 111: // BIT 5,(IX+d) 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); return (16);
break; break;
case 112: // BIT 6,(IX+d) 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); return (16);
break; break;
case 113: // BIT 6,(IX+d) 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); return (16);
break; break;
case 114: // BIT 6,(IX+d) 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); return (16);
break; break;
case 115: // BIT 6,(IX+d) 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); return (16);
break; break;
case 116: // BIT 6,(IX+d) 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); return (16);
break; break;
case 117: // BIT 6,(IX+d) 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); return (16);
break; break;
case 118: // BIT 6,(IX+d) 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); return (16);
break; break;
case 119: // BIT 6,(IX+d) 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); return (16);
break; break;
case 120: // BIT 7,(IX+d) 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); return (16);
break; break;
case 121: // BIT 7,(IX+d) 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); return (16);
break; break;
case 122: // BIT 7,(IX+d) 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); return (16);
break; break;
case 123: // BIT 7,(IX+d) 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); return (16);
break; break;
case 124: // BIT 7,(IX+d) 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); return (16);
break; break;
case 125: // BIT 7,(IX+d) 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); return (16);
break; break;
case 126: // BIT 7,(IX+d) 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); return (16);
break; break;
case 127: // BIT 7,(IX+d) 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); return (16);
break; break;
case 128: // LD_RES B,0,(IX+d) case 128: // LD_RES B,0,(IX+d)

View File

@ -19,9 +19,12 @@
#include "Z80free.h" #include "Z80free.h"
extern int Z80free_parityBit[256];
int Z80free_codesED (Z80FREE *processor,byte opcode) { int Z80free_codesED (Z80FREE *processor,byte opcode) {
static byte tmp1; static byte tmp1;
static byte tmp2; static byte tmp2;
static word tmp3;
switch(opcode) { switch(opcode) {
case 0: // NOP case 0: // NOP
@ -220,6 +223,7 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
processor->Rm.br.B=Z80free_In(processor->Rm.wr.BC); processor->Rm.br.B=Z80free_In(processor->Rm.wr.BC);
Z80free_adjustFlagSZP (processor,processor->Rm.br.B); Z80free_adjustFlagSZP (processor,processor->Rm.br.B);
Z80free_resFlag(processor,F_H|F_N); Z80free_resFlag(processor,F_H|F_N);
Z80free_adjustFlags (processor, processor->Rm.br.B);
return (8); return (8);
break; break;
case 65: // OUT_BC B 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); processor->Rm.br.C=Z80free_In(processor->Rm.wr.BC);
Z80free_adjustFlagSZP (processor,processor->Rm.br.C); Z80free_adjustFlagSZP (processor,processor->Rm.br.C);
Z80free_resFlag(processor,F_H|F_N); Z80free_resFlag(processor,F_H|F_N);
Z80free_adjustFlags (processor, processor->Rm.br.C);
return (8); return (8);
break; break;
case 73: // OUT_BC C 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); processor->Rm.br.D=Z80free_In(processor->Rm.wr.BC);
Z80free_adjustFlagSZP (processor,processor->Rm.br.D); Z80free_adjustFlagSZP (processor,processor->Rm.br.D);
Z80free_resFlag(processor,F_H|F_N); Z80free_resFlag(processor,F_H|F_N);
Z80free_adjustFlags (processor, processor->Rm.br.D);
return (8); return (8);
break; break;
case 81: // OUT_BC D 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); processor->Rm.br.E=Z80free_In(processor->Rm.wr.BC);
Z80free_adjustFlagSZP (processor,processor->Rm.br.E); Z80free_adjustFlagSZP (processor,processor->Rm.br.E);
Z80free_resFlag(processor,F_H|F_N); Z80free_resFlag(processor,F_H|F_N);
Z80free_adjustFlags (processor, processor->Rm.br.E);
return (8); return (8);
break; break;
case 89: // OUT_BC E 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); processor->Rm.br.H=Z80free_In(processor->Rm.wr.BC);
Z80free_adjustFlagSZP (processor,processor->Rm.br.H); Z80free_adjustFlagSZP (processor,processor->Rm.br.H);
Z80free_resFlag(processor,F_H|F_N); Z80free_resFlag(processor,F_H|F_N);
Z80free_adjustFlags (processor, processor->Rm.br.H);
return (8); return (8);
break; break;
case 97: // OUT_BC H 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); processor->Rm.br.L=Z80free_In(processor->Rm.wr.BC);
Z80free_adjustFlagSZP (processor,processor->Rm.br.L); Z80free_adjustFlagSZP (processor,processor->Rm.br.L);
Z80free_resFlag(processor,F_H|F_N); Z80free_resFlag(processor,F_H|F_N);
Z80free_adjustFlags (processor, processor->Rm.br.L);
return (8); return (8);
break; break;
case 105: // OUT_BC L case 105: // OUT_BC L
@ -431,6 +440,7 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
tmp1=Z80free_In(processor->Rm.wr.BC); tmp1=Z80free_In(processor->Rm.wr.BC);
Z80free_adjustFlagSZP (processor,tmp1); Z80free_adjustFlagSZP (processor,tmp1);
Z80free_resFlag(processor,F_H|F_N); Z80free_resFlag(processor,F_H|F_N);
Z80free_adjustFlags (processor, tmp1);
return (8); return (8);
break; break;
case 113: // OUT_BC 0 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); processor->Rm.br.A=Z80free_In(processor->Rm.wr.BC);
Z80free_adjustFlagSZP (processor,processor->Rm.br.A); Z80free_adjustFlagSZP (processor,processor->Rm.br.A);
Z80free_resFlag(processor,F_H|F_N); Z80free_resFlag(processor,F_H|F_N);
Z80free_adjustFlags (processor, processor->Rm.br.A);
return (8); return (8);
break; break;
case 121: // OUT_BC A case 121: // OUT_BC A
@ -623,18 +634,29 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
break; break;
case 162: // INI case 162: // INI
/*INI, IND, INIR and INDR first decrement B and then uses it*/ /*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.wr.HL++;
processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1); 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)); Z80free_valFlag(processor,F_Z, (processor->Rm.br.B == 0));
return (12); return (12);
break; break;
case 163: // OUTI case 163: // OUTI
/*OUTI, OUTD, OTIR and OTDR first decrements B and then uses it*/ /*OUTI, OUTD, OTIR and OTDR first decrements B and then uses it*/
processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1); 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++; 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); return (12);
break; break;
case 164: // NOP case 164: // NOP
@ -680,15 +702,27 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
return (12); return (12);
break; break;
case 170: // IND 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.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1);
processor->Rm.wr.HL--; 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); return (12);
break; break;
case 171: // OUTD case 171: // OUTD
processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1); 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--; 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); return (12);
break; break;
case 172: // NOP case 172: // NOP
@ -720,14 +754,19 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
break; break;
case 177: // CPIR case 177: // CPIR
tmp2=F_C&processor->Rm.br.F; 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--; processor->Rm.wr.BC--;
if ((processor->Rm.wr.BC)&&(!(processor->Rm.br.F&F_Z))) { if ((processor->Rm.wr.BC)&&(!(processor->Rm.br.F&F_Z))) {
processor->PC-=2; processor->PC-=2;
Z80free_valFlag(processor,F_C,tmp2); Z80free_valFlag(processor,F_C,tmp2);
return (17); return (17);
} else { } 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_setFlag(processor,F_N);
Z80free_valFlag(processor,F_C,tmp2); Z80free_valFlag(processor,F_C,tmp2);
if (processor->Rm.wr.BC) if (processor->Rm.wr.BC)
@ -735,24 +774,36 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
} }
break; break;
case 178: // INIR 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.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1);
processor->Rm.wr.HL++; processor->Rm.wr.HL++;
if (processor->Rm.br.B) { if (processor->Rm.br.B) {
processor->PC-=2; processor->PC-=2;
return (17); return (17);
} else { } 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); return (12);
} }
break; break;
case 179: // OTIR case 179: // OTIR
processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1); 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++; processor->Rm.wr.HL++;
if (processor->Rm.br.B) { if (processor->Rm.br.B) {
processor->PC-=2; processor->PC-=2;
return (17); return (17);
} else { } 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); return (12);
} }
break; break;
@ -785,14 +836,19 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
break; break;
case 185: // CPDR case 185: // CPDR
tmp2=F_C&processor->Rm.br.F; 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--; processor->Rm.wr.BC--;
if ((processor->Rm.wr.BC)&&(!(processor->Rm.br.F&F_Z))) { if ((processor->Rm.wr.BC)&&(!(processor->Rm.br.F&F_Z))) {
processor->PC-=2; processor->PC-=2;
Z80free_valFlag(processor,F_C,tmp2); Z80free_valFlag(processor,F_C,tmp2);
return (17); return (17);
} else { } 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_setFlag(processor,F_N);
Z80free_valFlag(processor,F_C,tmp2); Z80free_valFlag(processor,F_C,tmp2);
if (processor->Rm.wr.BC) if (processor->Rm.wr.BC)
@ -800,24 +856,36 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
} }
break; break;
case 186: // INDR 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.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1);
processor->Rm.wr.HL--; processor->Rm.wr.HL--;
if (processor->Rm.br.B) { if (processor->Rm.br.B) {
processor->PC-=2; processor->PC-=2;
return (17); return (17);
} else { } 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); return (12);
} }
break; break;
case 187: // OTDR case 187: // OTDR
processor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1); 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--; processor->Rm.wr.HL--;
if (processor->Rm.br.B) { if (processor->Rm.br.B) {
processor->PC-=2; processor->PC-=2;
return (17); return (17);
} else { } 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); return (12);
} }
break; break;

View File

@ -21,6 +21,7 @@
int Z80free_codesFDCB (Z80FREE *processor,byte d1) { int Z80free_codesFDCB (Z80FREE *processor,byte d1) {
static byte tmp1; static byte tmp1;
static word tmp2;
static byte opcode; static byte opcode;
opcode=Z80free_Rd(processor->PC++); opcode=Z80free_Rd(processor->PC++);
@ -394,259 +395,387 @@ int Z80free_codesFDCB (Z80FREE *processor,byte d1) {
return (19); return (19);
break; break;
case 64: // BIT 0,(IY+d) 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); return (16);
break; break;
case 65: // BIT 0,(IY+d) 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); return (16);
break; break;
case 66: // BIT 0,(IY+d) 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); return (16);
break; break;
case 67: // BIT 0,(IY+d) 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); return (16);
break; break;
case 68: // BIT 0,(IY+d) 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); return (16);
break; break;
case 69: // BIT 0,(IY+d) 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); return (16);
break; break;
case 70: // BIT 0,(IY+d) 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); return (16);
break; break;
case 71: // BIT 0,(IY+d) 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); return (16);
break; break;
case 72: // BIT 1,(IY+d) 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); return (16);
break; break;
case 73: // BIT 1,(IY+d) 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); return (16);
break; break;
case 74: // BIT 1,(IY+d) 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); return (16);
break; break;
case 75: // BIT 1,(IY+d) 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); return (16);
break; break;
case 76: // BIT 1,(IY+d) 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); return (16);
break; break;
case 77: // BIT 1,(IY+d) 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); return (16);
break; break;
case 78: // BIT 1,(IY+d) 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); return (16);
break; break;
case 79: // BIT 1,(IY+d) 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); return (16);
break; break;
case 80: // BIT 2,(IY+d) 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); return (16);
break; break;
case 81: // BIT 2,(IY+d) 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); return (16);
break; break;
case 82: // BIT 2,(IY+d) 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); return (16);
break; break;
case 83: // BIT 2,(IY+d) 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); return (16);
break; break;
case 84: // BIT 2,(IY+d) 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); return (16);
break; break;
case 85: // BIT 2,(IY+d) 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); return (16);
break; break;
case 86: // BIT 2,(IY+d) 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); return (16);
break; break;
case 87: // BIT 2,(IY+d) 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); return (16);
break; break;
case 88: // BIT 3,(IY+d) 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); return (16);
break; break;
case 89: // BIT 3,(IY+d) 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); return (16);
break; break;
case 90: // BIT 3,(IY+d) 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); return (16);
break; break;
case 91: // BIT 3,(IY+d) 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); return (16);
break; break;
case 92: // BIT 3,(IY+d) 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); return (16);
break; break;
case 93: // BIT 3,(IY+d) 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); return (16);
break; break;
case 94: // BIT 3,(IY+d) 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); return (16);
break; break;
case 95: // BIT 3,(IY+d) 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); return (16);
break; break;
case 96: // BIT 4,(IY+d) 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); return (16);
break; break;
case 97: // BIT 4,(IY+d) 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); return (16);
break; break;
case 98: // BIT 4,(IY+d) 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); return (16);
break; break;
case 99: // BIT 4,(IY+d) 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); return (16);
break; break;
case 100: // BIT 4,(IY+d) 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); return (16);
break; break;
case 101: // BIT 4,(IY+d) 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); return (16);
break; break;
case 102: // BIT 4,(IY+d) 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); return (16);
break; break;
case 103: // BIT 4,(IY+d) 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); return (16);
break; break;
case 104: // BIT 5,(IY+d) 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); return (16);
break; break;
case 105: // BIT 5,(IY+d) 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); return (16);
break; break;
case 106: // BIT 5,(IY+d) 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); return (16);
break; break;
case 107: // BIT 5,(IY+d) 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); return (16);
break; break;
case 108: // BIT 5,(IY+d) 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); return (16);
break; break;
case 109: // BIT 5,(IY+d) 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); return (16);
break; break;
case 110: // BIT 5,(IY+d) 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); return (16);
break; break;
case 111: // BIT 5,(IY+d) 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); return (16);
break; break;
case 112: // BIT 6,(IY+d) 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); return (16);
break; break;
case 113: // BIT 6,(IY+d) 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); return (16);
break; break;
case 114: // BIT 6,(IY+d) 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); return (16);
break; break;
case 115: // BIT 6,(IY+d) 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); return (16);
break; break;
case 116: // BIT 6,(IY+d) 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); return (16);
break; break;
case 117: // BIT 6,(IY+d) 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); return (16);
break; break;
case 118: // BIT 6,(IY+d) 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); return (16);
break; break;
case 119: // BIT 6,(IY+d) 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); return (16);
break; break;
case 120: // BIT 7,(IY+d) 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); return (16);
break; break;
case 121: // BIT 7,(IY+d) 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); return (16);
break; break;
case 122: // BIT 7,(IY+d) 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); return (16);
break; break;
case 123: // BIT 7,(IY+d) 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); return (16);
break; break;
case 124: // BIT 7,(IY+d) 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); return (16);
break; break;
case 125: // BIT 7,(IY+d) 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); return (16);
break; break;
case 126: // BIT 7,(IY+d) 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); return (16);
break; break;
case 127: // BIT 7,(IY+d) 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); return (16);
break; break;
case 128: // LD_RES B,0,(IY+d) case 128: // LD_RES B,0,(IY+d)

View File

@ -38,7 +38,7 @@ byte ports[256];
word portdirs[256]; word portdirs[256];
int portpos=0,elements=0; int portpos=0,elements=0;
#define NO35 //#define NO35
int compare_processors() { int compare_processors() {