Exemplo n.º 1
0
        // CONSTRUCTOR

        internal Clock(Computer Computer, Z80.Z80 Cpu, ITimer Timer, InterruptManager InterruptManager, ulong TicksPerSoundSample, Action SoundCallback)
        {
            InitTickMeasurement(Timer.TicksPerSecond);

            TickCount = 0;

            computer = Computer;
            cpu      = Cpu;
            timer    = Timer;
            intMgr   = InterruptManager;

            ticksPerSoundSample = TicksPerSoundSample;
            soundCallback       = SoundCallback;
            clockSpeed          = ClockSpeed.Normal;

            nextRtcIrqTick = TICKS_PER_IRQ;

            ResetTriggers();

            waitTrigger = new Trigger(null,
                                      null,
                                      TriggerLock: false,
                                      CanLatchBeforeEnabled: false)
            {
                Enabled = true
            };
        }
Exemplo n.º 2
0
 public void Initialize(FloppyController FloppyController, InterruptManager InterruptManager, Tape Tape, Printer Printer)
 {
     floppyController = FloppyController;
     intMgr           = InterruptManager;
     tape             = Tape;
     printer          = Printer;
     Reset();
 }
Exemplo n.º 3
0
        // CONSTRUCTOR

        public Computer(IScreen Screen, ISound Sound, ITimer Timer, ISettings Settings, IDialogs Dialogs)
        {
            ulong ticksPerSoundSample = Clock.TICKS_PER_SECOND / (ulong)Sound.SampleRate;

            HasRunYet = false;

            screen   = Screen;
            settings = Settings;
            dialogs  = Dialogs;
            sound    = Sound;

            Storage.Initialize(settings, dialogs);

            memory    = new Memory();
            intMgr    = new InterruptManager(this);
            this.tape = new Tape(this);
            ports     = new PortSet(this);
            cpu       = new Z80.Z80(this);
            printer   = new Printer();

            if (sound.Stopped)
            {
                sound = new SoundNull();
            }
            else
            {
                sound.SampleCallback = ports.CassetteOut;
            }

            clock = new Clock(this,
                              cpu,
                              Timer,
                              intMgr,
                              ticksPerSoundSample,
                              Sound.Sample);

            clock.SpeedChanged += () => Sound.Mute = clock.ClockSpeed != ClockSpeed.Normal;

            DiskUserEnabled = Settings.DiskEnabled;

            floppyController = new FloppyController(this, ports, clock, intMgr, Sound, DiskUserEnabled);

            intMgr.Initialize(ports, this.tape);
            this.tape.Initialize(clock, intMgr);
            ports.Initialize(floppyController, intMgr, this.tape, printer);

            for (byte i = 0; i < 4; i++)
            {
                LoadFloppy(i);
            }

            var tape = Storage.LastTapeFile;

            if (tape.Length > 0 && File.Exists(tape))
            {
                TapeLoad(tape);
            }

            DriveNoise   = Settings.DriveNoise;
            BreakPoint   = Settings.Breakpoint;
            BreakPointOn = Settings.BreakpointOn;
            SoundOn      = Settings.SoundOn;
            ClockSpeed   = Settings.ClockSpeed;
            Ready        = true;
        }
Exemplo n.º 4
0
 public void Initialize(Clock Clock, InterruptManager InterruptManager)
 {
     clock  = Clock;
     intMgr = InterruptManager;
     InitTape();
 }