Files
SVM/SVM/Instructions/BRK.cs
Sam Stevens cf9004e206 Implemented faults and fault handling.
Added flags FLTSTS, FLTJH, FLTJL.

Added breakpoints and BRK instruction.

Added PUSH and POP instructions for interacting with the stack.
2017-12-31 23:18:17 +00:00

36 lines
800 B
C#

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace SVM.Instructions
{
class BRK : Instruction
{
public override string ASM => "BRK";
public override byte OP => 0x61;
public override byte[] Encode(string asm, Dictionary<string, ushort> markerRefs)
{
Debug.Assert(string.IsNullOrWhiteSpace(asm));
return new byte[] { OP };
}
public override void Exec(VM vm, byte[] vars)
{
if (vm.DEBUG)
{
vm.RUN = false;
vm.InvokeBreakpoint();
}
}
public override string ToASM(byte[] vars)
{
Debug.Assert(vars.Length == 0);
return ASM;
}
}
}