Exemple #1
0
        public override byte Read(byte value, ushort address)
        {
            switch (address)
            {
            case 0x5010:
                value   = 0;
                value  |= (byte)(interrupt ? 0x80 : 0x00);
                irqTrip = false;
                break;

            case 0x5015:
                value  = 0;
                value |= square1.Read(0, 0);
                value |= (byte)(square2.Read(0, 0) << 1);
                break;
            }
            if (readMode && address >= 0x8000 && address <= 0xBFFF)
            {
                if (value == 0)
                {
                    irqTrip = true;
                }
                else
                {
                    nes.APU.Update();
                    pcmData = value;
                }
            }
            return(value);
        }
Exemple #2
0
        public byte Read()
        {
            byte nextByte = 0;

            nextByte |= square1.Read(0, 0);
            nextByte |= (byte)(square2.Read(0, 0) << 1);
            nextByte |= (byte)(triangle.Read(0, 0) << 2);
            nextByte |= (byte)(noise.Read(0, 0) << 3);
            nextByte |= dmc.Read(0, 0);
            if (frameIRQ)
            {
                nextByte |= 0x40;
            }
            frameIRQ = false;
            return(nextByte);
        }