public void MemoryReadOutOfRange() { Byte[] dump = MakeMemoryDumpPattern0(); MemoryManagementUnit memory = new MemoryManagementUnit(dump); Assert.Throws <IndexOutOfRangeException>(() => memory[dump.GetLength(0)]); }
public GameBoy(byte[] rom) { var romInfo = new RomInfo(rom); Rom = romInfo.Rom; Mmu = new MemoryManagementUnit(romInfo, Timer); Init(); }
public InterruptService(DMGCPU dmgcpu) : base(dmgcpu) { for (int i = 0; i <= 0x1F; i++) { if ((i & 0x10) == 0x10) { IRQLookup[i] = 4; } if ((i & 0x8) == 0x8) { IRQLookup[i] = 3; } if ((i & 0x4) == 0x4) { IRQLookup[i] = 2; } if ((i & 0x2) == 0x2) { IRQLookup[i] = 1; } if ((i & 0x1) == 0x1) { IRQLookup[i] = 0; } if (i == 0) { IRQLookup[i] = -1; } } Board = dmgcpu.GetBoard(); Memory = Board.GetMemoryManagementUnit(); Registers = dmgcpu.Registers; }
public void MemoryByteReadTests() { Byte[] dump = MakeMemoryDumpPattern0(); Byte[] expected = dump.Select(i => (Byte)(i + 1)).ToArray(); MemoryManagementUnit memory = new MemoryManagementUnit(dump); Assert.True(Enumerable.Range(0, memory.Size).All(i => memory[i] == dump[i])); Assert.True(Enumerable.Range(0, memory.Size).Select(i => memory[i] = (Byte)(memory[i] + 1)).All(i => memory[i] == dump[i])); Assert.True(Enumerable.Range(0, memory.Size).All(i => memory[i] == expected[i])); }
public IChip8Device Build(IKeyboard keyboard, IDisplay display) { IArithmeticLogicUnit alu = BuildALU(); IMemoryManagementUnit mmu = new MemoryManagementUnit(); ISystemBridge systemBridge = BuildBridge(mmu, alu, display, keyboard); ICentralProcessingUnit cpu = BuildCPU(alu, mmu, systemBridge); Chip8Device device = new Chip8Device(cpu, mmu, systemBridge, keyboard, display); LoadFonts(mmu, Fontset, FontOffset); return(device); }
public override void Initialize() { Clock = 416; LcdPointer = 0; Memory = GetBoard().GetMemoryManagementUnit(); Renderer = new Renderer(); BGP = new int[4]; OBP0 = new int[4]; OBP1 = new int[4]; VRAM = new byte[0x2000]; Screen = new int[ScreenWidth, ScreenHeight]; Bitmap = new int[ScreenWidth * ScreenHeight]; MMIOWrite(0x91, _LCDC); MMIOWrite(0x85, _STAT); }
public Debugger(DMGBoard b) { InitializeComponent(); disassembler.RetrieveVirtualItem += Debug_RetrieveVirtualItem; disassembler.DoubleBuffered(true); StackView.RetrieveVirtualItem += Stack_RetrieveVirtualItem; Shown += Debugger_Shown; KeyPreview = true; KeyDown += new KeyEventHandler(Debugger_KeyDown); hexBox1.ByteProvider = new DynamicMemoryByteProvider(b); hexBox1.Width = hexBox1.RequiredWidth + 20; labels = new List <Symbol.Label>(); Board = b; Memory = b.GetMemoryManagementUnit(); CPU = (DMGCPU)b.CPU; PPU = (DMGPPU)b.PPU; cart = (Cartridge)b.GetComponents()[0]; String symbolPath = Path.GetDirectoryName(cart.GetRomPath()) + '\\' + Path.GetFileNameWithoutExtension(cart.GetRomPath()) + ".sym"; labels = symbol_loader(symbolPath); disasm = new Disassembler(CPU); assemblies = disasm.Disassemble(); disassembler.VirtualListSize = assemblies.Count + 0x8000; foreach (Components.Component c in Board.GetComponents()) { componentList.Items.Add(c.GetType().Name); } }
public override void Initialize() { Memory = GetBoard().GetMemoryManagementUnit(); }
public Disassembler(DMGCPU dmg) { cpu = dmg; Memory = dmg.GetBoard().GetMemoryManagementUnit(); }
public DynamicMemoryByteProvider(DMGBoard b) { B = b; mmu = b.GetMemoryManagementUnit(); }