This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Tokenizer | |
| { | |
| public Tokenizer(TextReader reader); | |
| // The current token | |
| public Token Token { get; } | |
| // The value of the number of Token.Number | |
| public double Number { get; } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public enum Token | |
| { | |
| EOF, | |
| Add, | |
| Subtract, | |
| Number, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Force break in the debugger on the next instruction | |
| public void Break() | |
| { | |
| _break = true; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class StepOutBreakPoint : BreakPoint | |
| { | |
| public StepOutBreakPoint(CPU cpu) | |
| { | |
| // Store the current stack pointer | |
| _ssBreakOnReturn = cpu.ss; | |
| _spBreakOnReturn = cpu.sp; | |
| } | |
| ushort _ssBreakOnReturn = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Single Step | |
| void SingleStep() | |
| { | |
| _break = true; | |
| } | |
| // Step Over | |
| public void StepOver() | |
| { | |
| // Check if the current instruction is a call instruction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void IDebugger.OnStep() | |
| { | |
| // Test all break points | |
| for (int i=0; i<_allBreakPoints.Count; i++) | |
| { | |
| if (bp.Enabled && bp.ShouldBreak(this)) | |
| { | |
| _break = true; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CodeBreakPoint : BreakPoint | |
| { | |
| public CodeBreakPoint(ushort segment, ushort offset) | |
| { | |
| Segment = segment; | |
| Offset = offset; | |
| } | |
| public ushort Segment; | |
| public ushort Offset; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class CodeBreakPoint : BreakPoint | |
| { | |
| public CodeBreakPoint(ushort segment, ushort offset) | |
| { | |
| Segment = segment; | |
| Offset = offset; | |
| } | |
| public ushort Segment; | |
| public ushort Offset; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public abstract class BreakPoint | |
| { | |
| // Check if this break point wants the debugger to stop | |
| public abstract bool ShouldBreak(DebuggerCore debugger); | |
| [Json("number")] | |
| public int Number { get; set; } | |
| [Json("enabled")] | |
| public bool Enabled { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Disassembler | |
| { | |
| // Machine code read from here | |
| public IMemoryBus MemoryBus { get; set; } | |
| // Using this address | |
| public ushort cs { get; set; } | |
| public ushort ip { get; set; } | |
| // Read disassembled instruction here |