Example #1
0
 public override void Out(uint port, ushort value)
 {
     if (port == ((uint)(0x3B8)))
     {
         if ((value & 2) == 2 && mVideoMode != (int)VideoModes.Mode7_Text_BW_80x25)
         {
             VideoMode = (uint)VideoModes.Mode7_Text_BW_80x25;
         }
     } // CRT (6845) index register
     else if (((((((port == ((uint)(0x3D0))) || (port == ((uint)(0x3D2)))) || (port == ((uint)(0x3D4)))) || (port == ((uint)(0x3D6)))) || (port == +0x3B0)) || (port == ((uint)(0x3B2)))) || (port == ((uint)(0x3B4))))
     {
         CRT6845IndexRegister = (byte)(value & 31);
     } // CRT (6845) data register
     else if (((((((port == ((uint)(0x3D1))) || (port == ((uint)(0x3D3)))) || (port == ((uint)(0x3D5)))) || (port == ((uint)(0x3D7)))) || (port == +0x3B1)) || (port == ((uint)(0x3B3)))) || (port == ((uint)(0x3B5))))
     {
         CRT6845DataRegister[CRT6845IndexRegister] = (byte)(value & CtrlMask[CRT6845IndexRegister]);
         OnDataRegisterChanged();
     } // CGA mode control register  (except PCjr)
     else if ((port == ((uint)(0x3D8))) || (port == ((uint)(0x3B8))))
     {
         X8086.WordToBitsArray(value, CGAModeControlRegister);
         OnModeControlRegisterChanged();
     } // CGA palette register
     else if ((port == ((uint)(0x3D9))) || (port == ((uint)(0x3B9))))
     {
         X8086.WordToBitsArray(value, CGAPaletteRegister);
         OnPaletteRegisterChanged();
     } // CGA status register	EGA/VGA: input status 1 register / EGA/VGA feature control register
     else if ((port == ((uint)(0x3DA))) || (port == ((uint)(0x3BA))))
     {
         X8086.WordToBitsArray(value, CGAStatusRegister);
     } // The trigger is cleared by writing any value to port 03DBh (undocumented)
     else if (port == ((uint)(0x3DB)))
     {
         CGAStatusRegister[(int)CGAStatusRegisters.light_pen_trigger_set] = false;
     } // CRT/CPU page register  (PCjr only)
     else if (port == ((uint)(0x3DF)))
     {
         //Stop
     }
     else
     {
         base.CPU.RaiseException("CGA: Unknown Out Port: " + port.ToString("X4"));
     }
 }
Example #2
0
        public override void Reset()
        {
            X8086.WordToBitsArray((ushort)(0x29), CGAModeControlRegister);
            X8086.WordToBitsArray((ushort)(0x0), CGAColorControlRegister);
            CRT6845DataRegister[0]  = (byte)(0x71);
            CRT6845DataRegister[1]  = (byte)(0x50);
            CRT6845DataRegister[2]  = (byte)(0x5A);
            CRT6845DataRegister[3]  = (byte)(0xA);
            CRT6845DataRegister[4]  = (byte)(0x1F);
            CRT6845DataRegister[5]  = (byte)(0x6);
            CRT6845DataRegister[6]  = (byte)(0x19);
            CRT6845DataRegister[7]  = (byte)(0x1C);
            CRT6845DataRegister[8]  = (byte)(0x2);
            CRT6845DataRegister[9]  = (byte)(0x7);
            CRT6845DataRegister[10] = (byte)(0x6);
            CRT6845DataRegister[11] = (byte)(0x71);
            for (int i = 12; i <= 32 - 1; i++)
            {
                CRT6845DataRegister[i] = (byte)0;
            }

            //HandleCGAModeControlRegisterUpdated()
            InitVideoMemory(false);
        }