Ein paar Änderungen am Disammbler (Anzeige
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
"csharp.suppressDotnetRestoreNotification": true,
|
"csharp.suppressDotnetRestoreNotification": true,
|
||||||
"dotnet.defaultSolution": "${workspaceFolder}/STCompiler.sln"
|
"dotnet.defaultSolution": "${workspaceFolder}/STCompiler.sln",
|
||||||
|
"docwriter.style": "Auto-detect"
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("STCompiler.Common")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("STCompiler.Common")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+bdee19419dc879274e82afdd621b54e1923e0940")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d6c0c1ee3d20a8c9c034ddc1705666c59490293b")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("STCompiler.Common")]
|
[assembly: System.Reflection.AssemblyProductAttribute("STCompiler.Common")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("STCompiler.Common")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("STCompiler.Common")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
003d3c09b7e8f7918fbf4cdaa8090fdb095851afe383470e725a487d784f9416
|
14757fc67d41cb1b12bbed6ec99ff57fbdd6b5433a8962bdc97d3b144274ced1
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("STCompiler.Compiler")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("STCompiler.Compiler")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+bdee19419dc879274e82afdd621b54e1923e0940")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d6c0c1ee3d20a8c9c034ddc1705666c59490293b")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("STCompiler.Compiler")]
|
[assembly: System.Reflection.AssemblyProductAttribute("STCompiler.Compiler")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("STCompiler.Compiler")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("STCompiler.Compiler")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
46a6144e75588781017434fbf53d108cb421bb266942aa9aa55b1dd432b3b750
|
a424a1c3ee1d7810475125cddba739ca260f9cec29125bc53f7c5b943f8f805a
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -41,8 +41,16 @@ class Program {
|
|||||||
|
|
||||||
ushort nVars = r.ReadUInt16();
|
ushort nVars = r.ReadUInt16();
|
||||||
Console.WriteLine($"Vars: {nVars}");
|
Console.WriteLine($"Vars: {nVars}");
|
||||||
var varTypes = new byte[nVars];
|
var varTypes = new VarType[nVars];
|
||||||
for (int i = 0; i < nVars; i++) { varTypes[i] = r.ReadByte(); Console.WriteLine($" Var[{i}] type = {varTypes[i]}"); }
|
for (int i = 0; i < nVars; i++) {
|
||||||
|
byte tb = r.ReadByte();
|
||||||
|
var vt = (VarType)tb;
|
||||||
|
varTypes[i] = vt;
|
||||||
|
if (Enum.IsDefined(typeof(VarType), vt))
|
||||||
|
Console.WriteLine($" Var[{i}] type = {vt}");
|
||||||
|
else
|
||||||
|
Console.WriteLine($" Var[{i}] type = {tb} (unknown)");
|
||||||
|
}
|
||||||
|
|
||||||
ushort codeLen = r.ReadUInt16();
|
ushort codeLen = r.ReadUInt16();
|
||||||
Console.WriteLine($"CodeLen: {codeLen} bytes");
|
Console.WriteLine($"CodeLen: {codeLen} bytes");
|
||||||
@ -53,15 +61,15 @@ class Program {
|
|||||||
while (ip < code.Length) {
|
while (ip < code.Length) {
|
||||||
int addr = ip;
|
int addr = ip;
|
||||||
byte op = code[ip++];
|
byte op = code[ip++];
|
||||||
Console.Write($"{addr:0000}: 0x{op:X2} {Bytecode.OpName(op)} ");
|
Console.Write($"{addr:0000}: 0x{op:X2} ");
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case Bytecode.OpCodes.NOP: Console.WriteLine("NOP"); break;
|
case Bytecode.OpCodes.NOP: Console.WriteLine("NOP"); break;
|
||||||
case Bytecode.OpCodes.PUSH_CONST: { ushort ci = ReadU16(code, ref ip); Console.WriteLine($"PUSH_CONST {ci} ({consts[ci]})"); break; }
|
case Bytecode.OpCodes.PUSH_CONST: { ushort ci = ReadU16(code, ref ip); Console.WriteLine($"PUSH_CONST {ci} ({consts[ci]})"); break; }
|
||||||
case Bytecode.OpCodes.PUSH_REAL_CONST: { ushort ci = ReadU16(code, ref ip); Console.WriteLine($"PUSH_REAL_CONST {ci} ({consts[ci]})"); break; }
|
case Bytecode.OpCodes.PUSH_REAL_CONST: { ushort ci = ReadU16(code, ref ip); Console.WriteLine($"PUSH_REAL_CONST {ci} ({consts[ci]})"); break; }
|
||||||
case Bytecode.OpCodes.LOAD_VAR: { ushort vi = ReadU16(code, ref ip); Console.WriteLine($"LOAD_VAR {vi}"); break; }
|
case Bytecode.OpCodes.LOAD_VAR: { ushort vi = ReadU16(code, ref ip); Console.WriteLine($"LOAD_VAR {vi}"); break; }
|
||||||
case Bytecode.OpCodes.STORE_VAR: { ushort vi = ReadU16(code, ref ip); Console.WriteLine($"STORE_VAR {vi}"); break; }
|
case Bytecode.OpCodes.STORE_VAR: { ushort vi = ReadU16(code, ref ip); Console.WriteLine($"STORE_VAR {vi}"); break; }
|
||||||
case Bytecode.OpCodes.JZ: { ushort target = ReadU16(code, ref ip); Console.WriteLine($"JZ addr={target}"); break; }
|
case Bytecode.OpCodes.JZ: { ushort target = ReadU16(code, ref ip); Console.WriteLine($"JZ addr={target:0000}"); break; }
|
||||||
case Bytecode.OpCodes.JMP: { ushort target = ReadU16(code, ref ip); Console.WriteLine($"JMP addr={target}"); break; }
|
case Bytecode.OpCodes.JMP: { ushort target = ReadU16(code, ref ip); Console.WriteLine($"JMP addr={target:0000}"); break; }
|
||||||
case Bytecode.OpCodes.HALT: Console.WriteLine("HALT"); break;
|
case Bytecode.OpCodes.HALT: Console.WriteLine("HALT"); break;
|
||||||
default: Console.WriteLine($"{Bytecode.OpName(op)}"); break;
|
default: Console.WriteLine($"{Bytecode.OpName(op)}"); break;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("STCompiler.Disassembler")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("STCompiler.Disassembler")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+bdee19419dc879274e82afdd621b54e1923e0940")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d6c0c1ee3d20a8c9c034ddc1705666c59490293b")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("STCompiler.Disassembler")]
|
[assembly: System.Reflection.AssemblyProductAttribute("STCompiler.Disassembler")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("STCompiler.Disassembler")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("STCompiler.Disassembler")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
e512ea89251f2295a76007dc4f99ce92f19bc2813739fd32e9bf7233cc288310
|
464c162666b4bc2ea38f251b8581cce943c86b051338cfd40945bd712973ca04
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("STCompiler.Simulator")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("STCompiler.Simulator")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+bdee19419dc879274e82afdd621b54e1923e0940")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d6c0c1ee3d20a8c9c034ddc1705666c59490293b")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("STCompiler.Simulator")]
|
[assembly: System.Reflection.AssemblyProductAttribute("STCompiler.Simulator")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("STCompiler.Simulator")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("STCompiler.Simulator")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
d8b8419173d413df3b338b6f12782609e7ef0c8712b509b4a4bb6869e65f93af
|
1f912a4d9abdccc3c72995cc47c6abca27b37eb53a3bef8d54e15f74186522d1
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user