private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); OptionsManager opm = new OptionsManager(); opm.LoadOptions(); BinFile bFile = new BinFile(); LabelContainer lContainer = new LabelContainer(); Disassembler dsembler = new Disassembler(bFile, lContainer); Assembler asmbler = new Assembler(lContainer); MainForm mainForm = new MainForm(bFile, dsembler, asmbler, lContainer); mainForm.GetOptions(opm.options); dsembler.GetOptions(opm.options); asmbler.GetOptions(opm.options); Application.Run(mainForm); mainForm.SetOptions(opm.options); dsembler.SetOptions(opm.options); asmbler.SetOptions(opm.options); opm.SaveOptions(); }
public Disassembler(BinFile cs, LabelContainer lcs) { CoreFile = cs; lc = lcs; PrintOffsets = true; PrintedOffsetFormat = OffsetFormat.BankOffset; InstructionNumberFormat = OffsetFormat.Hex; PrintBitPattern = true; PrintComments = false; HideDefinedData = false; }
public MainForm(BinFile cs, Disassembler ds, Assembler ac, LabelContainer lcnew) { InitializeComponent(); mainTextBox = ((TextBoxHost)elementHost2.Child).mainTextBox; disassembler = ds; assembler = ac; labelContainer = lcnew; romFile = cs; funcLabelBox.DataSource = labelContainer.FuncList; dataLabelBox.DataSource = labelContainer.DataList; varLabelBox.DataSource = labelContainer.VarList; }
public AddCommentForm(LabelContainer lblContainer, LabelEditMode editMode, int offset = -1) { InitializeComponent(); labelContainer = lblContainer; if (editMode == LabelEditMode.Edit) { if (labelContainer.Comments.ContainsKey(offset)) { commentBox.Text = labelContainer.Comments[offset]; } Text = "Edit Comment"; } }
public OptionsForm(Disassembler op, Assembler ap, LabelContainer lc, MainFormOptions mf) { InitializeComponent(); disassembler = op; assembler = ap; lcs = lc; mfo = mf; printOffsetsCheckBox.Checked = op.PrintOffsets; hideDataSectionsCheckBox.Checked = op.HideDefinedData; printBitPatternCheckBox.Checked = op.PrintBitPattern; printCommentsCheckBox.Checked = op.PrintComments; wordWrapCheckBox.Checked = mf.isWordWrap; switch (op.PrintedOffsetFormat) { case OffsetFormat.BankOffset: offsetNumberFormatBox.SelectedIndex = 0; break; case OffsetFormat.Hex: offsetNumberFormatBox.SelectedIndex = 1; break; case OffsetFormat.Decimal: offsetNumberFormatBox.SelectedIndex = 2; break; } switch (op.InstructionNumberFormat) { case OffsetFormat.Hex: instructionNumberFormatBox.SelectedIndex = 0; break; case OffsetFormat.Decimal: instructionNumberFormatBox.SelectedIndex = 1; break; } dsmColor00Box.Text = op.GameboyFormatChars.Length > 0 ? op.GameboyFormatChars[0].ToString() : "0"; dsmColor01Box.Text = op.GameboyFormatChars.Length > 1 ? op.GameboyFormatChars[1].ToString() : "1"; dsmColor10Box.Text = op.GameboyFormatChars.Length > 2 ? op.GameboyFormatChars[2].ToString() : "2"; dsmColor11Box.Text = op.GameboyFormatChars.Length > 3 ? op.GameboyFormatChars[3].ToString() : "3"; asmColor00Box.Text = ap.GameboyFormatChars.Length > 0 ? ap.GameboyFormatChars[0].ToString() : "0"; asmColor01Box.Text = ap.GameboyFormatChars.Length > 1 ? ap.GameboyFormatChars[1].ToString() : "1"; asmColor10Box.Text = ap.GameboyFormatChars.Length > 2 ? ap.GameboyFormatChars[2].ToString() : "2"; asmColor11Box.Text = ap.GameboyFormatChars.Length > 3 ? ap.GameboyFormatChars[3].ToString() : "3"; }
public AddVarLabelForm(LabelContainer lblContainer, LabelEditMode editMode, VarLabel newPriorLabel = null) { InitializeComponent(); labelContainer = lblContainer; editingMode = editMode; editedLabel = newPriorLabel; if (editMode == LabelEditMode.Edit) { Text = "Edit Variable"; if (editedLabel != null) { nameBox.Text = editedLabel.Name; offsetBox.Text = editedLabel.Value.ToString("X"); if (!String.IsNullOrEmpty(editedLabel.Comment)) { commentBox.Text = editedLabel.Comment; } } } }
public AddDataLabelForm(LabelContainer lblContainer, LabelEditMode editMode, DataLabel newPriorLabel = null) { InitializeComponent(); labelContainer = lblContainer; editingMode = editMode; editedLabel = newPriorLabel; dataTypeBox.SelectedIndex = 0; if (editMode == LabelEditMode.Edit) { Text = "Edit Data Section"; if (editedLabel != null) { nameBox.Text = editedLabel.Name; offsetBox.Text = editedLabel.Offset.ToString("X"); lengthBox.Text = editedLabel.Length.ToString("X"); dataTypeBox.SelectedIndex = (int)editedLabel.DSectionType; if (!String.IsNullOrEmpty(editedLabel.Comment)) { commentBox.Text = editedLabel.Comment; } dataTemplateBox.Text = TemplateBuilder.TemplateToString(editedLabel.PrintTemplate); } } }
public Assembler(LabelContainer newlc) { lc = newlc; GameboyFormatChars = "0123"; }