private static Instruction Instruction( OpCode code, AddressingMode mode, string addressString = null, string label = null, int lineNumber = 0, LabelFinder labelFinder = null) { return(new InstructionFactory(labelFinder).Create(code, mode, addressString, lineNumber, label)); }
public void LabelFinder_OnlyFindsTheFirstLabel_IfThereAreTwoLabelsToTheSameLine_HopefullyThisIsntAProblem() { string pretemplate = @"0: LDC 6, 9(0) ; set registers 6 to value 9 101: LDA 7, [label0](0) ; jump to label label0 102: LDC 1, 1(0) ; load constant into r1 103: OUT 1, 0, 0 ; write out contens of r1 * label:label0 * label:label1 104: LDC 1, 2(0) ; load constant into r1 105: OUT 1, 0, 0 ; write out contens of r1"; var dictionary = LabelFinder.FindLabels(pretemplate); Assert.That(dictionary.Count, Is.EqualTo(1)); Assert.That(dictionary["label0"], Is.EqualTo("104")); }
public void LabelFinder_ShouldWorkWithBigLineNumbers() { string pretemplate = @"0: LDC 6, 9(0) ; set registers 6 to value 9 101: LDA 7, [label0](0) ; jump to label label0 102: LDC 1, 1(0) ; load constant into r1 103: OUT 1, 0, 0 ; write out contens of r1 * label:label0 104: LDC 1, 2(0) ; load constant into r1 105: OUT 1, 0, 0 ; write out contens of r1"; var dictionary = LabelFinder.FindLabels(pretemplate); Assert.That(dictionary.Count, Is.EqualTo(1)); Assert.That(dictionary["label0"], Is.EqualTo("104")); }
public InstructionParser(LabelFinder labelFinder) { _factory = new InstructionFactory(labelFinder); }
public TwoByteAddressInstruction(LabelFinder labelFinder) : base(labelFinder) { }
public SingleByteAddressInstruction(LabelFinder labelFinder) : base(labelFinder) { }
protected Instruction(LabelFinder labelFinder) { _labelFinder = labelFinder; }
public InstructionFactory(LabelFinder labelFinder) { _labelFinder = labelFinder; }