Interesting: in profiling, creating the mapping object was one of the major bottlenecks, when running the M6502 test suite.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2019-02-15 09:10:27 +00:00
parent 219d65a57a
commit 3108a373d7

View File

@ -14,6 +14,7 @@ namespace M6502.Test
private readonly M6502 cpu; private readonly M6502 cpu;
private readonly Symbols symbols; private readonly Symbols symbols;
private readonly Disassembly disassembler; private readonly Disassembly disassembler;
private readonly MemoryMapping mapping;
private ushort oldPC; private ushort oldPC;
@ -24,6 +25,7 @@ namespace M6502.Test
this.cpu = new M6502(this); this.cpu = new M6502(this);
this.symbols = new Symbols(); this.symbols = new Symbols();
this.disassembler = new Disassembly(this, this.cpu, this.symbols); this.disassembler = new Disassembly(this, this.cpu, this.symbols);
this.mapping = new MemoryMapping(this.ram, 0x0000, (ushort)Mask.Mask16, AccessLevel.ReadWrite);
this.oldPC = (ushort)Mask.Mask16; this.oldPC = (ushort)Mask.Mask16;
} }
@ -65,10 +67,7 @@ namespace M6502.Test
this.cpu.PokeWord(0x01, this.configuration.StartAddress); this.cpu.PokeWord(0x01, this.configuration.StartAddress);
} }
public override MemoryMapping Mapping(ushort absolute) public override MemoryMapping Mapping(ushort absolute) => this.mapping;
{
return new MemoryMapping(this.ram, 0x0000, (ushort)Mask.Mask16, AccessLevel.ReadWrite);
}
private void CPU_ExecutedInstruction(object sender, System.EventArgs e) private void CPU_ExecutedInstruction(object sender, System.EventArgs e)
{ {