public Interpreter(EmulatorState EmulatorState) { this.EmulatorState = EmulatorState; this.Memory = EmulatorState.Memory; this.Registers = EmulatorState.Registers; this.Display = EmulatorState.Display; this.Controller = EmulatorState.Controller; this.Memory.WriteBytes(0, Digits); }
public void Draw(Registers Registers, Memory Memory, ushort Address, int px, int py, int height) { //Console.WriteLine("----------"); //for (int y = 0; y < height; y++) { // var Row = Memory.Read8((ushort)(Address + y)); // for (int x = 0; x < 8; x++) { // var New = ((Row >> (x)) & 1) != 0; // Console.Write(New ? "*" : "."); // } // Console.WriteLine(); //} Registers.V[15] = 0; for (int y = 0; y < height; y++) { var Row = Memory.Read8((ushort)(Address + y)); for (int x = 0; x < 8; x++) { var New = ((Row >> (7 - x)) & 1) != 0; var Old = Get(px + x, py + y); if (Old && New) Registers.V[15] = 1; Set(px + x, py + y, Old ^ New); } } }