Beispiel #1
0
        public RAM6116(DeserializationContext input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            input.CheckVersion(1);
            RAM = input.ReadExpectedBytes(0x800);
        }
Beispiel #2
0
        public Bios7800(DeserializationContext input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            input.CheckVersion(1);
            ROM = input.ReadExpectedBytes(4096, 16384);

            Mask = (ushort)ROM.Length;
            Mask--;
        }
Beispiel #3
0
        public HSC7800(DeserializationContext input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            input.CheckVersion(1);
            ROM = input.ReadExpectedBytes(4096);
            SRAM = input.ReadRAM6116();
 
            Size = Mask = (ushort)ROM.Length;
            Mask--;
        }
Beispiel #4
0
        public TIA(DeserializationContext input, MachineBase m) : this()
        {
            if (input == null)
                throw new ArgumentNullException("input");
            if (m == null)
                throw new ArgumentNullException("m");

            M = m;
            TIASound = input.ReadTIASound(M, CPU_TICKS_PER_AUDIO_SAMPLE);

            input.CheckVersion(2);
            RegW = input.ReadExpectedBytes(0x40);
            HSync = input.ReadInt32();
            HMoveCounter = input.ReadInt32();
            ScanLine = input.ReadInt32();
            FrameBufferIndex = input.ReadInt32();
            //FrameBufferElement = input.ReadBufferElement();
            StartHMOVEClock = input.ReadUInt64();
            HMoveLatch = input.ReadBoolean();
            StartClock = input.ReadUInt64();
            P0 = input.ReadInt32();
            P0mmr = input.ReadBoolean();
            EffGRP0 = input.ReadByte();
            OldGRP0 = input.ReadByte();
            P0type = input.ReadInt32();
            P0suppress = input.ReadInt32();
            P1 = input.ReadInt32();
            P1mmr = input.ReadBoolean();
            EffGRP1 = input.ReadByte();
            OldGRP1 = input.ReadByte();
            P1type = input.ReadInt32();
            P1suppress = input.ReadInt32();
            M0 = input.ReadInt32();
            M0mmr = input.ReadBoolean();
            M0type = input.ReadInt32();
            M0size = input.ReadInt32();
            m0on = input.ReadBoolean();
            M1 = input.ReadInt32();
            M1mmr = input.ReadBoolean();
            M1type = input.ReadInt32();
            M1size = input.ReadInt32();
            m1on = input.ReadBoolean();
            BL = input.ReadInt32();
            BLmmr = input.ReadBoolean();
            OldENABL = input.ReadBoolean();
            BLsize = input.ReadInt32();
            blon = input.ReadBoolean();
            PF210 = input.ReadUInt32();
            PFReflectionState = input.ReadInt32();
            colubk = input.ReadByte();
            colupf = input.ReadByte();
            colup0 = input.ReadByte();
            colup1 = input.ReadByte();
            vblankon = input.ReadBoolean();
            scoreon = input.ReadBoolean();
            pfpriority = input.ReadBoolean();
            DumpEnabled = input.ReadBoolean();
            DumpDisabledCycle = input.ReadUInt64();
            Collisions = (TIACxPairFlags)input.ReadInt32();
            WSYNCDelayClocks = input.ReadInt32();
            EndOfFrame = input.ReadBoolean();
        }
Beispiel #5
0
        protected Cart(DeserializationContext input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            input.CheckVersion(1);
        }
Beispiel #6
0
        protected MachineBase(DeserializationContext input, int[] palette)
        {
            if (input == null)
                throw new ArgumentNullException("input");
            if (palette == null)
                throw new ArgumentNullException("palette");
            if (palette.Length != 0x100)
                throw new ArgumentException("palette incorrect size, must be 256.");

            input.CheckVersion(1);
            _MachineHalt = input.ReadBoolean();
            _FrameHZ = input.ReadInt32();
            _VisiblePitch = input.ReadInt32();
            _Scanlines = input.ReadInt32();
            FirstScanline = input.ReadInt32();
            SoundSampleFrequency = input.ReadInt32();
            NOPRegisterDumping = input.ReadBoolean();
            InputState = input.ReadInputState();

            Palette = palette;
            Logger = null;
        }
Beispiel #7
0
 /// <summary>
 /// Deserialize a <see cref="MachineBase"/> from the specified stream.
 /// </summary>
 /// <param name="binaryReader"/>
 /// <exception cref="ArgumentNullException"/>
 /// <exception cref="Emu7800SerializationException"/>
 public static MachineBase Deserialize(BinaryReader binaryReader)
 {
     var context = new DeserializationContext(binaryReader);
     MachineBase m;
     try
     {
         m = context.ReadMachine();
     }
     catch (Emu7800SerializationException)
     {
         throw;
     }
     catch (TargetInvocationException ex)
     {
         // TargetInvocationException wraps exceptions that unwind an Activator.CreateInstance() frame.
         throw new Emu7800SerializationException("Serialization stream does not describe a valid machine.", ex.InnerException);
     }
     catch (Exception ex)
     {
         throw new Emu7800SerializationException("Serialization stream does not describe a valid machine.", ex);
     }
     return m;
 }
Beispiel #8
0
        public AddressSpace(DeserializationContext input, MachineBase m, int addrSpaceShift, int pageShift) : this(m, addrSpaceShift, pageShift)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            input.CheckVersion(1);
            DataBusState = input.ReadByte();
        }
Beispiel #9
0
        public PokeySound(DeserializationContext input, MachineBase m) : this(m)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            input.CheckVersion(1);
            _lastUpdateCpuClock = input.ReadUInt64();
            _bufferIndex = input.ReadInt32();
            _audf = input.ReadBytes();
            _audc = input.ReadBytes();
            _audctl = input.ReadByte();
            _skctl = input.ReadByte();
            _output = input.ReadBytes();
            _outvol = input.ReadBytes();
            _divideMax = input.ReadIntegers(4);
            _divideCount = input.ReadIntegers(4);
            _pokeyTicks = input.ReadInt32();
            _pokeyTicksPerSample = input.ReadInt32();
            _baseMultiplier = input.ReadInt32();
            _poly04Counter = input.ReadInt32();
            _poly05Counter = input.ReadInt32();
            _poly17Counter = input.ReadInt32();
            _poly17Size = input.ReadInt32();
        }
Beispiel #10
0
        public M6502(DeserializationContext input, MachineBase m, int runClocksMultiple) : this(m, runClocksMultiple)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            input.CheckVersion(1);
            Clock = input.ReadUInt64();
            RunClocks = input.ReadInt32();
            RunClocksMultiple = input.ReadInt32();
            EmulatorPreemptRequest = input.ReadBoolean();
            Jammed = input.ReadBoolean();
            IRQInterruptRequest = input.ReadBoolean();
            NMIInterruptRequest = input.ReadBoolean();
            PC = input.ReadUInt16();
            A = input.ReadByte();
            X = input.ReadByte();
            Y = input.ReadByte();
            S = input.ReadByte();
            P = input.ReadByte();
        }
Beispiel #11
0
        public InputState(DeserializationContext input)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            input.CheckVersion(2);
            _rotState = input.ReadIntegers(2);
            _nextInputState = input.ReadIntegers(InputStateSize);
            _inputState = input.ReadIntegers(InputStateSize);
			_lagged = input.ReadBoolean();
        }
Beispiel #12
0
        public PIA(DeserializationContext input, MachineBase m) : this(m)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            var version = input.CheckVersion(1, 2);
            RAM = input.ReadExpectedBytes(0x80);
            TimerTarget = input.ReadUInt64();
            TimerShift = input.ReadInt32();
            IRQEnabled = input.ReadBoolean();
            IRQTriggered = input.ReadBoolean();
            DDRA = input.ReadByte();
            WrittenPortA = input.ReadByte();
            if (version > 1)
            {
                DDRB = input.ReadByte();
                WrittenPortB = input.ReadByte();
            }
        }
Beispiel #13
0
        public TIASound(DeserializationContext input, MachineBase m, int cpuClocksPerSample) : this(m, cpuClocksPerSample)
        {
            if (input == null)
                throw new ArgumentNullException("input");

            input.CheckVersion(1);
            Bit9 = input.ReadExpectedBytes(511);
            P4 = input.ReadIntegers(2);
            P5 = input.ReadIntegers(2);
            P9 = input.ReadIntegers(2);
            DivByNCounter = input.ReadIntegers(2);
            DivByNMaximum = input.ReadIntegers(2);
            AUDC = input.ReadExpectedBytes(2);
            AUDF = input.ReadExpectedBytes(2);
            AUDV = input.ReadExpectedBytes(2);
            OutputVol = input.ReadExpectedBytes(2);
            LastUpdateCPUClock = input.ReadUInt64();
            BufferIndex = input.ReadInt32();
        }
Beispiel #14
0
        public Maria(DeserializationContext input, Machine7800 m, int scanlines)
        {
            if (input == null)
                throw new ArgumentNullException("input");
            if (m == null)
                throw new ArgumentNullException("m");

            M = m;
            InitializeVisibleScanlineValues(scanlines);
            TIASound = new TIASound(input, M, CPU_TICKS_PER_AUDIO_SAMPLE);

            var version = input.CheckVersion(1, 2);
            LineRAM = input.ReadExpectedBytes(512);
            if (version == 1)
            {
                // formerly persisted values, MariaPalette[8,4]
                for (var i = 0; i < 32; i++) 
                    input.ReadByte();
            }
            Registers = input.ReadExpectedBytes(0x40);
            if (version == 1)
            {
                // formerly persisted value, Scanline
                input.ReadInt32();
            }
            switch (version)
            {
                case 1:
                    WM = (input.ReadByte() != 0);
                    break;
                case 2:
                    WM = input.ReadBoolean();
                    break;
            }
            DLL = input.ReadUInt16();
            DL = input.ReadUInt16();
            Offset = input.ReadInt32();
            Holey = input.ReadInt32();
            Width = input.ReadInt32();
            HPOS = input.ReadByte();
            PaletteNo = input.ReadByte();
            INDMode = input.ReadBoolean();
            if (version == 1)
            {
                // formerly persisted value (DLI)
                input.ReadBoolean();
            }
            CtrlLock = input.ReadBoolean();
            if (version == 1)
            {
                // formerly persisted value (VBLANK)
                input.ReadByte();
            }
            DMAEnabled = input.ReadBoolean();
            if (version == 1)
            {
                // formerly persisted value (DMAOn)
                input.ReadBoolean();
            }
            ColorKill = input.ReadBoolean();
            CWidth = input.ReadBoolean();
            BCntl = input.ReadBoolean();
            Kangaroo = input.ReadBoolean();
            RM = input.ReadByte();
        }
Beispiel #15
0
        public Maria(DeserializationContext input, Machine7800 m, int scanlines)
        {
            if (input == null)
            {
                throw new ArgumentNullException("input");
            }
            if (m == null)
            {
                throw new ArgumentNullException("m");
            }

            M = m;
            InitializeVisibleScanlineValues(scanlines);
            TIASound = new TIASound(input, M, CPU_TICKS_PER_AUDIO_SAMPLE);

            var version = input.CheckVersion(1, 2);

            LineRAM = input.ReadExpectedBytes(512);
            if (version == 1)
            {
                // formerly persisted values, MariaPalette[8,4]
                for (var i = 0; i < 32; i++)
                {
                    input.ReadByte();
                }
            }
            Registers = input.ReadExpectedBytes(0x40);
            if (version == 1)
            {
                // formerly persisted value, Scanline
                input.ReadInt32();
            }
            switch (version)
            {
            case 1:
                WM = (input.ReadByte() != 0);
                break;

            case 2:
                WM = input.ReadBoolean();
                break;
            }
            DLL       = input.ReadUInt16();
            DL        = input.ReadUInt16();
            Offset    = input.ReadInt32();
            Holey     = input.ReadInt32();
            Width     = input.ReadInt32();
            HPOS      = input.ReadByte();
            PaletteNo = input.ReadByte();
            INDMode   = input.ReadBoolean();
            if (version == 1)
            {
                // formerly persisted value (DLI)
                input.ReadBoolean();
            }
            CtrlLock = input.ReadBoolean();
            if (version == 1)
            {
                // formerly persisted value (VBLANK)
                input.ReadByte();
            }
            DMAEnabled = input.ReadBoolean();
            if (version == 1)
            {
                // formerly persisted value (DMAOn)
                input.ReadBoolean();
            }
            ColorKill = input.ReadBoolean();
            CWidth    = input.ReadBoolean();
            BCntl     = input.ReadBoolean();
            Kangaroo  = input.ReadBoolean();
            RM        = input.ReadByte();
        }
Beispiel #16
0
 public AddressSpace(DeserializationContext input, MachineBase m, int addrSpaceShift, int pageShift) : this(m, addrSpaceShift, pageShift)
 {
     input.CheckVersion(1);
     DataBusState = input.ReadByte();
 }