mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-04-19 15:16:41 +00:00
Power-on and reset consistency fixes
This commit is contained in:
@@ -102,12 +102,6 @@ namespace EightBit
|
||||
return this.HALT.Lowered() ? (byte)0 : read;
|
||||
}
|
||||
|
||||
|
||||
protected void ResetWorkingRegisters()
|
||||
{
|
||||
this.AF.Word = this.BC.Word = this.DE.Word = this.HL.Word = (ushort)Mask.Sixteen;
|
||||
}
|
||||
|
||||
protected static int BuildHalfCarryIndex(byte before, byte value, int calculation) => ((before & 0x88) >> 1) | ((value & 0x88) >> 2) | ((calculation & 0x88) >> 3);
|
||||
|
||||
protected static int CalculateHalfCarryAdd(byte before, byte value, int calculation)
|
||||
@@ -124,7 +118,8 @@ namespace EightBit
|
||||
|
||||
private void IntelProcessor_RaisedPOWER(object? sender, EventArgs e)
|
||||
{
|
||||
this.PC.Word = this.SP.Word = this.AF.Word = this.BC.Word = this.DE.Word = this.HL.Word = (ushort)Mask.Sixteen;
|
||||
this.PC.Word = this.SP.Word = (ushort)Mask.Sixteen;
|
||||
this.AF.Word = this.BC.Word = this.DE.Word = this.HL.Word = (ushort)Mask.Sixteen;
|
||||
this.RaiseHALT();
|
||||
}
|
||||
|
||||
|
||||
+11
-1
@@ -192,7 +192,6 @@ namespace Z80
|
||||
this.Exx();
|
||||
|
||||
this.IX.Word = this.IY.Word = (ushort)Mask.Sixteen;
|
||||
base.ResetWorkingRegisters();
|
||||
|
||||
this.ResetPrefixes();
|
||||
}
|
||||
@@ -520,10 +519,21 @@ namespace Z80
|
||||
return returned;
|
||||
}
|
||||
|
||||
// From Zilog Z80 manual
|
||||
// https://www.zilog.com/docs/z80/um0080.pdf
|
||||
//
|
||||
// RESET. Reset (input, active Low).
|
||||
// _____
|
||||
// RESET initializes the CPU as follows: it resets the
|
||||
// interrupt enable flip-flop, clears the Program Counter and registers I and R, and sets the
|
||||
// interrupt status to Mode 0. During reset time, the address and data bus enter a high-impedance
|
||||
// state, and all control output signals enter an inactive state.RESET must be active for
|
||||
// a minimum of three full clock cycles before a reset operation is complete.
|
||||
protected override void HandleRESET()
|
||||
{
|
||||
base.HandleRESET();
|
||||
this.IV = this.REFRESH = 0;
|
||||
this.IM = 0;
|
||||
this.SP.Word = this.AF.Word = (ushort)Mask.Sixteen;
|
||||
this.Tick(3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user