public InterruptQueueingHandler(InterruptHandler interruptHandler, String interruptQueueName, String interruptName, long interruptQueueingAddress, long interruptFlagAddress) { _interruptHandler = interruptHandler; _interruptFlagAddress = interruptFlagAddress; _interruptName = interruptName; _interruptHandler.RegisterHardwareInterrupt(interruptQueueName, interruptQueueingAddress, true, AddToInterruptQueue); }
public CPU(MemoryController memoryBus, InterruptHandler interruptHandler) { _memoryBus = memoryBus; interruptHandler.SoftwareInterruptTriggered += new EventHandler<InterruptEventArgs>(InterruptHandler_InterruptTriggered); _interruptReturnAddress = new Stack<long>(); _interruptReturnStack = new Stack<SoftwareInterruptRequest>(); _interruptJump = new List<SoftwareInterruptRequest>(); }
private static void DisplayDevices(MemoryController memory, List<IMemoryMappedDevice> devices, InterruptHandler interruptHandler) { Console.WriteLine("Memory {0} bytes", memory.Size ); Console.WriteLine(); Console.WriteLine("Devices"); Console.WriteLine("============================================="); foreach (var mappedDevice in devices.OrderBy(d=>d.MemoryRangeStart)) { Console.WriteLine("{0} - {1} bytes [{2}-{3}]", mappedDevice.Name.PadRight(15), mappedDevice.MemoryRangeLength, mappedDevice.MemoryRangeStart, mappedDevice.MemoryRangeStart + mappedDevice.MemoryRangeLength); } Console.WriteLine("============================================="); String irqList = interruptHandler.GetIrqList(); Console.WriteLine(); Console.WriteLine(irqList); }
static void Main(string[] args) { // Create memory and load the program and arguments (if present). _mem = new MemoryController(); if (args.Length >= 1) { _mem.LoadProgram(args[0], args.Skip(1)); } else if (args.Length == 1) { _mem.LoadProgram(args[0]); } InterruptHandler interruptHandler = new InterruptHandler(_mem); _mappedDevices = new List <IMemoryMappedDevice>(); // Create a memory mapped console device. ConsoleDevice consoleDevice = new ConsoleDevice(_mem, interruptHandler, 1048448, 128); _mappedDevices.Add(consoleDevice); KeyboardDevice keyboardDevice = new KeyboardDevice(_mem, interruptHandler, 1048319, 128); _mappedDevices.Add(keyboardDevice); DisplayDevices(_mem, _mappedDevices, interruptHandler); Console.WriteLine(); Console.WriteLine("Ready. Press enter to begin..."); Console.ReadLine(); Console.Clear(); // Start the keyboard device. keyboardDevice.StartDevice(); _mem.DebugWrite(); // Create the CPU and start it running. _cpu = new CPU(_mem, interruptHandler); _cpu.Run(); Console.ReadLine(); }
static void Main(string[] args) { // Create memory and load the program and arguments (if present). _mem = new MemoryController(); if (args.Length >= 1) { _mem.LoadProgram(args[0], args.Skip(1)); } else if (args.Length == 1) { _mem.LoadProgram(args[0]); } InterruptHandler interruptHandler = new InterruptHandler(_mem); _mappedDevices = new List<IMemoryMappedDevice>(); // Create a memory mapped console device. ConsoleDevice consoleDevice = new ConsoleDevice(_mem, interruptHandler, 1048448, 128); _mappedDevices.Add(consoleDevice); KeyboardDevice keyboardDevice = new KeyboardDevice(_mem, interruptHandler, 1048319, 128); _mappedDevices.Add(keyboardDevice); DisplayDevices(_mem, _mappedDevices, interruptHandler); Console.WriteLine(); Console.WriteLine("Ready. Press enter to begin..."); Console.ReadLine(); Console.Clear(); // Start the keyboard device. keyboardDevice.StartDevice(); _mem.DebugWrite(); // Create the CPU and start it running. _cpu = new CPU(_mem, interruptHandler); _cpu.Run(); Console.ReadLine(); }
private static void DisplayDevices(MemoryController memory, List <IMemoryMappedDevice> devices, InterruptHandler interruptHandler) { Console.WriteLine("Memory {0} bytes", memory.Size); Console.WriteLine(); Console.WriteLine("Devices"); Console.WriteLine("============================================="); foreach (var mappedDevice in devices.OrderBy(d => d.MemoryRangeStart)) { Console.WriteLine("{0} - {1} bytes [{2}-{3}]", mappedDevice.Name.PadRight(15), mappedDevice.MemoryRangeLength, mappedDevice.MemoryRangeStart, mappedDevice.MemoryRangeStart + mappedDevice.MemoryRangeLength); } Console.WriteLine("============================================="); String irqList = interruptHandler.GetIrqList(); Console.WriteLine(); Console.WriteLine(irqList); }