Exemple #1
0
        public CpuBoardAsic(WpcCpuBoard.InitObject initObject)
        {
            foreach (var fieldInfo in typeof(OP).GetFields())
            {
                object value = fieldInfo.GetValue(null);

                if (value is ushort)
                {
                    if (!REVERSEOP.ContainsKey((ushort)value))
                    {
                        REVERSEOP.Add((ushort)value, fieldInfo.Name);
                    }
                }
            }

            interruptCallback = initObject.interruptCallback;
            pageMask          = PAGESIZE_MAP[initObject.romSizeMBit];
            //if (pageMask == 0)
            //{
            //    throw new Exception("PAGEMASK_EMPTY");
            //}
            Debug.Print("pageMask calculated pageMask: {0}, romSizeMBit: {1}", pageMask, initObject.romSizeMBit);
            ram = initObject.ram;
            hardwareHasSecurityPic = initObject.romObject != null && initObject.romObject?.hasSecurityPic == true;

            inputSwitchMatrix    = InputSwitchMatrix.getInstance();
            outputLampMatrix     = OutputLampMatrix.getInstance(Timing.CALL_UPDATELAMP_AFTER_TICKS);
            outputSolenoidMatrix = OutputSolenoidMatrix.getInstance(Timing.CALL_UPDATESOLENOID_AFTER_TICKS);

            bool isWpc95 = initObject.romObject != null && initObject.romObject?.wpc95 == true;

            outputGeneralIllumination = OutputGeneralIllumination.getInstance(isWpc95);
            securityPic             = SecurityPic.getInstance();
            periodicIRQTimerEnabled = true;
            romBank = 0;
            diagnosticLedToggleCount = 0;
            oldDiagnostigLedState    = 0;
            _firqSourceDmd           = false;
            irqCountGI             = 0;
            zeroCrossFlag          = 0;
            ticksZeroCross         = 0;
            memoryProtectionMask   = null;
            midnightMadnessMode    = new DateTimeOffset(DateTime.Now).ToUnixTimeMilliseconds();
            midnightModeEnabled    = false;
            blankSignalHigh        = true;
            watchdogTicks          = 0;
            watchdogExpiredCounter = 0;
            dipSwitchSetting       = DipSwitchCountry.USA;
        }
 public void Init()
 {
     securityPic = SecurityPic.getInstance(MACHINE_SERIAL);
 }