public static InterruptVector[] ParseInterruptVectors(string file, string tableStart, string tableEnd, string vectorLineA, string vectorLineB, string ignoredLine, string macroDef, int nameGroup, int commentGroup) { var rgTableStart = new Regex(tableStart); var rgTableEnd = new Regex(tableEnd); var rgVectorLineA = new Regex(vectorLineA); var rgVectorLineB = vectorLineB == null ? null : new Regex(vectorLineB); var rgIgnoredLine = new Regex(ignoredLine); var rgMacroDef = (macroDef == null) ? null : new Regex(macroDef); Dictionary<string, string> macroValues = new Dictionary<string, string>(); bool insideTable = false; List<InterruptVector> result = new List<InterruptVector>(); foreach(var line in File.ReadAllLines(file)) { if (!insideTable) { if (rgMacroDef != null) { var m = rgMacroDef.Match(line); if (m.Success) macroValues[m.Groups[1].Value] = m.Groups[2].Value; } if (rgTableStart.IsMatch(line)) { insideTable = true; continue; } } else { if (string.IsNullOrWhiteSpace(line) || rgIgnoredLine.IsMatch(line)) continue; else if (rgTableEnd.IsMatch(line)) break; var m = rgVectorLineA.Match(line); if (!m.Success && vectorLineB != null) m = rgVectorLineB.Match(line); if (!m.Success) throw new Exception("Cannot parse interrupt vector table definition line: " + line); InterruptVector vec = new InterruptVector { Name = m.Groups[nameGroup].Value }; if (m.Groups.Count > commentGroup) vec.OptionalComment = m.Groups[commentGroup].Value; string val; if (vec.Name == "0") vec = null; else if (macroValues.TryGetValue(vec.Name, out val)) vec.SpecialVectorValue = val; result.Add(vec); } } return result.ToArray(); }
protected override void DoInt(InterruptVector interruptVector, Action?flagAction = null) { Push(GetFlags()); flagAction?.Invoke(); var tableOfs = (byte)interruptVector * 4; DoCall(memoryController.ReadWord(tableOfs), memoryController.ReadWord(tableOfs + 2)); clockCount += 51; if (opcodes[0] == 0xCC) { clockCount++; } }
public static InterruptVector[] ParseInterruptVectors(string file, string tableStart, string tableEnd, string vectorLineA, string vectorLineB, string ignoredLine, string macroDef, int nameGroup, int commentGroup) { var rgTableStart = new Regex(tableStart); var rgTableEnd = new Regex(tableEnd); var rgVectorLineA = new Regex(vectorLineA); var rgVectorLineB = vectorLineB == null ? null : new Regex(vectorLineB); var rgIgnoredLine = new Regex(ignoredLine); var rgMacroDef = (macroDef == null) ? null : new Regex(macroDef); Dictionary <string, string> macroValues = new Dictionary <string, string>(); bool insideTable = false; List <InterruptVector> result = new List <InterruptVector>(); foreach (var line in File.ReadAllLines(file)) { if (!insideTable) { if (rgMacroDef != null) { var m = rgMacroDef.Match(line); if (m.Success) { macroValues[m.Groups[1].Value] = m.Groups[2].Value; } } if (rgTableStart.IsMatch(line)) { insideTable = true; continue; } } else { if (string.IsNullOrWhiteSpace(line) || rgIgnoredLine.IsMatch(line)) { continue; } else if (rgTableEnd.IsMatch(line)) { break; } var m = rgVectorLineA.Match(line); if (!m.Success && vectorLineB != null) { m = rgVectorLineB.Match(line); } if (!m.Success) { throw new Exception("Cannot parse interrupt vector table definition line: " + line); } InterruptVector vec = new InterruptVector { Name = m.Groups[nameGroup].Value }; if (m.Groups.Count > commentGroup) { vec.OptionalComment = m.Groups[commentGroup].Value; } string val; if (vec.Name == "0") { vec = null; } else if (macroValues.TryGetValue(vec.Name, out val)) { vec.SpecialVectorValue = val; } result.Add(vec); } } return(result.ToArray()); }
internal int Rst(InterruptVector isr) { Call((ushort)isr); return(12); }