Пример #1
0
 private protected VideoMode(int width, int height, VideoMode baseMode)
 {
     this.Width               = width;
     this.Height              = height;
     this.BitsPerPixel        = baseMode.BitsPerPixel;
     this.IsPlanar            = baseMode.IsPlanar;
     this.FontHeight          = baseMode.FontHeight;
     this.VideoModeType       = baseMode.VideoModeType;
     this.dac                 = baseMode.dac;
     this.crtController       = baseMode.crtController;
     this.attributeController = baseMode.attributeController;
     this.VideoRam            = baseMode.VideoRam;
 }
Пример #2
0
        public byte ReadByte(int port)
        {
            switch (port)
            {
            case Ports.DacAddressReadMode:
                return(Dac.ReadIndex);

            case Ports.DacAddressWriteMode:
                return(Dac.WriteIndex);

            case Ports.DacData:
                return(Dac.Read());

            case Ports.GraphicsControllerAddress:
                return((byte)graphicsRegister);

            case Ports.GraphicsControllerData:
                return(Graphics.ReadRegister(graphicsRegister));

            case Ports.SequencerAddress:
                return((byte)sequencerRegister);

            case Ports.SequencerData:
                return(Sequencer.ReadRegister(sequencerRegister));

            case Ports.AttributeAddress:
                return((byte)attributeRegister);

            case Ports.AttributeData:
                return(AttributeController.ReadRegister(attributeRegister));

            case Ports.CrtControllerAddress:
            case Ports.CrtControllerAddressAlt:
                return((byte)crtRegister);

            case Ports.CrtControllerData:
            case Ports.CrtControllerDataAlt:
                return(CrtController.ReadRegister(crtRegister));

            case Ports.InputStatus1Read:
            case Ports.InputStatus1ReadAlt:
                attributeDataMode = false;
                return(GetInputStatus1Value());

            default:
                return(0);
            }
        }
Пример #3
0
        private protected VideoMode(int width, int height, int bpp, bool planar, int fontHeight, VideoModeType modeType, VideoHandler video)
        {
            this.Width               = width;
            this.Height              = height;
            this.OriginalHeight      = height;
            this.BitsPerPixel        = bpp;
            this.IsPlanar            = planar;
            this.FontHeight          = fontHeight;
            this.VideoModeType       = modeType;
            this.dac                 = video.Dac;
            this.crtController       = video.CrtController;
            this.attributeController = video.AttributeController;
            this.VideoRam            = GetVideoRamPointer(video);

            InitializeFont(video.VirtualMachine.PhysicalMemory);
        }
Пример #4
0
        public void WriteByte(int port, byte value)
        {
            switch (port)
            {
            case Ports.DacAddressReadMode:
                Dac.ReadIndex = value;
                break;

            case Ports.DacAddressWriteMode:
                Dac.WriteIndex = value;
                break;

            case Ports.DacData:
                Dac.Write(value);
                break;

            case Ports.GraphicsControllerAddress:
                graphicsRegister = (GraphicsRegister)value;
                break;

            case Ports.GraphicsControllerData:
                Graphics.WriteRegister(graphicsRegister, value);
                break;

            case Ports.SequencerAddress:
                sequencerRegister = (SequencerRegister)value;
                break;

            case Ports.SequencerData:
                var previousMode = Sequencer.SequencerMemoryMode;
                Sequencer.WriteRegister(sequencerRegister, value);
                if ((previousMode & SequencerMemoryMode.Chain4) == SequencerMemoryMode.Chain4 && (Sequencer.SequencerMemoryMode & SequencerMemoryMode.Chain4) == 0)
                {
                    EnterModeX();
                }
                break;

            case Ports.AttributeAddress:
                if (!attributeDataMode)
                {
                    attributeRegister = (AttributeControllerRegister)(value & 0x1F);
                }
                else
                {
                    AttributeController.WriteRegister(attributeRegister, value);
                }
                attributeDataMode = !attributeDataMode;
                break;

            case Ports.AttributeData:
                AttributeController.WriteRegister(attributeRegister, value);
                break;

            case Ports.CrtControllerAddress:
            case Ports.CrtControllerAddressAlt:
                crtRegister = (CrtControllerRegister)value;
                break;

            case Ports.CrtControllerData:
            case Ports.CrtControllerDataAlt:
                int previousVerticalEnd = CrtController.VerticalDisplayEnd;
                CrtController.WriteRegister(crtRegister, value);
                if (previousVerticalEnd != CrtController.VerticalDisplayEnd)
                {
                    ChangeVerticalEnd();
                }
                break;
            }
        }