示例#1
0
        protected virtual void OnModeControlRegisterChanged()
        {
            // http://www.seasip.info/VintagePC/cga.html
            uint       v       = (uint)(X8086.BitsArrayToWord(CGAModeControlRegister));
            VideoModes newMode = (VideoModes)(v & 0x17); // 10111

            if ((v & vidModeChangeFlag) != 0 && (int)newMode != mVideoMode)
            {
                VideoMode = (uint)newMode;
            }

            mVideoEnabled = CGAModeControlRegister[(int)CGAModeControlRegisters.video_enabled] || VideoMode == (int)VideoModes.Mode7_Text_BW_80x25;
        }
示例#2
0
        protected virtual void OnPaletteRegisterChanged()
        {
            if (MainMode == MainModes.Text)
            {
                CGAPalette = (Color[])(CGABasePalette.Clone());
            }
            else
            {
                Color[] colors      = null;
                uint    cgaModeReg  = (uint)(X8086.BitsArrayToWord(CGAModeControlRegister));
                uint    cgaColorReg = (uint)(X8086.BitsArrayToWord(CGAPaletteRegister));

                if (VideoMode == ((uint)VideoModes.Mode4_Graphic_Color_320x200))
                {
                    int intense = (int)((cgaColorReg & 0x10) >> 1);
                    int pal1    = (int)((cgaColorReg >> 5) & (~(cgaModeReg >> 2)) & 1);
                    int pal2    = (int)(((~cgaColorReg) >> 5) & (~(cgaModeReg >> 2)) & 1);

                    colors = new Color[] {
                        CGABasePalette[cgaColorReg & 0xF],
                        CGABasePalette[3 ^ pal2 | intense],
                        CGABasePalette[4 ^ pal1 | intense],
                        CGABasePalette[7 ^ pal2 | intense]
                    };
                }
                else if (VideoMode == ((uint)VideoModes.Mode6_Graphic_Color_640x200))
                {
                    colors = new Color[] {
                        CGABasePalette[0],
                        CGABasePalette[cgaColorReg & 0xF]
                    };
                }

                if (colors != null)
                {
                    for (int i = 0; i <= colors.Length - 1; i++)
                    {
                        CGAPalette[i] = colors[i];
                    }
                }
            }
        }
示例#3
0
        public override ushort In(uint port)
        {
            if ((((port == ((uint)(0x3D0))) || (port == ((uint)(0x3D2)))) || (port == ((uint)(0x3D4)))) || (port == ((uint)(0x3D6)))) // CRT (6845) index register
            {
                return((ushort)(CRT6845IndexRegister));
            } // CRT (6845) data register
            else if (((((port == ((uint)(0x3D1))) || (port == ((uint)(0x3D3)))) || (port == ((uint)(0x3D5)))) || (port == ((uint)(0x3D7)))) || (port == ((uint)(0x3B5))))
            {
                return((ushort)(CRT6845DataRegister[CRT6845IndexRegister]));
            } // CGA mode control register  (except PCjr)
            else if (port == ((uint)(0x3D8)))
            {
                return(X8086.BitsArrayToWord(CGAModeControlRegister));
            } // CGA palette register
            else if (port == ((uint)(0x3D9)))
            {
                return(X8086.BitsArrayToWord(CGAPaletteRegister));
            } // CGA status register
            else if ((port == ((uint)(0x3DA))) || (port == ((uint)(0x3BA))))
            {
                UpdateStatusRegister();
                return(X8086.BitsArrayToWord(CGAStatusRegister));
            } // CRT/CPU page register  (PCjr only)
            else if (port == ((uint)(0x3DF)))
            {
#if DEBUG
                //stop
#endif
            }
            else
            {
                base.CPU.RaiseException("CGA: Unknown In Port: " + port.ToString("X4"));
            }

            return((ushort)(0xFF));
        }