Exemplo n.º 1
0
        public GameboyComponent(IApp app)
        {
            this.gamepad_ = app.Input.Controller;

            this.lcd_ = new Lcd();
            this.mmu_ =
                new Mmu(new MemoryMap(new IoAddresses(new SerialBus())),
                        new Registers());
            var opcodes = new Opcodes(this.mmu_);

            this.cpu_ = new Cpu(this.lcd_, this.mmu_, opcodes);
            this.cpu_.OnEnterVblank += () => {
                if (!this.pboCacheDirty_)
                {
                    return;
                }
                this.pbo_.SetAllPixels(this.lcd_.PixelData);
                this.pboCacheDirty_ = false;
            };

            this.apu_ = new Apu();
            app.Audio.Factory.NewAudioStreamSource(this.apu_.BufferSubject,
                                                   2,
                                                   1,
                                                   Apu.FREQUENCY,
                                                   10,
                                                   Apu.FREQUENCY);

            var outputPath =
                "R:/Documents/CSharpWorkspace/FinCSharp/FinCSharpTests/tst/emulation/gb/blargg/output.txt";

            this.writer_ = new StreamWriter(outputPath);

            this.pbo_ = app.Graphics.Textures.Create(201, 144);
        }
Exemplo n.º 2
0
        public Cpu(Lcd lcd, Mmu memory, IOpcodes opcodes)
        {
            this.lcd_     = lcd;
            this.memory_  = memory;
            this.opcodes_ = opcodes;

            this.MemoryMap   = this.memory_.MemoryMap;
            this.IoAddresses = this.MemoryMap.IoAddresses;

            this.Reset();
        }