Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Intel8080Registers"/> class.
        /// </summary>
        /// <param name="initialState">The initial state.</param>
        /// <param name="platformConfig">The platform configuration.</param>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        public Intel8080Registers(Intel8080RegisterState initialState, IPlatformConfig platformConfig)
        {
            _initialState = initialState;

            IFlagsRegister flagsRegister;

            switch (platformConfig.CpuMode)
            {
            case CpuMode.Intel8080:
            case CpuMode.Z80:
                flagsRegister = new Intel8080FlagsRegister();
                break;

            case CpuMode.GameBoy:
                flagsRegister = new GameBoyFlagsRegister();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            GeneralPurposeRegisters      = new GeneralPurposeRegisterSet();
            AccumulatorAndFlagsRegisters = new AccumulatorAndFlagsRegisterSet(flagsRegister);
            Reset();
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Z80Registers"/> class.
        /// </summary>
        /// <param name="initialState">The initial state.</param>
        public Z80Registers(Z80RegisterState initialState)
        {
            _initialState = initialState;
            _primaryGeneralPurposeRegisterSet          = new GeneralPurposeRegisterSet();
            _alternativeGeneralPurposeRegisterSet      = new GeneralPurposeRegisterSet();
            _primaryAccumulatorAndFlagsRegisterSet     = new AccumulatorAndFlagsRegisterSet(new Intel8080FlagsRegister());
            _alternativeAccumulatorAndFlagsRegisterSet = new AccumulatorAndFlagsRegisterSet(new Intel8080FlagsRegister());

            Reset();
        }