示例#1
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();
        }
示例#2
0
 public NullDevice(MachineBase m)
 {
     if (m == null)
     {
         throw new ArgumentNullException("m");
     }
     M = m;
 }
示例#3
0
文件: Cart.cs 项目: CadeLaRen/BizHawk
 public virtual void Attach(MachineBase m)
 {
     if (m == null)
         throw new ArgumentNullException("m");
     if (M != null && M != m)
         throw new InvalidOperationException("Cart already attached to a different machine.");
     M = m;
 }
示例#4
0
        public TIA(MachineBase m) : this()
        {
            if (m == null)
            {
                throw new ArgumentNullException("m");
            }

            M        = m;
            TIASound = new TIASound(M, CPU_TICKS_PER_AUDIO_SAMPLE);
        }
示例#5
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();
        }
示例#6
0
        public PokeySound(MachineBase m) : this()
        {
            if (m == null)
            {
                throw new ArgumentNullException("m");
            }

            M = m;

            // Add 8-bits of fractional representation to reduce distortion on output
            _pokeyTicksPerSample = (POKEY_FREQ << 8) / M.SoundSampleFrequency;
        }
示例#7
0
 public virtual void Attach(MachineBase m)
 {
     if (m == null)
     {
         throw new ArgumentNullException("m");
     }
     if (M != null && M != m)
     {
         throw new InvalidOperationException("Cart already attached to a different machine.");
     }
     M = m;
 }
示例#8
0
        public TIASound(MachineBase m, int cpuClocksPerSample) : this()
        {
            if (m == null)
            {
                throw new ArgumentNullException("m");
            }
            if (cpuClocksPerSample <= 0)
            {
                throw new ArgumentException("cpuClocksPerSample must be positive.");
            }

            M = m;
            _cpuClocksPerSample = cpuClocksPerSample;
        }
示例#9
0
        public M6502(MachineBase m, int runClocksMultiple) : this()
        {
            if (m == null)
            {
                throw new ArgumentNullException("m");
            }
            if (runClocksMultiple <= 0)
            {
                throw new ArgumentException("runClocksMultiple must be greater than zero.");
            }

            M = m;
            RunClocksMultiple = runClocksMultiple;
        }
示例#10
0
        public AddressSpace(MachineBase m, int addrSpaceShift, int pageShift)
        {
            M = m;

            AddrSpaceShift = addrSpaceShift;
            AddrSpaceSize  = 1 << AddrSpaceShift;
            AddrSpaceMask  = AddrSpaceSize - 1;

            PageShift = pageShift;
            PageSize  = 1 << PageShift;

            MemoryMap = new IDevice[1 << addrSpaceShift >> PageShift];

            for (var pageno = 0; pageno < MemoryMap.Length; pageno++)
            {
                MemoryMap[pageno] = NullDevice.Default;
            }
        }
        public Cart ReadCart(MachineBase m)
        {
            var typeName = _binaryReader.ReadString();

            if (string.IsNullOrWhiteSpace(typeName))
            {
                throw new Emu7800SerializationException("Invalid type name.");
            }

            var type = Type.GetType(typeName);

            if (type == null)
            {
                throw new Emu7800SerializationException("Unable to resolve type name: " + typeName);
            }

            return((Cart)Activator.CreateInstance(type, new object[] { this, m }));
        }
示例#12
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();
        }
示例#13
0
文件: PIA.cs 项目: WolfpawGroup/RTC3
        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();
            }
        }
示例#14
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();
        }
示例#15
0
        public AddressSpace(MachineBase m, int addrSpaceShift, int pageShift)
        {
            if (m == null)
            {
                throw new ArgumentNullException("m");
            }

            M = m;

            AddrSpaceShift = addrSpaceShift;
            AddrSpaceSize  = 1 << AddrSpaceShift;
            AddrSpaceMask  = AddrSpaceSize - 1;

            PageShift = pageShift;
            PageSize  = 1 << PageShift;

            MemoryMap = new IDevice[1 << addrSpaceShift >> PageShift];
            IDevice nullDev = new NullDevice(M);

            for (var pageno = 0; pageno < MemoryMap.Length; pageno++)
            {
                MemoryMap[pageno] = nullDev;
            }
        }
示例#16
0
文件: TIA.cs 项目: ddugovic/RASuite
        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();
        }
示例#17
0
        public Cart ReadCart(MachineBase m)
        {
            var typeName = _binaryReader.ReadString();
            if (string.IsNullOrWhiteSpace(typeName))
                throw new Emu7800SerializationException("Invalid type name.");

            var type = Type.GetType(typeName);
            if (type == null)
                throw new Emu7800SerializationException("Unable to resolve type name: " + typeName);

            return (Cart)Activator.CreateInstance(type, new object[] { this, m });
        }
示例#18
0
 public TIASound ReadTIASound(MachineBase m, int cpuClocksPerSample)
 {
     var tiaSound = new TIASound(this, m, cpuClocksPerSample);
     return tiaSound;
 }
示例#19
0
 public PIA ReadPIA(MachineBase m)
 {
     var pia = new PIA(this, m);
     return pia;
 }
示例#20
0
 public AddressSpace ReadAddressSpace(MachineBase m, int addrSpaceShift, int pageShift)
 {
     var addressSpace = new AddressSpace(this, m, addrSpaceShift, pageShift);
     return addressSpace;
 }
示例#21
0
        public AddressSpace(MachineBase m, int addrSpaceShift, int pageShift)
        {
            if (m == null)
                throw new ArgumentNullException("m");

            M = m;

            AddrSpaceShift = addrSpaceShift;
            AddrSpaceSize  = 1 << AddrSpaceShift;
            AddrSpaceMask = AddrSpaceSize - 1;

            PageShift = pageShift;
            PageSize = 1 << PageShift;

            MemoryMap = new IDevice[1 << addrSpaceShift >> PageShift];
            IDevice nullDev = new NullDevice(M);
            for (var pageno=0; pageno < MemoryMap.Length; pageno++)
            {
                MemoryMap[pageno] = nullDev;
            }
        }
示例#22
0
 public AddressSpace(DeserializationContext input, MachineBase m, int addrSpaceShift, int pageShift) : this(m, addrSpaceShift, pageShift)
 {
     input.CheckVersion(1);
     DataBusState = input.ReadByte();
 }
示例#23
0
文件: M6502.cs 项目: ddugovic/RASuite
        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();
        }
示例#24
0
        void HardReset()
        {
            cart = Cart.Create(rom, GameInfo.CartType);
            ILogger logger = new ConsoleLogger();

            HSC7800 hsc7800 = null;
            if (hsbios != null)
            {
                hsc7800 = new HSC7800(hsbios, hsram);
            }

            Bios7800 bios7800 = new Bios7800(bios);
            theMachine = MachineBase.Create
                (GameInfo.MachineType,
                cart,
                bios7800,
                hsc7800,
                GameInfo.LController,
                GameInfo.RController,
                logger);

            theMachine.Reset();
            theMachine.InputState.InputPollCallback = InputCallbacks.Call;

            ControlAdapter = new Atari7800Control(theMachine);
            ControllerDefinition = ControlAdapter.ControlType;

            avProvider.ConnectToMachine(theMachine, GameInfo);
            // to sync exactly with audio as this emulator creates and times it, the frame rate should be exactly 60:1 or 50:1
            CoreComm.VsyncNum = theMachine.FrameHZ;
            CoreComm.VsyncDen = 1;

            SetupMemoryDomains(hsc7800);
        }
示例#25
0
        public TIASound(MachineBase m, int cpuClocksPerSample) : this()
        {
            if (m == null)
                throw new ArgumentNullException("m");
            if (cpuClocksPerSample <= 0)
                throw new ArgumentException("cpuClocksPerSample must be positive.");

            M = m;
            _cpuClocksPerSample = cpuClocksPerSample;
        }
示例#26
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();
        }
示例#27
0
文件: PIA.cs 项目: CadeLaRen/BizHawk
 public PIA(MachineBase m)
 {
     if (m == null)
         throw new ArgumentNullException("m");
     M = m;
 }
示例#28
0
文件: PIA.cs 项目: CadeLaRen/BizHawk
        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();
            }
        }
示例#29
0
 public virtual void Attach(MachineBase m)
 {
     M = m;
 }
示例#30
0
 public void Write(MachineBase m)
 {
     WriteTypeName(m);
     m.GetObjectData(this);
 }
示例#31
0
文件: M6502.cs 项目: ddugovic/RASuite
        public M6502(MachineBase m, int runClocksMultiple) : this()
        {
            if (m == null)
                throw new ArgumentNullException("m");
            if (runClocksMultiple <= 0)
                throw new ArgumentException("runClocksMultiple must be greater than zero.");

            M = m;
            RunClocksMultiple = runClocksMultiple;
        }
示例#32
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();
        }
 public void Write(MachineBase m)
 {
     _binaryWriter.Write(m.ToString() ?? string.Empty);
     m.GetObjectData(this);
 }
示例#34
0
			public void ConnectToMachine(MachineBase m, EMU7800.Win.GameProgram g)
			{
				framebuffer = m.CreateFrameBuffer();
				BufferWidth = framebuffer.VisiblePitch;
				BufferHeight = framebuffer.Scanlines;
				vidbuffer = new int[BufferWidth * BufferHeight];

				uint newsamplerate = (uint)m.SoundSampleFrequency;
				if (newsamplerate != samplerate)
				{
					// really shouldn't happen (after init), but if it does, we're ready
					if (resampler != null)
						resampler.Dispose();
					resampler = new SpeexResampler(3, newsamplerate, 44100, newsamplerate, 44100, null, null);
					samplerate = newsamplerate;
					dcfilter = DCFilter.DetatchedMode(256);
				}
				if (g.MachineType == MachineType.A7800PAL || g.MachineType == MachineType.A2600PAL)
					palette = TIATables.PALPalette;
				else
					palette = TIATables.NTSCPalette;
			}
        public AddressSpace ReadAddressSpace(MachineBase m, int addrSpaceShift, int pageShift)
        {
            var addressSpace = new AddressSpace(this, m, addrSpaceShift, pageShift);

            return(addressSpace);
        }
示例#36
0
 public M6502 ReadM6502(MachineBase m, int runClocksMultiple)
 {
     var cpu = new M6502(this, m, runClocksMultiple);
     return cpu;
 }
        public M6502 ReadM6502(MachineBase m, int runClocksMultiple)
        {
            var cpu = new M6502(this, m, runClocksMultiple);

            return(cpu);
        }
示例#38
0
 public TIA ReadTIA(MachineBase m)
 {
     var tia = new TIA(this, m);
     return tia;
 }
        public PIA ReadPIA(MachineBase m)
        {
            var pia = new PIA(this, m);

            return(pia);
        }
示例#40
0
 public PokeySound ReadOptionalPokeySound(MachineBase m)
 {
     var exist = ReadBoolean();
     return exist ? new PokeySound(this, m) : null;
 }
        public TIA ReadTIA(MachineBase m)
        {
            var tia = new TIA(this, m);

            return(tia);
        }
示例#42
0
 public void Write(MachineBase m)
 {
     WriteTypeName(m);
     m.GetObjectData(this);
 }
        public TIASound ReadTIASound(MachineBase m, int cpuClocksPerSample)
        {
            var tiaSound = new TIASound(this, m, cpuClocksPerSample);

            return(tiaSound);
        }
示例#44
0
文件: TIA.cs 项目: ddugovic/RASuite
        public TIA(MachineBase m) : this()
        {
            if (m == null)
                throw new ArgumentNullException("m");

            M = m;
            TIASound = new TIASound(M, CPU_TICKS_PER_AUDIO_SAMPLE);
        }
        public PokeySound ReadOptionalPokeySound(MachineBase m)
        {
            var exist = ReadBoolean();

            return(exist ? new PokeySound(this, m) : null);
        }
示例#46
0
        public PokeySound(MachineBase m) : this()
        {
            if (m == null)
                throw new ArgumentNullException("m");

            M = m;

            // Add 8-bits of fractional representation to reduce distortion on output
            _pokeyTicksPerSample = (POKEY_FREQ << 8) / M.SoundSampleFrequency;
        }
示例#47
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();
        }
示例#48
0
		public Atari7800Control(MachineBase mac)
		{
			var l = mac.InputState.LeftControllerJack;
			var r = mac.InputState.RightControllerJack;

			foreach (var a in Adapters)
			{
				if (a.Left == l && a.Right == r)
				{
					Convert = a.Convert;
					ControlType = a.Type;
					return;
				}
			}
			throw new Exception(string.Format("Couldn't connect Atari 7800 controls \"{0}\" and \"{1}\"", l.ToString(), r.ToString()));
		}
示例#49
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();
        }