Fix conditional jump instructions not eating their immediate data

This commit is contained in:
Nero 2019-11-15 15:54:37 +00:00
parent 6b1c53dad5
commit fe319a0caa

View File

@ -188,6 +188,7 @@ void step() {
case 0x04: unarync(B, ++); break;; case 0x04: unarync(B, ++); break;;
case 0x05: unarync(B, --); break;; case 0x05: unarync(B, --); break;;
case 0x06: B=imm8(); break;; case 0x06: B=imm8(); break;;
case 0x07: tmp=A; A = A << 1 | flags.c; flags.c = tmp >> 7; break;;
case 0x09: HL=add16c(HL,BC); break;; case 0x09: HL=add16c(HL,BC); break;;
case 0x0a: A=mem[BC]; break;; case 0x0a: A=mem[BC]; break;;
@ -387,66 +388,66 @@ void step() {
case 0xC0: if (!flags.z) IP=pop(); break;; case 0xC0: if (!flags.z) IP=pop(); break;;
case 0xC1: BC=pop(); break;; case 0xC1: BC=pop(); break;;
case 0xC2: if (!flags.z) IP=imm16(); break;; case 0xC2: tmp=imm16(); if (!flags.z) IP=tmp; break;;
case 0xC3: IP=imm16(); break;; case 0xC3: IP=imm16(); break;;
case 0xC4: if (!flags.z) call(imm16()); break;; case 0xC4: tmp=imm16(); if (!flags.z) call(tmp); break;;
case 0xC5: push(BC); break;; case 0xC5: push(BC); break;;
case 0xC6: arith(A, +, imm8()); break;; case 0xC6: arith(A, +, imm8()); break;;
case 0xC7: interrupt(0); break;; case 0xC7: interrupt(0); break;;
case 0xC8: if (flags.z) IP=pop(); break;; case 0xC8: if (flags.z) IP=pop(); break;;
case 0xC9: IP=pop(); break;; case 0xC9: IP=pop(); break;;
case 0xCA: if (flags.z) IP=imm16(); break;; case 0xCA: tmp=imm16(); if (flags.z) IP=tmp; break;;
case 0xCC: if (flags.z) call(imm16()); break;; case 0xCC: tmp=imm16(); if (flags.z) call(tmp); break;;
case 0xCD: call(imm16()); break;; case 0xCD: call(imm16()); break;;
case 0xCE: arith(A, +flags.c+, imm8()); break;; case 0xCE: arith(A, +flags.c+, imm8()); break;;
case 0xCF: interrupt(1); break;; case 0xCF: interrupt(1); break;;
case 0xD0: if (!flags.c) IP=pop(); break;; case 0xD0: if (!flags.c) IP=pop(); break;;
case 0xD1: DE=pop(); break;; case 0xD1: DE=pop(); break;;
case 0xD2: if (!flags.c) IP=imm16(); break;; case 0xD2: tmp=imm16(); if (!flags.c) IP=tmp; break;;
case 0xD3: out(imm8()); break;; case 0xD3: out(imm8()); break;;
case 0xD4: if (!flags.c) call(imm16()); break;; case 0xD4: tmp=imm16(); if (!flags.c) call(tmp); break;;
case 0xD5: push(DE); break;; case 0xD5: push(DE); break;;
case 0xD6: arith(A, -, imm8()); break;; case 0xD6: arith(A, -, imm8()); break;;
case 0xD7: interrupt(2); break;; case 0xD7: interrupt(2); break;;
case 0xD8: if (flags.c) IP=pop(); break;; case 0xD8: if (flags.c) IP=pop(); break;;
case 0xDA: if (flags.c) IP=imm16(); break;; case 0xDA: tmp=imm16(); if (flags.c) IP=tmp; break;;
case 0xDB: in(imm8()); break;; case 0xDB: in(imm8()); break;;
case 0xDC: if (flags.c) call(imm16()); break;; case 0xDC: tmp=imm16(); if (flags.c) call(tmp); break;;
case 0xDE: arith(A, -flags.c-, imm8()); break;; case 0xDE: arith(A, -flags.c-, imm8()); break;;
case 0xDF: interrupt(3); break;; case 0xDF: interrupt(3); break;;
case 0xE0: if (!flags.p) IP=pop(); break;; case 0xE0: if (!flags.p) IP=pop(); break;;
case 0xE1: HL=pop(); break;; case 0xE1: HL=pop(); break;;
case 0xE2: if (!flags.p) IP=imm16(); break;; case 0xE2: tmp=imm16(); if (!flags.p) IP=tmp; break;;
case 0xE3: tmp=HL; HL=pop(); push(tmp); break;; case 0xE3: tmp=HL; HL=pop(); push(tmp); break;;
case 0xE4: if (!flags.p) call(imm16()); break;; case 0xE4: tmp=imm16(); if (!flags.p) call(tmp); break;;
case 0xE5: push(HL); break;; case 0xE5: push(HL); break;;
case 0xE6: arith(A, &, imm8()); break;; case 0xE6: arith(A, &, imm8()); break;;
case 0xE7: interrupt(4); break;; case 0xE7: interrupt(4); break;;
case 0xE8: if (flags.p) IP=pop(); break;; case 0xE8: if (flags.p) IP=pop(); break;;
case 0xE9: IP=HL; break;; case 0xE9: IP=HL; break;;
case 0xEA: if (flags.p) IP=imm16(); break;; case 0xEA: tmp=imm16(); if (flags.p) IP=tmp; break;;
case 0xEB: tmp=HL; HL=DE; DE=tmp;; break;; case 0xEB: tmp=HL; HL=DE; DE=tmp;; break;;
case 0xEC: if (flags.p) call(imm16()); break;; case 0xEC: tmp=imm16(); if (flags.p) call(tmp); break;;
case 0xEE: arith(A, ^, imm8()); break;; case 0xEE: arith(A, ^, imm8()); break;;
case 0xEF: interrupt(5); break;; case 0xEF: interrupt(5); break;;
case 0xF0: if (!flags.s) IP=pop(); break;; case 0xF0: if (!flags.s) IP=pop(); break;;
case 0xF1: regset.regp.psw=pop(); break;; case 0xF1: regset.regp.psw=pop(); break;;
case 0xF2: if (!flags.s) IP=imm16(); break;; case 0xF2: tmp=imm16(); if (!flags.s) IP=tmp; break;;
case 0xF4: if (!flags.s) call(imm16()); break;; case 0xF4: tmp=imm16(); if (!flags.s) call(tmp); break;;
case 0xF5: push(regset.regp.psw); break;; case 0xF5: push(regset.regp.psw); break;;
case 0xF6: arith(A, |, imm8()); break;; case 0xF6: arith(A, |, imm8()); break;;
case 0xF7: interrupt(6); break;; case 0xF7: interrupt(6); break;;
case 0xF8: if (flags.s) IP=pop(); break;; case 0xF8: if (flags.s) IP=pop(); break;;
case 0xF9: SP=HL; break;; case 0xF9: SP=HL; break;;
case 0xFA: if (flags.s) IP=imm16(); break;; case 0xFA: tmp=imm16(); if (flags.s) IP=tmp; break;;
case 0xFC: if (flags.s) call(imm16()); break;; case 0xFC: tmp=imm16(); if (flags.s) call(tmp); break;;
case 0xFE: aritht(A, -, imm8()); break;; case 0xFE: aritht(A, -, imm8()); break;;
case 0xFF: interrupt(7); break;; case 0xFF: interrupt(7); break;;