diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IDebuggable.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IDebuggable.cs index 5a5e2b2da5..ea20175609 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IDebuggable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IDebuggable.cs @@ -61,6 +61,82 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public IMemoryCallbackSystem MemoryCallbacks { get; private set; } [FeatureNotImplemented] - public void Step(StepType type) { throw new NotImplementedException(); } + public void Step(StepType type) + { + switch (type) + { + case StepType.Into: + StepInto(); + break; + case StepType.Out: + throw new NotImplementedException(); + case StepType.Over: + throw new NotImplementedException(); + } + } + + private void StepInto() + { + var size = opsize[Cpu.PeekMemory(Cpu.PC)]; + + for (int i = 0; i < size; i++) + { + CycleAdvance(); + } + } + + //the opsize table is used to quickly grab the instruction sizes (in bytes) + private readonly byte[] opsize = new byte[] + { + /*0x00*/ 1,2,0,0,0,2,2,0,1,2,1,0,0,3,3,0, + /*0x10*/ 2,2,0,0,0,2,2,0,1,3,0,0,0,3,3,0, + /*0x20*/ 3,2,0,0,2,2,2,0,1,2,1,0,3,3,3,0, + /*0x30*/ 2,2,0,0,0,2,2,0,1,3,0,0,0,3,3,0, + /*0x40*/ 1,2,0,0,0,2,2,0,1,2,1,0,3,3,3,0, + /*0x50*/ 2,2,0,0,0,2,2,0,1,3,0,0,0,3,3,0, + /*0x60*/ 1,2,0,0,0,2,2,0,1,2,1,0,3,3,3,0, + /*0x70*/ 2,2,0,0,0,2,2,0,1,3,0,0,0,3,3,0, + /*0x80*/ 0,2,0,0,2,2,2,0,1,0,1,0,3,3,3,0, + /*0x90*/ 2,2,0,0,2,2,2,0,1,3,1,0,0,3,0,0, + /*0xA0*/ 2,2,2,0,2,2,2,0,1,2,1,0,3,3,3,0, + /*0xB0*/ 2,2,0,0,2,2,2,0,1,3,1,0,3,3,3,0, + /*0xC0*/ 2,2,0,0,2,2,2,0,1,2,1,0,3,3,3,0, + /*0xD0*/ 2,2,0,0,0,2,2,0,1,3,0,0,0,3,3,0, + /*0xE0*/ 2,2,0,0,2,2,2,0,1,2,1,0,3,3,3,0, + /*0xF0*/ 2,2,0,0,0,2,2,0,1,3,0,0,0,3,3,0 + }; + + + /*the optype table is a quick way to grab the addressing mode for any 6502 opcode + // + // 0 = Implied\Accumulator\Immediate\Branch\NULL + // 1 = (Indirect,X) + // 2 = Zero Page + // 3 = Absolute + // 4 = (Indirect),Y + // 5 = Zero Page,X + // 6 = Absolute,Y + // 7 = Absolute,X + // 8 = Zero Page,Y + */ + private readonly byte[] optype = new byte[] + { + /*0x00*/ 0,1,0,0,0,2,2,0,0,0,0,0,0,3,3,0, + /*0x10*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0, + /*0x20*/ 0,1,0,0,2,2,2,0,0,0,0,0,3,3,3,0, + /*0x30*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0, + /*0x40*/ 0,1,0,0,0,2,2,0,0,0,0,0,0,3,3,0, + /*0x50*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0, + /*0x60*/ 0,1,0,0,0,2,2,0,0,0,0,0,3,3,3,0, + /*0x70*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0, + /*0x80*/ 0,1,0,0,2,2,2,0,0,0,0,0,3,3,3,0, + /*0x90*/ 0,4,0,0,5,5,8,0,0,6,0,0,0,7,0,0, + /*0xA0*/ 0,1,0,0,2,2,2,0,0,0,0,0,3,3,3,0, + /*0xB0*/ 0,4,0,0,5,5,8,0,0,6,0,0,7,7,6,0, + /*0xC0*/ 0,1,0,0,2,2,2,0,0,0,0,0,3,3,3,0, + /*0xD0*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0, + /*0xE0*/ 0,1,0,0,2,2,2,0,0,0,0,0,3,3,3,0, + /*0xF0*/ 0,4,0,0,0,5,5,0,0,6,0,0,0,7,7,0 + }; } } diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.ISettable.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.ISettable.cs index e2d26d54f2..2df755e350 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.ISettable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.ISettable.cs @@ -41,6 +41,9 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 return false; } + internal A2600Settings Settings { get; private set; } + internal A2600SyncSettings SyncSettings { get; private set; } + public class A2600Settings { [JsonIgnore] diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs index acaf200615..f7811ffcf3 100644 --- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs +++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs @@ -79,10 +79,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600 public bool DeterministicEmulation { get; set; } - public A2600Settings Settings { get; private set; } - - public A2600SyncSettings SyncSettings { get; private set; } - public static readonly ControllerDefinition Atari2600ControllerDefinition = new ControllerDefinition { Name = "Atari 2600 Basic Controller",