public MC68000Test() { bus = new MemorySpace(1); cpu = new MC68000(); cpu.SetAddressSpace(bus); cpu.Reset(); }
public MooneyeTestRunner(FileInfo romFileInfo, TextWriter os, bool trace) { _tracer = trace ? (ITracer) new Tracer(romFileInfo.Name) : new NullTracer(); var opts = new List <string>(); if (romFileInfo.ToString().EndsWith("-C.gb") || romFileInfo.ToString().EndsWith("-cgb.gb")) { opts.Add("c"); } if (romFileInfo.Name.StartsWith("boot_")) { opts.Add("b"); } opts.Add("db"); var options = new GameboyOptions(romFileInfo, new List <string>(), opts); var cart = new Cartridge(options); _gb = new Gameboy(options, cart, new NullDisplay(), new NullController(), new NullSoundOutput(), new NullSerialEndpoint()); Console.WriteLine("System type: " + (cart.Gbc ? "CGB" : "DMG")); Console.WriteLine("Bootstrap: " + (options.UseBootstrap ? "enabled" : "disabled")); _cpu = _gb.Cpu; _registers = _cpu.Registers; _mem = _gb.Mmu; _os = os; }
public ELFVirtualAddressSpace(IReadOnlyList <ElfProgramHeader> segments, IAddressSpace addressSpace) { Length = segments.Max(s => s.VirtualAddress + s.VirtualSize); // FileSize == 0 means the segment isn't backed by any data _segments = segments.Where((programHeader) => programHeader.FileSize > 0).ToArray(); _addressSpace = addressSpace; }
public PDBPagedAddressSpace(IAddressSpace physicalAddresses, uint[] pageIndicies, uint pageSize, ulong length) { _physicalAddresses = physicalAddresses; _pageIndicies = pageIndicies; _pageSize = pageSize; Length = length; }
public OamSearch(IAddressSpace oemRam, Lcdc lcdc, MemoryRegisters registers) { this._oemRam = oemRam; this._registers = registers; this._lcdc = lcdc; _sprites = new SpritePosition[10]; }
/// <summary> /// Returns true if the given address space is a minidump. /// </summary> /// <param name="addressSpace">The address space to check.</param> /// <param name="position">The position of the minidump.</param> /// <returns>True if the address space is a minidump, false otherwise.</returns> public static bool IsValidMinidump(IAddressSpace addressSpace, ulong position = 0) { Reader headerReader = new Reader(addressSpace); MinidumpHeader header = headerReader.Read <MinidumpHeader>(position); return(header.IsSignatureValid.Check()); }
public Gpu(IDisplay display, InterruptManager interruptManager, Dma dma, Ram oamRam, bool gbc) { _r = new MemoryRegisters(GpuRegister.Values().ToArray()); _lcdc = new Lcdc(); _interruptManager = interruptManager; _gbc = gbc; _videoRam0 = new Ram(0x8000, 0x2000); _videoRam1 = gbc ? new Ram(0x8000, 0x2000) : null; _oamRam = oamRam; _dma = dma; _bgPalette = new ColorPalette(0xff68); _oamPalette = new ColorPalette(0xff6a); _oamPalette.FillWithFf(); _oamSearchPhase = new OamSearch(oamRam, _lcdc, _r); _pixelTransferPhase = new PixelTransfer(_videoRam0, _videoRam1, oamRam, display, _lcdc, _r, gbc, _bgPalette, _oamPalette); _hBlankPhase = new HBlankPhase(); _vBlankPhase = new VBlankPhase(); _mode = Mode.OamSearch; _phase = _oamSearchPhase.Start(); _display = display; }
private static bool GetInternalSRAM(ITarget2 target, out IAddressSpace addressSpace, out IMemorySegment memorySegment) { addressSpace = null; memorySegment = null; if (target.Device.Architecture.StartsWith("AVR8") == false) { return(false); } foreach (IAddressSpace mem in target.Device.AddressSpaces) { foreach (IMemorySegment seg in mem.MemorySegments) { if (seg.Type.IndexOf("RAM", StringComparison.OrdinalIgnoreCase) < 0) { continue; } if ((seg.Name.IndexOf("IRAM", StringComparison.OrdinalIgnoreCase) >= 0) || (seg.Name.IndexOf("INTERNAL_SRAM", StringComparison.OrdinalIgnoreCase) >= 0)) { addressSpace = mem; memorySegment = seg; return(true); } } } return(false); }
public ELFCoreFile(IAddressSpace dataSource) { _dataSource = dataSource; _elf = new ELFFile(dataSource); _fileTable = new Lazy <ELFFileTable>(ReadFileTable); _images = new Lazy <ELFLoadedImage[]>(ReadLoadedImages); }
public void Start(ITransport transport) { if (_running) { return; } _state = State.None; _target = ATServiceProvider.GetService <STargetService, ITargetService>(); _debugTarget = _target.GetCurrentTarget(); _pc = 0; _ramSpace = _debugTarget.Device.GetAddressSpace("data"); _events.DebugLeave += EventsOnDebugLeave; _events.DebugEnter += EventsOnDebugEnter; _events.MemoryChanged += EventsOnMemoryChanged; _events.Start(_debugTarget); _server.SetTransport(transport); _server.UnknownData += ServerOnUnknownData; _server.DebuggerAttached += ServerDebuggerAttached; // Start the debug server _server.Start(); _output.Activate(Output.SDSerialOutputPane); DebugStateChanged?.Invoke(); _running = true; }
public ShadowAddressSpace(IAddressSpace addressSpace, int echoStart, int targetStart, int length) { _addressSpace = addressSpace; _echoStart = echoStart; _targetStart = targetStart; _length = length; }
public PDBFile(IAddressSpace dataSource) { _reader = new Reader(dataSource); _header = new Lazy <PDBFileHeader>(() => _reader.Read <PDBFileHeader>(0)); _streams = new Lazy <Reader[]>(ReadDirectory); _nameStream = new Lazy <PDBNameStream>(() => new PDBNameStream(Streams[1])); }
public PEAddressSpace(IAddressSpace addressSpace, ulong baseAddress, ReadOnlyCollection <ImageSectionHeader> segments) { _length = new Lazy <ulong>(GetLength); _segments = segments; _baseAddress = baseAddress; _addressSpace = addressSpace; }
public MinidumpVirtualAddressSpace(ReadOnlyCollection <MinidumpSegment> segments, IAddressSpace addressSpace) { _addressSpace = addressSpace; _segments = segments; MinidumpSegment last = segments.Last(); _length = last.VirtualAddress + last.Size; }
private static void CopyValues(IAddressSpace addressSpace, int from, int to, int length) { for (var i = length - 1; i >= 0; i--) { var b = addressSpace.GetByte(0xfe00 + from + i) % 0xff; addressSpace.SetByte(0xfe00 + to + i, b); } }
public RelativeAddressSpace(IAddressSpace baseAddressSpace, string name, long startOffset, long length, long baseToRelativeShift) { _baseAddressSpace = baseAddressSpace; _baseStart = startOffset; _length = length; _baseToRelativeShift = baseToRelativeShift; _name = name; }
public override object Read(IAddressSpace dataSource, ulong position) { ulong val = (SizeT)_storageLayout.Read(dataSource, position); Pointer p = (Pointer)Activator.CreateInstance(Type); p.Init(_targetLayout, val); return(p); }
public AddTest1() { bus = new MemorySpace(1); //create 1kb of memory for the cpu cpu = new MC68000(); cpu.AddressSpace = bus; cpu.Reset(); cpu.SetAddrRegisterLong(7, 0x200); }
public MachCore(IAddressSpace dataSource, ulong dylinkerHintAddress = 0) { _machO = new MachOFile(dataSource); _dylinkerHintAddress = dylinkerHintAddress; _dylinkerAddress = new Lazy <ulong>(FindDylinker); _dylinker = new Lazy <MachDyld>(() => new MachDyld(new MachOFile(VirtualAddressReader.DataSource, DylinkerAddress, true))); _loadedImages = new Lazy <MachLoadedImage[]>(ReadImages); }
public PDBFile(IAddressSpace fileAddressSpace) { _fileAddressSpace = fileAddressSpace; _pdbFileReader = new Reader(_fileAddressSpace); _pdbFileHeader = new Lazy <PDBFileHeader>(() => _pdbFileReader.Read <PDBFileHeader>(0)); _streams = new Lazy <Reader[]>(ReadDirectory); _nameStream = new Lazy <PDBNameStream>(() => new PDBNameStream(Streams[1])); }
public ElfVirtualAddressSpace(ImmutableArray <ElfProgramHeader> segments, IAddressSpace addressSpace) { // FileSize == 0 means the segment isn't backed by any data _segments = segments.Where(segment => segment.FileSize > 0).OrderBy(segment => segment.VirtualAddress).ThenBy(segment => segment.VirtualSize).ToArray(); ElfProgramHeader lastSegment = _segments[_segments.Length - 1]; Length = lastSegment.VirtualAddress + lastSegment.FileSize; _addressSpace = addressSpace; }
public MachOFatFile(IAddressSpace dataSource) { _reader = new Reader(dataSource); _headerMagic = new Lazy <MachFatHeaderMagic>(() => _reader.Read <MachFatHeaderMagic>(0)); _headerReader = new Lazy <Reader>(() => new Reader(dataSource, new LayoutManager().AddMachFatHeaderTypes(IsBigEndian))); _header = new Lazy <MachFatHeader>(() => _headerReader.Value.Read <MachFatHeader>(0)); _arches = new Lazy <MachFatArch[]>(ReadArches); _archSpecificFiles = new Lazy <MachOFile[]>(ReadArchSpecificFiles); }
public Monitor(ICPU icpu, IAddressSpace imemory) { cpu = icpu; memory = imemory; buffer = new StringBuilder(128); showBytes = false; autoRegs = false; breakpoints = new List <int>(); }
/// <summary> /// Read the specified number of bytes. /// </summary> /// <param name="addressSpace">The address space to read from</param> /// <param name="position">The position in the address space to start reading from</param> /// <param name="count">The number of bytes to read</param> /// <returns> /// Returns an array of exactly "count" bytes or throw an exception. /// </returns> /// <throws> /// BadInputFormatException to indicate an "unexpected end of stream" condition /// </throws> public static byte[] Read(this IAddressSpace addressSpace, ulong position, uint count) { byte[] bytes = ArrayHelper.New <byte>(count); if (count != addressSpace.Read(position, bytes, 0, count)) { throw new BadInputFormatException("Unable to read bytes at offset 0x" + position.ToString("x")); } return(bytes); }
public Cpu(IAddressSpace addressSpace, InterruptManager interruptManager, Gpu gpu, IDisplay display, SpeedMode speedMode) { _opcodes = new Opcodes(); Registers = new Registers(); _addressSpace = addressSpace; _interruptManager = interruptManager; _gpu = gpu; _display = display; _speedMode = speedMode; }
private IEnumerable <IDumpModule> TryParseMachODump(IAddressSpace dumpDataSource) { MachCore core = new MachCore(dumpDataSource); if (!core.IsValidCoreFile) { return(null); } return(core.LoadedImages.Select(i => new MachDumpModule(i))); }
public AddressRegisterPreDecOperandTest() { //create 1kb of memory for the cpu bus = new MemorySpaceAnonymousInnerClass(this); cpu = new MC68000(); cpu.AddressSpace = bus; cpu.Reset(); cpu.SetAddrRegisterLong(7, 0x200); wordWrites.Clear(); }
private static PiecewiseAddressSpaceRange ToRange(IAddressSpace virtualAddressSpace, ulong preferredVMBaseAddress, MachSegment segment) { ulong actualSegmentLoadAddress = preferredVMBaseAddress + segment.LoadCommand.VMAddress - segment.LoadCommand.FileOffset; return(new PiecewiseAddressSpaceRange() { AddressSpace = new RelativeAddressSpace(virtualAddressSpace, actualSegmentLoadAddress, segment.LoadCommand.FileSize), Start = segment.LoadCommand.FileOffset, Length = segment.LoadCommand.FileSize }); }
public override object Read(IAddressSpace dataTarget, ulong position) { TStruct blank = (TStruct)Activator.CreateInstance(Type); foreach (IField field in Fields) { Object fieldValue = field.Layout.Read(dataTarget, position + field.Offset); field.SetValue(blank, fieldValue); } return(blank); }
public Fetcher(IPixelFifo fifo, IAddressSpace videoRam0, IAddressSpace videoRam1, IAddressSpace oemRam, Lcdc lcdc, MemoryRegisters registers, bool gbc) { _gbc = gbc; _fifo = fifo; _videoRam0 = videoRam0; _videoRam1 = videoRam1; _oemRam = oemRam; _r = registers; _lcdc = lcdc; }