Beispiel #1
0
        /// <summary>
        /// Signs that the device has been attached to the Spectrum virtual machine
        /// </summary>
        public void OnAttachedToVm(ISpectrumVm hostVm)
        {
            HostVm             = hostVm;
            _borderDevice      = hostVm.BorderDevice;
            _fetchScreenMemory = hostVm.MemoryDevice.OnUlaReadMemory;
            InitializeUlaTactTable();
            _flashPhase = false;
            FrameCount  = 0;

            // --- Calculate color conversion table
            _flashOffColors = new int[0x200];
            _flashOnColors  = new int[0x200];

            for (var attr = 0; attr < 0x100; attr++)
            {
                var ink   = (attr & 0x07) | ((attr & 0x40) >> 3);
                var paper = ((attr & 0x38) >> 3) | ((attr & 0x40) >> 3);
                _flashOffColors[attr]         = paper;
                _flashOffColors[0x100 + attr] = ink;
                _flashOnColors[attr]          = (attr & 0x80) != 0 ? ink : paper;
                _flashOnColors[0x100 + attr]  = (attr & 0x80) != 0 ? paper : ink;
            }

            _screenWidth = hostVm.ScreenDevice.ScreenConfiguration.ScreenWidth;
            _pixelBuffer = new byte[_screenWidth * hostVm.ScreenDevice.ScreenConfiguration.ScreenLines];
        }
Beispiel #2
0
 /// <summary>
 /// Signs that the device has been attached to the Spectrum virtual machine
 /// </summary>
 public void OnAttachedToVm(ISpectrumVm hostVm)
 {
     HostVm          = hostVm;
     _cpu            = hostVm.Cpu;
     _borderDevice   = hostVm.BorderDevice;
     _beeperDevice   = hostVm.BeeperDevice;
     _keyboardDevice = hostVm.KeyboardDevice;
     _tapeDevice     = hostVm.TapeDevice;
 }