예제 #1
0
파일: Tile.cs 프로젝트: Zindre17/GameBoi
        public Byte GetColorCode(Byte x, Byte y)
        {
            if (x > 7)
            {
                throw new ArgumentOutOfRangeException(nameof(x), "x must be between 0 and 7");
            }
            if (y > 7)
            {
                throw new ArgumentOutOfRangeException(nameof(y), "y must be between 0 and 7");
            }

            Byte result = 0;

            Byte rowIndex = y * 2;

            if (data[rowIndex + 1].Read()[7 - x])
            {
                result |= 2;
            }
            if (data[rowIndex].Read()[7 - x])
            {
                result |= 1;
            }

            return(result);
        }
예제 #2
0
        private void SetRomBankNr(Byte value)
        {
            var bankNr = value & 0x0F;

            if (bankNr == 0)
            {
                bankNr = 1;
            }
            romBanks.Switch(bankNr % romBankCount);
        }
예제 #3
0
        protected override void OnBank0Write(Address address, Byte value)
        {
            Byte highByte = GetHighByte(address);

            if (highByte[0])
            {
                SetRomBankNr(value);
            }
            else
            {
                ToggleRam(value);
            }
        }
예제 #4
0
        public void Initialize()
        {
            initialVolume = data >> 4;
            isIncrease    = data[3];
            Byte stepLengthData = data & 7;

            if (stepLengthData == 0 || (isIncrease && initialVolume == 0xF) || (!isIncrease && initialVolume == 0))
            {
                isActive = false;
            }
            else
            {
                var secondsPerStep = stepLengthData / 64d;
                cyclesPerStep = (int)(secondsPerStep * Statics.Frequencies.cpuSpeed);
                isActive      = true;
            }
        }
예제 #5
0
        public Address GetVolume(int elapsedCycles)
        {
            Byte currentVolume = initialVolume;

            if (isActive)
            {
                int steps = elapsedCycles / cyclesPerStep;
                if (isIncrease)
                {
                    currentVolume = Math.Min(0x0F, initialVolume + steps);
                }
                else
                {
                    currentVolume = Math.Max(0, initialVolume - steps);
                }
            }
            return(ScaleVolume(currentVolume));
        }
예제 #6
0
파일: RTC.cs 프로젝트: Zindre17/GameBoi
 public void Write(Address address, Byte value, bool isCpu = false)
 {
 }
예제 #7
0
 public override void Write(Address address, Byte value, bool isCpu = false)
 {
     base.Write(address % RAMSize, value, isCpu);
 }
예제 #8
0
 protected override void OnBank1Write(Address address, Byte value)
 {
 }
예제 #9
0
        private void ToggleRam(Byte value)
        {
            var lowNibble = GetLowNibble(value);

            ((MbcRam)ramBanks).isEnabled = lowNibble == 0b1010;
        }
예제 #10
0
파일: Tile.cs 프로젝트: Zindre17/GameBoi
 public void Write(Address address, Byte value, bool isCpu = false) => data[address].Write(value);