コード例 #1
0
ファイル: Program.cs プロジェクト: mmcgill/dcpu_sharp
        static void Main(string[] args)
        {
            if (args.Length == 0) {
                PrintUsage();
                Environment.Exit(1);
            }

            var keyboardState = new KeyboardState();
            var displayState = new DisplayState();
            IState state = ImmutableState.ReadFromFile(args[0]);
            state = state.Map((ushort)KeyboardState.BufferAddress,
                (ushort)(KeyboardState.BufferAddress + KeyboardState.BufferLength + 1),
                keyboardState);
            state = state.Map((ushort)DisplayState.DisplayAddress,
                (ushort)(DisplayState.DisplayAddress + DisplayState.Width * DisplayState.Height),
                displayState);
            _cpu = new Dcpu(state);

            var mainForm = new MainForm(_cpu, displayState);

            mainForm.FormClosed += new FormClosedEventHandler( (obj, arg) => _cpu.Stop());

            Application.EnableVisualStyles();
            Application.Run(mainForm);
        }
コード例 #2
0
ファイル: KeyboardState.cs プロジェクト: mmcgill/dcpu_sharp
 protected KeyboardState(KeyboardState prev, PersistentArray<ushort> ringBuffer)
     : base(prev)
 {
     _ringBuffer = ringBuffer;
 }