Example #1
0
 public CHIP8(Func <bool[, ], Task> writeDisplay,
              IRegisterModule registerModule,
              IStackModule stackModule,
              MemoryModule memoryModule,
              IRandomModule randomModule)
 {
     updateDisplay       = writeDisplay;
     this.registerModule = registerModule;
     this.stackModule    = stackModule;
     this.ram            = memoryModule;
     this.random         = randomModule;
 }
Example #2
0
 public static CHIP8 GetChip8(Func <bool[, ], Task> writeDisplay = null,
                              IRegisterModule registers          = null,
                              IStackModule stack   = null,
                              MemoryModule mem     = null,
                              IRandomModule random = null)
 {
     return(new CHIP8(writeDisplay ?? (x => Task.CompletedTask),
                      registers ?? new RegisterModule(),
                      stack ?? new StackModule(),
                      mem
                      ?? new MemoryModule(Enumerable.Repeat((byte)0x0,
                                                            4096)),
                      random ?? new RandomModule()));
 }