Previous 199869 Revisions Next

r18532 Monday 15th October, 2012 at 12:32:28 UTC by hap
fix H flag on DCR and DAD
[src/emu/cpu/i8085]i8085cpu.h

trunk/src/emu/cpu/i8085/i8085cpu.h
r18531r18532
6868
6969/* increase / decrease */
7070#define M_INR(R) {UINT8 hc = ((R & 0x0f) == 0x0f) ? HF : 0; ++R; cpustate->AF.b.l= (cpustate->AF.b.l & CF ) | ZSP[R] | hc; }
71#define M_DCR(R) {UINT8 hc = ((R & 0x0f) == 0x00) ? HF : 0; --R; cpustate->AF.b.l= (cpustate->AF.b.l & CF ) | ZSP[R] | hc | VF; }
71#define M_DCR(R) {UINT8 hc = ((R & 0x0f) != 0x00) ? HF : 0; --R; cpustate->AF.b.l= (cpustate->AF.b.l & CF ) | ZSP[R] | hc | VF; }
7272
7373/* arithmetic */
7474#define M_ADD(R) {                                                   \
r18531r18532
100100   cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|((cpustate->AF.b.h^q^R)&HF)|VF;         \
101101}
102102
103#define M_DAD(R) {                                                             \
104   int q = cpustate->HL.d + cpustate->R.d;                               \
105   cpustate->AF.b.l = ( cpustate->AF.b.l & ~(HF+CF) ) |                     \
106      ( ((cpustate->HL.d^q^cpustate->R.d) >> 8) & HF ) |                     \
107      ( (q>>16) & CF );                                             \
103#define M_DAD(R) {                                                   \
104   int q = cpustate->HL.d + cpustate->R.d;                                 \
105   cpustate->AF.b.l = (cpustate->AF.b.l & ~CF) | (q>>16 & CF );               \
108106   cpustate->HL.w.l = q;                                             \
109107}
110108

Previous 199869 Revisions Next


© 1997-2024 The MAME Team