updated Z80 core in line with official version (MEMPTR renamed to WZ)

additional fixes to overscan color in shadow/highlight mode
This commit is contained in:
ekeeke31 2009-11-14 18:42:42 +00:00
parent 46fa9f1849
commit 14f512034f
3 changed files with 68 additions and 67 deletions

View File

@ -1781,7 +1781,7 @@ void render_line(uint32 line, uint32 overscan)
if (!(reg[1] & 0x40) || overscan)
{
width += 2 * x_offset;
memset(&tmp_buf[0x20 - x_offset], 0x40, width);
memset(&tmp_buf[0x20 - x_offset], 0x00, width);
}
else
{

View File

@ -190,9 +190,9 @@
#define HY Z80.iy.b.h
#define LY Z80.iy.b.l
#define MEMPTR Z80.memptr.w.l
#define MEMPTR_H Z80.memptr.b.h
#define MEMPTR_L Z80.memptr.b.l
#define WZ Z80.wz.w.l
#define WZ_H Z80.wz.b.h
#define WZ_L Z80.wz.b.l
#define I Z80.i
#define R Z80.r
@ -661,8 +661,8 @@ INLINE UINT32 ARG16(void)
* Calculate the effective address EA of an opcode using
* IX+offset resp. IY+offset addressing.
***************************************************************/
#define EAX do { EA = (UINT32)(UINT16)(IX + (INT8)ARG()); MEMPTR = EA; } while (0)
#define EAY do { EA = (UINT32)(UINT16)(IY + (INT8)ARG()); MEMPTR = EA; } while (0)
#define EAX do { EA = (UINT32)(UINT16)(IX + (INT8)ARG()); WZ = EA; } while (0)
#define EAY do { EA = (UINT32)(UINT16)(IY + (INT8)ARG()); WZ = EA; } while (0)
/***************************************************************
* POP
@ -679,7 +679,7 @@ INLINE UINT32 ARG16(void)
***************************************************************/
#define JP { \
PCD = ARG16(); \
MEMPTR = PCD; \
WZ = PCD; \
}
/***************************************************************
@ -689,11 +689,11 @@ INLINE UINT32 ARG16(void)
if (cond) \
{ \
PCD = ARG16(); \
MEMPTR = PCD; \
WZ = PCD; \
} \
else \
{ \
MEMPTR = ARG16(); /* implicit do PC += 2 */ \
WZ = ARG16(); /* implicit do PC += 2 */ \
} \
}
@ -703,7 +703,7 @@ INLINE UINT32 ARG16(void)
#define JR() { \
INT8 arg = (INT8)ARG(); /* ARG() also increments PC */ \
PC += arg; /* so don't do PC += ARG() */ \
MEMPTR = PC; \
WZ = PC; \
}
/***************************************************************
@ -723,7 +723,7 @@ INLINE UINT32 ARG16(void)
***************************************************************/
#define CALL() { \
EA = ARG16(); \
MEMPTR = EA; \
WZ = EA; \
PUSH(pc); \
PCD = EA; \
}
@ -735,14 +735,14 @@ INLINE UINT32 ARG16(void)
if (cond) \
{ \
EA = ARG16(); \
MEMPTR = EA; \
WZ = EA; \
PUSH(pc); \
PCD = EA; \
CC(ex, opcode); \
} \
else \
{ \
MEMPTR = ARG16(); /* implicit call PC+=2; */ \
WZ = ARG16(); /* implicit call PC+=2; */ \
} \
}
@ -753,7 +753,7 @@ INLINE UINT32 ARG16(void)
if (cond) \
{ \
POP(pc); \
MEMPTR = PC; \
WZ = PC; \
CC(ex, opcode); \
} \
} while (0)
@ -764,7 +764,7 @@ INLINE UINT32 ARG16(void)
#define RETN do { \
LOG(("Z80 #%d RETN IFF1:%d IFF2:%d\n", cpu_getactivecpu(), IFF1, IFF2)); \
POP( pc ); \
MEMPTR = PC; \
WZ = PC; \
IFF1 = IFF2; \
} while (0)
@ -773,7 +773,7 @@ INLINE UINT32 ARG16(void)
***************************************************************/
#define RETI { \
POP( pc ); \
MEMPTR = PC; \
WZ = PC; \
/* according to http://www.msxnet.org/tech/z80-documented.pdf */ \
IFF1 = IFF2; \
}
@ -815,7 +815,7 @@ INLINE UINT32 ARG16(void)
#define RST(addr) \
PUSH( pc ); \
PCD = addr; \
MEMPTR = PC; \
WZ = PC; \
/***************************************************************
* INC r8
@ -877,7 +877,7 @@ INLINE UINT8 DEC(UINT8 value)
***************************************************************/
#define RRD { \
UINT8 n = RM(HL); \
MEMPTR = HL+1; \
WZ = HL+1; \
WM( HL, (n >> 4) | (A << 4) ); \
A = (A & 0xf0) | (n & 0x0f); \
F = (F & CF) | SZP[A]; \
@ -888,7 +888,7 @@ INLINE UINT8 DEC(UINT8 value)
***************************************************************/
#define RLD { \
UINT8 n = RM(HL); \
MEMPTR = HL+1; \
WZ = HL+1; \
WM( HL, (n << 4) | (A & 0x0f) ); \
A = (A & 0xf0) | (n >> 4); \
F = (F & CF) | SZP[A]; \
@ -1032,7 +1032,7 @@ INLINE UINT8 DEC(UINT8 value)
RM16( SPD, &tmp ); \
WM16( SPD, &Z80.DR ); \
Z80.DR = tmp; \
MEMPTR = Z80.DR.d; \
WZ = Z80.DR.d; \
}
@ -1042,7 +1042,7 @@ INLINE UINT8 DEC(UINT8 value)
#define ADD16(DR,SR) \
{ \
UINT32 res = Z80.DR.d + Z80.SR.d; \
MEMPTR = Z80.DR.d + 1; \
WZ = Z80.DR.d + 1; \
F = (F & (SF | ZF | VF)) | \
(((Z80.DR.d ^ res ^ Z80.SR.d) >> 8) & HF) | \
((res >> 16) & CF) | ((res >> 8) & (YF | XF)); \
@ -1055,7 +1055,7 @@ INLINE UINT8 DEC(UINT8 value)
#define ADC16(Reg) \
{ \
UINT32 res = HLD + Z80.Reg.d + (F & CF); \
MEMPTR = HL + 1; \
WZ = HL + 1; \
F = (((HLD ^ res ^ Z80.Reg.d) >> 8) & HF) | \
((res >> 16) & CF) | \
((res >> 8) & (SF | YF | XF)) | \
@ -1070,7 +1070,7 @@ INLINE UINT8 DEC(UINT8 value)
#define SBC16(Reg) \
{ \
UINT32 res = HLD - Z80.Reg.d - (F & CF); \
MEMPTR = HL + 1; \
WZ = HL + 1; \
F = (((HLD ^ res ^ Z80.Reg.d) >> 8) & HF) | NF | \
((res >> 16) & CF) | \
((res >> 8) & (SF | YF | XF)) | \
@ -1186,7 +1186,7 @@ INLINE UINT8 SRL(UINT8 value)
* BIT bit,(HL)
***************************************************************/
#define BIT_HL(bit, reg) \
F = (F & CF) | HF | (SZ_BIT[reg & (1<<bit)] & ~(YF|XF)) | (MEMPTR_H & (YF|XF)); \
F = (F & CF) | HF | (SZ_BIT[reg & (1<<bit)] & ~(YF|XF)) | (WZ_H & (YF|XF)); \
/***************************************************************
* BIT bit,(IX/Y+o)
@ -1229,7 +1229,7 @@ INLINE UINT8 SET(UINT8 bit, UINT8 value)
#define CPI { \
UINT8 val = RM(HL); \
UINT8 res = A - val; \
MEMPTR++; \
WZ++; \
HL++; BC--; \
F = (F & CF) | (SZ[res]&~(YF|XF)) | ((A^val^res)&HF) | NF; \
if( F & HF ) res -= 1; \
@ -1244,7 +1244,7 @@ INLINE UINT8 SET(UINT8 bit, UINT8 value)
#define INI { \
unsigned t; \
UINT8 io = IN(BC); \
MEMPTR = BC + 1; \
WZ = BC + 1; \
CC(ex,0xa2); \
B--; \
WM( HL, io ); \
@ -1263,7 +1263,7 @@ INLINE UINT8 SET(UINT8 bit, UINT8 value)
unsigned t; \
UINT8 io = RM(HL); \
B--; \
MEMPTR = BC + 1; \
WZ = BC + 1; \
OUT( BC, io ); \
HL++; \
F = SZ[B]; \
@ -1292,7 +1292,7 @@ INLINE UINT8 SET(UINT8 bit, UINT8 value)
#define CPD { \
UINT8 val = RM(HL); \
UINT8 res = A - val; \
MEMPTR--; \
WZ--; \
HL--; BC--; \
F = (F & CF) | (SZ[res]&~(YF|XF)) | ((A^val^res)&HF) | NF; \
if( F & HF ) res -= 1; \
@ -1307,7 +1307,7 @@ INLINE UINT8 SET(UINT8 bit, UINT8 value)
#define IND { \
unsigned t; \
UINT8 io = IN(BC); \
MEMPTR = BC - 1; \
WZ = BC - 1; \
CC(ex,0xaa); \
B--; \
WM( HL, io ); \
@ -1326,7 +1326,7 @@ INLINE UINT8 SET(UINT8 bit, UINT8 value)
unsigned t; \
UINT8 io = RM(HL); \
B--; \
MEMPTR = BC - 1; \
WZ = BC - 1; \
OUT( BC, io ); \
HL--; \
F = SZ[B]; \
@ -1344,7 +1344,7 @@ INLINE UINT8 SET(UINT8 bit, UINT8 value)
if( BC ) \
{ \
PC -= 2; \
MEMPTR = PC + 1; \
WZ = PC + 1; \
CC(ex,0xb0); \
}
@ -1356,7 +1356,7 @@ INLINE UINT8 SET(UINT8 bit, UINT8 value)
if( BC && !(F & ZF) ) \
{ \
PC -= 2; \
MEMPTR = PC + 1; \
WZ = PC + 1; \
CC(ex,0xb1); \
}
@ -1390,7 +1390,7 @@ INLINE UINT8 SET(UINT8 bit, UINT8 value)
if( BC ) \
{ \
PC -= 2; \
MEMPTR = PC + 1; \
WZ = PC + 1; \
CC(ex,0xb8); \
}
@ -1402,7 +1402,7 @@ INLINE UINT8 SET(UINT8 bit, UINT8 value)
if( BC && !(F & ZF) ) \
{ \
PC -= 2; \
MEMPTR = PC + 1; \
WZ = PC + 1; \
CC(ex,0xb9); \
}
@ -2068,7 +2068,7 @@ OP(dd,1f) { illegal_1(); op_1f(); } /* DB DD
OP(dd,20) { illegal_1(); op_20(); } /* DB DD */
OP(dd,21) { IX = ARG16(); } /* LD IX,w */
OP(dd,22) { EA = ARG16(); WM16( EA, &Z80.ix ); MEMPTR = EA+1; } /* LD (w),IX */
OP(dd,22) { EA = ARG16(); WM16( EA, &Z80.ix ); WZ = EA+1; } /* LD (w),IX */
OP(dd,23) { IX++; } /* INC IX */
OP(dd,24) { HX = INC(HX); } /* INC HX */
OP(dd,25) { HX = DEC(HX); } /* DEC HX */
@ -2077,7 +2077,7 @@ OP(dd,27) { illegal_1(); op_27(); } /* DB DD
OP(dd,28) { illegal_1(); op_28(); } /* DB DD */
OP(dd,29) { ADD16(ix,ix); } /* ADD IX,IX */
OP(dd,2a) { EA = ARG16(); RM16( EA, &Z80.ix ); MEMPTR = EA+1; } /* LD IX,(w) */
OP(dd,2a) { EA = ARG16(); RM16( EA, &Z80.ix ); WZ = EA+1; } /* LD IX,(w) */
OP(dd,2b) { IX--; } /* DEC IX */
OP(dd,2c) { LX = INC(LX); } /* INC LX */
OP(dd,2d) { LX = DEC(LX); } /* DEC LX */
@ -2359,7 +2359,7 @@ OP(fd,1f) { illegal_1(); op_1f(); } /* DB FD
OP(fd,20) { illegal_1(); op_20(); } /* DB FD */
OP(fd,21) { IY = ARG16(); } /* LD IY,w */
OP(fd,22) { EA = ARG16(); WM16( EA, &Z80.iy ); MEMPTR = EA+1; } /* LD (w),IY */
OP(fd,22) { EA = ARG16(); WM16( EA, &Z80.iy ); WZ = EA+1; } /* LD (w),IY */
OP(fd,23) { IY++; } /* INC IY */
OP(fd,24) { HY = INC(HY); } /* INC HY */
OP(fd,25) { HY = DEC(HY); } /* DEC HY */
@ -2368,7 +2368,7 @@ OP(fd,27) { illegal_1(); op_27(); } /* DB FD
OP(fd,28) { illegal_1(); op_28(); } /* DB FD */
OP(fd,29) { ADD16(iy,iy); } /* ADD IY,IY */
OP(fd,2a) { EA = ARG16(); RM16( EA, &Z80.iy ); MEMPTR = EA+1; } /* LD IY,(w) */
OP(fd,2a) { EA = ARG16(); RM16( EA, &Z80.iy ); WZ = EA+1; } /* LD IY,(w) */
OP(fd,2b) { IY--; } /* DEC IY */
OP(fd,2c) { LY = INC(LY); } /* INC LY */
OP(fd,2d) { LY = DEC(LY); } /* DEC LY */
@ -2695,7 +2695,7 @@ OP(ed,3f) { illegal_2(); } /* DB ED
OP(ed,40) { B = IN(BC); F = (F & CF) | SZP[B]; } /* IN B,(C) */
OP(ed,41) { OUT(BC, B); } /* OUT (C),B */
OP(ed,42) { SBC16( bc ); } /* SBC HL,BC */
OP(ed,43) { EA = ARG16(); WM16( EA, &Z80.bc ); MEMPTR = EA+1; } /* LD (w),BC */
OP(ed,43) { EA = ARG16(); WM16( EA, &Z80.bc ); WZ = EA+1; } /* LD (w),BC */
OP(ed,44) { NEG; } /* NEG */
OP(ed,45) { RETN; } /* RETN; */
OP(ed,46) { IM = 0; } /* IM 0 */
@ -2704,7 +2704,7 @@ OP(ed,47) { LD_I_A; } /* LD I,A
OP(ed,48) { C = IN(BC); F = (F & CF) | SZP[C]; } /* IN C,(C) */
OP(ed,49) { OUT(BC, C); } /* OUT (C),C */
OP(ed,4a) { ADC16( bc ); } /* ADC HL,BC */
OP(ed,4b) { EA = ARG16(); RM16( EA, &Z80.bc ); MEMPTR = EA+1; } /* LD BC,(w) */
OP(ed,4b) { EA = ARG16(); RM16( EA, &Z80.bc ); WZ = EA+1; } /* LD BC,(w) */
OP(ed,4c) { NEG; } /* NEG */
OP(ed,4d) { RETI; } /* RETI */
OP(ed,4e) { IM = 0; } /* IM 0 */
@ -2713,7 +2713,7 @@ OP(ed,4f) { LD_R_A; } /* LD R,A
OP(ed,50) { D = IN(BC); F = (F & CF) | SZP[D]; } /* IN D,(C) */
OP(ed,51) { OUT(BC, D); } /* OUT (C),D */
OP(ed,52) { SBC16( de ); } /* SBC HL,DE */
OP(ed,53) { EA = ARG16(); WM16( EA, &Z80.de ); MEMPTR = EA+1; } /* LD (w),DE */
OP(ed,53) { EA = ARG16(); WM16( EA, &Z80.de ); WZ = EA+1; } /* LD (w),DE */
OP(ed,54) { NEG; } /* NEG */
OP(ed,55) { RETN; } /* RETN; */
OP(ed,56) { IM = 1; } /* IM 1 */
@ -2722,7 +2722,7 @@ OP(ed,57) { LD_A_I; } /* LD A,I
OP(ed,58) { E = IN(BC); F = (F & CF) | SZP[E]; } /* IN E,(C) */
OP(ed,59) { OUT(BC, E); } /* OUT (C),E */
OP(ed,5a) { ADC16( de ); } /* ADC HL,DE */
OP(ed,5b) { EA = ARG16(); RM16( EA, &Z80.de ); MEMPTR = EA+1; } /* LD DE,(w) */
OP(ed,5b) { EA = ARG16(); RM16( EA, &Z80.de ); WZ = EA+1; } /* LD DE,(w) */
OP(ed,5c) { NEG; } /* NEG */
OP(ed,5d) { RETI; } /* RETI */
OP(ed,5e) { IM = 2; } /* IM 2 */
@ -2731,7 +2731,7 @@ OP(ed,5f) { LD_A_R; } /* LD A,R
OP(ed,60) { H = IN(BC); F = (F & CF) | SZP[H]; } /* IN H,(C) */
OP(ed,61) { OUT(BC, H); } /* OUT (C),H */
OP(ed,62) { SBC16( hl ); } /* SBC HL,HL */
OP(ed,63) { EA = ARG16(); WM16( EA, &Z80.hl ); MEMPTR = EA+1; } /* LD (w),HL */
OP(ed,63) { EA = ARG16(); WM16( EA, &Z80.hl ); WZ = EA+1; } /* LD (w),HL */
OP(ed,64) { NEG; } /* NEG */
OP(ed,65) { RETN; } /* RETN; */
OP(ed,66) { IM = 0; } /* IM 0 */
@ -2740,7 +2740,7 @@ OP(ed,67) { RRD; } /* RRD (HL)
OP(ed,68) { L = IN(BC); F = (F & CF) | SZP[L]; } /* IN L,(C) */
OP(ed,69) { OUT(BC, L); } /* OUT (C),L */
OP(ed,6a) { ADC16( hl ); } /* ADC HL,HL */
OP(ed,6b) { EA = ARG16(); RM16( EA, &Z80.hl ); MEMPTR = EA+1; } /* LD HL,(w) */
OP(ed,6b) { EA = ARG16(); RM16( EA, &Z80.hl ); WZ = EA+1; } /* LD HL,(w) */
OP(ed,6c) { NEG; } /* NEG */
OP(ed,6d) { RETI; } /* RETI */
OP(ed,6e) { IM = 0; } /* IM 0 */
@ -2749,16 +2749,16 @@ OP(ed,6f) { RLD; } /* RLD (HL)
OP(ed,70) { UINT8 res = IN(BC); F = (F & CF) | SZP[res]; } /* IN 0,(C) */
OP(ed,71) { OUT(BC, 0); } /* OUT (C),0 */
OP(ed,72) { SBC16( sp ); } /* SBC HL,SP */
OP(ed,73) { EA = ARG16(); WM16( EA, &Z80.sp ); MEMPTR = EA+1; } /* LD (w),SP */
OP(ed,73) { EA = ARG16(); WM16( EA, &Z80.sp ); WZ = EA+1; } /* LD (w),SP */
OP(ed,74) { NEG; } /* NEG */
OP(ed,75) { RETN; } /* RETN; */
OP(ed,76) { IM = 1; } /* IM 1 */
OP(ed,77) { illegal_2(); } /* DB ED,77 */
OP(ed,78) { A = IN(BC); F = (F & CF) | SZP[A]; MEMPTR = BC+1; } /* IN E,(C) */
OP(ed,79) { OUT(BC, A); MEMPTR = BC + 1; } /* OUT (C),A */
OP(ed,78) { A = IN(BC); F = (F & CF) | SZP[A]; WZ = BC+1; } /* IN E,(C) */
OP(ed,79) { OUT(BC, A); WZ = BC + 1; } /* OUT (C),A */
OP(ed,7a) { ADC16( sp ); } /* ADC HL,SP */
OP(ed,7b) { EA = ARG16(); RM16( EA, &Z80.sp ); MEMPTR = EA+1; } /* LD SP,(w) */
OP(ed,7b) { EA = ARG16(); RM16( EA, &Z80.sp ); WZ = EA+1; } /* LD SP,(w) */
OP(ed,7c) { NEG; } /* NEG */
OP(ed,7d) { RETI; } /* RETI */
OP(ed,7e) { IM = 2; } /* IM 2 */
@ -2914,7 +2914,7 @@ OP(ed,ff) { illegal_2(); } /* DB ED
**********************************************************/
OP(op,00) { } /* NOP */
OP(op,01) { BC = ARG16(); } /* LD BC,w */
OP(op,02) { WM( BC, A ); MEMPTR_L = (BC + 1) & 0xFF; MEMPTR_H = A; } /* LD (BC),A */
OP(op,02) { WM( BC, A ); WZ_L = (BC + 1) & 0xFF; WZ_H = A; } /* LD (BC),A */
OP(op,03) { BC++; } /* INC BC */
OP(op,04) { B = INC(B); } /* INC B */
OP(op,05) { B = DEC(B); } /* DEC B */
@ -2923,7 +2923,7 @@ OP(op,07) { RLCA;
OP(op,08) { EX_AF; } /* EX AF,AF' */
OP(op,09) { ADD16(hl, bc); } /* ADD HL,BC */
OP(op,0a) { A = RM( BC ); MEMPTR=BC+1; } /* LD A,(BC) */
OP(op,0a) { A = RM( BC ); WZ=BC+1; } /* LD A,(BC) */
OP(op,0b) { BC--; } /* DEC BC */
OP(op,0c) { C = INC(C); } /* INC C */
OP(op,0d) { C = DEC(C); } /* DEC C */
@ -2932,7 +2932,7 @@ OP(op,0f) { RRCA;
OP(op,10) { B--; JR_COND( B, 0x10 ); } /* DJNZ o */
OP(op,11) { DE = ARG16(); } /* LD DE,w */
OP(op,12) { WM( DE, A ); MEMPTR_L = (DE + 1) & 0xFF; MEMPTR_H = A; } /* LD (DE),A */
OP(op,12) { WM( DE, A ); WZ_L = (DE + 1) & 0xFF; WZ_H = A; } /* LD (DE),A */
OP(op,13) { DE++; } /* INC DE */
OP(op,14) { D = INC(D); } /* INC D */
OP(op,15) { D = DEC(D); } /* DEC D */
@ -2941,7 +2941,7 @@ OP(op,17) { RLA;
OP(op,18) { JR(); } /* JR o */
OP(op,19) { ADD16(hl, de); } /* ADD HL,DE */
OP(op,1a) { A = RM( DE ); MEMPTR=DE+1; } /* LD A,(DE) */
OP(op,1a) { A = RM( DE ); WZ=DE+1; } /* LD A,(DE) */
OP(op,1b) { DE--; } /* DEC DE */
OP(op,1c) { E = INC(E); } /* INC E */
OP(op,1d) { E = DEC(E); } /* DEC E */
@ -2950,7 +2950,7 @@ OP(op,1f) { RRA;
OP(op,20) { JR_COND( !(F & ZF), 0x20 ); } /* JR NZ,o */
OP(op,21) { HL = ARG16(); } /* LD HL,w */
OP(op,22) { EA = ARG16(); WM16( EA, &Z80.hl ); MEMPTR = EA+1; } /* LD (w),HL */
OP(op,22) { EA = ARG16(); WM16( EA, &Z80.hl ); WZ = EA+1; } /* LD (w),HL */
OP(op,23) { HL++; } /* INC HL */
OP(op,24) { H = INC(H); } /* INC H */
OP(op,25) { H = DEC(H); } /* DEC H */
@ -2959,7 +2959,7 @@ OP(op,27) { DAA;
OP(op,28) { JR_COND( F & ZF, 0x28 ); } /* JR Z,o */
OP(op,29) { ADD16(hl, hl); } /* ADD HL,HL */
OP(op,2a) { EA = ARG16(); RM16( EA, &Z80.hl ); MEMPTR = EA+1; } /* LD HL,(w) */
OP(op,2a) { EA = ARG16(); RM16( EA, &Z80.hl ); WZ = EA+1; } /* LD HL,(w) */
OP(op,2b) { HL--; } /* DEC HL */
OP(op,2c) { L = INC(L); } /* INC L */
OP(op,2d) { L = DEC(L); } /* DEC L */
@ -2968,7 +2968,7 @@ OP(op,2f) { A ^= 0xff; F = (F&(SF|ZF|PF|CF))|HF|NF|(A&(YF|XF));
OP(op,30) { JR_COND( !(F & CF), 0x30 ); } /* JR NC,o */
OP(op,31) { SP = ARG16(); } /* LD SP,w */
OP(op,32) { EA = ARG16(); WM( EA, A ); MEMPTR_L=(EA+1)&0xFF;MEMPTR_H=A; } /* LD (w),A */
OP(op,32) { EA = ARG16(); WM( EA, A ); WZ_L=(EA+1)&0xFF;WZ_H=A; } /* LD (w),A */
OP(op,33) { SP++; } /* INC SP */
OP(op,34) { WM( HL, INC(RM(HL)) ); } /* INC (HL) */
OP(op,35) { WM( HL, DEC(RM(HL)) ); } /* DEC (HL) */
@ -2977,7 +2977,7 @@ OP(op,37) { F = (F & (SF|ZF|YF|XF|PF)) | CF | (A & (YF|XF));
OP(op,38) { JR_COND( F & CF, 0x38 ); } /* JR C,o */
OP(op,39) { ADD16(hl, sp); } /* ADD HL,SP */
OP(op,3a) { EA = ARG16(); A = RM( EA ); MEMPTR = EA+1; } /* LD A,(w) */
OP(op,3a) { EA = ARG16(); A = RM( EA ); WZ = EA+1; } /* LD A,(w) */
OP(op,3b) { SP--; } /* DEC SP */
OP(op,3c) { A = INC(A); } /* INC A */
OP(op,3d) { A = DEC(A); } /* DEC A */
@ -3138,7 +3138,7 @@ OP(op,c6) { ADD(ARG());
OP(op,c7) { RST(0x00); } /* RST 0 */
OP(op,c8) { RET_COND( F & ZF, 0xc8 ); } /* RET Z */
OP(op,c9) { POP( pc ); MEMPTR=PCD; } /* RET */
OP(op,c9) { POP( pc ); WZ=PCD; } /* RET */
OP(op,ca) { JP_COND( F & ZF ); } /* JP Z,a */
OP(op,cb) { R++; EXEC(cb,ROP()); } /* **** CB xx */
OP(op,cc) { CALL_COND( F & ZF, 0xcc ); } /* CALL Z,a */
@ -3149,7 +3149,7 @@ OP(op,cf) { RST(0x08);
OP(op,d0) { RET_COND( !(F & CF), 0xd0 ); } /* RET NC */
OP(op,d1) { POP( de ); } /* POP DE */
OP(op,d2) { JP_COND( !(F & CF) ); } /* JP NC,a */
OP(op,d3) { unsigned n = ARG() | (A << 8); OUT( n, A ); MEMPTR_L = ((n & 0xff) + 1) & 0xff; MEMPTR_H = A; } /* OUT (n),A */
OP(op,d3) { unsigned n = ARG() | (A << 8); OUT( n, A ); WZ_L = ((n & 0xff) + 1) & 0xff; WZ_H = A; } /* OUT (n),A */
OP(op,d4) { CALL_COND( !(F & CF), 0xd4 ); } /* CALL NC,a */
OP(op,d5) { PUSH( de ); } /* PUSH DE */
OP(op,d6) { SUB(ARG()); } /* SUB n */
@ -3158,7 +3158,7 @@ OP(op,d7) { RST(0x10);
OP(op,d8) { RET_COND( F & CF, 0xd8 ); } /* RET C */
OP(op,d9) { EXX; } /* EXX */
OP(op,da) { JP_COND( F & CF ); } /* JP C,a */
OP(op,db) { unsigned n = ARG() | (A << 8); A = IN( n ); MEMPTR = n + 1; } /* IN A,(n) */
OP(op,db) { unsigned n = ARG() | (A << 8); A = IN( n ); WZ = n + 1; } /* IN A,(n) */
OP(op,dc) { CALL_COND( F & CF, 0xdc ); } /* CALL C,a */
OP(op,dd) { R++; EXEC(dd,ROP()); } /* **** DD xx */
OP(op,de) { SBC(ARG()); } /* SBC A,n */
@ -3263,7 +3263,7 @@ static void take_interrupt(void)
break;
}
}
MEMPTR=PCD;
WZ=PCD;
}
/****************************************************************************
@ -3392,7 +3392,7 @@ void z80_reset(void)
Z80.nmi_pending = FALSE;
Z80.irq_state = CLEAR_LINE;
Z80.after_ei = FALSE;
MEMPTR=PCD;
WZ=PCD;
}
void z80_exit(void)
@ -3421,7 +3421,7 @@ int z80_execute(int cycles)
IFF1 = 0;
PUSH( pc );
PCD = 0x0066;
MEMPTR=PCD;
WZ=PCD;
z80_ICount -= 11;
Z80.nmi_pending = FALSE;
}

View File

@ -3,13 +3,14 @@
#include "cpuintrf.h"
enum {
Z80_PC=1, Z80_SP, Z80_A, Z80_B,
Z80_C, Z80_D, Z80_E, Z80_H, Z80_L,
enum
{
Z80_PC, Z80_SP,
Z80_A, Z80_B, Z80_C, Z80_D, Z80_E, Z80_H, Z80_L,
Z80_AF, Z80_BC, Z80_DE, Z80_HL,
Z80_IX, Z80_IY, Z80_AF2, Z80_BC2, Z80_DE2, Z80_HL2,
Z80_R, Z80_I, Z80_IM, Z80_IFF1, Z80_IFF2, Z80_HALT,
Z80_DC0, Z80_DC1, Z80_DC2, Z80_DC3, Z80_MEMPTR
Z80_DC0, Z80_DC1, Z80_DC2, Z80_DC3, Z80_WZ
};
enum {
@ -27,7 +28,7 @@ enum {
/****************************************************************************/
typedef struct
{
PAIR prvpc,pc,sp,af,bc,de,hl,ix,iy,memptr;
PAIR pc,sp,af,bc,de,hl,ix,iy,wz;
PAIR af2,bc2,de2,hl2;
UINT8 r,r2,iff1,iff2,halt,im,i;
UINT8 nmi_state; /* nmi line state */