Ejemplo n.º 1
0
        public void CheckVideoRamReadReturnsWritten()
        {
            var ram = new VideoRam(null, 0, 0x0000, 0x100);

            ram.Write(0x0001, 0x59);
            Assert.AreEqual(0x59, ram.Read(0x0001));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Performs any necessary initialization upon entering the video mode.
        /// </summary>
        /// <param name="video">The video device.</param>
        internal virtual void InitializeMode(VideoHandler video)
        {
            video.VirtualMachine.PhysicalMemory.Bios.CharacterPointHeight = (ushort)this.FontHeight;

            unsafe
            {
                byte *ptr = (byte *)VideoRam.ToPointer();
                for (int i = 0; i < VideoHandler.TotalVramBytes; i++)
                {
                    ptr[i] = 0;
                }
            }

            int stride;

            if (this.VideoModeType == VideoModeType.Text)
            {
                video.TextConsole.Width  = this.Width;
                video.TextConsole.Height = this.Height;
                stride = this.Width * 2;
            }
            else
            {
                video.TextConsole.Width  = this.Width / 8;
                video.TextConsole.Height = this.Height / this.FontHeight;
                if (this.BitsPerPixel < 8)
                {
                    stride = this.Width / 8;
                }
                else
                {
                    stride = this.Width;
                }
            }

            crtController.Overflow        = (1 << 4);
            crtController.MaximumScanLine = (1 << 6);
            crtController.LineCompare     = 0xFF;
            crtController.Offset          = (byte)(stride / 2u);
            crtController.StartAddress    = 0;
            video.Graphics.BitMask        = 0xFF;
        }
Ejemplo n.º 3
0
        public void CheckCanReadVideoRam()
        {
            var ram = new VideoRam(null, 0, 0x0000, 0x100);

            Assert.IsTrue(ram.CanRead);
        }