Example #1
0
File: SMS.cs Project: m35/BizHawk
        private void WritePort(ushort port, byte value)
        {
            port &= 0xFF;
            if (port < 0x40)             // general IO ports
            {
                switch (port & 0xFF)
                {
                case 0x01: Port01 = value; break;

                case 0x02: Port02 = value; break;

                case 0x03: p3_write = true; Port03 = value; break;

                case 0x04: /*Port04 = value;*/ break;                         // receive port, not sure what writing does

                case 0x05: Port05 = (byte)(value & 0xF8); break;

                case 0x06: PSG.Set_Panning(value); break;

                case 0x3E: Port3E = value; break;

                case 0x3F: Port3F = value; break;
                }
            }
            else if (port < 0x80)             // PSG
            {
                PSG.WriteReg(value);
            }
            else if (port < 0xC0)             // VDP
            {
                if ((port & 1) == 0)
                {
                    Vdp.WriteVdpData(value);
                }
                else
                {
                    Vdp.WriteVdpControl(value);
                }
            }
            else if (port == 0xDE && PortDEEnabled)
            {
                PortDE = value;
            }
            else if (port == 0xF0 && HasYM2413)
            {
                YM2413.RegisterLatch = value;
            }
            else if (port == 0xF1 && HasYM2413)
            {
                YM2413.Write(value);
            }
            else if (port == 0xF2 && HasYM2413)
            {
                YM2413.DetectionValue = value;
            }
        }
Example #2
0
        private void WritePort(ushort port, byte value)
        {
            port &= 0xFF;
            if (port < 0x40)             // general IO ports
            {
                switch (port & 0xFF)
                {
                case 0x01: Port01 = value; break;

                case 0x02: Port02 = value; break;

                case 0x05: Port05 = value; break;

                case 0x06: PSG.Set_Panning(value); break;

                case 0x3E: Port3E = value; break;

                case 0x3F: Port3F = value; break;
                }
            }
            else if (port < 0x80)             // PSG
            {
                PSG.WriteReg(value);
            }
            else if (port < 0xC0)             // VDP
            {
                if ((port & 1) == 0)
                {
                    Vdp.WriteVdpData(value);
                }
                else
                {
                    Vdp.WriteVdpControl(value);
                }
            }
            else if (port == 0xDE && PortDEEnabled)
            {
                PortDE = value;
            }
            else if (port == 0xF0 && HasYM2413)
            {
                YM2413.RegisterLatch = value;
            }
            else if (port == 0xF1 && HasYM2413)
            {
                YM2413.Write(value);
            }
            else if (port == 0xF2 && HasYM2413)
            {
                YM2413.DetectionValue = value;
            }
        }