Skip to content

Commit

Permalink
Add DoOnMemoryWrite
Browse files Browse the repository at this point in the history
  • Loading branch information
JorisVanEijden committed Jun 8, 2024
1 parent 104fcfd commit 4a08b0e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Spice86.Core/Emulator/ReverseEngineer/CSharpOverrideHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,21 @@ public void DoOnTopOfInstruction(ushort segment, ushort offset, Action action) {
Machine.MachineBreakpoints.ToggleBreakPoint(breakPoint, true);
}

/// <summary>
/// Executes the specified action when the byte at the specified segment and offset is written to.
/// </summary>
/// <param name="segment">The segment of the memory location to watch.</param>
/// <param name="offset">The offset of the memory location to watch.</param>
/// <param name="action">The action to execute when the memory location is written to.</param>
public void DoOnMemoryWrite(ushort segment, ushort offset, Action action) {
AddressBreakPoint breakPoint = new(
BreakPointType.WRITE,
MemoryUtils.ToPhysicalAddress(segment, offset),
_ => action.Invoke()
, false);
Machine.MachineBreakpoints.ToggleBreakPoint(breakPoint, true);
}

/// <summary>
/// Checks if the vtable contains the expected segment and offset values.
/// </summary>
Expand Down

0 comments on commit 4a08b0e

Please sign in to comment.