29 lines
654 B
C#
29 lines
654 B
C#
|
using System;
|
||
|
using System.IO;
|
||
|
|
||
|
namespace TLang.Common
|
||
|
{
|
||
|
public class JumpConditional : Instruction, ILabelable
|
||
|
{
|
||
|
public string Key {get;set;}="";
|
||
|
public int Value {get;set;} =0;
|
||
|
public JumpConditional(string key)
|
||
|
{
|
||
|
Key = key;
|
||
|
}
|
||
|
|
||
|
public override int CalculateLength()
|
||
|
{
|
||
|
return 5;
|
||
|
}
|
||
|
|
||
|
public override void WriteData(Stream strm)
|
||
|
{
|
||
|
strm.WriteByte(JMPC);
|
||
|
var data=BitConverter.GetBytes(Value);
|
||
|
if(BitConverter.IsLittleEndian) Array.Reverse(data);
|
||
|
strm.Write(data,0,data.Length);
|
||
|
}
|
||
|
}
|
||
|
}
|