public Machine7800(DeserializationContext input, int[] palette, int scanlines) : base(input, palette) { input.CheckVersion(1); Mem = input.ReadAddressSpace(this, 16, 6); // 7800: 16bit, 64byte pages CPU = input.ReadM6502(this, 4); Maria = input.ReadMaria(this, scanlines); Mem.Map(0x0000, 0x0040, Maria); Mem.Map(0x0100, 0x0040, Maria); Mem.Map(0x0200, 0x0040, Maria); Mem.Map(0x0300, 0x0040, Maria); PIA = input.ReadPIA(this); Mem.Map(0x0280, 0x0080, PIA); Mem.Map(0x0480, 0x0080, PIA); Mem.Map(0x0580, 0x0080, PIA); RAM1 = input.ReadRAM6116(); RAM2 = input.ReadRAM6116(); Mem.Map(0x1800, 0x0800, RAM1); Mem.Map(0x2000, 0x0800, RAM2); Mem.Map(0x0040, 0x00c0, RAM2); // page 0 shadow Mem.Map(0x0140, 0x00c0, RAM2); // page 1 shadow Mem.Map(0x2800, 0x0800, RAM2); // shadow1 Mem.Map(0x3000, 0x0800, RAM2); // shadow2 Mem.Map(0x3800, 0x0800, RAM2); // shadow3 BIOS = input.ReadOptionalBios7800(); HSC = input.ReadOptionalHSC7800(); if (HSC != null) { Mem.Map(0x1000, 0x800, HSC.SRAM); Mem.Map(0x3000, 0x1000, HSC); } Cart = input.ReadCart(this); Mem.Map(0x4000, 0xc000, Cart); using_bios = input.ReadBoolean(); if (using_bios && BIOS != null) { Mem.Map((ushort)(0x10000 - BIOS.Size), BIOS.Size, BIOS); } }
public Machine7800(Cart cart, Bios7800 bios, HSC7800 hsc, ILogger logger, int scanlines, int startl, int fHZ, int sRate, int[] p) : base(logger, scanlines, startl, fHZ, sRate, p, 320) { Mem = new AddressSpace(this, 16, 6); // 7800: 16bit, 64byte pages CPU = new M6502(this, 4); Maria = new Maria(this, scanlines); Mem.Map(0x0000, 0x0040, Maria); Mem.Map(0x0100, 0x0040, Maria); Mem.Map(0x0200, 0x0040, Maria); Mem.Map(0x0300, 0x0040, Maria); PIA = new PIA(this); Mem.Map(0x0280, 0x0080, PIA); Mem.Map(0x0480, 0x0080, PIA); Mem.Map(0x0580, 0x0080, PIA); RAM1 = new RAM6116(); RAM2 = new RAM6116(); Mem.Map(0x1800, 0x0800, RAM1); Mem.Map(0x2000, 0x0800, RAM2); Mem.Map(0x0040, 0x00c0, RAM2); // page 0 shadow Mem.Map(0x0140, 0x00c0, RAM2); // page 1 shadow Mem.Map(0x2800, 0x0800, RAM2); // shadow1 Mem.Map(0x3000, 0x0800, RAM2); // shadow2 Mem.Map(0x3800, 0x0800, RAM2); // shadow3 BIOS = bios; HSC = hsc; if (HSC != null) { Mem.Map(0x1000, 0x800, HSC.SRAM); Mem.Map(0x3000, 0x1000, HSC); Logger.WriteLine("7800 Highscore Cartridge Installed"); } Cart = cart; Mem.Map(0x4000, 0xc000, Cart); }
private 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); }
public Machine7800(DeserializationContext input, int[] palette, int scanlines) : base(input, palette) { input.CheckVersion(1); Mem = input.ReadAddressSpace(this, 16, 6); // 7800: 16bit, 64byte pages CPU = input.ReadM6502(this, 4); Maria = input.ReadMaria(this, scanlines); Mem.Map(0x0000, 0x0040, Maria); Mem.Map(0x0100, 0x0040, Maria); Mem.Map(0x0200, 0x0040, Maria); Mem.Map(0x0300, 0x0040, Maria); PIA = input.ReadPIA(this); Mem.Map(0x0280, 0x0080, PIA); Mem.Map(0x0480, 0x0080, PIA); Mem.Map(0x0580, 0x0080, PIA); RAM1 = input.ReadRAM6116(); RAM2 = input.ReadRAM6116(); Mem.Map(0x1800, 0x0800, RAM1); Mem.Map(0x2000, 0x0800, RAM2); Mem.Map(0x0040, 0x00c0, RAM2); // page 0 shadow Mem.Map(0x0140, 0x00c0, RAM2); // page 1 shadow Mem.Map(0x2800, 0x0800, RAM2); // shadow1 Mem.Map(0x3000, 0x0800, RAM2); // shadow2 Mem.Map(0x3800, 0x0800, RAM2); // shadow3 BIOS = input.ReadOptionalBios7800(); HSC = input.ReadOptionalHSC7800(); if (HSC != null) { Mem.Map(0x1000, 0x800, HSC.SRAM); Mem.Map(0x3000, 0x1000, HSC); } Cart = input.ReadCart(this); Mem.Map(0x4000, 0xc000, Cart); }
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 = CoreComm.InputCallback.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; // reset memory domains if (_MemoryDomains == null) { _MemoryDomains = new List <MemoryDomain>(); if (theMachine is Machine7800) { _MemoryDomains.Add(new MemoryDomain( "RAM1", 0x800, MemoryDomain.Endian.Unknown, delegate(int addr) { if (addr < 0 || addr >= 0x800) { throw new ArgumentOutOfRangeException(); } return(((Machine7800)theMachine).RAM1[(ushort)addr]); }, delegate(int addr, byte val) { if (addr < 0 || addr >= 0x800) { throw new ArgumentOutOfRangeException(); } ((Machine7800)theMachine).RAM1[(ushort)addr] = val; })); _MemoryDomains.Add(new MemoryDomain( "RAM2", 0x800, MemoryDomain.Endian.Unknown, delegate(int addr) { if (addr < 0 || addr >= 0x800) { throw new ArgumentOutOfRangeException(); } return(((Machine7800)theMachine).RAM2[(ushort)addr]); }, delegate(int addr, byte val) { if (addr < 0 || addr >= 0x800) { throw new ArgumentOutOfRangeException(); } ((Machine7800)theMachine).RAM2[(ushort)addr] = val; })); _MemoryDomains.Add(new MemoryDomain( "BIOS ROM", bios.Length, MemoryDomain.Endian.Unknown, delegate(int addr) { return(bios[addr]); }, delegate(int addr, byte val) { })); if (hsc7800 != null) { _MemoryDomains.Add(new MemoryDomain( "HSC ROM", hsbios.Length, MemoryDomain.Endian.Unknown, delegate(int addr) { return(hsbios[addr]); }, delegate(int addr, byte val) { })); _MemoryDomains.Add(new MemoryDomain( "HSC RAM", hsram.Length, MemoryDomain.Endian.Unknown, delegate(int addr) { return(hsram[addr]); }, delegate(int addr, byte val) { hsram[addr] = val; })); } _MemoryDomains.Add(new MemoryDomain( "System Bus", 65536, MemoryDomain.Endian.Unknown, delegate(int addr) { if (addr < 0 || addr >= 0x10000) { throw new ArgumentOutOfRangeException(); } return(theMachine.Mem[(ushort)addr]); }, delegate(int addr, byte val) { if (addr < 0 || addr >= 0x10000) { throw new ArgumentOutOfRangeException(); } theMachine.Mem[(ushort)addr] = val; })); } else // todo 2600? { } MemoryDomains = new MemoryDomainList(_MemoryDomains); } }
public Machine7800NTSC(Cart cart, Bios7800 bios, HSC7800 hsc, ILogger logger) : base(cart, bios, hsc, logger, 262, 16, 60, 31440 /* NTSC_SAMPLES_PER_SEC */, MariaTables.NTSCPalette) { }
public void SetupMemoryDomains(HSC7800 hsc7800) { // reset memory domains if (_MemoryDomains == null) { _MemoryDomains = new List <MemoryDomain>(); if (theMachine is Machine7800) { _MemoryDomains.Add(new MemoryDomainDelegate( "RAM", 0x1000, MemoryDomain.Endian.Unknown, delegate(long addr) { if (addr < 0 || addr >= 0x1000) { throw new ArgumentOutOfRangeException(); } if (addr < 0x800) { return(((Machine7800)theMachine).RAM1[(ushort)addr]); } return(((Machine7800)theMachine).RAM2[(ushort)addr]); }, delegate(long addr, byte val) { if (addr < 0 || addr >= 0x1000) { throw new ArgumentOutOfRangeException(); } else if (addr < 0x800) { ((Machine7800)theMachine).RAM1[(ushort)(addr & 0x800)] = val; } else { ((Machine7800)theMachine).RAM2[(ushort)addr] = val; } }, 1)); _MemoryDomains.Add(new MemoryDomainByteArray( "BIOS ROM", MemoryDomain.Endian.Unknown, bios, false, 1)); if (hsc7800 != null) { _MemoryDomains.Add(new MemoryDomainByteArray( "HSC ROM", MemoryDomain.Endian.Unknown, hsbios, false, 1)); _MemoryDomains.Add(new MemoryDomainByteArray( "HSC RAM", MemoryDomain.Endian.Unknown, hsram, true, 1)); } _MemoryDomains.Add(new MemoryDomainDelegate( "System Bus", 65536, MemoryDomain.Endian.Unknown, delegate(long addr) { if (addr < 0 || addr >= 0x10000) { throw new ArgumentOutOfRangeException(); } return(theMachine.Mem[(ushort)addr]); }, delegate(long addr, byte val) { if (addr < 0 || addr >= 0x10000) { throw new ArgumentOutOfRangeException(); } theMachine.Mem[(ushort)addr] = val; }, 1)); } else // todo 2600? { } MemoryDomains = new MemoryDomainList(_MemoryDomains); (ServiceProvider as BasicServiceProvider).Register <IMemoryDomains>(MemoryDomains); } }
public Machine7800PAL(Cart cart, Bios7800 bios, HSC7800 hsc, ILogger logger) : base(cart, bios, hsc, logger, 312, 34, 50, 31200 /* PAL_SAMPLES_PER_SEC */, MariaTables.PALPalette) { }