/// <summary> /// Creates a new instance of a Pull instruction. /// </summary> public Pull(ZVariable variable) : base("pull", 0x09, OpcodeTypeKind.Var, new ZOperand(variable.VariableNumber)) { // While this instruction requires a variable // We have to convert it into a byte constant // Thus "new ZOperand(variable.VariableNumber)" _variable = variable; }
/// <summary> /// Creates a new instance of a Load instruction. /// </summary> public Load(ZVariable variable, ZVariable store) : base("load", 0x0E, OpcodeTypeKind.OneOP, store, new ZOperand(variable.VariableNumber)) { // While this instruction requires a variable // We have to convert it into a byte constant // Thus "new ZOperand(variable.VariableNumber)" _variable = variable; }
/// <summary> /// Creates a new instance of a Store instruction with a short as value. /// </summary> /// <param name="variable">The referenced variable.</param> /// <param name="value">The value to set.</param> public Store(ZVariable variable, short value) : base("store", 0x0D, OpcodeTypeKind.TwoOP, new ZOperand(variable.VariableNumber), new ZOperand(value)) { // While this instruction requires a variable // We have to convert it into a byte constant // Thus "new ZOperand(variable.VariableNumber)" _variable = variable; _value = value; }
/// <summary> /// Creates a new instance of an Mod instruction. /// </summary> public Mod(ZVariable a, short b, ZVariable store) : this(store, new ZOperand(a), new ZOperand(b)) { }
/// <summary> /// Creates a new instance of an Mod instruction. /// </summary> public Mod(short a, ZVariable b, ZVariable store) : this(store, new ZOperand(a), new ZOperand(b)) { }
public Jz(ZVariable a, ZBranchLabel branchLabel) : this(branchLabel, new ZOperand(a)) { }
private Div(ZVariable store, params ZOperand[] operands) : base("div", 0x17, OpcodeTypeKind.TwoOP, store, operands) { }
/// <summary> /// Creates a new instance of an Inc instruction. /// </summary> public Inc(ZVariable variable) : base("inc", 0x05, OpcodeTypeKind.OneOP, new ZOperand(variable)) { _variable = variable; }
/// <summary> /// Creates a new instance of an Add instruction. /// </summary> public Add(ZVariable a, ZVariable b, ZVariable store) : this(store, new ZOperand(a), new ZOperand(b)) { }
/// <summary> /// Creates a new instance of a ZInstructionSt. Check the complete table of opcodes for valid values. /// </summary> /// <param name="name">The Inform name for the used opcode. It is used for debugging purposes only, so you COULD leave this empty or null.</param> /// <param name="opcodeNumer">The opcode number.</param> /// <param name="opcodeType">The opcode type.</param> /// <param name="store">The store variable.</param> /// <param name="operands">The operands to use.</param> public ZInstructionSt(string name, byte opcodeNumber, OpcodeTypeKind opcodeType, ZVariable store, params ZOperand[] operands) : base(name, opcodeNumber, opcodeType, operands) { _store = store; _subComponents.Add(store); }
/// <summary> /// Creates a new instance of a Random instruction. /// </summary> /// <param name="range">If range is positive, returns a uniformly random number between 1 and range. If range is negative, the random number generator is seeded to that value and the return value is 0.</param> /// <param name="store">The variable where the result will be stored.</param> public Random(short range, ZVariable store) : base("random", 0x07, OpcodeTypeKind.Var, store, new ZOperand(range)) { _range = range; }
/// <summary> /// Creates a new instance of a PrintNum instruction. /// </summary> public PrintNum(ZVariable variable) : base("print_num", 0x06, OpcodeTypeKind.Var, new ZOperand(variable)) { }
private Mul(ZVariable store, params ZOperand[] operands) : base("mul", 0x16, OpcodeTypeKind.TwoOP, store, operands) { }
public Je(ZVariable a, short b, ZBranchLabel branchLabel) : this(branchLabel, new ZOperand(a), new ZOperand(b)) { }
private Mod(ZVariable store, params ZOperand[] operands) : base("mod", 0x18, OpcodeTypeKind.TwoOP, store, operands) { }
private Sub(ZVariable store, params ZOperand[] operands) : base("sub", 0x15, OpcodeTypeKind.TwoOP, store, operands) { }
/// <summary> /// Creates a new instance of an Add instruction. /// </summary> public Add(short a, short b, ZVariable store) : this(store, new ZOperand(a), new ZOperand(b)) { }
/// <summary> /// Creates a new instance of a ZOperand with <see cref="ZVariable"/> as value. /// </summary> /// <param name="value">The value as ZVariable.</param> public ZOperand(ZVariable value) { _value = value; _subComponents.Add(value); _operandType = OperandTypeKind.Variable; }
private Add(ZVariable store, params ZOperand[] operands) : base("add", 0x14, OpcodeTypeKind.TwoOP, store, operands) { }
/// <summary> /// Creates a new instance of a ReadChar instruction. /// </summary> public ReadChar(ZVariable variable) : base("read_char", 0x16, OpcodeTypeKind.Var, variable, new ZOperand((byte)1), new ZOperand((byte)0), new ZOperand((byte)0)) { }
public Jl(ZVariable a, ZVariable b, ZBranchLabel branchLabel) : this(branchLabel, new ZOperand(a), new ZOperand(b)) { }
/// <summary> /// Creates a new instance of a Push instruction with a variable as value. /// </summary> /// <param name="variable">The variable to push.</param> public Push(ZVariable variable) : base("push", 0x08, OpcodeTypeKind.Var, new ZOperand(variable)) { }