From 800eff05a6a658044cf7ceec2ddc682436ba73d5 Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Fri, 26 Jul 2019 00:58:54 +0100 Subject: [PATCH] Correct AF value in LR35902 emulator Signed-off-by: Adrian Conlon --- LR35902/LR35902.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/LR35902/LR35902.cs b/LR35902/LR35902.cs index 9068642..8604507 100644 --- a/LR35902/LR35902.cs +++ b/LR35902/LR35902.cs @@ -11,6 +11,7 @@ namespace EightBit public class LR35902 : IntelProcessor { private readonly Bus bus; + private readonly Register16 af = new Register16((int)Mask.Mask16); private bool prefixCB = false; public LR35902(Bus bus) @@ -22,7 +23,14 @@ namespace EightBit public int ClockCycles => this.Cycles * 4; - public override Register16 AF { get; } = new Register16((int)Mask.Mask16); + public override Register16 AF + { + get + { + this.af.Low = (byte)HigherNibble(this.af.Low); + return this.af; + } + } public override Register16 BC { get; } = new Register16((int)Mask.Mask16);