Skip to content
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2911,4 +2911,4 @@ Bug fixes
- Terminal created
- KerboScript designed and implemented
- VAB Part created
- Flight stats and bindings created
- Flight stats and bindings created
23 changes: 22 additions & 1 deletion src/kOS.Safe/Compilation/Opcode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public enum ByteCode :byte
ARGBOTTOM = 0x60,
TESTARGBOTTOM = 0x61,
TESTCANCELLED = 0x62,

JUMPSTACK = 0x63,

// Augmented bogus placeholder versions of the normal
// opcodes: These only exist in the program temporarily
Expand Down Expand Up @@ -1102,6 +1102,27 @@ public override void Execute(ICpu cpu)
DeltaInstructionPointer = Distance;
}
}

/// <summary>
/// <para>
/// Pops a Int32 from the stack and then unconditionally
/// advances the instruction pointer by it
/// </para>
/// <para></para>
/// <para>... dist ...</para>
/// </summary>
public class OpcodeJumpStack : Opcode
{
protected override string Name { get { return "jumpstack"; } }
public override ByteCode Code { get { return ByteCode.JUMPSTACK; } }

public override void Execute(ICpu cpu)
{
object popval = cpu.PopValueArgument();
int distance = Convert.ToInt32(popval);
DeltaInstructionPointer = distance;
}
}

/// <summary>
/// Most Opcode.Label fields are just string-ified numbers for their index
Expand Down
Loading