Example #1
0
        public override void Replay(AltoSystem system, ExecutionController controller)
        {
            //
            // Press all requested keys simultaneously, then release them.
            //
            foreach (AltoKey key in _keys)
            {
                if (_keyDown)
                {
                    system.Keyboard.KeyDown(key);
                }
                else
                {
                    system.Keyboard.KeyUp(key);
                }
            }

            if (_keyDown)
            {
                // Delay 50ms, then repeat for keyup
                _keyDown   = false;
                _completed = false;
                _timestamp = 50 * Conversion.MsecToNsec;
            }
            else
            {
                _completed = true;
            }
        }
Example #2
0
        public SdlConsole(AltoSystem system)
        {
            _system = system;

            _controller = new ExecutionController(_system);
            _controller.ErrorCallback += OnExecutionError;
        }
Example #3
0
        public DoverROS(AltoSystem system)
        {
            _system           = system;
            _printEngineEvent = new Event(0, null, PrintEngineCallback);

            Reset();
        }
Example #4
0
        public TridentDrive(AltoSystem system)
        {
            _system = system;

            _seekEvent = new Event(0, null, SeekCallback);
            Reset();
        }
Example #5
0
        public ScriptRecorder(AltoSystem system, string scriptFile)
        {
            _script        = new ScriptWriter(scriptFile);
            _system        = system;
            _lastTimestamp = 0;

            _firstTime = true;
        }
Example #6
0
        public OrbitController(AltoSystem system)
        {
            _system       = system;
            _ros          = new DoverROS(system);
            _refreshEvent = new Event(_refreshInterval, null, RefreshCallback);

            Reset();
        }
Example #7
0
        public ScriptPlayback(string scriptFile, AltoSystem system, ExecutionController controller)
        {
            _scriptReader = new ScriptReader(scriptFile);
            _system       = system;
            _controller   = controller;

            _currentAction = null;

            _stopPlayback = false;
        }
Example #8
0
        public DiskController(AltoSystem system)
        {
            _system = system;

            // Load the drives
            _drives    = new DiabloDrive[2];
            _drives[0] = new DiabloDrive(_system);
            _drives[1] = new DiabloDrive(_system);

            Reset();
        }
Example #9
0
        public SdlConsole(AltoSystem system)
        {
            _system = system;

            _controller = new ExecutionController(_system);
            _controller.ErrorCallback    += OnExecutionError;
            _controller.ShutdownCallback += OnShutdown;

            _commitDisksAtShutdown = true;

            ScriptManager.PlaybackCompleted += OnScriptPlaybackCompleted;
        }
Example #10
0
        public override void Replay(AltoSystem system, ExecutionController controller)
        {
            if (_keyDown)
            {
                system.Keyboard.KeyDown(_key);
            }
            else
            {
                system.Keyboard.KeyUp(_key);
            }

            _completed = true;
        }
Example #11
0
        public override void Replay(AltoSystem system, ExecutionController controller)
        {
            if (_mouseDown)
            {
                system.MouseAndKeyset.MouseDown(_buttons);
            }
            else
            {
                system.MouseAndKeyset.MouseUp(_buttons);
            }

            _completed = true;
        }
Example #12
0
        public static void StartPlayback(AltoSystem system, ExecutionController controller, string scriptPath)
        {
            // Stop any pending actions
            StopRecording();
            StopPlayback();

            _scheduler.Reset();

            _scriptPlayback = new ScriptPlayback(scriptPath, system, controller);
            _scriptPlayback.PlaybackCompleted += OnPlaybackCompleted;
            _scriptPlayback.Start();

            Log.Write(LogComponent.Scripting, "Starting playback of {0}", scriptPath);
        }
Example #13
0
        public override void Replay(AltoSystem system, ExecutionController controller)
        {
            if (_absolute)
            {
                //
                // We stuff the x/y coordinates into the well-defined memory locations for the mouse coordinates.
                //
                system.Memory.Load(0x114, (ushort)_dx, CPU.TaskType.Emulator, false);
                system.Memory.Load(0x115, (ushort)_dy, CPU.TaskType.Emulator, false);
            }
            else
            {
                system.MouseAndKeyset.MouseMove(_dx, _dy);
            }

            _completed = true;
        }
Example #14
0
        public AltoCPU(AltoSystem system)
        {
            _system = system;

            _tasks[(int)TaskType.Emulator]          = new EmulatorTask(this);
            _tasks[(int)TaskType.DiskSector]        = new DiskTask(this, true);
            _tasks[(int)TaskType.DiskWord]          = new DiskTask(this, false);
            _tasks[(int)TaskType.DisplayWord]       = new DisplayWordTask(this);
            _tasks[(int)TaskType.DisplayHorizontal] = new DisplayHorizontalTask(this);
            _tasks[(int)TaskType.DisplayVertical]   = new DisplayVerticalTask(this);
            _tasks[(int)TaskType.Cursor]            = new CursorTask(this);
            _tasks[(int)TaskType.MemoryRefresh]     = new MemoryRefreshTask(this);
            _tasks[(int)TaskType.Ethernet]          = new EthernetTask(this);
            _tasks[(int)TaskType.Parity]            = new ParityTask(this);

            Reset();
        }
Example #15
0
        public EthernetController(AltoSystem system)
        {
            _system = system;

            _receiverLock = new System.Threading.ReaderWriterLockSlim();

            _fifo = new Queue <ushort>();

            _fifoTransmitWakeupEvent = new Event(_fifoTransmitDuration, null, OutputFifoCallback);

            // Attach real Ethernet device if user has specified one, otherwise leave unattached; output data
            // will go into a bit-bucket.
            try
            {
                switch (Configuration.HostPacketInterfaceType)
                {
                case PacketInterfaceType.UDPEncapsulation:
                    _hostInterface = new UDPEncapsulation(Configuration.HostPacketInterfaceName);
                    _hostInterface.RegisterReceiveCallback(OnHostPacketReceived);
                    break;

                case PacketInterfaceType.EthernetEncapsulation:
                    _hostInterface = new HostEthernetEncapsulation(Configuration.HostPacketInterfaceName);
                    _hostInterface.RegisterReceiveCallback(OnHostPacketReceived);
                    break;

                default:
                    _hostInterface = null;
                    break;
                }
            }
            catch (Exception e)
            {
                _hostInterface = null;
                Log.Write(LogComponent.HostNetworkInterface, "Unable to configure network interface.  Error {0}", e.Message);
            }

            // More words than the Alto will ever send.
            _outputData = new ushort[4096];

            _nextPackets = new Queue <MemoryStream>();

            _inputPollEvent = new Event(_inputPollPeriod, null, InputHandler);

            Reset();
        }
        public TridentController(AltoSystem system)
        {
            _system = system;

            //
            // We initialize 16 drives even though the
            // controller only technically supports 8.
            // TODO: detail
            //
            _drives = new TridentDrive[16];

            for (int i = 0; i < _drives.Length; i++)
            {
                _drives[i] = new TridentDrive(system);
            }

            Reset();
        }
Example #17
0
        public static void StartRecording(AltoSystem system, string scriptPath)
        {
            // Stop any pending actions
            StopRecording();
            StopPlayback();

            _scriptRecorder = new ScriptRecorder(system, scriptPath);

            Log.Write(LogComponent.Scripting, "Starting recording to {0}", scriptPath);

            //
            // Record the absolute position of the mouse (as held in MOUSELOC in system memory).
            // All other mouse movements in the script will be recorded relative to this point.
            //
            int x = system.Memory.Read(0x114, CPU.TaskType.Ethernet, false);
            int y = system.Memory.Read(0x115, CPU.TaskType.Ethernet, false);

            _scriptRecorder.MouseMoveAbsolute(x, y);
        }
Example #18
0
        public override void Replay(AltoSystem system, ExecutionController controller)
        {
            if (_currentStroke >= _strokes.Count)
            {
                _completed = true;
            }
            else
            {
                Keystroke stroke = _strokes[_currentStroke++];

                if (stroke.Type == StrokeType.KeyDown)
                {
                    system.Keyboard.KeyDown(stroke.Key);
                }
                else
                {
                    system.Keyboard.KeyUp(stroke.Key);
                }

                // Delay 50ms before the next key
                _timestamp = 50 * Conversion.MsecToNsec;
            }
        }
Example #19
0
        public override void Replay(AltoSystem system, ExecutionController controller)
        {
            //
            // Execute the command.
            //
            // TODO: recreating these objects each time through is uncool.
            //
            ControlCommands controlCommands = new ControlCommands(system, controller);
            CommandExecutor executor        = new CommandExecutor(controlCommands);

            CommandResult res = executor.ExecuteCommand(_commandString);

            if (res == CommandResult.Quit ||
                res == CommandResult.QuitNoSave)
            {
                //
                // Force an exit, commit disks if result was Quit.
                //
                throw new ShutdownException(res == CommandResult.Quit);
            }

            _completed = true;
        }
Example #20
0
 public MouseAndKeyset(AltoSystem system)
 {
     _system = system;
     _lock   = new ReaderWriterLockSlim();
     Reset();
 }
Example #21
0
 public AudioDAC(AltoSystem system)
 {
     _system    = system;
     _dacOutput = new Queue <ushort>(16384);
 }
Example #22
0
 public Music(AltoSystem system)
 {
     //_musicIo = new FileStream("c:\\alto\\mus.snd", FileMode.Create, FileAccess.ReadWrite);
     _system = system;
     Reset();
 }
Example #23
0
 public override void Replay(AltoSystem system, ExecutionController controller)
 {
     // This is a no-op.
     _completed = true;
 }
Example #24
0
 /// <summary>
 /// Replays a single step of the action.  If the action is completed,
 /// Completed will be true afterwards.
 /// </summary>
 /// <param name="system"></param>
 /// <param name="controller"></param>
 public abstract void Replay(AltoSystem system, ExecutionController controller);
Example #25
0
 public void AttachSystem(AltoSystem system)
 {
     _system = system;
     _system.AttachDisplay(this);
 }
 public DisplayController(AltoSystem system)
 {
     _system = system;
     Reset();
 }
Example #27
0
 public DiabloDrive(AltoSystem system)
 {
     _system = system;
     Reset();
 }
Example #28
0
 public ControlCommands(AltoSystem system, ExecutionController controller)
 {
     _system     = system;
     _controller = controller;
 }
Example #29
0
 public OrganKeyboard(AltoSystem system)
 {
     _system = system;
     Reset();
 }