trunk/src/emu/cpu/i8085/i8085cpu.h
| r18536 | r18537 | |
| 85 | 85 | |
| 86 | 86 | #define M_SUB(R) { \ |
| 87 | 87 | int q = cpustate->AF.b.h-R; \ |
| 88 | | cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|((cpustate->AF.b.h^q^R)&HF)|VF; \ |
| 88 | cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|(~(cpustate->AF.b.h^q^R)&HF)|VF; \ |
| 89 | 89 | cpustate->AF.b.h=q; \ |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | #define M_SBB(R) { \ |
| 93 | 93 | int q = cpustate->AF.b.h-R-(cpustate->AF.b.l&CF); \ |
| 94 | | cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|((cpustate->AF.b.h^q^R)&HF)|VF; \ |
| 94 | cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|(~(cpustate->AF.b.h^q^R)&HF)|VF; \ |
| 95 | 95 | cpustate->AF.b.h=q; \ |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | #define M_CMP(R) { \ |
| 99 | 99 | int q = cpustate->AF.b.h-R; \ |
| 100 | | cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|((cpustate->AF.b.h^q^R)&HF)|VF; \ |
| 100 | cpustate->AF.b.l=ZSP[q&255]|((q>>8)&CF)|(~(cpustate->AF.b.h^q^R)&HF)|VF; \ |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | #define M_DAD(R) { \ |
| r18536 | r18537 | |
| 106 | 106 | cpustate->HL.w.l = q; \ |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | // DSUB is 8085-only, not sure if H flag handling is correct |
| 109 | 110 | #define M_DSUB(cpustate) { \ |
| 110 | 111 | int q = cpustate->HL.b.l-cpustate->BC.b.l; \ |
| 111 | 112 | cpustate->AF.b.l=ZS[q&255]|((q>>8)&CF)|VF| \ |
trunk/src/emu/cpu/i8085/i8085.c
| r18536 | r18537 | |
| 78 | 78 | * Revisions: |
| 79 | 79 | * |
| 80 | 80 | * xx-xx-2002 Acho A. Tang |
| 81 | | * |
| 82 | 81 | * - 8085 emulation was in fact never used. It's been treated as a plain 8080. |
| 83 | 82 | * - protected IRQ0 vector from being overwritten |
| 84 | 83 | * - modified interrupt handler to properly process 8085-specific IRQ's |
| 85 | 84 | * - corrected interrupt masking, RIM and SIM behaviors according to Intel's documentation |
| 86 | 85 | * |
| 87 | 86 | * 20-Jul-2002 Krzysztof Strzecha |
| 88 | | * |
| 89 | 87 | * - SBB r instructions should affect parity flag. |
| 90 | 88 | * Fixed only for non x86 asm version (#define i8080_EXACT 1). |
| 91 | 89 | * There are probably more opcodes which should affect this flag, but don't. |
| r18536 | r18537 | |
| 98 | 96 | * Thanks for the info go to Anton V. Ignatichev. |
| 99 | 97 | * |
| 100 | 98 | * 08-Dec-2002 Krzysztof Strzecha |
| 101 | | * |
| 102 | 99 | * - ADC r instructions should affect parity flag. |
| 103 | 100 | * Fixed only for non x86 asm version (#define i8080_EXACT 1). |
| 104 | 101 | * There are probably more opcodes which should affect this flag, but don't. |
| 105 | 102 | * |
| 106 | 103 | * 05-Sep-2003 Krzysztof Strzecha |
| 107 | | * |
| 108 | 104 | * - INR r, DCR r, ADD r, SUB r, CMP r instructions should affect parity flag. |
| 109 | 105 | * Fixed only for non x86 asm version (#define i8080_EXACT 1). |
| 110 | 106 | * |
| 111 | 107 | * 23-Dec-2006 Tomasz Slanina |
| 112 | | * |
| 113 | 108 | * - SIM fixed |
| 114 | 109 | * |
| 115 | 110 | * 28-Jan-2007 Zsolt Vasvari |
| 116 | | * |
| 117 | 111 | * - Removed archaic i8080_EXACT flag. |
| 118 | 112 | * |
| 119 | 113 | * 08-June-2008 Miodrag Milanovic |
| 120 | | * |
| 121 | 114 | * - Flag setting fix for some instructions and cycle count update |
| 122 | 115 | * |
| 123 | 116 | * August 2009, hap |
| 124 | | * |
| 125 | 117 | * - removed DAA table |
| 126 | 118 | * - fixed accidental double memory reads due to macro overuse |
| 127 | 119 | * - fixed cycle deduction on unconditional CALL / RET |
| r18536 | r18537 | |
| 133 | 125 | * fixed X5 / V flags where accidentally broken due to flag names confusion |
| 134 | 126 | * |
| 135 | 127 | * 21-Aug-2009, Curt Coder |
| 136 | | * |
| 137 | 128 | * - added 8080A variant |
| 138 | 129 | * - refactored callbacks to use devcb |
| 139 | 130 | * |
| 131 | * October 2012, hap |
| 132 | * - fixed H flag on subtraction opcodes |
| 133 | * - on 8080, don't push the unsupported flags(X5, X3, V) to stack |
| 134 | * - 8080 passes on 8080/8085 CPU Exerciser, 8085 errors only on the DAA test |
| 135 | * (ref: http://www.idb.me.uk/sunhillow/8080.html - tests only 8080 opcodes) |
| 136 | * |
| 140 | 137 | *****************************************************************************/ |
| 141 | 138 | |
| 142 | 139 | #include "emu.h" |