Esempio n. 1
0
        public void CloneWorksAsExpectedWithChangedBanks()
        {
            // --- Arrange
            var dev = new SpectrumP3MemoryDevice();

            dev.OnAttachedToVm(null);
            dev.Reset();

            for (var i = 0; i < 0x4000; i++)
            {
                dev.CurrentRom[i] = 0xFC;
                for (var b = 0; b < 8; b++)
                {
                    dev.RamBanks[b][i] = (byte)b;
                }
            }
            dev.PageIn(3, 4);

            // --- Act
            var cloned = dev.CloneMemory();

            // -- Assert
            for (var i = 0; i <= 0x3FFF; i++)
            {
                cloned[i].ShouldBe((byte)0xFC);
            }
            for (var i = 0x4000; i <= 0x7FFF; i++)
            {
                cloned[i].ShouldBe((byte)0x05);
            }
            for (var i = 0x8000; i <= 0xBFFF; i++)
            {
                cloned[i].ShouldBe((byte)0x02);
            }
            for (var i = 0xC000; i <= 0xFFFF; i++)
            {
                cloned[i].ShouldBe((byte)0x04);
            }
        }