Exemple #1
0
        public void Connect(Assemblage.IN8 CPU, params byte[] ports)
        {
            if (ports.Length != 2) throw new InvalidOperationException("ICM-CD2 display must be connected to 2 ports");
            this.CPU = CPU;
            dataPort = ports[0];
            controlPort = ports[1];

            CPU.AttachHardware(this, ports);
        }
        public VisualHardwareGrid(Assemblage.IN8 CPU)
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            this.IsMouseVisible = true;

            this.CPU = CPU;

            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;
        }
        public VisualHardwareHost(System.Type hostedHardwareType, Assemblage.IN8 CPU, params byte[] ports)
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            this.CPU = CPU;
            this.ports = ports;

            screenDevice = Activator.CreateInstance(hostedHardwareType) as IVisualHardware;
            if (screenDevice == null) throw new InvalidProgramException("Cannot host devices that are not visual hardware.");

            screenDevice.Connect(CPU, ports);
            var size = screenDevice.PreferredWindowSize;

            graphics.PreferredBackBufferHeight = (int)size.X;
            graphics.PreferredBackBufferWidth = (int)size.Y;
        }