Beispiel #1
0
 /// <summary>
 /// Returns the current value of a graphics register.
 /// </summary>
 /// <param name="address">Address of register to read.</param>
 /// <returns>Current value of the register.</returns>
 public byte ReadRegister(GraphicsRegister address)
 {
     return(address switch
     {
         GraphicsRegister.SetReset => this.SetReset,
         GraphicsRegister.EnableSetReset => this.EnableSetReset,
         GraphicsRegister.ColorCompare => this.ColorCompare,
         GraphicsRegister.DataRotate => this.DataRotate,
         GraphicsRegister.ReadMapSelect => ReadMapSelect,
         GraphicsRegister.GraphicsMode => this.GraphicsMode,
         GraphicsRegister.MiscellaneousGraphics => this.MiscellaneousGraphics,
         GraphicsRegister.ColorDontCare => this.ColorDontCare,
         GraphicsRegister.BitMask => this.BitMask,
         _ => 0
     });
Beispiel #2
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;
            }
        }