mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-23 15:29:24 +00:00
Small correction to GB SP instructions passes a little more of the Blargg tests.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
ae4106ce5a
commit
246e6431ab
@ -4949,7 +4949,7 @@ f8_1
|
|||||||
0 MC 0000
|
0 MC 0000
|
||||||
4 MR 0000 f8
|
4 MR 0000 f8
|
||||||
4 MC 0001
|
4 MC 0001
|
||||||
0010 0000 0000 0000 fffe 0002
|
0030 0000 0000 0000 fffe 0002
|
||||||
0 5
|
0 5
|
||||||
|
|
||||||
|
|
||||||
@ -4957,7 +4957,7 @@ f8_2
|
|||||||
0 MC 0000
|
0 MC 0000
|
||||||
4 MR 0000 f8
|
4 MR 0000 f8
|
||||||
4 MC 0001
|
4 MC 0001
|
||||||
0000 0000 0000 0fff 1000 0002
|
0010 0000 0000 0fff 1000 0002
|
||||||
0 5
|
0 5
|
||||||
|
|
||||||
|
|
||||||
|
@ -686,13 +686,14 @@ void EightBit::LR35902::executeOther(int x, int y, int z, int p, int q) {
|
|||||||
cycles += 3;
|
cycles += 3;
|
||||||
break;
|
break;
|
||||||
case 5: { // GB: ADD SP,dd
|
case 5: { // GB: ADD SP,dd
|
||||||
auto before = SP();
|
auto before = SP().word;
|
||||||
auto value = fetchByte();
|
auto value = fetchByte();
|
||||||
auto result = SP().word + (int8_t)value;
|
auto result = before + (int8_t)value;
|
||||||
SP().word = result;
|
SP().word = result;
|
||||||
|
auto carried = before ^ value ^ result;
|
||||||
clearFlag(f, ZF | NF);
|
clearFlag(f, ZF | NF);
|
||||||
setFlag(f, CF, result & Bit16);
|
setFlag(f, CF, carried & 0x100);
|
||||||
adjustHalfCarryAdd(f, before.high, value, SP().high);
|
setFlag(f, HC, carried & 0x10);
|
||||||
}
|
}
|
||||||
cycles += 4;
|
cycles += 4;
|
||||||
break;
|
break;
|
||||||
@ -701,13 +702,14 @@ void EightBit::LR35902::executeOther(int x, int y, int z, int p, int q) {
|
|||||||
cycles += 3;
|
cycles += 3;
|
||||||
break;
|
break;
|
||||||
case 7: { // GB: LD HL,SP + dd
|
case 7: { // GB: LD HL,SP + dd
|
||||||
auto before = HL();
|
auto before = SP().word;
|
||||||
auto value = fetchByte();
|
auto value = fetchByte();
|
||||||
auto result = SP().word + (int8_t)value;
|
auto result = before + (int8_t)value;
|
||||||
HL().word = result;
|
HL().word = result;
|
||||||
|
auto carried = before ^ value ^ result;
|
||||||
clearFlag(f, ZF | NF);
|
clearFlag(f, ZF | NF);
|
||||||
setFlag(f, CF, result & Bit16);
|
setFlag(f, CF, carried & 0x100);
|
||||||
adjustHalfCarryAdd(f, before.high, value, HL().high);
|
setFlag(f, HC, carried & 0x10);
|
||||||
}
|
}
|
||||||
cycles += 3;
|
cycles += 3;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user