/// <summary> /// Power On /// </summary> public ULA() { _cpuCLK = SignalState.LOW; _cpuINT = SignalState.HIGH; Address = new BusConnector <ushort>(); Data = new BusConnector <byte>(); VideoAddress = new BusConnector <ushort>(); VideoData = new BusConnector <byte>(); _videoMREQ = SignalState.HIGH; _videoRD = SignalState.HIGH; ColorSignal = new AnalogOutputPin <byte>(0); _hSync = SignalState.HIGH; _vSync = SignalState.HIGH; KeyboardData = new BusConnector <byte>(); _keyboardRD = SignalState.HIGH; SpeakerSoundSignal = new AnalogOutputPin <byte>(0); _soundSampleCLK = SignalState.HIGH; TapeInputSignal = new AnalogInputPin <byte>(); TapeOuputSignal = new AnalogOutputPin <byte>(0); }
public IODevice(byte portAddress) { this.portAddress = portAddress; Address = new BusConnector <ushort>(); Data = new BusConnector <byte>(); }
public IODevice(byte portAddress) { this.portAddress = portAddress; Address = new BusConnector<ushort>(); Data = new BusConnector<byte>(); }
public Memory(int capacityBytes) { cells = new byte[capacityBytes]; Address = new BusConnector<ushort>(); Data = new BusConnector<byte>(); }
public BusNumberPage(BusConnector BusCon) { InitializeComponent(); busCon = BusCon; NavigationPage.SetHasBackButton(this, false); NavigationPage.SetHasNavigationBar(this, false); }
public Reparatie(Bus Bus, BusConnector BusCon) { InitializeComponent(); bus = Bus; busCon = BusCon; NavigationPage.SetHasBackButton(this, false); NavigationPage.SetHasNavigationBar(this, false); }
public Drivein(Bus Bus, BusConnector BusCon) { InitializeComponent(); bus = Bus; busCon = BusCon; frontLbl.Text = "Welkom bus " + bus.BusID.ToString(); NavigationPage.SetHasBackButton(this, false); NavigationPage.SetHasNavigationBar(this, false); }
public ParkeerOp(Bus Bus, BusConnector BusCon) { InitializeComponent(); bus = Bus; busCon = BusCon; GetInfo(); NavigationPage.SetHasBackButton(this, false); NavigationPage.SetHasNavigationBar(this, false); }
public RemoteBusFixture() { StandardTimeout = TimeSpan.FromMilliseconds(200); LocalBus = new Dispatcher(nameof(TestCommandBusFixture), 1, false, StandardTimeout, StandardTimeout); RemoteBus = new Dispatcher(nameof(TestCommandBusFixture), 1, false, StandardTimeout, StandardTimeout); LocalBus.SubscribeToAll(new AdHocHandler <IMessage>(_ => Interlocked.Increment(ref LocalMsgCount))); RemoteBus.SubscribeToAll(new AdHocHandler <IMessage>(_ => Interlocked.Increment(ref RemoteMsgCount))); _connector = new BusConnector(LocalBus, RemoteBus); Reset(); }
public ROM() { cells = new byte[Memory.BYTES_16K]; Address = new BusConnector<ushort>(); Data = new BusConnector<byte>(); string sourcePath = "zxspectrum.asm"; Stream romProgramFileStream = PlatformSpecific.GetStreamForProjectFile(sourcePath); Program = Assembler.ParseProgram(sourcePath, romProgramFileStream, Encoding.UTF8, false); MemoryMap programBytes = new MemoryMap(cells.Length); Assembler.CompileProgram(Program, 0, programBytes); cells = programBytes.MemoryCells; }
public ROM() { cells = new byte[Memory.BYTES_16K]; Address = new BusConnector <ushort>(); Data = new BusConnector <byte>(); string sourcePath = "zxspectrum.asm"; Stream romProgramFileStream = PlatformSpecific.GetStreamForProjectFile(sourcePath); Program = Assembler.ParseProgram(sourcePath, romProgramFileStream, Encoding.UTF8, false); MemoryMap programBytes = new MemoryMap(cells.Length); Assembler.CompileProgram(Program, 0, programBytes); cells = programBytes.MemoryCells; }
public MemoryMappedChip(ushort capacityBytes, ushort startAddress) { cells = new byte[capacityBytes]; if (startAddress == 0x4000) { Address = new PartialAddressBusConnector(14); } else if (startAddress == 0x8000) { Address = new PartialAddressBusConnector(15); } else { throw new NotSupportedException(); } Data = new BusConnector <byte>(); }
public Machine(short WordLength, short AddrLength) { this.WordLength = WordLength; this.AddrLength = WordLength; this.DataLength = WordLength - AddrLength; //creating buses... AddrBus = new Bus(WordLength); DataBus = new Bus(WordLength); //connecting buses... ADBus = new BusConnector(WordLength, AddrBus, DataBus); //creating components... Memory = new Memory(WordLength, AddrBus, DataBus); Counter = new Counter(WordLength, AddrBus); Accumulator = new Accumulator(WordLength, DataBus); Interpreter = new Interpreter(WordLength, AddrLength, this, AddrBus, DataBus, Memory, Counter, Accumulator); }
public DualAccessMemoryMappedChip(ushort capacityBytes, ushort startAddress) { cells = new byte[capacityBytes]; if (startAddress == 0x4000) { AddressInput1 = new PartialAddressBusConnector(14); AddressInput2 = new PartialAddressBusConnector(14); } else if (startAddress == 0x8000) { AddressInput1 = new PartialAddressBusConnector(15); AddressInput2 = new PartialAddressBusConnector(15); } else { throw new NotSupportedException(); } DataInput1 = new BusConnector<byte>(); DataInput2 = new BusConnector<byte>(); }
public void passing_commands_on_connected_busses_should_pass() { var bus = new CommandBus("local"); var bus2 = new CommandBus("remote"); var conn = new BusConnector(bus, bus2); long gotCmd1 = 0; bus2.Subscribe(new AdHocCommandHandler <TestCommands.TestCommand>( cmd => { Interlocked.Exchange(ref gotCmd1, 1); return(true); })); CommandResponse result; bus.TryFire(new TestCommands.TestCommand(Guid.NewGuid(), null), out result); Assert.True(result is Success); Assert.IsOrBecomesTrue(() => Interlocked.Read(ref gotCmd1) == 1, msg: "Expected Cmd1 handled"); }
public void fire_oversubscribed_commands_should_throw_oversubscribed() { var bus = new CommandBus("local"); var bus2 = new CommandBus("remote"); var conn = new BusConnector(bus, bus2); long proccessedCmd = 0; long gotAck = 0; bus.Subscribe(new AdHocCommandHandler <TestCommands.TestCommand>( cmd => { Interlocked.Increment(ref proccessedCmd); Task.Delay(1000).Wait(); return(true); })); bus2.Subscribe(new AdHocCommandHandler <TestCommands.TestCommand>( cmd => { Interlocked.Increment(ref proccessedCmd); Task.Delay(100).Wait(); return(true); })); bus.Subscribe( new AdHocHandler <AckCommand>(cmd => Interlocked.Increment(ref gotAck))); Assert.Throws <CommandOversubscribedException>(() => bus.Fire(new TestCommands.TestCommand(Guid.NewGuid(), null))); Assert.IsOrBecomesTrue( () => Interlocked.Read(ref gotAck) == 2, msg: "Expected command Acked twice, got " + gotAck); Assert.IsOrBecomesTrue( () => Interlocked.Read(ref proccessedCmd) <= 1, msg: "Expected command handled once or less, actual " + proccessedCmd); }
public Keyboard() { Address = new BusConnector <ushort>(); Data = new BusConnector <byte>(); }
public Keyboard() { Address = new BusConnector<ushort>(); Data = new BusConnector<byte>(); }
public TestMultiportDevice() { Address = new BusConnector<ushort>(); Data = new BusConnector<byte>(); }
public TestMultiportDevice() { Address = new BusConnector <ushort>(); Data = new BusConnector <byte>(); }
/// <summary> /// Power On /// </summary> public ULA() { _cpuCLK = SignalState.LOW; _cpuINT = SignalState.HIGH; Address = new BusConnector<ushort>(); Data = new BusConnector<byte>(); VideoAddress = new BusConnector<ushort>(); VideoData = new BusConnector<byte>(); _videoMREQ = SignalState.HIGH; _videoRD = SignalState.HIGH; ColorSignal = new AnalogOutputPin<byte>(0); _hSync = SignalState.HIGH; _vSync = SignalState.HIGH; KeyboardData = new BusConnector<byte>(); _keyboardRD = SignalState.HIGH; SpeakerSoundSignal = new AnalogOutputPin<byte>(0); _soundSampleCLK = SignalState.HIGH; TapeInputSignal = new AnalogInputPin<byte>(); TapeOuputSignal = new AnalogOutputPin<byte>(0); }
public void tryfire_oversubscribed_commands_should_return_false() { var bus = new CommandBus("local"); var bus2 = new CommandBus("remote"); var conn = new BusConnector(bus, bus2); long gotCmd = 0; long proccessedCmd = 0; long cancelPublished = 0; long cancelReturned = 0; bus.Subscribe(new AdHocCommandHandler <TestCommands.TestCommand>( cmd => { Interlocked.Increment(ref gotCmd); Task.Delay(250).Wait(); Interlocked.Increment(ref proccessedCmd); return(true); })); bus2.Subscribe(new AdHocCommandHandler <TestCommands.TestCommand>( cmd => { Interlocked.Increment(ref gotCmd); Task.Delay(250).Wait(); Interlocked.Increment(ref proccessedCmd); return(true); })); bus.Subscribe(new AdHocCommandHandler <TestCommands.TestCommand2>( cmd => { Interlocked.Increment(ref gotCmd); Task.Delay(250).Wait(); Interlocked.Increment(ref proccessedCmd); return(true); })); bus2.Subscribe(new AdHocHandler <Canceled>(c => Interlocked.Increment(ref cancelPublished))); bus2.Subscribe(new AdHocHandler <Fail>( c => { if (c.Exception is CommandCanceledException) { Interlocked.Increment(ref cancelReturned); } })); CommandResponse response; var timer = Stopwatch.StartNew(); var passed = bus.TryFire( new TestCommands.TestCommand(Guid.NewGuid(), null), out response, TimeSpan.FromMilliseconds(1500)); timer.Stop(); Assert.IsOrBecomesTrue(() => Interlocked.Read(ref gotCmd) <= 1, msg: "Expected command received no more than once, got " + gotCmd); Assert.True(timer.ElapsedMilliseconds < 1000, "Expected failure before task completion."); Assert.IsOrBecomesTrue(() => Interlocked.Read(ref proccessedCmd) == 0, msg: "Expected command failed before handled; got " + proccessedCmd); Assert.False(passed, "Expected false return"); Assert.IsType(typeof(Fail), response); Assert.IsType(typeof(CommandOversubscribedException), ((Fail)response).Exception); Assert.IsOrBecomesTrue(() => Interlocked.Read(ref proccessedCmd) <= 1, 1500, msg: "Expected command handled no more than once, actual" + proccessedCmd); Assert.IsOrBecomesTrue( () => Interlocked.Read(ref cancelPublished) == 1, msg: "Expected cancel published once"); Assert.IsOrBecomesTrue( () => Interlocked.Read(ref cancelReturned) == 1, msg: "Expected cancel returned once, actual " + cancelReturned); }