ScriptStack 1.0.4
Loading...
Searching...
No Matches
ScriptStack.Runtime.Instruction Class Reference

An instruction in a virtual intermediate language. More...

Public Member Functions

 Instruction (OpCode opcode, Operand first, Operand second)
 Instruction (OpCode opcode, Operand operand0)
 Instruction (OpCode opcode)
override string ToString ()

Properties

uint Address [get, set]
OpCode OpCode [get, set]
Operand First [get, set]
Operand Second [get, set]

Detailed Description

An instruction in a virtual intermediate language.

Definition at line 11 of file Instruction.cs.

Constructor & Destructor Documentation

◆ Instruction() [1/3]

ScriptStack.Runtime.Instruction.Instruction ( OpCode opcode,
Operand first,
Operand second )

Definition at line 65 of file Instruction.cs.

66 {
67 address = 0;
68 this.opcode = opcode;
69 this.first = first;
70 this.second = second;
71 }

References OpCode.

◆ Instruction() [2/3]

ScriptStack.Runtime.Instruction.Instruction ( OpCode opcode,
Operand operand0 )

Definition at line 73 of file Instruction.cs.

74 : this(opcode, operand0, null)
75 {
76 }

References OpCode.

◆ Instruction() [3/3]

ScriptStack.Runtime.Instruction.Instruction ( OpCode opcode)

Definition at line 78 of file Instruction.cs.

79 : this(opcode, null, null)
80 {
81 }

References OpCode.

Member Function Documentation

◆ ToString()

override string ScriptStack.Runtime.Instruction.ToString ( )

Definition at line 83 of file Instruction.cs.

84 {
85
86 if (opcode == OpCode.DBG)
87 {
88
89 int lineNumber = (int)first.Value;
90 return "Verarbeite Zeile: " + lineNumber + "\n" + second.Value;
91
92 }
93
94 StringBuilder stringBuilder = new StringBuilder();
95
96 stringBuilder.Append("["+string.Format(address.ToString("X8"))+"]");
97 stringBuilder.Append(" ");
98
99 stringBuilder.Append(opcode.ToString());
100 int iOpcodeLength = opcode.ToString().Length;
101 if (iOpcodeLength == 2)
102 stringBuilder.Append(" ");
103 if (iOpcodeLength == 3)
104 stringBuilder.Append(" ");
105
106 if (first != null)
107 {
108 stringBuilder.Append(" ");
109 stringBuilder.Append(first.ToString());
110 }
111
112 if (second != null)
113 {
114 stringBuilder.Append(", ");
115 stringBuilder.Append(second.ToString());
116 }
117
118 return stringBuilder.ToString();
119 }

References OpCode.

Property Documentation

◆ Address

uint ScriptStack.Runtime.Instruction.Address
getset

Definition at line 125 of file Instruction.cs.

126 {
127 get { return address; }
128 set { address = value; }
129 }

Referenced by ScriptStack.Runtime.Operand.ToString().

◆ First

Operand ScriptStack.Runtime.Instruction.First
getset

Definition at line 137 of file Instruction.cs.

138 {
139 get { return first; }
140 set { first = value; }
141 }

◆ OpCode

OpCode ScriptStack.Runtime.Instruction.OpCode
getset

Definition at line 131 of file Instruction.cs.

132 {
133 get { return opcode; }
134 set { opcode = value; }
135 }

Referenced by Instruction(), Instruction(), Instruction(), and ToString().

◆ Second

Operand ScriptStack.Runtime.Instruction.Second
getset

Definition at line 143 of file Instruction.cs.

144 {
145 get { return second; }
146 set { second = value; }
147 }

The documentation for this class was generated from the following file: