public V9938(IV9938DisplayRenderer displayRenderer, Configuration config, int vramSizeInKB = 16) { if (!allowedVramSizes.Contains(vramSizeInKB)) { throw new ArgumentException("VRAM size must be one of: " + string.Join(", ", allowedVramSizes.Select(s => s.ToString()).ToArray())); } vramSize = vramSizeInKB * 1024; vramAddressMask = vramSize - 1; _PatternNameTableAddress = 0x1800; _colorTableAddress = 0x2000; _patternGeneratorTableAddress = 0x800; Vram = new PlainMemory(vramSize); modeBits = new Bit[] { 0, 0, 0, 0, 0 }; this.displayRenderer = displayRenderer; displayRenderer.BlankScreen(); if (config.VdpFrequencyMultiplier < 0.01M || config.VdpFrequencyMultiplier > 100) { throw new ConfigurationException("The VDP frequency multiplier must be a number between 0.01 and 100."); } var interruptGenerationInterval = TimeSpan.FromSeconds(((double)1) / 60).TotalMilliseconds / (double)config.VdpFrequencyMultiplier; interruptGenerationTaskCancellatonTokenSource = new CancellationTokenSource(); interruptGenerationTask = Task.Factory.StartNew(InterruptGenerationTaskProcess, interruptGenerationInterval, interruptGenerationTaskCancellatonTokenSource.Token); SetScreenMode(ScreenMode.Graphic1); }
public void MinimalProgramRuns() { var source = @" .data .instructions HALT"; using var executable = new Executable(source); using var processor = new Processor(); using var memory = new PlainMemory(4); Assert.NotNull(executable); Assert.NotNull(processor); Assert.NotNull(memory); processor.Run(executable, memory); Assert.NotNull(processor.ExitCode); Assert.False(processor.ExitCode.Value.IsError); }
public void Setup() { Fixture = new Fixture(); MemorySize = Random(100, 1000000); Sut = new PlainMemory(MemorySize); }