summaryrefslogtreecommitdiff
path: root/src/Noddybox.Emulation.EightBit
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2012-07-01 14:35:59 +0000
committerIan C <ianc@noddybox.co.uk>2012-07-01 14:35:59 +0000
commitbcf9a06fedbfc3978fe18a065fcc755bad2196ba (patch)
treee94fb22be148a4ce56b1ced30ddb8c264e79433a /src/Noddybox.Emulation.EightBit
parent11d53755f5fcb9158f4fe3abaa3c0b480a461fe7 (diff)
Updates
Diffstat (limited to 'src/Noddybox.Emulation.EightBit')
-rw-r--r--src/Noddybox.Emulation.EightBit/ICpu.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Noddybox.Emulation.EightBit/ICpu.cs b/src/Noddybox.Emulation.EightBit/ICpu.cs
index 9d1909c..1ee7781 100644
--- a/src/Noddybox.Emulation.EightBit/ICpu.cs
+++ b/src/Noddybox.Emulation.EightBit/ICpu.cs
@@ -20,6 +20,15 @@ using System;
namespace Noddybox.Emulation.EightBit
{
/// <summary>
+ /// Defines a delegate that will be called after an instruction.
+ /// </summary>
+ /// <param name="sender">The CPU being used. All state will be upto date prior to invoking
+ /// the callback.</param>
+ /// <returns>True if the CPU should continue executing, or false if not. Users should simply
+ /// return Clock.VBL if they need no other than clock control.</returns>
+ public delegate bool CpuCallback(object sender);
+
+ /// <summary>
/// Defines an 8-bit CPU.
/// </summary>
public interface ICpu
@@ -48,6 +57,15 @@ namespace Noddybox.Emulation.EightBit
void Run();
/// <summary>
+ /// Runs the CPU until the callback tells it to stop.
+ /// </summary>
+ /// <param name="callback">A delegate that is called after every completed instruction
+ /// cycle and tells the CPU when to stop running. Note that at least one instruction
+ /// is always executed as the callback is made after the cycle has completed.
+ /// </param>
+ void Run(CpuCallback callback);
+
+ /// <summary>
/// Generates a maskable interrupt to the CPU.
/// </summary>
/// <param name="value">Optional value from an interrupting device. May be ignored depending on the CPU type.</param>