public override bool HandleImport(CharsetProject CharSet, CharsetEditor Editor) { Parser.ASMFileParser asmParser = new RetroDevStudio.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" + editInput.Text; if ((asmParser.Parse(temp, null, config, null)) && (asmParser.Assemble(config))) { GR.Memory.ByteBuffer charData = asmParser.AssembledOutput.Assembly; int charsToImport = (int)charData.Length / 8; if (charsToImport > CharSet.TotalNumberOfCharacters) { charsToImport = CharSet.TotalNumberOfCharacters; } for (int i = 0; i < charsToImport; ++i) { charData.CopyTo(CharSet.Characters[i].Tile.Data, i * 8, 8); Editor.CharacterChanged(i); } return(true); } return(false); }
private void editASMDirArt_TextChanged(object sender, EventArgs e) { Parser.ASMFileParser asmParser = new RetroDevStudio.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" + editASMDirArt.Text; if ((asmParser.Parse(temp, null, config, null)) && (asmParser.Assemble(config))) { GR.Memory.ByteBuffer data = asmParser.AssembledOutput.Assembly; ResultingData = data; labelASMInfo.Text = "Data is valid"; labelASMInfo.ForeColor = System.Drawing.SystemColors.ControlText; } else { labelASMInfo.Text = "Invalid ASM Data (expect !byte statements)"; labelASMInfo.ForeColor = System.Drawing.Color.Red; } }
private void btnFromASM_Click(object sender, EventArgs e) { Parser.ASMFileParser asmParser = new RetroDevStudio.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" + textBinaryData.Text; if ((asmParser.Parse(temp, null, config, null)) && (asmParser.Assemble(config))) { SetHexData(asmParser.AssembledOutput.Assembly); } }
private void btnImportFromAssembly_Click(object sender, EventArgs e) { Parser.ASMFileParser asmParser = new RetroDevStudio.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" + editDataImport.Text; if ((asmParser.Parse(temp, null, config, null)) && (asmParser.Assemble(config))) { ImportFromData(asmParser.AssembledOutput.Assembly, checkImportSwizzle.Checked, checkImportColorsSorted.Checked); } }