private void btnImportFromASM_Click(object sender, EventArgs e) { var parser = new Parser.ASMFileParser(); Parser.CompileConfig config = new Parser.CompileConfig(); config.TargetType = Types.CompileTargetType.PLAIN; config.OutputFile = "temp.bin"; config.Assembler = Types.AssemblerType.C64_STUDIO; string temp = "* = $0801\n" + editDataExport.Text; if ((!parser.Parse(temp, new ProjectConfig(), config)) || (!parser.Assemble(config))) { return; } var output = parser.AssembledOutput; m_Project.ValueTable.Data.Clear(); m_Project.ValueTable.Values.Clear(); listValues.Items.Clear(); for (int i = 0; i < output.Assembly.Length; ++i) { byte nextValue = output.Assembly.ByteAt(i); m_Project.ValueTable.Values.Add(nextValue.ToString()); m_Project.ValueTable.Data.AppendU8(nextValue); listValues.Items.Add(nextValue.ToString()); } SetModified(); }
internal static ByteBuffer FromASMData(string Text) { var asmParser = new Parser.ASMFileParser(); var config = new Parser.CompileConfig(); config.TargetType = CompileTargetType.PLAIN; config.OutputFile = "temp.bin"; config.Assembler = AssemblerType.C64_STUDIO; string temp = "* = $0801\n" + Text; if (Text.Contains(".BYTE")) { config.Assembler = AssemblerType.DASM; // DASM requires pseudo ops to be not at the left most border temp = " ORG $0801\n" + Text.Replace(".BYTE", " .BYTE"); } if ((asmParser.Parse(temp, null, config, null)) && (asmParser.Assemble(config))) { return(asmParser.AssembledOutput.Assembly); } return(null); }