Skip to content

Commit

Permalink
Slightly optimized for when there are no read or write breakpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
drdnar committed Jan 4, 2015
1 parent 71ab5d0 commit 00ffcf0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions Tiedye/Hardware/MemoryMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,17 @@ public void AddBreakpoint(Breakpoint bp, bool isActive)
switch (bp.Type)
{
case MemoryBreakpointType.Execution:
haveExecBps = true;
if (!ExecBps.ContainsKey(bp))
ExecBps.Add(bp, isActive);
break;
case MemoryBreakpointType.Read:
haveReadBps = true;
if (!ReadBps.ContainsKey(bp))
ReadBps.Add(bp, isActive);
break;
case MemoryBreakpointType.Write:
haveWriteBps = true;
if (!WriteBps.ContainsKey(bp))
WriteBps.Add(bp, isActive);
break;
Expand All @@ -166,14 +169,20 @@ public void DeleteBreakpoint(Breakpoint bp)
case MemoryBreakpointType.Execution:
//if (ExecBps.ContainsKey(bp))
ExecBps.Remove(bp);
if (ExecBps.Count == 0)
haveExecBps = false;
break;
case MemoryBreakpointType.Read:
//if (ReadBps.ContainsKey(bp))
ReadBps.Remove(bp);
if (ReadBps.Count == 0)
haveReadBps = false;
break;
case MemoryBreakpointType.Write:
//if (WriteBps.ContainsKey(bp))
WriteBps.Remove(bp);
if (WriteBps.Count == 0)
haveWriteBps = false;
break;
}
}
Expand Down Expand Up @@ -259,10 +268,13 @@ public List<KeyValuePair<Breakpoint, bool>> GetBreakpoints()
return items;
}

protected bool haveExecBps = false;
Dictionary<Breakpoint, bool> ExecBps = new Dictionary<Breakpoint, bool>();

protected bool haveReadBps = false;
Dictionary<Breakpoint, bool> ReadBps = new Dictionary<Breakpoint, bool>();

protected bool haveWriteBps = false;
Dictionary<Breakpoint, bool> WriteBps = new Dictionary<Breakpoint, bool>();

}
Expand Down
4 changes: 2 additions & 2 deletions Tiedye/Hardware/SE84/MemoryMapperSE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public override byte BusRead(object sender, ushort address)
};
if (Cpu.M1 && IsExecutionBreakpoint(bp))
Cpu.BreakExecution();
else if (IsReadBreakpoint(bp))
else if (haveReadBps && IsReadBreakpoint(bp))
Cpu.BreakExecution();
if (isRam)
{
Expand Down Expand Up @@ -478,7 +478,7 @@ public override void BusWrite(object sender, ushort address, byte value)
Page = linearAddress >> 14,
Type = MemoryBreakpointType.Write
};
if (IsWriteBreakpoint(bp))
if (haveWriteBps && IsWriteBreakpoint(bp))
Cpu.BreakExecution();
if (isRam)
Ram.WriteByte(sender, linearAddress & 0x3FFFF, value);
Expand Down

0 comments on commit 00ffcf0

Please sign in to comment.