1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-26 06:49:19 +00:00

Remove WinForms code

This commit is contained in:
Andy McFadden 2019-08-02 12:48:12 -07:00
parent 2a901cc373
commit 1219755e85
158 changed files with 0 additions and 45253 deletions

View File

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{08EC328D-078E-4236-B574-BE6B3FD85915}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CommonWinForms</RootNamespace>
<AssemblyName>CommonWinForms</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="NativeMethods.cs" />
<Compile Include="WinFormsExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,83 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace CommonWinForms {
// From https://stackoverflow.com/questions/1019388/
/// <summary>
/// Unpleasant hackery to make "select all" faster. With 500K items it takes about 24
/// seconds to select everything individually, and there isn't a better way. With this
/// it only takes a few milliseconds.
/// </summary>
public class NativeMethods {
private const int LVM_FIRST = 0x1000;
private const int LVM_SETITEMSTATE = LVM_FIRST + 43;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct LVITEM {
public int mask;
public int iItem;
public int iSubItem;
public int state;
public int stateMask;
[MarshalAs(UnmanagedType.LPTStr)]
public string pszText;
public int cchTextMax;
public int iImage;
public IntPtr lParam;
public int iIndent;
public int iGroupId;
public int cColumns;
public IntPtr puColumns;
};
[DllImport("user32.dll", EntryPoint = "SendMessage", CharSet = CharSet.Auto)]
public static extern IntPtr SendMessageLVItem(IntPtr hWnd, int msg, int wParam, ref LVITEM lvi);
/// <summary>
/// Select all rows on the given listview
/// </summary>
/// <param name="list">The listview whose items are to be selected</param>
public static void SelectAllItems(ListView list) {
NativeMethods.SetItemState(list, -1, 2, 2);
}
/// <summary>
/// Deselect all rows on the given listview
/// </summary>
/// <param name="list">The listview whose items are to be deselected</param>
public static void DeselectAllItems(ListView list) {
NativeMethods.SetItemState(list, -1, 2, 0);
}
/// <summary>
/// Set the item state on the given item
/// </summary>
/// <param name="list">The listview whose item's state is to be changed</param>
/// <param name="itemIndex">The index of the item to be changed</param>
/// <param name="mask">Which bits of the value are to be set?</param>
/// <param name="value">The value to be set</param>
public static void SetItemState(ListView list, int itemIndex, int mask, int value) {
LVITEM lvItem = new LVITEM();
lvItem.stateMask = mask;
lvItem.state = value;
SendMessageLVItem(list.Handle, LVM_SETITEMSTATE, itemIndex, ref lvItem);
}
}
}

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CommonWinForms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CommonWinForms")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("08ec328d-078e-4236-b574-be6b3fd85915")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,141 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Drawing;
using System.Windows.Forms;
namespace CommonWinForms {
/// <summary>
/// Overload RichTextBox.AppendText() with a version that takes a color as an argument.
///
/// From https://stackoverflow.com/a/1926822/294248
/// </summary>
public static class RichTextBoxExtensions {
public static void AppendText(this RichTextBox box, string text, Color color) {
box.SelectionStart = box.TextLength;
box.SelectionLength = 0;
box.SelectionColor = color;
box.AppendText(text);
box.SelectionColor = box.ForeColor;
}
}
/// <summary>
/// Add functions to select and deselect all items.
/// </summary>
public static class ListViewExtensions {
// I don't know if NativeMethods is going to work on other platforms, but I assume
// not. I'm not sure how expensive the runtime check is, so cache the result.
private enum DNY { Dunno = 0, No, Yes };
private static DNY IsPlatformWindows;
private static bool IsWindows {
get {
if (IsPlatformWindows == DNY.Dunno) {
// This is the .NET framework 4.6 way. Later versions (4.7, netcommon)
// prefer the RuntimeInformation.IsOSPlatform() approach.
OperatingSystem os = Environment.OSVersion;
if (os.Platform == PlatformID.Win32NT) {
IsPlatformWindows = DNY.Yes;
} else {
IsPlatformWindows = DNY.No;
}
}
return (IsPlatformWindows == DNY.Yes);
}
}
/// <summary>
/// Selects all items in the list view.
/// </summary>
public static void SelectAll(this ListView listView) {
// Neither I nor the Internet can figure out how to do this efficiently for
// large lists without P/Invoke interop. With 554253 lines, it takes 24.3 seconds
// to select each item individually, but only 4 milliseconds to do it through an
// LVITEM. The latter causes a single VirtualItemsSelectionRangeChanged event
// instead of 554K ItemSelectionChanged events.
//
// https://stackoverflow.com/questions/9039989/
// https://stackoverflow.com/questions/1019388/
if (IsWindows) {
NativeMethods.SelectAllItems(listView);
} else {
try {
Application.UseWaitCursor = true;
Cursor.Current = Cursors.WaitCursor;
listView.BeginUpdate();
int max = listView.VirtualListSize;
for (int i = 0; i < max; i++) {
//codeListView.Items[i].Selected = true;
listView.SelectedIndices.Add(i);
}
} finally {
listView.EndUpdate();
Application.UseWaitCursor = false;
}
}
}
/// <summary>
/// Deselects all items in the list view.
/// </summary>
public static void DeselectAll(this ListView listView) {
// This is as fast as the native DeselectAllItems(), so just use it.
listView.SelectedIndices.Clear();
}
/// <summary>
/// Sets the double-buffered status of the list view.
/// </summary>
public static void SetDoubleBuffered(this ListView listView, bool enable) {
WinFormsUtil.SetDoubleBuffered(listView, enable);
}
/// <summary>
/// Determines whether the specified item is visible in the list view.
/// </summary>
public static bool IsItemVisible(this ListView listView, ListViewItem item) {
Rectangle lvBounds = listView.ClientRectangle;
if (listView.HeaderStyle != ColumnHeaderStyle.None) {
// Need to factor the header height out. There's no easy way to do that,
// but the header should be (almost) the same height as an item.
// https://stackoverflow.com/q/538906/294248
int headerHeight = item.Bounds.Height + 5; // 5 is magic, will probably break
lvBounds = new Rectangle(lvBounds.X, lvBounds.Y + headerHeight,
lvBounds.Width, lvBounds.Height - headerHeight);
}
//Console.WriteLine("IsVis LV: " + lvBounds + " IT: " +
// item.GetBounds(ItemBoundsPortion.Entire));
return lvBounds.IntersectsWith(item.GetBounds(ItemBoundsPortion.Entire));
}
}
public static class WinFormsUtil {
/// <summary>
/// Sets the "DoubleBuffered" property on a Control. For some reason the
/// property is defined as "protected", but I don't want to subclass a ListView
/// just so I can enable double-buffering.
/// </summary>
/// <param name="ctrl">Control to update.</param>
/// <param name="enable">New state.</param>
public static void SetDoubleBuffered(Control ctrl, bool enable) {
System.Reflection.PropertyInfo prop = ctrl.GetType().GetProperty("DoubleBuffered",
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.NonPublic);
prop.SetValue(ctrl, enable, null);
}
}
}

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>

View File

@ -1,103 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace MakeDistWF {
partial class CopyProgress {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.progressRichTextBox = new System.Windows.Forms.RichTextBox();
this.cancelButton = new System.Windows.Forms.Button();
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.SuspendLayout();
//
// progressRichTextBox
//
this.progressRichTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.progressRichTextBox.Location = new System.Drawing.Point(13, 13);
this.progressRichTextBox.Name = "progressRichTextBox";
this.progressRichTextBox.ReadOnly = true;
this.progressRichTextBox.Size = new System.Drawing.Size(459, 507);
this.progressRichTextBox.TabIndex = 0;
this.progressRichTextBox.Text = "";
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(397, 526);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 1;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// backgroundWorker1
//
this.backgroundWorker1.WorkerReportsProgress = true;
this.backgroundWorker1.WorkerSupportsCancellation = true;
this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
this.backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);
this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
//
// CopyProgress
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(484, 561);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.progressRichTextBox);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "CopyProgress";
this.ShowInTaskbar = false;
this.Text = "CopyDistFiles";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CopyProgress_FormClosing);
this.Load += new System.EventHandler(this.CopyProgress_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.RichTextBox progressRichTextBox;
private System.Windows.Forms.Button cancelButton;
private System.ComponentModel.BackgroundWorker backgroundWorker1;
}
}

View File

@ -1,134 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using CommonWinForms;
namespace MakeDistWF {
public partial class CopyProgress : Form {
/// <summary>
/// Progress message, with colorful text. This is generated by the worker thread and
/// passed to the UI thread.
/// </summary>
public class ProgressMessage {
public string Text { get; private set; }
public Color Color { get; private set; }
public bool HasColor { get { return Color.A != 0; } }
public ProgressMessage(string msg) : this(msg, Color.FromArgb(0, 0, 0, 0)) { }
public ProgressMessage(string msg, Color color) {
Text = msg;
Color = color;
}
}
private bool mClosedWhileRunning;
// Copy parameters.
private FileCopier.BuildType mBuildType;
private bool mCopyTestFiles;
public CopyProgress(FileCopier.BuildType buildType, bool copyTestFiles) {
InitializeComponent();
this.Size = new Size(1200, 600);
mBuildType = buildType;
mCopyTestFiles = copyTestFiles;
}
private void CopyProgress_Load(object sender, EventArgs e) {
backgroundWorker1.RunWorkerAsync();
}
private void CopyProgress_FormClosing(object sender, FormClosingEventArgs e) {
if (backgroundWorker1.IsBusy) {
backgroundWorker1.CancelAsync();
DialogResult = DialogResult.Cancel;
// First close attempt is converted to a cancel.
if (!mClosedWhileRunning) {
e.Cancel = true;
mClosedWhileRunning = true;
}
} else {
DialogResult = DialogResult.OK;
}
}
private void cancelButton_Click(object sender, EventArgs e) {
if (backgroundWorker1.IsBusy) {
backgroundWorker1.CancelAsync();
} else {
Close();
}
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) {
BackgroundWorker worker = sender as BackgroundWorker;
FileCopier copier = new FileCopier(mBuildType, mCopyTestFiles);
e.Result = copier.CopyAllFiles(worker);
}
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) {
if (e.UserState is ProgressMessage) {
ProgressMessage msg = e.UserState as ProgressMessage;
if (msg.HasColor) {
progressRichTextBox.AppendText(msg.Text, msg.Color);
} else {
// plain foreground text color
progressRichTextBox.AppendText(msg.Text);
}
progressRichTextBox.SelectionStart = progressRichTextBox.Text.Length;
progressRichTextBox.ScrollToCaret();
} else {
if (!string.IsNullOrEmpty((string)e.UserState)) {
Debug.WriteLine("Weird progress: " + e.UserState);
}
}
}
private void backgroundWorker1_RunWorkerCompleted(object sender,
RunWorkerCompletedEventArgs e) {
if (e.Cancelled) {
Debug.WriteLine("Test halted -- user cancellation");
} else if (e.Error != null) {
// test harness shouldn't be throwing errors like this
Debug.WriteLine("Test failed: " + e.Error.ToString());
progressRichTextBox.AppendText("\r\n");
progressRichTextBox.AppendText(e.Error.ToString());
progressRichTextBox.SelectionStart = progressRichTextBox.Text.Length;
progressRichTextBox.ScrollToCaret();
} else {
bool ok = (bool)e.Result;
Debug.WriteLine("Tests complete, success=" + ok);
}
if (mClosedWhileRunning) {
Close();
}
cancelButton.Text = "Close";
}
}
}

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -1,316 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace MakeDistWF {
public class FileCopier {
private const string SOURCEGEN_DIRNAME = "SourceGen";
/// <summary>
/// Type of build to gather files for.
/// </summary>
public enum BuildType { Unknown, Release, Debug };
private enum SourceFileSpec {
Unknown = 0,
All,
List,
RegressionTests,
AsmSources,
NotBins,
}
private class CopySpec {
public string SourceDir { get; private set; }
public string DestDir { get; private set; }
public SourceFileSpec FileSpec { get; private set; }
public bool IsRecursive { get; private set; }
public string[] FileList { get; private set; }
public CopySpec(string srcDir, string dstDir, SourceFileSpec spec, bool recursive,
string[] fileList) {
SourceDir = srcDir;
DestDir = dstDir;
FileSpec = spec;
IsRecursive = recursive;
FileList = fileList;
}
}
private static CopySpec[] sMainSpec = {
new CopySpec(".", ".",
SourceFileSpec.List, false, new string[] { "README.md" }),
new CopySpec("Asm65/bin/{BUILD_TYPE}/netstandard2.0/", ".",
SourceFileSpec.List, false, new string[] { "Asm65.dll" }),
new CopySpec("CommonUtil/bin/{BUILD_TYPE}/netstandard2.0/", ".",
SourceFileSpec.List, false, new string[] { "CommonUtil.dll" }),
new CopySpec("CommonWinForms/bin/{BUILD_TYPE}/", ".",
SourceFileSpec.List, false, new string[] { "CommonWinForms.dll" }),
new CopySpec("PluginCommon/bin/{BUILD_TYPE}/netstandard2.0/", ".",
SourceFileSpec.List, false, new string[] { "PluginCommon.dll" }),
new CopySpec("SourceGen/bin/{BUILD_TYPE}/", ".",
SourceFileSpec.List, false, new string[] { "SourceGen.exe" }),
new CopySpec("SourceGen/RuntimeData", "RuntimeData",
SourceFileSpec.NotBins, true, null),
new CopySpec("SourceGen/Examples", "Examples",
SourceFileSpec.All, true, null),
};
private static CopySpec[] sTestSpec = {
new CopySpec("SourceGen/SGTestData", "SGTestData",
SourceFileSpec.RegressionTests, false, null),
new CopySpec("SourceGen/SGTestData", "SGTestData",
SourceFileSpec.List, false, new string[] { "README.md" }),
new CopySpec("SourceGen/SGTestData/Expected", "SGTestData/Expected",
SourceFileSpec.AsmSources, false, null),
new CopySpec("SourceGen/SGTestData/Source", "SGTestData/Source",
SourceFileSpec.AsmSources, false, null),
new CopySpec("SourceGen/SGTestData/FunkyProjects", "SGTestData/FunkyProjects",
SourceFileSpec.All, false, null),
};
private static string sBasePath;
// We want all of the regression test binaries, plus the .sym65, .dis65, and .cs,
// but nothing with an underscore in the part before the extension.
private const string TestCasePattern = @"^\d\d\d\d-[A-Za-z0-9-]+(\..*)?$";
private static Regex sTestCaseRegex = new Regex(TestCasePattern);
private BuildType mBuildType;
private bool mCopyTestFiles;
private BackgroundWorker mWorker;
public FileCopier(BuildType buildType, bool copyTestFiles) {
mBuildType = buildType;
mCopyTestFiles = copyTestFiles;
}
private void ReportProgress(string msg) {
mWorker.ReportProgress(0, new CopyProgress.ProgressMessage(msg + "\r\n"));
}
private void ReportProgress(string msg, Color color) {
mWorker.ReportProgress(0, new CopyProgress.ProgressMessage(msg + "\r\n", color));
}
private void ReportErrMsg(string msg) {
ReportProgress(msg, Color.Red);
}
/// <summary>
/// Main entry point.
/// </summary>
/// <param name="worker">Background task interface object.</param>
/// <returns>True on success.</returns>
public bool CopyAllFiles(BackgroundWorker worker) {
mWorker = worker;
ReportProgress("Preparing... build type is " + mBuildType + ", test files are " +
(mCopyTestFiles ? "" : "NOT ") + "included.");
string buildStr = mBuildType.ToString();
string basePath = FindBasePath();
Debug.Assert(basePath != null);
string distPath = Path.Combine(basePath, "DIST_" + buildStr);
// TODO(maybe): recursively delete distPath
if (!CopySpecList(sMainSpec, basePath, distPath, buildStr)) {
return false;
}
if (mCopyTestFiles) {
if (!CopySpecList(sTestSpec, basePath, distPath, buildStr)) {
return false;
}
}
return true;
}
private bool CopySpecList(CopySpec[] specList, string basePath, string distPath,
string buildStr) {
foreach (CopySpec cs in specList) {
string srcDir = Path.GetFullPath(Path.Combine(basePath,
cs.SourceDir.Replace("{BUILD_TYPE}", buildStr)));
string dstDir = Path.GetFullPath(Path.Combine(distPath, cs.DestDir));
ReportProgress("Scanning [" + cs.FileSpec + "] " + srcDir);
if (!CopyBySpec(srcDir, dstDir, cs.FileSpec, cs.FileList, cs.IsRecursive)) {
return false;
}
}
return true;
}
private bool CopyBySpec(string srcDir, string dstDir, SourceFileSpec sfspec,
string[] specFileList, bool isRecursive) {
if (!EnsureDirectoryExists(dstDir)) {
return false;
}
string[] fileList;
if (sfspec == SourceFileSpec.List) {
fileList = specFileList;
} else {
fileList = Directory.GetFiles(srcDir);
}
foreach (string str in fileList) {
// Spec list is filenames, GetFiles is paths; convert to simple filename.
string fileName = Path.GetFileName(str);
switch (sfspec) {
case SourceFileSpec.All:
case SourceFileSpec.List:
// keep all
break;
case SourceFileSpec.NotBins:
// Mostly this means "skip obj and bin dirs", which happens later.
// Rather than specify everything we do want, just omit this one thing.
if (fileName == "RuntimeData.csproj") {
continue;
}
break;
case SourceFileSpec.AsmSources:
if (!fileName.ToUpperInvariant().EndsWith(".S")) {
continue;
}
break;
case SourceFileSpec.RegressionTests:
MatchCollection matches = sTestCaseRegex.Matches(fileName);
if (matches.Count != 1) {
continue;
}
// Could probably do this with regex... but why.
if (fileName.StartsWith("1") && fileName.EndsWith(".dis65")) {
continue;
}
break;
default:
throw new Exception("Unsupported spec " + sfspec);
}
string srcPath = Path.Combine(srcDir, fileName);
string dstPath = Path.Combine(dstDir, fileName);
if (!CopyFile(srcPath, dstPath)) {
return false;
}
}
if (isRecursive) {
string[] dirList = Directory.GetDirectories(srcDir);
foreach (string str in dirList) {
string dirFileName = Path.GetFileName(str);
if (sfspec == SourceFileSpec.NotBins &&
(dirFileName == "obj" || dirFileName == "bin")) {
continue;
}
if (!CopyBySpec(Path.Combine(srcDir, dirFileName),
Path.Combine(dstDir, dirFileName),
sfspec, specFileList, isRecursive)) {
return false;
}
}
}
return true;
}
private bool EnsureDirectoryExists(string dirPath) {
if (Directory.Exists(dirPath)) {
return true;
}
if (File.Exists(dirPath)) {
ReportErrMsg("File exists and is not directory: " + dirPath);
return false;
}
try {
Directory.CreateDirectory(dirPath);
ReportProgress(" Created " + dirPath);
} catch (Exception ex) {
ReportErrMsg("Failed creating directory " + dirPath + ": " + ex.Message);
return false;
}
return true;
}
private bool CopyFile(string srcPath, string dstPath) {
// Poll cancel button.
if (mWorker.CancellationPending) {
ReportErrMsg("Cancel\r\n");
return false;
}
ReportProgress(" Copy " + srcPath + " --> " + dstPath);
try {
File.Copy(srcPath, dstPath, true);
} catch (Exception ex) {
ReportErrMsg("Failed: " + ex.Message);
return false;
}
return true;
}
/// <summary>
/// Returns the base directory of the 6502bench installation.
/// </summary>
/// <returns></returns>
private static string FindBasePath() {
if (sBasePath != null) {
return sBasePath;
}
string exeName = Process.GetCurrentProcess().MainModule.FileName;
string baseDir = Path.GetDirectoryName(exeName);
if (string.IsNullOrEmpty(baseDir)) {
return null;
}
string tryPath;
// Use the SourceGen directory as a sentinel.
tryPath = Path.Combine(baseDir, SOURCEGEN_DIRNAME);
if (Directory.Exists(tryPath)) {
sBasePath = Path.GetFullPath(tryPath);
return sBasePath;
}
string upThree = Path.GetDirectoryName(
Path.GetDirectoryName(Path.GetDirectoryName(baseDir)));
tryPath = Path.Combine(upThree, SOURCEGEN_DIRNAME);
if (Directory.Exists(tryPath)) {
sBasePath = Path.GetFullPath(upThree);
return sBasePath;
}
Debug.WriteLine("Unable to find RuntimeData dir near " + exeName);
return null;
}
}
}

View File

@ -1,162 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace MakeDistWF {
partial class MakeDist {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.descriptionLabel = new System.Windows.Forms.Label();
this.distributionTypeGroupBox = new System.Windows.Forms.GroupBox();
this.releaseDistRadio = new System.Windows.Forms.RadioButton();
this.debugDistRadio = new System.Windows.Forms.RadioButton();
this.includeTestsCheckBox = new System.Windows.Forms.CheckBox();
this.goButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.distributionTypeGroupBox.SuspendLayout();
this.SuspendLayout();
//
// descriptionLabel
//
this.descriptionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.descriptionLabel.Location = new System.Drawing.Point(13, 13);
this.descriptionLabel.Name = "descriptionLabel";
this.descriptionLabel.Size = new System.Drawing.Size(371, 35);
this.descriptionLabel.TabIndex = 0;
this.descriptionLabel.Text = "This program gathers up all the files needed for a 6502bench distribution. A full" +
" debug or release build should be performed before running this.";
//
// distributionTypeGroupBox
//
this.distributionTypeGroupBox.Controls.Add(this.releaseDistRadio);
this.distributionTypeGroupBox.Controls.Add(this.debugDistRadio);
this.distributionTypeGroupBox.Location = new System.Drawing.Point(16, 51);
this.distributionTypeGroupBox.Name = "distributionTypeGroupBox";
this.distributionTypeGroupBox.Size = new System.Drawing.Size(120, 67);
this.distributionTypeGroupBox.TabIndex = 1;
this.distributionTypeGroupBox.TabStop = false;
this.distributionTypeGroupBox.Text = "Distribution Type";
//
// releaseDistRadio
//
this.releaseDistRadio.AutoSize = true;
this.releaseDistRadio.Location = new System.Drawing.Point(7, 20);
this.releaseDistRadio.Name = "releaseDistRadio";
this.releaseDistRadio.Size = new System.Drawing.Size(64, 17);
this.releaseDistRadio.TabIndex = 0;
this.releaseDistRadio.TabStop = true;
this.releaseDistRadio.Text = "Release";
this.releaseDistRadio.UseVisualStyleBackColor = true;
//
// debugDistRadio
//
this.debugDistRadio.AutoSize = true;
this.debugDistRadio.Location = new System.Drawing.Point(7, 43);
this.debugDistRadio.Name = "debugDistRadio";
this.debugDistRadio.Size = new System.Drawing.Size(57, 17);
this.debugDistRadio.TabIndex = 1;
this.debugDistRadio.TabStop = true;
this.debugDistRadio.Text = "Debug";
this.debugDistRadio.UseVisualStyleBackColor = true;
//
// includeTestsCheckBox
//
this.includeTestsCheckBox.AutoSize = true;
this.includeTestsCheckBox.Location = new System.Drawing.Point(16, 125);
this.includeTestsCheckBox.Name = "includeTestsCheckBox";
this.includeTestsCheckBox.Size = new System.Drawing.Size(153, 17);
this.includeTestsCheckBox.TabIndex = 2;
this.includeTestsCheckBox.Text = "Include regression test files";
this.includeTestsCheckBox.UseVisualStyleBackColor = true;
//
// goButton
//
this.goButton.Location = new System.Drawing.Point(192, 59);
this.goButton.Name = "goButton";
this.goButton.Size = new System.Drawing.Size(88, 47);
this.goButton.TabIndex = 3;
this.goButton.Text = "BUILD";
this.goButton.UseVisualStyleBackColor = true;
this.goButton.Click += new System.EventHandler(this.goButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(309, 120);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 4;
this.cancelButton.Text = "Close";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// MakeDist
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(396, 155);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.goButton);
this.Controls.Add(this.includeTestsCheckBox);
this.Controls.Add(this.distributionTypeGroupBox);
this.Controls.Add(this.descriptionLabel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MakeDist";
this.Text = "6502bench Distribution Maker";
this.Load += new System.EventHandler(this.MakeDist_Load);
this.distributionTypeGroupBox.ResumeLayout(false);
this.distributionTypeGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label descriptionLabel;
private System.Windows.Forms.GroupBox distributionTypeGroupBox;
private System.Windows.Forms.RadioButton releaseDistRadio;
private System.Windows.Forms.RadioButton debugDistRadio;
private System.Windows.Forms.CheckBox includeTestsCheckBox;
private System.Windows.Forms.Button goButton;
private System.Windows.Forms.Button cancelButton;
}
}

View File

@ -1,47 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Windows.Forms;
namespace MakeDistWF {
public partial class MakeDist : Form {
public MakeDist() {
InitializeComponent();
}
private void MakeDist_Load(object sender, EventArgs e) {
releaseDistRadio.Checked = true;
}
private void goButton_Click(object sender, EventArgs e) {
FileCopier.BuildType buildType;
if (releaseDistRadio.Checked) {
buildType = FileCopier.BuildType.Release;
} else {
buildType = FileCopier.BuildType.Debug;
}
bool copyTestFiles = includeTestsCheckBox.Checked;
CopyProgress dlg = new CopyProgress(buildType, copyTestFiles);
dlg.ShowDialog();
dlg.Dispose();
}
private void cancelButton_Click(object sender, EventArgs e) {
Close();
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,100 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2415F337-2CE2-42E0-A8A7-4127FEEC94C4}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>MakeDistWF</RootNamespace>
<AssemblyName>MakeDistWF</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CopyProgress.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CopyProgress.Designer.cs">
<DependentUpon>CopyProgress.cs</DependentUpon>
</Compile>
<Compile Include="FileCopier.cs" />
<Compile Include="MakeDist.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MakeDist.Designer.cs">
<DependentUpon>MakeDist.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="CopyProgress.resx">
<DependentUpon>CopyProgress.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MakeDist.resx">
<DependentUpon>MakeDist.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CommonWinForms\CommonWinForms.csproj">
<Project>{08ec328d-078e-4236-b574-be6b3fd85915}</Project>
<Name>CommonWinForms</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,31 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Windows.Forms;
namespace MakeDistWF {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MakeDist());
}
}
}

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MakeDist")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MakeDist")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2415f337-2ce2-42e0-a8a7-4127feec94c4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,63 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MakeDistWF.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MakeDistWF.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,26 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MakeDistWF.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 KiB

View File

@ -1,296 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
namespace SourceGenWF {
/// <summary>
/// Map file offsets to 65xx addresses and vice-versa. Useful for sources with
/// multiple ORG directives.
///
/// It's possible to generate code that would overlap once relocated at run time,
/// which means a given address could map to multiple offsets. For this reason
/// it's useful to know the offset of the referring code when evaluating a
/// reference, so that a "local" match can take priority.
/// </summary>
public class AddressMap : IEnumerable<AddressMap.AddressMapEntry> {
/// <summary>
/// Code starting at the specified offset will have the specified address.
///
/// The entries are held in the list in order, sorted by offset, with no gaps.
/// This makes the "length" field redundant, as it can be computed by
/// (entry[N+1].mOffset - entry[N].mOffset), with a special case for the last
/// entry in the list. It's convenient to maintain it explicitly however, as
/// the list is read far more often than it is updated.
///
/// Entries are mutable, but must only be altered by AddressMap. Don't retain
/// instances of this across other activity.
/// </summary>
public class AddressMapEntry {
public int Offset { get; set; }
public int Addr { get; set; }
public int Length { get; set; }
public AddressMapEntry(int offset, int addr, int len) {
Offset = offset;
Addr = addr;
Length = len;
}
}
/// <summary>
/// Total length, in bytes, spanned by this map.
/// </summary>
private int mTotalLength;
/// <summary>
/// List of definitions, in sorted order.
/// </summary>
private List<AddressMapEntry> mAddrList = new List<AddressMapEntry>();
/// <summary>
/// Constructor.
/// </summary>
/// <param name="length">Total length, in bytes, spanned by this map.</param>
public AddressMap(int length) {
/// There must always be at least one entry, defining the target address
/// for file offset 0. This can be changed, but can't be removed.
mTotalLength = length;
mAddrList.Add(new AddressMapEntry(0, 0, length));
}
// IEnumerable
public IEnumerator<AddressMapEntry> GetEnumerator() {
return ((IEnumerable<AddressMapEntry>)mAddrList).GetEnumerator();
}
// IEnumerable
IEnumerator IEnumerable.GetEnumerator() {
return ((IEnumerable<AddressMapEntry>)mAddrList).GetEnumerator();
}
/// <summary>
/// Returns the Nth entry in the address map.
/// </summary>
public AddressMapEntry this[int i] {
get { return mAddrList[i]; }
}
/// <summary>
/// Number of entries in the address map.
/// </summary>
public int Count { get { return mAddrList.Count; } }
/// <summary>
/// Returns the Address value of the address map entry associated with the specified
/// offset, or -1 if there is no address map entry there. The offset must match exactly.
/// </summary>
public int Get(int offset) {
foreach (AddressMapEntry ad in mAddrList) {
if (ad.Offset == offset) {
return ad.Addr;
}
}
return -1;
}
/// <summary>
/// Returns the index of the address map entry that contains the given offset.
/// We assume the offset is valid.
/// </summary>
private int IndexForOffset(int offset) {
for (int i = 1; i < mAddrList.Count; i++) {
if (mAddrList[i].Offset > offset) {
return i - 1;
}
}
return mAddrList.Count - 1;
}
/// <summary>
/// Adds, updates, or removes a map entry.
/// </summary>
/// <param name="offset">File offset at which the address changes.</param>
/// <param name="addr">24-bit address.</param>
public void Set(int offset, int addr) {
Debug.Assert(offset >= 0);
if (addr == -1) {
if (offset != 0) { // ignore attempts to remove entry at offset zero
Remove(offset);
}
return;
}
Debug.Assert(addr >= 0 && addr < 0x01000000); // 24-bit address space
int i;
for (i = 0; i < mAddrList.Count; i++) {
AddressMapEntry ad = mAddrList[i];
if (ad.Offset == offset) {
// update existing
ad.Addr = addr;
mAddrList[i] = ad;
return;
} else if (ad.Offset > offset) {
// The i'th entry is one past the interesting part.
break;
}
}
// Carve a chunk out of the previous entry.
AddressMapEntry prev = mAddrList[i - 1];
int prevOldLen = prev.Length;
int prevNewLen = offset - prev.Offset;
prev.Length = prevNewLen;
mAddrList[i - 1] = prev;
mAddrList.Insert(i,
new AddressMapEntry(offset, addr, prevOldLen - prevNewLen));
DebugValidate();
}
/// <summary>
/// Removes an entry from the set.
/// </summary>
/// <param name="offset">The initial offset of the mapping to remove. This
/// must be the initial value, not a mid-range value.</param>
/// <returns>True if something was removed.</returns>
public bool Remove(int offset) {
if (offset == 0) {
throw new Exception("Not allowed to remove entry 0");
}
for (int i = 1; i < mAddrList.Count; i++) {
if (mAddrList[i].Offset == offset) {
// Add the length to the previous entry.
AddressMapEntry prev = mAddrList[i - 1];
prev.Length += mAddrList[i].Length;
mAddrList[i - 1] = prev;
mAddrList.RemoveAt(i);
DebugValidate();
return true;
}
}
return false;
}
/// <summary>
/// Returns true if the given address falls into the range spanned by the
/// address map entry.
/// </summary>
/// <param name="index">Address map entry index.</param>
/// <param name="addr">Address to check.</param>
/// <returns></returns>
private bool IndexContainsAddress(int index, int addr) {
return addr >= mAddrList[index].Addr &&
addr < mAddrList[index].Addr + mAddrList[index].Length;
}
/// <summary>
/// Determines the file offset that best contains the specified target address.
/// </summary>
/// <param name="srcOffset">Offset of the address reference.</param>
/// <param name="targetAddr">Address to look up.</param>
/// <returns>The file offset, or -1 if the address falls outside the file.</returns>
public int AddressToOffset(int srcOffset, int targetAddr) {
if (mAddrList.Count == 1) {
// Trivial case.
if (IndexContainsAddress(0, targetAddr)) {
Debug.Assert(targetAddr >= mAddrList[0].Addr);
return targetAddr - mAddrList[0].Addr;
} else {
return -1;
}
}
// We have multiple, potentially overlapping address ranges. Start by
// looking for a match in the srcOffset range; if that fails, scan
// forward from the start.
int srcOffIndex = IndexForOffset(srcOffset);
if (IndexContainsAddress(srcOffIndex, targetAddr)) {
Debug.Assert(targetAddr >= mAddrList[srcOffIndex].Addr);
return (targetAddr - mAddrList[srcOffIndex].Addr) + mAddrList[srcOffIndex].Offset;
}
for (int i = 0; i < mAddrList.Count; i++) {
if (i == srcOffIndex) {
// optimization -- we already checked this one
continue;
}
if (IndexContainsAddress(i, targetAddr)) {
Debug.Assert(targetAddr >= mAddrList[i].Addr);
return (targetAddr - mAddrList[i].Addr) + mAddrList[i].Offset;
}
}
return -1;
}
/// <summary>
/// Converts a file offset to an address.
/// </summary>
/// <param name="offset">File offset.</param>
/// <returns>24-bit address.</returns>
public int OffsetToAddress(int offset) {
int srcOffIndex = IndexForOffset(offset);
return mAddrList[srcOffIndex].Addr + (offset - mAddrList[srcOffIndex].Offset);
}
/// <summary>
/// Internal consistency checks.
/// </summary>
private void DebugValidate() {
if (mAddrList.Count < 1) {
throw new Exception("AddressMap: empty");
}
if (mAddrList[0].Offset != 0) {
throw new Exception("AddressMap: bad offset 0");
}
if (mAddrList.Count == 1) {
if (mAddrList[0].Length != mTotalLength) {
throw new Exception("AddressMap: single entry len bad");
}
} else {
int totalLen = 0;
for (int i = 0; i < mAddrList.Count; i++) {
AddressMapEntry ent = mAddrList[i];
if (i != 0) {
if (ent.Offset != mAddrList[i - 1].Offset + mAddrList[i - 1].Length) {
throw new Exception("Bad offset step to " + i);
}
}
totalLen += ent.Length;
}
if (totalLen != mTotalLength) {
throw new Exception("AddressMap: bad length sum (" + totalLen + " vs " +
mTotalLength + ")");
}
}
}
public override string ToString() {
return "[AddressMap: " + mAddrList.Count + " entries]";
}
}
}

View File

@ -1,355 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Diagnostics;
using System.Text;
using Asm65;
namespace SourceGenWF {
/// <summary>
/// Analyzer attribute holder. Contains the output of the instruction and data analyzers.
/// Every byte in the input file has one of these associated with it.
///
/// (Yes, it's a mutable struct. Yes, that fact has bitten me a few times. The array
/// of these may have millions of elements, so the reduction in overhead seems worthwhile.)
/// </summary>
public struct Anattrib {
[FlagsAttribute]
private enum AttribFlags {
InstrStart = 1 << 0, // byte is first of an instruction
Instruction = 1 << 1, // byte is part of an instruction or inline data
InlineData = 1 << 2, // byte is inline data
Data = 1 << 3, // byte is data
EntryPoint = 1 << 8, // external code branches here
BranchTarget = 1 << 9, // internal code branches here
ExternalBranch = 1 << 10, // this abs/rel branch lands outside input file
NoContinue = 1 << 12, // execution does not continue to following instruction
Visited = 1 << 16, // has the analyzer visited this byte?
Changed = 1 << 17, // set/cleared as the analyzer works
Hinted = 1 << 18, // was this byte affected by a type hint?
}
// Flags indicating what type of data is here. Use the following Is* properties
// to set/clear.
private AttribFlags mAttribFlags;
public bool IsInstructionStart {
get {
return (mAttribFlags & AttribFlags.InstrStart) != 0;
}
set {
IsInstruction = value;
if (value) {
mAttribFlags |= AttribFlags.InstrStart;
} else {
mAttribFlags &= ~AttribFlags.InstrStart;
}
}
}
public bool IsInstruction {
get {
return (mAttribFlags & AttribFlags.Instruction) != 0;
}
set {
Debug.Assert(value == false ||
(mAttribFlags & (AttribFlags.InlineData | AttribFlags.Data)) == 0);
if (value) {
mAttribFlags |= AttribFlags.Instruction;
} else {
mAttribFlags &= ~AttribFlags.Instruction;
}
}
}
public bool IsInlineData {
get {
return (mAttribFlags & AttribFlags.InlineData) != 0;
}
set {
Debug.Assert(value == false ||
(mAttribFlags & (AttribFlags.Instruction | AttribFlags.Data)) == 0);
if (value) {
mAttribFlags |= AttribFlags.InlineData;
} else {
mAttribFlags &= ~AttribFlags.InlineData;
}
}
}
public bool IsData {
get {
return (mAttribFlags & AttribFlags.Data) != 0;
}
set {
Debug.Assert(value == false ||
(mAttribFlags & (AttribFlags.InlineData | AttribFlags.Instruction)) == 0);
if (value) {
mAttribFlags |= AttribFlags.Data;
} else {
mAttribFlags &= ~AttribFlags.Data;
}
}
}
public bool IsStart {
get {
return IsInstructionStart || IsDataStart || IsInlineDataStart;
}
}
public bool IsEntryPoint {
get {
return (mAttribFlags & AttribFlags.EntryPoint) != 0;
}
set {
if (value) {
mAttribFlags |= AttribFlags.EntryPoint;
} else {
mAttribFlags &= ~AttribFlags.EntryPoint;
}
}
}
public bool IsBranchTarget {
get {
return (mAttribFlags & AttribFlags.BranchTarget) != 0;
}
set {
if (value) {
mAttribFlags |= AttribFlags.BranchTarget;
} else {
mAttribFlags &= ~AttribFlags.BranchTarget;
}
}
}
public bool IsExternalBranch {
get {
return (mAttribFlags & AttribFlags.ExternalBranch) != 0;
}
set {
if (value) {
mAttribFlags |= AttribFlags.ExternalBranch;
} else {
mAttribFlags &= ~AttribFlags.ExternalBranch;
}
}
}
public bool DoesNotContinue {
get {
return (mAttribFlags & AttribFlags.NoContinue) != 0;
}
set {
if (value) {
mAttribFlags |= AttribFlags.NoContinue;
} else {
mAttribFlags &= ~AttribFlags.NoContinue;
}
}
}
public bool DoesNotBranch {
get {
return (BranchTaken == OpDef.BranchTaken.Never);
}
}
public bool IsVisited {
get {
return (mAttribFlags & AttribFlags.Visited) != 0;
}
set {
if (value) {
mAttribFlags |= AttribFlags.Visited;
} else {
mAttribFlags &= ~AttribFlags.Visited;
}
}
}
public bool IsChanged {
get {
return (mAttribFlags & AttribFlags.Changed) != 0;
}
set {
if (value) {
mAttribFlags |= AttribFlags.Changed;
} else {
mAttribFlags &= ~AttribFlags.Changed;
}
}
}
public bool IsHinted {
get {
return (mAttribFlags & AttribFlags.Hinted) != 0;
}
set {
if (value) {
mAttribFlags |= AttribFlags.Hinted;
} else {
mAttribFlags &= ~AttribFlags.Hinted;
}
}
}
public bool IsDataStart {
get {
return IsData && DataDescriptor != null;
}
}
public bool IsInlineDataStart {
get {
return IsInlineData && DataDescriptor != null;
}
}
/// <summary>
/// Get the target memory address for this byte.
/// </summary>
public int Address { get; set; }
/// <summary>
/// Instructions: length of the instruction (for InstrStart). If a FormatDescriptor
/// is assigned, the length must match.
/// Inline data: FormatDescriptor length, or zero if no descriptor is defined.
/// Data: FormatDescriptor length, or zero if no descriptor is defined.
///
/// This field should only be set by CodeAnalysis methods, although the "get" value
/// can be changed for data/inline-data by setting the DataDescriptor field.
/// </summary>
public int Length {
get {
// For data we don't even use the field; this ensures that we're always
// using the FormatDescriptor's length.
if (IsData || IsInlineData) {
Debug.Assert(mLength == 0);
if (DataDescriptor != null) {
return DataDescriptor.Length;
} else {
return 0;
}
}
return mLength;
}
set {
Debug.Assert(!IsData);
mLength = value;
}
}
private int mLength;
/// <summary>
/// Instructions only: processor status flags.
///
/// Note this returns a copy of a struct, so modifications to the returned value
/// (including calls to Merge and Apply) are not permanent.
/// </summary>
public StatusFlags StatusFlags {
get { return mStatusFlags; }
set { mStatusFlags = value; }
}
private StatusFlags mStatusFlags;
public void MergeStatusFlags(StatusFlags other) {
mStatusFlags.Merge(other);
}
public void ApplyStatusFlags(StatusFlags other) {
mStatusFlags.Apply(other);
}
/// <summary>
/// Branch instructions only: outcome of branch.
/// </summary>
public OpDef.BranchTaken BranchTaken { get; set; }
/// <summary>
/// Instructions only: decoded operand address value. Will be -1 if not
/// yet computed or not applicable. For a relative branch instruction,
/// this will have the absolute branch target address. On the 65816, this
/// will be a 24-bit address.
/// </summary>
public int OperandAddress {
get { return mOperandAddressSet ? mOperandAddress : -1; }
set {
Debug.Assert(mOperandAddress >= -1);
mOperandAddress = value;
mOperandAddressSet = (value >= 0);
}
}
private int mOperandAddress;
private bool mOperandAddressSet;
/// <summary>
/// Instructions only: offset referenced by OperandAddress. Will be -1 if not
/// yet computed, not applicable, or if OperandAddress refers to a location
/// outside the scope of the file.
/// </summary>
public int OperandOffset {
get { return mOperandOffsetSet ? mOperandOffset : -1; }
set {
Debug.Assert(mOperandOffset >= -1);
mOperandOffset = value;
mOperandOffsetSet = (value >= 0);
}
}
private int mOperandOffset;
private bool mOperandOffsetSet;
/// <summary>
/// Instructions only: is OperandOffset a direct target offset? (This is used when
/// tracing jump instructions, to know if we should add the offset to the scan list.
/// It's determined by the opcode, e.g. "JMP addr" -> true, "JMP (addr,X)" -> false.)
/// </summary>
public bool IsOperandOffsetDirect { get; set; }
/// <summary>
/// Symbol defined as the label for this offset. All offsets that are instruction
/// or data target offsets will have one of these defined. Users can define additional
/// symbols as well.
///
/// Will be null if no label is defined for this offset.
/// </summary>
public Symbol Symbol { get; set; }
/// <summary>
/// Format descriptor for operands and data items. Will be null if no descriptor
/// is defined for this offset.
/// </summary>
public FormatDescriptor DataDescriptor { get; set; }
/// <summary>
/// Is this an instruction with an operand (i.e. not impl/acc)?
/// </summary>
public bool IsInstructionWithOperand {
get {
if (!IsInstructionStart) {
return false;
}
return Length != 1;
}
}
/// <summary>
/// Returns a fixed-width string with indicators for items of interest.
/// </summary>
public string ToAttrString() {
StringBuilder sb = new StringBuilder(5);
char blank = '.';
sb.Append(IsEntryPoint ? '@' : blank);
sb.Append(IsHinted ? 'H' : blank);
sb.Append(DoesNotBranch ? '!' : blank);
sb.Append(DoesNotContinue ? '#' : blank);
sb.Append(IsBranchTarget ? '>' : blank);
return sb.ToString();
}
}
}

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>

View File

@ -1,187 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class AboutBox {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.boardPictureBox = new System.Windows.Forms.PictureBox();
this.sourceGenLabel = new System.Windows.Forms.Label();
this.versionLabel = new System.Windows.Forms.Label();
this.createdLabel = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.legalStuffTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.osPlatformLabel = new System.Windows.Forms.Label();
this.debugEnabledLabel = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.boardPictureBox)).BeginInit();
this.SuspendLayout();
//
// boardPictureBox
//
this.boardPictureBox.Location = new System.Drawing.Point(13, 13);
this.boardPictureBox.Name = "boardPictureBox";
this.boardPictureBox.Size = new System.Drawing.Size(320, 236);
this.boardPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.boardPictureBox.TabIndex = 0;
this.boardPictureBox.TabStop = false;
//
// sourceGenLabel
//
this.sourceGenLabel.AutoSize = true;
this.sourceGenLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.sourceGenLabel.Location = new System.Drawing.Point(340, 13);
this.sourceGenLabel.Name = "sourceGenLabel";
this.sourceGenLabel.Size = new System.Drawing.Size(346, 37);
this.sourceGenLabel.TabIndex = 1;
this.sourceGenLabel.Text = "6502bench SourceGen";
//
// versionLabel
//
this.versionLabel.AutoSize = true;
this.versionLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.versionLabel.Location = new System.Drawing.Point(340, 60);
this.versionLabel.Name = "versionLabel";
this.versionLabel.Size = new System.Drawing.Size(273, 31);
this.versionLabel.TabIndex = 2;
this.versionLabel.Text = "Version X.Y.Z Alpha1";
//
// createdLabel
//
this.createdLabel.AutoSize = true;
this.createdLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.createdLabel.Location = new System.Drawing.Point(407, 142);
this.createdLabel.Name = "createdLabel";
this.createdLabel.Size = new System.Drawing.Size(206, 40);
this.createdLabel.TabIndex = 3;
this.createdLabel.Text = "Copyright 2018 faddenSoft\r\nCreated by Andy McFadden\r\n";
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(617, 526);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 0;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
//
// legalStuffTextBox
//
this.legalStuffTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.legalStuffTextBox.Location = new System.Drawing.Point(12, 305);
this.legalStuffTextBox.MaxLength = 0;
this.legalStuffTextBox.Multiline = true;
this.legalStuffTextBox.Name = "legalStuffTextBox";
this.legalStuffTextBox.ReadOnly = true;
this.legalStuffTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.legalStuffTextBox.Size = new System.Drawing.Size(680, 215);
this.legalStuffTextBox.TabIndex = 4;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 289);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(59, 13);
this.label1.TabIndex = 5;
this.label1.Text = "Legal stuff:";
//
// osPlatformLabel
//
this.osPlatformLabel.AutoSize = true;
this.osPlatformLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.osPlatformLabel.Location = new System.Drawing.Point(12, 263);
this.osPlatformLabel.Name = "osPlatformLabel";
this.osPlatformLabel.Size = new System.Drawing.Size(86, 16);
this.osPlatformLabel.TabIndex = 6;
this.osPlatformLabel.Text = "[OS platform]";
//
// debugEnabledLabel
//
this.debugEnabledLabel.AutoSize = true;
this.debugEnabledLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.debugEnabledLabel.Location = new System.Drawing.Point(340, 233);
this.debugEnabledLabel.Name = "debugEnabledLabel";
this.debugEnabledLabel.Size = new System.Drawing.Size(293, 16);
this.debugEnabledLabel.TabIndex = 7;
this.debugEnabledLabel.Text = "Assertions and extended validation are enabled";
this.debugEnabledLabel.Visible = false;
//
// AboutBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(704, 561);
this.Controls.Add(this.debugEnabledLabel);
this.Controls.Add(this.osPlatformLabel);
this.Controls.Add(this.label1);
this.Controls.Add(this.legalStuffTextBox);
this.Controls.Add(this.okButton);
this.Controls.Add(this.createdLabel);
this.Controls.Add(this.versionLabel);
this.Controls.Add(this.sourceGenLabel);
this.Controls.Add(this.boardPictureBox);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AboutBox";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "About SourceGen";
this.Load += new System.EventHandler(this.AboutBox_Load);
((System.ComponentModel.ISupportInitialize)(this.boardPictureBox)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox boardPictureBox;
private System.Windows.Forms.Label sourceGenLabel;
private System.Windows.Forms.Label versionLabel;
private System.Windows.Forms.Label createdLabel;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.TextBox legalStuffTextBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label osPlatformLabel;
private System.Windows.Forms.Label debugEnabledLabel;
}
}

View File

@ -1,51 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.IO;
using System.Windows.Forms;
namespace SourceGenWF.AppForms {
public partial class AboutBox : Form {
private const string IMAGE_FILE_NAME = "AboutImage.png";
private const string LEGAL_STUFF_FILE_NAME = "LegalStuff.txt";
public AboutBox() {
InitializeComponent();
boardPictureBox.ImageLocation = RuntimeDataAccess.GetPathName(IMAGE_FILE_NAME);
versionLabel.Text = string.Format(Properties.Resources.VERSION_FMT,
Program.ProgramVersion);
osPlatformLabel.Text = "OS: " +
System.Runtime.InteropServices.RuntimeInformation.OSDescription;
#if DEBUG
debugEnabledLabel.Visible = true;
#endif
}
private void AboutBox_Load(object sender, EventArgs e) {
string text;
string pathName = RuntimeDataAccess.GetPathName(LEGAL_STUFF_FILE_NAME);
try {
text = File.ReadAllText(pathName);
} catch (Exception ex) {
text = ex.ToString();
}
legalStuffTextBox.Text = text;
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,143 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class DataFileLoadIssue {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.problemWithFileLabel = new System.Windows.Forms.Label();
this.pathNameTextBox = new System.Windows.Forms.TextBox();
this.problemLabel = new System.Windows.Forms.Label();
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.doYouWantLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// problemWithFileLabel
//
this.problemWithFileLabel.AutoSize = true;
this.problemWithFileLabel.Location = new System.Drawing.Point(13, 13);
this.problemWithFileLabel.Name = "problemWithFileLabel";
this.problemWithFileLabel.Size = new System.Drawing.Size(221, 13);
this.problemWithFileLabel.TabIndex = 2;
this.problemWithFileLabel.Text = "There was an error while loading the data file:";
//
// pathNameTextBox
//
this.pathNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.pathNameTextBox.Location = new System.Drawing.Point(13, 39);
this.pathNameTextBox.Name = "pathNameTextBox";
this.pathNameTextBox.ReadOnly = true;
this.pathNameTextBox.Size = new System.Drawing.Size(488, 20);
this.pathNameTextBox.TabIndex = 3;
//
// problemLabel
//
this.problemLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.problemLabel.Location = new System.Drawing.Point(13, 73);
this.problemLabel.Name = "problemLabel";
this.problemLabel.Size = new System.Drawing.Size(488, 31);
this.problemLabel.TabIndex = 4;
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(428, 113);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 1;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(347, 113);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 0;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
//
// doYouWantLabel
//
this.doYouWantLabel.AutoSize = true;
this.doYouWantLabel.Location = new System.Drawing.Point(13, 117);
this.doYouWantLabel.Name = "doYouWantLabel";
this.doYouWantLabel.Size = new System.Drawing.Size(175, 13);
this.doYouWantLabel.TabIndex = 5;
this.doYouWantLabel.Text = "Do you want to locate the data file?\r\n";
//
// DataFileLoadIssue
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(515, 148);
this.Controls.Add(this.doYouWantLabel);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.problemLabel);
this.Controls.Add(this.pathNameTextBox);
this.Controls.Add(this.problemWithFileLabel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DataFileLoadIssue";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Data File Load Issue";
this.Load += new System.EventHandler(this.DataFileLoadIssue_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label problemWithFileLabel;
private System.Windows.Forms.TextBox pathNameTextBox;
private System.Windows.Forms.Label problemLabel;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Label doYouWantLabel;
}
}

View File

@ -1,44 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Windows.Forms;
namespace SourceGenWF.AppForms {
public partial class DataFileLoadIssue : Form {
/// <summary>
/// Path name of problematic file.
/// </summary>
private string mPathName;
/// <summary>
/// Message to show in the dialog.
/// </summary>
private string mMessage;
public DataFileLoadIssue(string pathName, string message) {
InitializeComponent();
mPathName = pathName;
mMessage = message;
}
private void DataFileLoadIssue_Load(object sender, EventArgs e) {
pathNameTextBox.Text = mPathName;
problemLabel.Text = mMessage;
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,119 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class DiscardChanges {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.cancelButton = new System.Windows.Forms.Button();
this.dontSaveButton = new System.Windows.Forms.Button();
this.saveButton = new System.Windows.Forms.Button();
this.warningLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(243, 74);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(110, 23);
this.cancelButton.TabIndex = 3;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// dontSaveButton
//
this.dontSaveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.dontSaveButton.Location = new System.Drawing.Point(127, 74);
this.dontSaveButton.Name = "dontSaveButton";
this.dontSaveButton.Size = new System.Drawing.Size(110, 23);
this.dontSaveButton.TabIndex = 2;
this.dontSaveButton.Text = "&Discard && Continue";
this.dontSaveButton.UseVisualStyleBackColor = true;
this.dontSaveButton.Click += new System.EventHandler(this.dontSaveButton_Click);
//
// saveButton
//
this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.saveButton.Location = new System.Drawing.Point(11, 74);
this.saveButton.Name = "saveButton";
this.saveButton.Size = new System.Drawing.Size(110, 23);
this.saveButton.TabIndex = 1;
this.saveButton.Text = "&Save && Continue";
this.saveButton.UseVisualStyleBackColor = true;
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
//
// warningLabel
//
this.warningLabel.AutoSize = true;
this.warningLabel.Location = new System.Drawing.Point(13, 13);
this.warningLabel.Name = "warningLabel";
this.warningLabel.Size = new System.Drawing.Size(288, 39);
this.warningLabel.TabIndex = 0;
this.warningLabel.Text = "You have unsaved changes that will be lost if you continue.\r\n\r\nHow do you wish to" +
" proceed?";
//
// DiscardChanges
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(365, 109);
this.Controls.Add(this.warningLabel);
this.Controls.Add(this.saveButton);
this.Controls.Add(this.dontSaveButton);
this.Controls.Add(this.cancelButton);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DiscardChanges";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Discard Changes?";
this.Load += new System.EventHandler(this.DiscardChanges_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button dontSaveButton;
private System.Windows.Forms.Button saveButton;
private System.Windows.Forms.Label warningLabel;
}
}

View File

@ -1,48 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Windows.Forms;
namespace SourceGenWF.AppForms {
/// <summary>
/// Prompt the user before discarding changes.
///
/// Dialog result will be:
/// DialogResult.Yes: save before continuing
/// DialogResult.No: don't save before continuing
/// DialogResult.Cancel: don't continue
/// </summary>
public partial class DiscardChanges : Form {
public DiscardChanges() {
InitializeComponent();
}
private void DiscardChanges_Load(object sender, EventArgs e) {
// Make this the default.
cancelButton.Select();
}
private void saveButton_Click(object sender, EventArgs e) {
DialogResult = DialogResult.Yes;
Close();
}
private void dontSaveButton_Click(object sender, EventArgs e) {
DialogResult = DialogResult.No;
Close();
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,142 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class EditAddress {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
System.Windows.Forms.Label addressLabel;
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.addressTextBox = new System.Windows.Forms.TextBox();
this.instructionLabel1 = new System.Windows.Forms.Label();
this.instructionLabel2 = new System.Windows.Forms.Label();
addressLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// addressLabel
//
addressLabel.AutoSize = true;
addressLabel.Location = new System.Drawing.Point(12, 16);
addressLabel.Name = "addressLabel";
addressLabel.Size = new System.Drawing.Size(48, 13);
addressLabel.TabIndex = 1;
addressLabel.Text = "Address:";
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(190, 91);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 3;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(271, 91);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 4;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// addressTextBox
//
this.addressTextBox.Location = new System.Drawing.Point(68, 13);
this.addressTextBox.Name = "addressTextBox";
this.addressTextBox.Size = new System.Drawing.Size(275, 20);
this.addressTextBox.TabIndex = 0;
this.addressTextBox.TextChanged += new System.EventHandler(this.addressTextBox_TextChanged);
//
// instructionLabel1
//
this.instructionLabel1.AutoSize = true;
this.instructionLabel1.Location = new System.Drawing.Point(12, 36);
this.instructionLabel1.Name = "instructionLabel1";
this.instructionLabel1.Size = new System.Drawing.Size(331, 13);
this.instructionLabel1.TabIndex = 2;
this.instructionLabel1.Text = "Enter 16-bit or 24-bit address in hexadecimal, e.g. $1000 or 00/be00.\r\n";
//
// instructionLabel2
//
this.instructionLabel2.AutoSize = true;
this.instructionLabel2.Location = new System.Drawing.Point(12, 58);
this.instructionLabel2.Name = "instructionLabel2";
this.instructionLabel2.Size = new System.Drawing.Size(258, 13);
this.instructionLabel2.TabIndex = 5;
this.instructionLabel2.Text = "Leave the field blank to remove the address override.";
//
// EditAddress
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(358, 126);
this.Controls.Add(this.instructionLabel2);
this.Controls.Add(this.instructionLabel1);
this.Controls.Add(this.addressTextBox);
this.Controls.Add(addressLabel);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "EditAddress";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Address";
this.Load += new System.EventHandler(this.EditAddress_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.TextBox addressTextBox;
private System.Windows.Forms.Label instructionLabel1;
private System.Windows.Forms.Label instructionLabel2;
}
}

View File

@ -1,78 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace SourceGenWF.AppForms {
public partial class EditAddress : Form {
/// <summary>
/// Address typed by user. Only valid after the dialog returns OK. Will be set to -1
/// if the user is attempting to delete the address.
/// </summary>
public int Address { get; private set; }
/// <summary>
/// Maximum allowed address value.
/// </summary>
private int mMaxAddressValue;
public EditAddress(int initialAddr, int maxAddressValue) {
InitializeComponent();
Address = -2;
mMaxAddressValue = maxAddressValue;
addressTextBox.Text = Asm65.Address.AddressToString(initialAddr, false);
}
private void EditAddress_Load(object sender, EventArgs e) {
addressTextBox.SelectAll();
}
/// <summary>
/// Handles a click on the OK button by setting the Address property to the
/// decoded value from the text field.
/// </summary>
private void okButton_Click(object sender, EventArgs e) {
if (addressTextBox.Text.Length == 0) {
Address = -1;
} else {
Asm65.Address.ParseAddress(addressTextBox.Text, mMaxAddressValue, out int addr);
Address = addr;
}
}
/// <summary>
/// Updates the OK button whenever the text changes. This works for all change sources,
/// including programmatic.
/// </summary>
private void addressTextBox_TextChanged(object sender, EventArgs e) {
UpdateOkEnabled();
}
/// <summary>
/// Enables or disables the OK button depending on whether the current input is
/// valid. We allow valid addresses and an empty box.
/// </summary>
private void UpdateOkEnabled() {
string text = addressTextBox.Text;
okButton.Enabled = (text.Length == 0) ||
Asm65.Address.ParseAddress(text, mMaxAddressValue, out int unused);
}
}
}

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="addressLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

File diff suppressed because it is too large Load Diff

View File

@ -1,745 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
using AssemblerInfo = SourceGenWF.AsmGen.AssemblerInfo;
using AssemblerConfig = SourceGenWF.AsmGen.AssemblerConfig;
using ExpressionMode = Asm65.Formatter.FormatConfig.ExpressionMode;
namespace SourceGenWF.AppForms {
public partial class EditAppSettings : Form {
/// <summary>
/// Tab page enumeration. Numbers must match page indices in designer.
/// </summary>
public enum Tab {
Unknown = -1,
CodeView = 0,
AsmConfig = 1,
DisplayFOrmat = 2,
PseudoOp = 3
}
/// <summary>
/// Clipboard format enumeration. Numbers must match order of items in combo box.
/// </summary>
public enum ClipLineFormat {
Unknown = -1,
AssemblerSource = 0,
Disassembly = 1
}
/// <summary>
/// ProjectView reference. When the user hits Apply, the object's ApplyAppSettings
/// method will be invoked.
/// </summary>
private ProjectView mProjectView;
/// <summary>
/// Copy of settings that we make changes to. On "Apply" or "OK", this is pushed
/// into the global settings object, and applied to the ProjectView.
/// </summary>
private AppSettings mSettings;
/// <summary>
/// Dirty flag, set when anything in mSettings changes. Don't modify this directly. Use
/// the SetDirty() call so that the Apply button's enabled status gets updated.
/// </summary>
private bool mDirty;
/// <summary>
/// Tab to show when dialog is first opened.
/// </summary>
private Tab mInitialTab;
/// <summary>
/// Assembler to initially select in combo boxes.
/// </summary>
private AssemblerInfo.Id mInitialAsmId;
// Map buttons to column show/hide buttons.
private const int NUM_COLUMNS = ProjectView.CodeListColumnWidths.NUM_COLUMNS;
private string[] mColumnFormats = new string[NUM_COLUMNS];
private Button[] mColButtons;
/// <summary>
/// Map pseudo-op text entry fields to PseudoOpName properties.
/// </summary>
private struct TextBoxPropertyMap {
public TextBox TextBox { get; private set; }
public PropertyInfo PropInfo { get; private set; }
public TextBoxPropertyMap(TextBox textBox, string propName) {
TextBox = textBox;
PropInfo = typeof(PseudoOp.PseudoOpNames).GetProperty(propName);
}
}
private TextBoxPropertyMap[] mPseudoNameMap;
/// <summary>
/// Holds an item for the assembler-selection combox box.
/// </summary>
private class AsmComboItem {
// Enumerated ID.
public AssemblerInfo.Id AssemblerId { get; private set; }
// Human-readable name for display.
public string Name { get; private set; }
public AsmComboItem(AssemblerInfo info) {
AssemblerId = info.AssemblerId;
Name = info.Name;
}
}
/// <summary>
/// Holds an item for the expression style selection combo box.
/// </summary>
private struct ExpressionStyleItem {
// Enumerated mode.
public ExpressionMode ExpMode { get; private set; }
// Human-readable name for display.
public string Name { get; private set; }
public ExpressionStyleItem(ExpressionMode expMode, string name) {
ExpMode = expMode;
Name = name;
}
}
private static ExpressionStyleItem[] sExpStyleItems = new ExpressionStyleItem[] {
new ExpressionStyleItem(ExpressionMode.Common, "Common"),
new ExpressionStyleItem(ExpressionMode.Cc65, "cc65"),
new ExpressionStyleItem(ExpressionMode.Merlin, "Merlin"),
};
public EditAppSettings(ProjectView projectView, Tab initialTab,
AssemblerInfo.Id initialAsmId) {
InitializeComponent();
mProjectView = projectView;
mInitialTab = initialTab;
mInitialAsmId = initialAsmId;
// Make a work copy, so we can discard changes if the user cancels out of the dialog.
projectView.SerializeCodeListColumnWidths();
mSettings = AppSettings.Global.GetCopy();
// Put column-width buttons in an array.
mColButtons = new Button[] {
showCol0, showCol1, showCol2, showCol3, showCol4,
showCol5, showCol6, showCol7, showCol8 };
Debug.Assert(NUM_COLUMNS == 9);
// Extract format strings from column-width button labels.
for (int i = 0; i < NUM_COLUMNS; i++) {
mColButtons[i].Click += ColumnVisibilityButtonClick;
mColumnFormats[i] = mColButtons[i].Text;
}
// Map text boxes to PseudoOpName fields.
mPseudoNameMap = new TextBoxPropertyMap[] {
new TextBoxPropertyMap(equDirectiveTextBox, "EquDirective"),
new TextBoxPropertyMap(orgDirectiveTextBox, "OrgDirective"),
new TextBoxPropertyMap(regWidthDirectiveTextBox, "RegWidthDirective"),
new TextBoxPropertyMap(defineData1TextBox, "DefineData1"),
new TextBoxPropertyMap(defineData2TextBox, "DefineData2"),
new TextBoxPropertyMap(defineData3TextBox, "DefineData3"),
new TextBoxPropertyMap(defineData4TextBox, "DefineData4"),
new TextBoxPropertyMap(defineBigData2TextBox, "DefineBigData2"),
new TextBoxPropertyMap(fillTextBox, "Fill"),
new TextBoxPropertyMap(denseTextBox, "Dense"),
new TextBoxPropertyMap(strGenericTextBox, "StrGeneric"),
new TextBoxPropertyMap(strGenericHiTextBox, "StrGenericHi"),
new TextBoxPropertyMap(strReverseTextBox, "StrReverse"),
new TextBoxPropertyMap(strReverseHiTextBox, "StrReverseHi"),
new TextBoxPropertyMap(strLen8TextBox, "StrLen8"),
new TextBoxPropertyMap(strLen8HiTextBox, "StrLen8Hi"),
new TextBoxPropertyMap(strLen16TextBox, "StrLen16"),
new TextBoxPropertyMap(strLen16HiTextBox, "StrLen16Hi"),
new TextBoxPropertyMap(strNullTermTextBox, "StrNullTerm"),
new TextBoxPropertyMap(strNullTermHiTextBox, "StrNullTermHi"),
new TextBoxPropertyMap(strDciTextBox, "StrDci"),
new TextBoxPropertyMap(strDciHiTextBox, "StrDciHi"),
};
ConfigureComboBox(asmConfigComboBox);
ConfigureComboBox(displayFmtQuickComboBox);
ConfigureComboBox(pseudoOpQuickComboBox);
expressionStyleComboBox.DisplayMember = "Name";
foreach (ExpressionStyleItem esi in sExpStyleItems) {
expressionStyleComboBox.Items.Add(esi);
}
}
private void ConfigureComboBox(ComboBox cb) {
// Show the Name field.
cb.DisplayMember = "Name";
cb.Items.Clear();
IEnumerator<AssemblerInfo> iter = AssemblerInfo.GetInfoEnumerator();
bool foundMatch = false;
while (iter.MoveNext()) {
AssemblerInfo info = iter.Current;
AsmComboItem item = new AsmComboItem(info);
cb.Items.Add(item);
if (item.AssemblerId == mInitialAsmId) {
cb.SelectedItem = item;
foundMatch = true;
}
}
if (!foundMatch) {
// Need to do this or box will show empty.
cb.SelectedIndex = 0;
}
}
private void EditAppSettings_Load(object sender, EventArgs e) {
// Column widths. We called SaveCodeListColumnWidths() earlier, so this
// should always be a valid serialized string.
string widthStr = mSettings.GetString(AppSettings.CDLV_COL_WIDTHS, null);
Debug.Assert(!string.IsNullOrEmpty(widthStr));
ProjectView.CodeListColumnWidths widths =
ProjectView.CodeListColumnWidths.Deserialize(widthStr);
Debug.Assert(widths != null);
for (int i = 0; i < NUM_COLUMNS; i++) {
SetShowHideButton(i, widths.Width[i]);
}
// Display localized font string.
FontConverter cvt = new FontConverter();
currentFontDisplayLabel.Text = cvt.ConvertToString(mProjectView.CodeListViewFont);
// Upper-case formatting.
upperHexCheckBox.Checked = mSettings.GetBool(AppSettings.FMT_UPPER_HEX_DIGITS, false);
upperOpcodeCheckBox.Checked = mSettings.GetBool(
AppSettings.FMT_UPPER_OP_MNEMONIC, false);
upperPseudoOpCheckBox.Checked = mSettings.GetBool(
AppSettings.FMT_UPPER_PSEUDO_OP_MNEMONIC, false);
upperACheckBox.Checked = mSettings.GetBool(AppSettings.FMT_UPPER_OPERAND_A, false);
upperSCheckBox.Checked = mSettings.GetBool(AppSettings.FMT_UPPER_OPERAND_S, false);
upperXYCheckBox.Checked = mSettings.GetBool(AppSettings.FMT_UPPER_OPERAND_XY, false);
int clipIndex = mSettings.GetEnum(AppSettings.CLIP_LINE_FORMAT,
typeof(ClipLineFormat), 0);
if (clipIndex >= 0 && clipIndex < clipboardFormatComboBox.Items.Count) {
clipboardFormatComboBox.SelectedIndex = clipIndex;
}
spacesBetweenBytesCheckBox.Checked =
mSettings.GetBool(AppSettings.FMT_SPACES_BETWEEN_BYTES, false);
enableDebugCheckBox.Checked = mSettings.GetBool(AppSettings.DEBUG_MENU_ENABLED, false);
// Assemblers.
PopulateAsmConfigItems();
showAsmIdentCheckBox.Checked =
mSettings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false);
disableLabelLocalizationCheckBox.Checked =
mSettings.GetBool(AppSettings.SRCGEN_DISABLE_LABEL_LOCALIZATION, false);
longLabelNewLineCheckBox.Checked =
mSettings.GetBool(AppSettings.SRCGEN_LONG_LABEL_NEW_LINE, false);
showCycleCountsCheckBox.Checked =
mSettings.GetBool(AppSettings.SRCGEN_SHOW_CYCLE_COUNTS, false);
// Pseudo ops.
string opStrCereal = mSettings.GetString(AppSettings.FMT_PSEUDO_OP_NAMES, null);
if (!string.IsNullOrEmpty(opStrCereal)) {
PseudoOp.PseudoOpNames opNames = PseudoOp.PseudoOpNames.Deserialize(opStrCereal);
ImportPseudoOpNames(opNames);
} else {
// no data available, populate with blanks
//PseudoOp.PseudoOpNames opNames = PseudoOp.sDefaultPseudoOpNames;
ImportPseudoOpNames(new PseudoOp.PseudoOpNames());
}
PopulateWidthDisamSettings();
string exprMode = mSettings.GetString(AppSettings.FMT_EXPRESSION_MODE, string.Empty);
ExpressionMode mode;
if (!Enum.TryParse<ExpressionMode>(exprMode, out mode)) {
mode = ExpressionMode.Common;
}
SetExpressionStyle(mode);
if (mInitialTab != Tab.Unknown) {
settingsTabControl.SelectTab((int)mInitialTab);
}
mDirty = false;
UpdateControls();
}
/// <summary>
/// Updates controls.
/// </summary>
private void UpdateControls() {
applyButton.Enabled = mDirty;
}
/// <summary>
/// Sets the dirty flag and updates the controls.
/// </summary>
/// <param name="dirty">New value for dirty flag.</param>
private void SetDirty(bool dirty) {
mDirty = dirty;
UpdateControls();
}
private void okButton_Click(object sender, EventArgs e) {
ApplySettings();
}
private void applyButton_Click(object sender, EventArgs e) {
ApplySettings();
}
private void ApplySettings() {
PseudoOp.PseudoOpNames opNames = ExportPseudoOpNames();
string pseudoCereal = opNames.Serialize();
mSettings.SetString(AppSettings.FMT_PSEUDO_OP_NAMES, pseudoCereal);
mProjectView.SetAppSettings(mSettings);
AsmGen.AssemblerVersionCache.QueryVersions();
SetDirty(false);
}
#region Code View
/// <summary>
/// Updates the text on a show/hide column button.
/// </summary>
/// <param name="index">Column index.</param>
/// <param name="width">New width.</param>
private void SetShowHideButton(int index, int width) {
Button button = mColButtons[index];
string fmt = mColumnFormats[index];
string show = Properties.Resources.SHOW_COL;
string hide = Properties.Resources.HIDE_COL;
button.Text = string.Format(fmt, (width == 0) ? show : hide);
}
/// <summary>
/// Handler for all show/hide column buttons.
/// </summary>
/// <param name="sender">Identifies the button that was clicked.</param>
/// <param name="e">Stuff.</param>
private void ColumnVisibilityButtonClick(object sender, EventArgs e) {
int index = -1;
for (int i = 0; i < mColButtons.Length; i++) {
if (sender == mColButtons[i]) {
index = i;
break;
}
}
Debug.Assert(index != -1);
string widthStr = mSettings.GetString(AppSettings.CDLV_COL_WIDTHS, null);
Debug.Assert(!string.IsNullOrEmpty(widthStr));
ProjectView.CodeListColumnWidths widths =
ProjectView.CodeListColumnWidths.Deserialize(widthStr);
if (widths.Width[index] == 0) {
// Expand to default width. The default width changes when the font
// changes, so it's best to just reacquire the default width set as needed.
ProjectView.CodeListColumnWidths defaultWidths =
mProjectView.GetDefaultCodeListColumnWidths();
widths.Width[index] = defaultWidths.Width[index];
} else {
widths.Width[index] = 0;
}
widthStr = widths.Serialize();
mSettings.SetString(AppSettings.CDLV_COL_WIDTHS, widthStr);
SetShowHideButton(index, widths.Width[index]);
SetDirty(true);
}
private void selectFontButton_Click(object sender, EventArgs e) {
FontDialog dlg = new FontDialog();
dlg.Font = mProjectView.CodeListViewFont;
dlg.ShowEffects = false;
Debug.WriteLine("Showing font dialog...");
if (dlg.ShowDialog() != DialogResult.Cancel) {
FontConverter cvt = new FontConverter();
// Store invariant string, display localized string.
mSettings.SetString(AppSettings.CDLV_FONT, cvt.ConvertToInvariantString(dlg.Font));
currentFontDisplayLabel.Text = cvt.ConvertToString(dlg.Font);
SetDirty(true);
}
Debug.WriteLine("Font dialog done...");
dlg.Dispose();
}
private void upperHexCheckBox_CheckedChanged(object sender, EventArgs e) {
mSettings.SetBool(AppSettings.FMT_UPPER_HEX_DIGITS, upperHexCheckBox.Checked);
SetDirty(true);
}
private void upperOpcodeCheckBox_CheckedChanged(object sender, EventArgs e) {
mSettings.SetBool(AppSettings.FMT_UPPER_OP_MNEMONIC, upperOpcodeCheckBox.Checked);
SetDirty(true);
}
private void upperPseudoOpCheckBox_CheckedChanged(object sender, EventArgs e) {
mSettings.SetBool(AppSettings.FMT_UPPER_PSEUDO_OP_MNEMONIC,
upperPseudoOpCheckBox.Checked);
SetDirty(true);
}
private void upperACheckBox_CheckedChanged(object sender, EventArgs e) {
mSettings.SetBool(AppSettings.FMT_UPPER_OPERAND_A, upperACheckBox.Checked);
SetDirty(true);
}
private void upperSCheckBox_CheckedChanged(object sender, EventArgs e) {
mSettings.SetBool(AppSettings.FMT_UPPER_OPERAND_S, upperSCheckBox.Checked);
SetDirty(true);
}
private void upperXYCheckBox_CheckedChanged(object sender, EventArgs e) {
mSettings.SetBool(AppSettings.FMT_UPPER_OPERAND_XY, upperXYCheckBox.Checked);
SetDirty(true);
}
private void upperAllLowerButton_Click(object sender, EventArgs e) {
upperHexCheckBox.Checked =
upperOpcodeCheckBox.Checked =
upperPseudoOpCheckBox.Checked =
upperACheckBox.Checked =
upperSCheckBox.Checked =
upperXYCheckBox.Checked = false;
}
private void upperAllUpperButton_Click(object sender, EventArgs e) {
upperHexCheckBox.Checked =
upperOpcodeCheckBox.Checked =
upperPseudoOpCheckBox.Checked =
upperACheckBox.Checked =
upperSCheckBox.Checked =
upperXYCheckBox.Checked = true;
}
private void clipboardFormatComboBox_SelectedIndexChanged(object sender, EventArgs e) {
mSettings.SetEnum(AppSettings.CLIP_LINE_FORMAT, typeof(ClipLineFormat),
clipboardFormatComboBox.SelectedIndex);
SetDirty(true);
}
private void spacesBetweenBytesCheckBox_CheckedChanged(object sender, EventArgs e) {
mSettings.SetBool(AppSettings.FMT_SPACES_BETWEEN_BYTES,
spacesBetweenBytesCheckBox.Checked);
SetDirty(true);
}
private void enableDebugCheckBox_CheckedChanged(object sender, EventArgs e) {
mSettings.SetBool(AppSettings.DEBUG_MENU_ENABLED, enableDebugCheckBox.Checked);
SetDirty(true);
}
#endregion Code View
#region Asm Config
/// <summary>
/// Populates the UI elements from the asm config item in the settings. If that doesn't
/// exist, use the default config.
/// </summary>
private void PopulateAsmConfigItems() {
AsmComboItem item = (AsmComboItem) asmConfigComboBox.SelectedItem;
AssemblerInfo.Id asmId = item.AssemblerId;
AssemblerConfig config = AssemblerConfig.GetConfig(mSettings, asmId);
if (config == null) {
AsmGen.IAssembler asm = AssemblerInfo.GetAssembler(asmId);
config = asm.GetDefaultConfig();
}
asmExePathTextBox.Text = config.ExecutablePath;
asmLabelColWidthTextBox.Text = config.ColumnWidths[0].ToString();
asmOpcodeColWidthTextBox.Text = config.ColumnWidths[1].ToString();
asmOperandColWidthTextBox.Text = config.ColumnWidths[2].ToString();
asmCommentColWidthTextBox.Text = config.ColumnWidths[3].ToString();
}
private AssemblerConfig GetAsmConfigFromUi() {
const int MIN_WIDTH = 1;
const int MAX_WIDTH = 200;
int[] widths = new int[4];
for (int i = 0; i < widths.Length; i++) {
widths[i] = MIN_WIDTH;
}
int result;
if (int.TryParse(asmLabelColWidthTextBox.Text, out result) && result >= MIN_WIDTH &&
result <= MAX_WIDTH) {
widths[0] = result;
}
if (int.TryParse(asmOpcodeColWidthTextBox.Text, out result) && result >= MIN_WIDTH &&
result <= MAX_WIDTH) {
widths[1] = result;
}
if (int.TryParse(asmOperandColWidthTextBox.Text, out result) && result >= MIN_WIDTH &&
result <= MAX_WIDTH) {
widths[2] = result;
}
if (int.TryParse(asmCommentColWidthTextBox.Text, out result) && result >= MIN_WIDTH &&
result <= MAX_WIDTH) {
widths[3] = result;
}
return new AssemblerConfig(asmExePathTextBox.Text, widths);
}
private void asmConfigComboBox_SelectedIndexChanged(object sender, EventArgs e) {
// They're switching to a different asm config. Changing the boxes will cause
// the dirty flag to be raised, which isn't right, so we save/restore it.
bool oldDirty = mDirty;
PopulateAsmConfigItems();
SetDirty(oldDirty);
}
private void asmExeBrowseButton_Click(object sender, EventArgs e) {
AsmComboItem item = (AsmComboItem)asmConfigComboBox.SelectedItem;
AssemblerInfo.Id asmId = item.AssemblerId;
// Figure out what we're looking for. For example, cc65 needs "cl65".
AsmGen.IAssembler asm = AssemblerInfo.GetAssembler(asmId);
asm.GetExeIdentifiers(out string humanName, out string exeName);
// Ask the user to find it.
string pathName = BrowseForExecutable(humanName, exeName);
if (pathName != null) {
asmExePathTextBox.Text = pathName;
AssemblerConfig.SetConfig(mSettings, asmId, GetAsmConfigFromUi());
SetDirty(true);
}
}
/// <summary>
/// Handles a text-changed event in the executable and column width text boxes.
/// </summary>
private void AsmConfig_TextChanged(object sender, EventArgs e) {
AsmComboItem item = (AsmComboItem)asmConfigComboBox.SelectedItem;
AssemblerConfig.SetConfig(mSettings, item.AssemblerId, GetAsmConfigFromUi());
SetDirty(true);
}
/// <summary>
/// Creates a file dialog to search for a specific executable.
/// </summary>
/// <param name="prefix">Human-readable filter string for UI.</param>
/// <param name="name">Filename of executable.</param>
/// <returns>Path of executable, or null if dialog was canceled.</returns>
private string BrowseForExecutable(string prefix, string name) {
string pathName = null;
if (Environment.OSVersion.Platform == PlatformID.Win32NT) {
name += ".exe";
}
OpenFileDialog dlg = new OpenFileDialog() {
FileName = name,
Filter = prefix + "|" + name,
RestoreDirectory = true
};
if (dlg.ShowDialog() != DialogResult.Cancel) {
pathName = dlg.FileName;
}
dlg.Dispose();
return pathName;
}
private void showCycleCountsCheckBox_CheckedChanged(object sender, EventArgs e) {
mSettings.SetBool(AppSettings.SRCGEN_SHOW_CYCLE_COUNTS,
showCycleCountsCheckBox.Checked);
SetDirty(true);
}
private void longLabelNewLineCheckBox_CheckedChanged(object sender, EventArgs e) {
mSettings.SetBool(AppSettings.SRCGEN_LONG_LABEL_NEW_LINE,
longLabelNewLineCheckBox.Checked);
SetDirty(true);
}
private void showAsmIdentCheckBox_CheckedChanged(object sender, EventArgs e) {
mSettings.SetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, showAsmIdentCheckBox.Checked);
SetDirty(true);
}
private void disableLabelLocalizationCheckBox_CheckedChanged(object sender, EventArgs e) {
mSettings.SetBool(AppSettings.SRCGEN_DISABLE_LABEL_LOCALIZATION,
disableLabelLocalizationCheckBox.Checked);
SetDirty(true);
}
#endregion Asm Config
#region Display Format
/// <summary>
/// Populates the width disambiguation text boxes.
/// </summary>
private void PopulateWidthDisamSettings() {
// Operand width disambiguation. This is a little tricky -- we have to query all
// settings then set all controls, or the field-updated callback may interfere
// with us by changing AppSettings.
string opcSuffixAbs = mSettings.GetString(AppSettings.FMT_OPCODE_SUFFIX_ABS,
string.Empty);
string opcSuffixLong = mSettings.GetString(AppSettings.FMT_OPCODE_SUFFIX_LONG,
string.Empty);
string opPrefixAbs = mSettings.GetString(AppSettings.FMT_OPERAND_PREFIX_ABS,
string.Empty);
string opPrefixLong = mSettings.GetString(AppSettings.FMT_OPERAND_PREFIX_LONG,
string.Empty);
disambSuffix16TextBox.Text = opcSuffixAbs;
disambSuffix24TextBox.Text = opcSuffixLong;
disambPrefix16TextBox.Text = opPrefixAbs;
disambPrefix24TextBox.Text = opPrefixLong;
}
/// <summary>
/// Sets all of the width disambiguation settings.
/// </summary>
private void SetWidthDisamSettings(string opcodeSuffixAbs, string opcodeSuffixLong,
string operandPrefixAbs, string operandPrefixLong) {
mSettings.SetString(AppSettings.FMT_OPCODE_SUFFIX_ABS, opcodeSuffixAbs);
mSettings.SetString(AppSettings.FMT_OPCODE_SUFFIX_LONG, opcodeSuffixLong);
mSettings.SetString(AppSettings.FMT_OPERAND_PREFIX_ABS, operandPrefixAbs);
mSettings.SetString(AppSettings.FMT_OPERAND_PREFIX_LONG, operandPrefixLong);
PopulateWidthDisamSettings();
}
// Called when text is typed.
private void WidthDisamControlChanged(object sender, EventArgs e) {
ExportWidthDisamSettings();
}
/// <summary>
/// Exports the current state of the width controls to the settings object.
/// </summary>
private void ExportWidthDisamSettings() {
mSettings.SetString(AppSettings.FMT_OPCODE_SUFFIX_ABS, disambSuffix16TextBox.Text);
mSettings.SetString(AppSettings.FMT_OPCODE_SUFFIX_LONG, disambSuffix24TextBox.Text);
mSettings.SetString(AppSettings.FMT_OPERAND_PREFIX_ABS, disambPrefix16TextBox.Text);
mSettings.SetString(AppSettings.FMT_OPERAND_PREFIX_LONG, disambPrefix24TextBox.Text);
SetDirty(true);
//Debug.WriteLine("disam: '" +
// mSettings.GetString(AppSettings.FMT_OPCODE_SUFFIX_ABS, string.Empty) + "' '" +
// mSettings.GetString(AppSettings.FMT_OPCODE_SUFFIX_LONG, string.Empty) + "' '" +
// mSettings.GetString(AppSettings.FMT_OPERAND_PREFIX_ABS, string.Empty) + "' '" +
// mSettings.GetString(AppSettings.FMT_OPERAND_PREFIX_LONG, string.Empty) + "'");
}
private void SetExpressionStyle(ExpressionMode mode) {
foreach (ExpressionStyleItem esi in expressionStyleComboBox.Items) {
if (esi.ExpMode == mode) {
expressionStyleComboBox.SelectedItem = esi;
return;
}
}
Debug.Assert(false, "Expression mode " + mode + " not found");
expressionStyleComboBox.SelectedIndex = 0;
}
private void expressionStyleComboBox_SelectedIndexChanged(object sender, EventArgs e) {
ExpressionStyleItem esi = (ExpressionStyleItem)expressionStyleComboBox.SelectedItem;
mSettings.SetString(AppSettings.FMT_EXPRESSION_MODE, esi.ExpMode.ToString());
SetDirty(true);
}
private void displayFmtSetButton_Click(object sender, EventArgs e) {
AsmComboItem item = (AsmComboItem)displayFmtQuickComboBox.SelectedItem;
AssemblerInfo.Id asmId = item.AssemblerId;
AsmGen.IGenerator gen = AssemblerInfo.GetGenerator(asmId);
PseudoOp.PseudoOpNames opNames;
Asm65.Formatter.FormatConfig formatConfig;
gen.GetDefaultDisplayFormat(out opNames, out formatConfig);
SetWidthDisamSettings(formatConfig.mForceAbsOpcodeSuffix,
formatConfig.mForceLongOpcodeSuffix,
formatConfig.mForceAbsOperandPrefix,
formatConfig.mForceLongOperandPrefix);
SetExpressionStyle(formatConfig.mExpressionMode);
// dirty flag set by change watchers if one or more fields have changed
}
private void quickFmtDefaultButton_Click(object sender, EventArgs e) {
SetWidthDisamSettings(null, "l", "a:", "f:");
SetExpressionStyle(ExpressionMode.Common);
// dirty flag set by change watchers if one or more fields have changed
}
#endregion Display Format
#region Pseudo-Op
/// <summary>
/// Imports values from PseudoOpNames struct into text fields.
/// </summary>
private void ImportPseudoOpNames(PseudoOp.PseudoOpNames opNames) {
for (int i = 0; i < mPseudoNameMap.Length; i++) {
string str = (string)mPseudoNameMap[i].PropInfo.GetValue(opNames);
mPseudoNameMap[i].TextBox.Text = (str == null) ? string.Empty : str;
}
}
/// <summary>
/// Exports values from text fields to a PseudoOpNames object.
/// </summary>
private PseudoOp.PseudoOpNames ExportPseudoOpNames() {
PseudoOp.PseudoOpNames opNames = new PseudoOp.PseudoOpNames();
for (int i = 0; i < mPseudoNameMap.Length; i++) {
// NOTE: PseudoOpNames must be a class (not a struct) or this will fail.
// SetValue() would be invoked on a boxed copy that is discarded afterward.
mPseudoNameMap[i].PropInfo.SetValue(opNames, mPseudoNameMap[i].TextBox.Text);
}
return opNames;
}
// Invoked when text is changed in any pseudo-op text box.
private void PseudoOpTextChanged(object sender, EventArgs e) {
// Just set the dirty flag. The (somewhat expensive) export will happen
// on Apply/OK.
SetDirty(true);
}
private void quickPseudoDefaultButton_Click(object sender, EventArgs e) {
ImportPseudoOpNames(new PseudoOp.PseudoOpNames());
}
private void pseudoOpSetButton_Click(object sender, EventArgs e) {
AsmComboItem item = (AsmComboItem)pseudoOpQuickComboBox.SelectedItem;
AssemblerInfo.Id asmId = item.AssemblerId;
AsmGen.IGenerator gen = AssemblerInfo.GetGenerator(asmId);
PseudoOp.PseudoOpNames opNames;
Asm65.Formatter.FormatConfig formatConfig;
gen.GetDefaultDisplayFormat(out opNames, out formatConfig);
ImportPseudoOpNames(opNames);
// dirty flag set by change watchers if one or more fields have changed
}
#endregion Pseudo-Op
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,153 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class EditComment {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.instructionLabel = new System.Windows.Forms.Label();
this.commentTextBox = new System.Windows.Forms.TextBox();
this.asciiOnlyLabel = new System.Windows.Forms.Label();
this.maxLengthLabel = new System.Windows.Forms.Label();
this.numCharsLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(426, 105);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 6;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(345, 105);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 5;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// instructionLabel
//
this.instructionLabel.AutoSize = true;
this.instructionLabel.Location = new System.Drawing.Point(13, 13);
this.instructionLabel.Name = "instructionLabel";
this.instructionLabel.Size = new System.Drawing.Size(81, 13);
this.instructionLabel.TabIndex = 0;
this.instructionLabel.Text = "Enter comment:";
//
// textBox1
//
this.commentTextBox.Location = new System.Drawing.Point(13, 30);
this.commentTextBox.Name = "textBox1";
this.commentTextBox.Size = new System.Drawing.Size(488, 20);
this.commentTextBox.TabIndex = 1;
this.commentTextBox.TextChanged += new System.EventHandler(this.commentTextBox_TextChanged);
//
// asciiOnlyLabel
//
this.asciiOnlyLabel.AutoSize = true;
this.asciiOnlyLabel.Location = new System.Drawing.Point(13, 57);
this.asciiOnlyLabel.Name = "asciiOnlyLabel";
this.asciiOnlyLabel.Size = new System.Drawing.Size(145, 13);
this.asciiOnlyLabel.TabIndex = 2;
this.asciiOnlyLabel.Text = "• ASCII-only is recommended";
//
// maxLengthLabel
//
this.maxLengthLabel.AutoSize = true;
this.maxLengthLabel.Location = new System.Drawing.Point(13, 74);
this.maxLengthLabel.Name = "maxLengthLabel";
this.maxLengthLabel.Size = new System.Drawing.Size(281, 13);
this.maxLengthLabel.TabIndex = 3;
this.maxLengthLabel.Text = "• Limit to 52 or fewer characters for nice 80-column output";
//
// numCharsLabel
//
this.numCharsLabel.Location = new System.Drawing.Point(386, 53);
this.numCharsLabel.Name = "numCharsLabel";
this.numCharsLabel.Size = new System.Drawing.Size(115, 23);
this.numCharsLabel.TabIndex = 4;
this.numCharsLabel.Text = "{0} characters";
this.numCharsLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// EditComment
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(513, 140);
this.Controls.Add(this.numCharsLabel);
this.Controls.Add(this.maxLengthLabel);
this.Controls.Add(this.asciiOnlyLabel);
this.Controls.Add(this.commentTextBox);
this.Controls.Add(this.instructionLabel);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "EditComment";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Comment";
this.Load += new System.EventHandler(this.EditComment_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Label instructionLabel;
private System.Windows.Forms.TextBox commentTextBox;
private System.Windows.Forms.Label asciiOnlyLabel;
private System.Windows.Forms.Label maxLengthLabel;
private System.Windows.Forms.Label numCharsLabel;
}
}

View File

@ -1,75 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace SourceGenWF.AppForms {
public partial class EditComment : Form {
/// <summary>
/// Edited comment string. Will be empty if the comment is to be deleted.
/// </summary>
public string Comment { get; private set; }
private string mNumCharsFormat;
private Color mDefaultLabelColor;
private const int RECOMMENDED_MAX_LENGTH = 52;
public EditComment(string comment) {
InitializeComponent();
// The initial label string is used as the format arg.
mNumCharsFormat = numCharsLabel.Text;
// Remember the default color.
mDefaultLabelColor = asciiOnlyLabel.ForeColor;
Debug.Assert(comment != null);
commentTextBox.Text = comment;
}
private void EditComment_Load(object sender, EventArgs e) {
UpdateLengthLabel();
}
private void UpdateLengthLabel() {
numCharsLabel.Text = string.Format(mNumCharsFormat, commentTextBox.Text.Length);
}
private void commentTextBox_TextChanged(object sender, EventArgs e) {
UpdateLengthLabel();
if (!CommonUtil.TextUtil.IsPrintableAscii(commentTextBox.Text)) {
asciiOnlyLabel.ForeColor = Color.Red;
} else {
asciiOnlyLabel.ForeColor = mDefaultLabelColor;
}
if (commentTextBox.Text.Length > RECOMMENDED_MAX_LENGTH) {
maxLengthLabel.ForeColor = Color.Red;
} else {
maxLengthLabel.ForeColor = mDefaultLabelColor;
}
}
private void okButton_Click(object sender, EventArgs e) {
Comment = commentTextBox.Text;
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,559 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class EditData {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.selectFormatLabel = new System.Windows.Forms.Label();
this.rawDataSectionLabel = new System.Windows.Forms.Label();
this.radioSingleBytes = new System.Windows.Forms.RadioButton();
this.radio16BitBig = new System.Windows.Forms.RadioButton();
this.radio16BitLittle = new System.Windows.Forms.RadioButton();
this.radio24BitLittle = new System.Windows.Forms.RadioButton();
this.radio32BitLittle = new System.Windows.Forms.RadioButton();
this.radioSimpleDataBinary = new System.Windows.Forms.RadioButton();
this.radioSimpleDataDecimal = new System.Windows.Forms.RadioButton();
this.radioSimpleDataHex = new System.Windows.Forms.RadioButton();
this.radioDenseHex = new System.Windows.Forms.RadioButton();
this.radioFill = new System.Windows.Forms.RadioButton();
this.horizontalLine1 = new System.Windows.Forms.Label();
this.horizontalLine2 = new System.Windows.Forms.Label();
this.stringSectionLabel = new System.Windows.Forms.Label();
this.horizontalLine3 = new System.Windows.Forms.Label();
this.radioStringMixed = new System.Windows.Forms.RadioButton();
this.radioStringMixedReverse = new System.Windows.Forms.RadioButton();
this.radioStringNullTerm = new System.Windows.Forms.RadioButton();
this.radioStringLen8 = new System.Windows.Forms.RadioButton();
this.radioStringLen16 = new System.Windows.Forms.RadioButton();
this.radioStringDci = new System.Windows.Forms.RadioButton();
this.symbolEntryTextBox = new System.Windows.Forms.TextBox();
this.symbolPartPanel = new System.Windows.Forms.Panel();
this.radioSymbolPartBank = new System.Windows.Forms.RadioButton();
this.radioSymbolPartHigh = new System.Windows.Forms.RadioButton();
this.radioSymbolPartLow = new System.Windows.Forms.RadioButton();
this.radioSimpleDataAscii = new System.Windows.Forms.RadioButton();
this.radioDefaultFormat = new System.Windows.Forms.RadioButton();
this.simpleDisplayAsGroupBox = new System.Windows.Forms.GroupBox();
this.radioSimpleDataAddress = new System.Windows.Forms.RadioButton();
this.radioSimpleDataSymbolic = new System.Windows.Forms.RadioButton();
this.label1 = new System.Windows.Forms.Label();
this.symbolPartPanel.SuspendLayout();
this.simpleDisplayAsGroupBox.SuspendLayout();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(438, 461);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 23;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(357, 461);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 22;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// selectFormatLabel
//
this.selectFormatLabel.AutoSize = true;
this.selectFormatLabel.Location = new System.Drawing.Point(12, 9);
this.selectFormatLabel.Name = "selectFormatLabel";
this.selectFormatLabel.Size = new System.Drawing.Size(253, 13);
this.selectFormatLabel.TabIndex = 0;
this.selectFormatLabel.Text = "Select data format ({0} bytes selected in {1} groups):";
//
// rawDataSectionLabel
//
this.rawDataSectionLabel.AutoSize = true;
this.rawDataSectionLabel.Location = new System.Drawing.Point(12, 63);
this.rawDataSectionLabel.Name = "rawDataSectionLabel";
this.rawDataSectionLabel.Size = new System.Drawing.Size(64, 13);
this.rawDataSectionLabel.TabIndex = 2;
this.rawDataSectionLabel.Text = "Simple Data";
//
// radioSingleBytes
//
this.radioSingleBytes.AutoSize = true;
this.radioSingleBytes.Location = new System.Drawing.Point(14, 89);
this.radioSingleBytes.Name = "radioSingleBytes";
this.radioSingleBytes.Size = new System.Drawing.Size(82, 17);
this.radioSingleBytes.TabIndex = 4;
this.radioSingleBytes.TabStop = true;
this.radioSingleBytes.Text = "Single &bytes";
this.radioSingleBytes.UseVisualStyleBackColor = true;
this.radioSingleBytes.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radio16BitBig
//
this.radio16BitBig.AutoSize = true;
this.radio16BitBig.Location = new System.Drawing.Point(14, 135);
this.radio16BitBig.Name = "radio16BitBig";
this.radio16BitBig.Size = new System.Drawing.Size(137, 17);
this.radio16BitBig.TabIndex = 6;
this.radio16BitBig.TabStop = true;
this.radio16BitBig.Text = "16-bit words, big-endian";
this.radio16BitBig.UseVisualStyleBackColor = true;
this.radio16BitBig.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radio16BitLittle
//
this.radio16BitLittle.AutoSize = true;
this.radio16BitLittle.Location = new System.Drawing.Point(14, 112);
this.radio16BitLittle.Name = "radio16BitLittle";
this.radio16BitLittle.Size = new System.Drawing.Size(141, 17);
this.radio16BitLittle.TabIndex = 5;
this.radio16BitLittle.TabStop = true;
this.radio16BitLittle.Text = "16-bit words, little-endian";
this.radio16BitLittle.UseVisualStyleBackColor = true;
this.radio16BitLittle.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radio24BitLittle
//
this.radio24BitLittle.AutoSize = true;
this.radio24BitLittle.Location = new System.Drawing.Point(14, 158);
this.radio24BitLittle.Name = "radio24BitLittle";
this.radio24BitLittle.Size = new System.Drawing.Size(141, 17);
this.radio24BitLittle.TabIndex = 7;
this.radio24BitLittle.TabStop = true;
this.radio24BitLittle.Text = "24-bit words, little-endian";
this.radio24BitLittle.UseVisualStyleBackColor = true;
this.radio24BitLittle.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radio32BitLittle
//
this.radio32BitLittle.AutoSize = true;
this.radio32BitLittle.Location = new System.Drawing.Point(14, 181);
this.radio32BitLittle.Name = "radio32BitLittle";
this.radio32BitLittle.Size = new System.Drawing.Size(141, 17);
this.radio32BitLittle.TabIndex = 8;
this.radio32BitLittle.TabStop = true;
this.radio32BitLittle.Text = "32-bit words, little-endian";
this.radio32BitLittle.UseVisualStyleBackColor = true;
this.radio32BitLittle.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radioSimpleDataBinary
//
this.radioSimpleDataBinary.AutoSize = true;
this.radioSimpleDataBinary.Location = new System.Drawing.Point(6, 64);
this.radioSimpleDataBinary.Name = "radioSimpleDataBinary";
this.radioSimpleDataBinary.Size = new System.Drawing.Size(54, 17);
this.radioSimpleDataBinary.TabIndex = 4;
this.radioSimpleDataBinary.TabStop = true;
this.radioSimpleDataBinary.Text = "Binary";
this.radioSimpleDataBinary.UseVisualStyleBackColor = true;
this.radioSimpleDataBinary.CheckedChanged += new System.EventHandler(this.SimpleDisplay_CheckedChanged);
//
// radioSimpleDataDecimal
//
this.radioSimpleDataDecimal.AutoSize = true;
this.radioSimpleDataDecimal.Location = new System.Drawing.Point(6, 41);
this.radioSimpleDataDecimal.Name = "radioSimpleDataDecimal";
this.radioSimpleDataDecimal.Size = new System.Drawing.Size(63, 17);
this.radioSimpleDataDecimal.TabIndex = 3;
this.radioSimpleDataDecimal.TabStop = true;
this.radioSimpleDataDecimal.Text = "Decimal";
this.radioSimpleDataDecimal.UseVisualStyleBackColor = true;
this.radioSimpleDataDecimal.CheckedChanged += new System.EventHandler(this.SimpleDisplay_CheckedChanged);
//
// radioSimpleDataHex
//
this.radioSimpleDataHex.AutoSize = true;
this.radioSimpleDataHex.Location = new System.Drawing.Point(6, 18);
this.radioSimpleDataHex.Name = "radioSimpleDataHex";
this.radioSimpleDataHex.Size = new System.Drawing.Size(44, 17);
this.radioSimpleDataHex.TabIndex = 2;
this.radioSimpleDataHex.TabStop = true;
this.radioSimpleDataHex.Text = "Hex";
this.radioSimpleDataHex.UseVisualStyleBackColor = true;
this.radioSimpleDataHex.CheckedChanged += new System.EventHandler(this.SimpleDisplay_CheckedChanged);
//
// radioDenseHex
//
this.radioDenseHex.AutoSize = true;
this.radioDenseHex.Location = new System.Drawing.Point(14, 247);
this.radioDenseHex.Name = "radioDenseHex";
this.radioDenseHex.Size = new System.Drawing.Size(130, 17);
this.radioDenseHex.TabIndex = 11;
this.radioDenseHex.TabStop = true;
this.radioDenseHex.Text = "Densely-&packed bytes";
this.radioDenseHex.UseVisualStyleBackColor = true;
this.radioDenseHex.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radioFill
//
this.radioFill.AutoSize = true;
this.radioFill.Location = new System.Drawing.Point(14, 270);
this.radioFill.Name = "radioFill";
this.radioFill.Size = new System.Drawing.Size(88, 17);
this.radioFill.TabIndex = 12;
this.radioFill.TabStop = true;
this.radioFill.Text = "&Fill with value";
this.radioFill.UseVisualStyleBackColor = true;
this.radioFill.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// horizontalLine1
//
this.horizontalLine1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.horizontalLine1.Location = new System.Drawing.Point(12, 81);
this.horizontalLine1.Name = "horizontalLine1";
this.horizontalLine1.Size = new System.Drawing.Size(500, 2);
this.horizontalLine1.TabIndex = 3;
//
// horizontalLine2
//
this.horizontalLine2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.horizontalLine2.Location = new System.Drawing.Point(12, 239);
this.horizontalLine2.Name = "horizontalLine2";
this.horizontalLine2.Size = new System.Drawing.Size(320, 2);
this.horizontalLine2.TabIndex = 10;
//
// stringSectionLabel
//
this.stringSectionLabel.AutoSize = true;
this.stringSectionLabel.Location = new System.Drawing.Point(12, 308);
this.stringSectionLabel.Name = "stringSectionLabel";
this.stringSectionLabel.Size = new System.Drawing.Size(34, 13);
this.stringSectionLabel.TabIndex = 13;
this.stringSectionLabel.Text = "String";
//
// horizontalLine3
//
this.horizontalLine3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.horizontalLine3.Location = new System.Drawing.Point(12, 326);
this.horizontalLine3.Name = "horizontalLine3";
this.horizontalLine3.Size = new System.Drawing.Size(320, 2);
this.horizontalLine3.TabIndex = 14;
//
// radioStringMixed
//
this.radioStringMixed.AutoSize = true;
this.radioStringMixed.Location = new System.Drawing.Point(14, 334);
this.radioStringMixed.Name = "radioStringMixed";
this.radioStringMixed.Size = new System.Drawing.Size(257, 17);
this.radioStringMixed.TabIndex = 15;
this.radioStringMixed.TabStop = true;
this.radioStringMixed.Text = "Mixed ASCII ({0} bytes) and non-ASCII ({1} bytes)";
this.radioStringMixed.UseVisualStyleBackColor = true;
this.radioStringMixed.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radioStringMixedReverse
//
this.radioStringMixedReverse.AutoSize = true;
this.radioStringMixedReverse.Location = new System.Drawing.Point(14, 357);
this.radioStringMixedReverse.Name = "radioStringMixedReverse";
this.radioStringMixedReverse.Size = new System.Drawing.Size(275, 17);
this.radioStringMixedReverse.TabIndex = 16;
this.radioStringMixedReverse.TabStop = true;
this.radioStringMixedReverse.Text = "Reversed ASCII ({0} bytes) and non-ASCII ({1} bytes)";
this.radioStringMixedReverse.UseVisualStyleBackColor = true;
this.radioStringMixedReverse.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radioStringNullTerm
//
this.radioStringNullTerm.AutoSize = true;
this.radioStringNullTerm.Location = new System.Drawing.Point(14, 381);
this.radioStringNullTerm.Name = "radioStringNullTerm";
this.radioStringNullTerm.Size = new System.Drawing.Size(151, 17);
this.radioStringNullTerm.TabIndex = 17;
this.radioStringNullTerm.TabStop = true;
this.radioStringNullTerm.Text = "Null-terminated strings ({0})";
this.radioStringNullTerm.UseVisualStyleBackColor = true;
this.radioStringNullTerm.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radioStringLen8
//
this.radioStringLen8.AutoSize = true;
this.radioStringLen8.Location = new System.Drawing.Point(14, 405);
this.radioStringLen8.Name = "radioStringLen8";
this.radioStringLen8.Size = new System.Drawing.Size(197, 17);
this.radioStringLen8.TabIndex = 18;
this.radioStringLen8.TabStop = true;
this.radioStringLen8.Text = "Strings prefixed with 8-bit length ({0})";
this.radioStringLen8.UseVisualStyleBackColor = true;
this.radioStringLen8.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radioStringLen16
//
this.radioStringLen16.AutoSize = true;
this.radioStringLen16.Location = new System.Drawing.Point(14, 429);
this.radioStringLen16.Name = "radioStringLen16";
this.radioStringLen16.Size = new System.Drawing.Size(203, 17);
this.radioStringLen16.TabIndex = 19;
this.radioStringLen16.TabStop = true;
this.radioStringLen16.Text = "Strings prefixed with 16-bit length ({0})";
this.radioStringLen16.UseVisualStyleBackColor = true;
this.radioStringLen16.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radioStringDci
//
this.radioStringDci.AutoSize = true;
this.radioStringDci.Location = new System.Drawing.Point(14, 453);
this.radioStringDci.Name = "radioStringDci";
this.radioStringDci.Size = new System.Drawing.Size(170, 17);
this.radioStringDci.TabIndex = 20;
this.radioStringDci.TabStop = true;
this.radioStringDci.Text = "Dextral character inverted ({0})";
this.radioStringDci.UseVisualStyleBackColor = true;
this.radioStringDci.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// symbolEntryTextBox
//
this.symbolEntryTextBox.Location = new System.Drawing.Point(108, 62);
this.symbolEntryTextBox.Name = "symbolEntryTextBox";
this.symbolEntryTextBox.Size = new System.Drawing.Size(200, 20);
this.symbolEntryTextBox.TabIndex = 1;
this.symbolEntryTextBox.TextChanged += new System.EventHandler(this.symbolEntryTextBox_TextChanged);
//
// symbolPartPanel
//
this.symbolPartPanel.Controls.Add(this.radioSymbolPartBank);
this.symbolPartPanel.Controls.Add(this.radioSymbolPartHigh);
this.symbolPartPanel.Controls.Add(this.radioSymbolPartLow);
this.symbolPartPanel.Location = new System.Drawing.Point(108, 86);
this.symbolPartPanel.Name = "symbolPartPanel";
this.symbolPartPanel.Size = new System.Drawing.Size(200, 20);
this.symbolPartPanel.TabIndex = 27;
//
// radioSymbolPartBank
//
this.radioSymbolPartBank.AutoSize = true;
this.radioSymbolPartBank.Location = new System.Drawing.Point(103, 1);
this.radioSymbolPartBank.Name = "radioSymbolPartBank";
this.radioSymbolPartBank.Size = new System.Drawing.Size(50, 17);
this.radioSymbolPartBank.TabIndex = 2;
this.radioSymbolPartBank.TabStop = true;
this.radioSymbolPartBank.Text = "Bank";
this.radioSymbolPartBank.UseVisualStyleBackColor = true;
this.radioSymbolPartBank.CheckedChanged += new System.EventHandler(this.PartGroup_CheckedChanged);
//
// radioSymbolPartHigh
//
this.radioSymbolPartHigh.AutoSize = true;
this.radioSymbolPartHigh.Location = new System.Drawing.Point(52, 1);
this.radioSymbolPartHigh.Name = "radioSymbolPartHigh";
this.radioSymbolPartHigh.Size = new System.Drawing.Size(47, 17);
this.radioSymbolPartHigh.TabIndex = 1;
this.radioSymbolPartHigh.TabStop = true;
this.radioSymbolPartHigh.Text = "High";
this.radioSymbolPartHigh.UseVisualStyleBackColor = true;
this.radioSymbolPartHigh.CheckedChanged += new System.EventHandler(this.PartGroup_CheckedChanged);
//
// radioSymbolPartLow
//
this.radioSymbolPartLow.AutoSize = true;
this.radioSymbolPartLow.Location = new System.Drawing.Point(4, 1);
this.radioSymbolPartLow.Name = "radioSymbolPartLow";
this.radioSymbolPartLow.Size = new System.Drawing.Size(45, 17);
this.radioSymbolPartLow.TabIndex = 0;
this.radioSymbolPartLow.TabStop = true;
this.radioSymbolPartLow.Text = "Low";
this.radioSymbolPartLow.UseVisualStyleBackColor = true;
this.radioSymbolPartLow.CheckedChanged += new System.EventHandler(this.PartGroup_CheckedChanged);
//
// radioSimpleDataAscii
//
this.radioSimpleDataAscii.AutoSize = true;
this.radioSimpleDataAscii.Location = new System.Drawing.Point(6, 87);
this.radioSimpleDataAscii.Name = "radioSimpleDataAscii";
this.radioSimpleDataAscii.Size = new System.Drawing.Size(52, 17);
this.radioSimpleDataAscii.TabIndex = 5;
this.radioSimpleDataAscii.TabStop = true;
this.radioSimpleDataAscii.Text = "ASCII";
this.radioSimpleDataAscii.UseVisualStyleBackColor = true;
this.radioSimpleDataAscii.CheckedChanged += new System.EventHandler(this.SimpleDisplay_CheckedChanged);
//
// radioDefaultFormat
//
this.radioDefaultFormat.AutoSize = true;
this.radioDefaultFormat.Location = new System.Drawing.Point(14, 30);
this.radioDefaultFormat.Name = "radioDefaultFormat";
this.radioDefaultFormat.Size = new System.Drawing.Size(59, 17);
this.radioDefaultFormat.TabIndex = 1;
this.radioDefaultFormat.TabStop = true;
this.radioDefaultFormat.Text = "&Default";
this.radioDefaultFormat.UseVisualStyleBackColor = true;
this.radioDefaultFormat.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// simpleDisplayAsGroupBox
//
this.simpleDisplayAsGroupBox.Controls.Add(this.radioSimpleDataAddress);
this.simpleDisplayAsGroupBox.Controls.Add(this.radioSimpleDataSymbolic);
this.simpleDisplayAsGroupBox.Controls.Add(this.radioSimpleDataAscii);
this.simpleDisplayAsGroupBox.Controls.Add(this.radioSimpleDataHex);
this.simpleDisplayAsGroupBox.Controls.Add(this.symbolPartPanel);
this.simpleDisplayAsGroupBox.Controls.Add(this.radioSimpleDataBinary);
this.simpleDisplayAsGroupBox.Controls.Add(this.symbolEntryTextBox);
this.simpleDisplayAsGroupBox.Controls.Add(this.radioSimpleDataDecimal);
this.simpleDisplayAsGroupBox.Location = new System.Drawing.Point(190, 84);
this.simpleDisplayAsGroupBox.Name = "simpleDisplayAsGroupBox";
this.simpleDisplayAsGroupBox.Size = new System.Drawing.Size(320, 114);
this.simpleDisplayAsGroupBox.TabIndex = 24;
this.simpleDisplayAsGroupBox.TabStop = false;
this.simpleDisplayAsGroupBox.Text = "Display As...";
//
// radioSimpleDataAddress
//
this.radioSimpleDataAddress.AutoSize = true;
this.radioSimpleDataAddress.Location = new System.Drawing.Point(89, 18);
this.radioSimpleDataAddress.Name = "radioSimpleDataAddress";
this.radioSimpleDataAddress.Size = new System.Drawing.Size(63, 17);
this.radioSimpleDataAddress.TabIndex = 6;
this.radioSimpleDataAddress.TabStop = true;
this.radioSimpleDataAddress.Text = "&Address";
this.radioSimpleDataAddress.UseVisualStyleBackColor = true;
//
// radioSimpleDataSymbolic
//
this.radioSimpleDataSymbolic.AutoSize = true;
this.radioSimpleDataSymbolic.Location = new System.Drawing.Point(89, 41);
this.radioSimpleDataSymbolic.Name = "radioSimpleDataSymbolic";
this.radioSimpleDataSymbolic.Size = new System.Drawing.Size(115, 17);
this.radioSimpleDataSymbolic.TabIndex = 7;
this.radioSimpleDataSymbolic.TabStop = true;
this.radioSimpleDataSymbolic.Text = "&Symbolic reference";
this.radioSimpleDataSymbolic.UseVisualStyleBackColor = true;
this.radioSimpleDataSymbolic.CheckedChanged += new System.EventHandler(this.SimpleDisplay_CheckedChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 221);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(54, 13);
this.label1.TabIndex = 9;
this.label1.Text = "Bulk Data";
//
// EditData
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(525, 496);
this.Controls.Add(this.label1);
this.Controls.Add(this.simpleDisplayAsGroupBox);
this.Controls.Add(this.radioDefaultFormat);
this.Controls.Add(this.radioStringDci);
this.Controls.Add(this.radioStringLen16);
this.Controls.Add(this.radioStringLen8);
this.Controls.Add(this.radioStringNullTerm);
this.Controls.Add(this.radioStringMixedReverse);
this.Controls.Add(this.radioStringMixed);
this.Controls.Add(this.stringSectionLabel);
this.Controls.Add(this.horizontalLine1);
this.Controls.Add(this.horizontalLine2);
this.Controls.Add(this.horizontalLine3);
this.Controls.Add(this.radioFill);
this.Controls.Add(this.radioDenseHex);
this.Controls.Add(this.radio32BitLittle);
this.Controls.Add(this.radio24BitLittle);
this.Controls.Add(this.radio16BitLittle);
this.Controls.Add(this.radio16BitBig);
this.Controls.Add(this.radioSingleBytes);
this.Controls.Add(this.rawDataSectionLabel);
this.Controls.Add(this.selectFormatLabel);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "EditData";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Data Format";
this.Load += new System.EventHandler(this.EditData_Load);
this.Shown += new System.EventHandler(this.EditData_Shown);
this.symbolPartPanel.ResumeLayout(false);
this.symbolPartPanel.PerformLayout();
this.simpleDisplayAsGroupBox.ResumeLayout(false);
this.simpleDisplayAsGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Label selectFormatLabel;
private System.Windows.Forms.Label rawDataSectionLabel;
private System.Windows.Forms.RadioButton radioSingleBytes;
private System.Windows.Forms.RadioButton radio16BitBig;
private System.Windows.Forms.RadioButton radio16BitLittle;
private System.Windows.Forms.RadioButton radio24BitLittle;
private System.Windows.Forms.RadioButton radio32BitLittle;
private System.Windows.Forms.RadioButton radioSimpleDataBinary;
private System.Windows.Forms.RadioButton radioSimpleDataDecimal;
private System.Windows.Forms.RadioButton radioSimpleDataHex;
private System.Windows.Forms.RadioButton radioDenseHex;
private System.Windows.Forms.RadioButton radioFill;
private System.Windows.Forms.Label horizontalLine1;
private System.Windows.Forms.Label horizontalLine2;
private System.Windows.Forms.Label stringSectionLabel;
private System.Windows.Forms.Label horizontalLine3;
private System.Windows.Forms.RadioButton radioStringMixed;
private System.Windows.Forms.RadioButton radioStringMixedReverse;
private System.Windows.Forms.RadioButton radioStringNullTerm;
private System.Windows.Forms.RadioButton radioStringLen8;
private System.Windows.Forms.RadioButton radioStringLen16;
private System.Windows.Forms.RadioButton radioStringDci;
private System.Windows.Forms.TextBox symbolEntryTextBox;
private System.Windows.Forms.Panel symbolPartPanel;
private System.Windows.Forms.RadioButton radioSymbolPartBank;
private System.Windows.Forms.RadioButton radioSymbolPartHigh;
private System.Windows.Forms.RadioButton radioSymbolPartLow;
private System.Windows.Forms.RadioButton radioSimpleDataAscii;
private System.Windows.Forms.RadioButton radioDefaultFormat;
private System.Windows.Forms.GroupBox simpleDisplayAsGroupBox;
private System.Windows.Forms.RadioButton radioSimpleDataSymbolic;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.RadioButton radioSimpleDataAddress;
}
}

View File

@ -1,953 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
using CommonUtil;
namespace SourceGenWF.AppForms {
public partial class EditData : Form {
/// <summary>
/// Result set that describes the formatting to perform. Not all regions will have
/// the same format, e.g. the "mixed ASCII" mode will alternate strings and bytes
/// (rather than a dedicated "mixed ASCII" format type).
/// </summary>
public SortedList<int, FormatDescriptor> Results { get; private set; }
/// <summary>
/// Selected offsets. An otherwise contiguous range of offsets can be broken up
/// by user-specified labels and address discontinuities, so this needs to be
/// processed by range.
/// </summary>
public TypedRangeSet Selection { private get; set; }
/// <summary>
/// FormatDescriptor from the first offset. May be null if the offset doesn't
/// have a format descriptor specified. This will be used to configure the
/// dialog controls if the format is suited to the selection. The goal is to
/// make single-item editing work as expected.
/// </summary>
public FormatDescriptor FirstFormatDescriptor { private get; set; }
/// <summary>
/// Raw file data.
/// </summary>
private byte[] mFileData;
/// <summary>
/// Symbol table to use when resolving symbolic values.
/// </summary>
private SymbolTable mSymbolTable;
/// <summary>
/// Formatter to use when displaying addresses and hex values.
/// </summary>
private Asm65.Formatter mFormatter;
/// <summary>
/// Set this during initial control configuration, so we know to ignore the CheckedChanged
/// events.
/// </summary>
private bool mIsInitialSetup;
/// <summary>
/// Set to true if, during the initial setup, the format defined by FirstFormatDescriptor
/// was unavailable.
/// </summary>
private bool mPreferredFormatUnavailable;
public EditData(byte[] fileData, SymbolTable symbolTable, Asm65.Formatter formatter) {
InitializeComponent();
mFileData = fileData;
mSymbolTable = symbolTable;
mFormatter = formatter;
//Results = new List<Result>();
}
private void EditData_Load(object sender, EventArgs e) {
DateTime startWhen = DateTime.Now;
mIsInitialSetup = true;
// Determine which of the various options is suitable for the selected offsets.
// Disable any radio buttons that won't work.
AnalyzeRanges();
// Configure the dialog from the FormatDescriptor, if one is available.
Debug.WriteLine("First FD: " + FirstFormatDescriptor);
SetControlsFromDescriptor(FirstFormatDescriptor);
if (mPreferredFormatUnavailable) {
// This can happen when e.g. a bunch of stuff is formatted as null-terminated
// strings. We don't recognize a lone zero as a string, but we allow it if
// it's next to a bunch of others. If you come back later and try to format
// just that one byte, you end up here.
// TODO(maybe): make it more obvious what's going on?
Debug.WriteLine("NOTE: preferred format unavailable");
}
mIsInitialSetup = false;
UpdateControls();
Debug.WriteLine("EditData dialog load time: " +
(DateTime.Now - startWhen).TotalMilliseconds + " ms");
}
private void EditData_Shown(object sender, EventArgs e) {
// Start with the focus in the text box if the initial format allows for a
// symbolic reference. This way they can start typing immediately.
if (simpleDisplayAsGroupBox.Enabled) {
symbolEntryTextBox.Focus();
}
}
/// <summary>
/// Handles CheckedChanged event for all radio buttons in main group. This will
/// fire twice when a radio button is clicked (once to un-check the old, once
/// to check the new).
/// </summary>
private void MainGroup_CheckedChanged(object sender, EventArgs e) {
// Enable/disable the style group and the low/high/bank radio group.
// Update preview window.
UpdateControls();
}
/// <summary>
/// Handles CheckedChanged event for radio buttons in the simple-data "display as"
/// group box.
/// </summary>
private void SimpleDisplay_CheckedChanged(object sender, EventArgs e) {
// Enable/disable the low/high/bank radio group.
UpdateControls();
}
/// <summary>
/// Handles CheckedChanged event for all radio buttons in symbol-part group.
/// </summary>
private void PartGroup_CheckedChanged(object sender, EventArgs e) {
// not currently using a preview window; could add one for single items?
}
private void symbolEntryTextBox_TextChanged(object sender, EventArgs e) {
// Make sure Symbol is checked if they're typing text in.
Debug.Assert(radioSimpleDataSymbolic.Enabled);
radioSimpleDataSymbolic.Checked = true;
// Update OK button based on symbol validity.
UpdateControls();
}
private void okButton_Click(object sender, EventArgs e) {
CreateDescriptorListFromControls();
FormatDescriptor.DebugDumpSortedList(Results);
}
/// <summary>
/// Updates all of the controls to reflect the current internal state.
/// </summary>
private void UpdateControls() {
if (mIsInitialSetup) {
return;
}
// Configure the simple data "display as" style box.
bool wantStyle = false;
int simpleWidth = -1;
bool isBigEndian = false;
if (radioSingleBytes.Checked) {
wantStyle = true;
simpleWidth = 1;
} else if (radio16BitLittle.Checked) {
wantStyle = true;
simpleWidth = 2;
} else if (radio16BitBig.Checked) {
wantStyle = true;
simpleWidth = 2;
isBigEndian = true;
} else if (radio24BitLittle.Checked) {
wantStyle = true;
simpleWidth = 3;
} else if (radio32BitLittle.Checked) {
wantStyle = true;
simpleWidth = 4;
}
bool focusOnSymbol = !simpleDisplayAsGroupBox.Enabled && wantStyle;
simpleDisplayAsGroupBox.Enabled = wantStyle;
if (wantStyle) {
// TODO(soon): compute on first need and save results; this is getting called
// 2x as radio buttons are hit, and might be slow on large data sets
radioSimpleDataAscii.Enabled = IsRawAsciiCompatible(simpleWidth, isBigEndian);
}
// Enable the symbolic reference entry box if the "display as" group is enabled.
// That way instead of "click 16-bit", "click symbol", "enter symbol", the user
// can skip the second step.
symbolEntryTextBox.Enabled = simpleDisplayAsGroupBox.Enabled;
symbolPartPanel.Enabled = radioSimpleDataSymbolic.Checked;
// If we just enabled the group box, set the focus on the symbol entry box. This
// removes another click from the steps, though it's a bit aggressive if you're
// trying to arrow your way through the items.
if (focusOnSymbol) {
symbolEntryTextBox.Focus();
}
bool isOk = true;
if (radioSimpleDataSymbolic.Checked) {
// Just check for correct format. References to non-existent labels are allowed.
isOk = Asm65.Label.ValidateLabel(symbolEntryTextBox.Text);
// Actually, let's discourage references to auto-labels.
if (isOk && mSymbolTable.TryGetValue(symbolEntryTextBox.Text, out Symbol sym)) {
isOk = sym.SymbolSource != Symbol.Source.Auto;
}
}
okButton.Enabled = isOk;
}
/// <summary>
/// Analyzes the selection to see which data formatting options are suitable.
/// Disables radio buttons and updates labels.
///
/// Call this once, when the dialog is first loaded.
/// </summary>
private void AnalyzeRanges() {
Debug.Assert(Selection.Count != 0);
string fmt = (Selection.RangeCount == 1) ?
Properties.Resources.FMT_FORMAT_SINGLE_GROUP :
Properties.Resources.FMT_FORMAT_MULTIPLE_GROUPS;
selectFormatLabel.Text = string.Format(fmt, Selection.Count, Selection.RangeCount);
IEnumerator<TypedRangeSet.TypedRange> iter = Selection.RangeListIterator;
int mixedAsciiOkCount = 0;
int mixedAsciiNotCount = 0;
int nullTermStringCount = 0;
int len8StringCount = 0;
int len16StringCount = 0;
int dciStringCount = 0;
//int revDciStringCount = 0;
// For each range, check to see if the data within qualifies for the various
// options. If any of them fail to meet the criteria, the option is disabled
// for all ranges.
while (iter.MoveNext()) {
TypedRangeSet.TypedRange rng = iter.Current;
Debug.WriteLine("Testing [" + rng.Low + ", " + rng.High + "]");
// Start with the easy ones. Single-byte and dense are always enabled.
int count = rng.High - rng.Low + 1;
Debug.Assert(count > 0);
if ((count & 0x01) != 0) {
// not divisible by 2, disallow 16-bit entries
radio16BitLittle.Enabled = false;
radio16BitBig.Enabled = false;
}
if ((count & 0x03) != 0) {
// not divisible by 4, disallow 32-bit entries
radio32BitLittle.Enabled = false;
}
if ((count / 3) * 3 != count) {
// not divisible by 3, disallow 24-bit entries
radio24BitLittle.Enabled = false;
}
// Check for run of bytes (2 or more of the same thing). Remember that
// we check this one region at a time, and each region could have different
// bytes, but so long as the bytes are all the same within a region we're good.
if (radioFill.Enabled && count > 1 &&
DataAnalysis.RecognizeRun(mFileData, rng.Low, rng.High) == count) {
// LGTM
} else {
radioFill.Enabled = false;
}
// See if there's enough string data to make it worthwhile. We use an
// arbitrary threshold of 2+ ASCII characters, and require twice as many
// ASCII as non-ASCII. We arbitrarily require the strings to be either
// high or low ASCII, and treat the other as non-ASCII. (We could relax
// this -- we generate separate items for each string and non-ASCII chunk --
// but I'm trying to hide the option when the buffer doesn't really seem
// to be holding strings. Could replace with some sort of minimum string
// length requirement?)
if (radioStringMixed.Enabled) {
int asciiCount;
DataAnalysis.CountAsciiBytes(mFileData, rng.Low, rng.High,
out int lowAscii, out int highAscii, out int nonAscii);
if (highAscii > lowAscii) {
asciiCount = highAscii;
nonAscii += lowAscii;
} else {
asciiCount = lowAscii;
nonAscii += highAscii;
}
if (asciiCount >= 2 && asciiCount >= nonAscii * 2) {
// Looks good
mixedAsciiOkCount += asciiCount;
mixedAsciiNotCount += nonAscii;
} else {
// Fail
radioStringMixed.Enabled = false;
radioStringMixedReverse.Enabled = false;
mixedAsciiOkCount = mixedAsciiNotCount = -1;
}
}
// Check for null-terminated strings. Zero-length strings are allowed, but
// not counted -- we want to have some actual character data. Individual
// strings need to be entirely high-ASCII or low-ASCII, but not all strings
// in a region have to be the same.
if (radioStringNullTerm.Enabled) {
int strCount = DataAnalysis.RecognizeNullTerminatedStrings(mFileData,
rng.Low, rng.High);
if (strCount > 0) {
nullTermStringCount += strCount;
} else {
radioStringNullTerm.Enabled = false;
nullTermStringCount = -1;
}
}
// Check for strings prefixed with an 8-bit length.
if (radioStringLen8.Enabled) {
int strCount = DataAnalysis.RecognizeLen8Strings(mFileData, rng.Low, rng.High);
if (strCount > 0) {
len8StringCount += strCount;
} else {
radioStringLen8.Enabled = false;
len8StringCount = -1;
}
}
// Check for strings prefixed with a 16-bit length.
if (radioStringLen16.Enabled) {
int strCount = DataAnalysis.RecognizeLen16Strings(mFileData, rng.Low, rng.High);
if (strCount > 0) {
len16StringCount += strCount;
} else {
radioStringLen16.Enabled = false;
len16StringCount = -1;
}
}
// Check for DCI strings. All strings within a single range must have the
// same "polarity", e.g. low ASCII terminated by high ASCII.
if (radioStringDci.Enabled) {
int strCount = DataAnalysis.RecognizeDciStrings(mFileData, rng.Low, rng.High);
if (strCount > 0) {
dciStringCount += strCount;
} else {
radioStringDci.Enabled = false;
dciStringCount = -1;
}
}
//// Check for reverse DCI strings. All strings within a single range must have the
//// same "polarity", e.g. low ASCII terminated by high ASCII.
//if (radioStringDciReverse.Enabled) {
// int strCount = DataAnalysis.RecognizeReverseDciStrings(mFileData,
// rng.Low, rng.High);
// if (strCount > 0) {
// revDciStringCount += strCount;
// } else {
// radioStringDciReverse.Enabled = false;
// revDciStringCount = -1;
// }
//}
}
// Update the dialog with string and character counts, summed across all regions.
if (mixedAsciiOkCount > 0) {
Debug.Assert(radioStringMixed.Enabled);
radioStringMixed.Text = string.Format(radioStringMixed.Text,
mixedAsciiOkCount, mixedAsciiNotCount);
radioStringMixedReverse.Text = string.Format(radioStringMixedReverse.Text,
mixedAsciiOkCount, mixedAsciiNotCount);
} else {
Debug.Assert(!radioStringMixed.Enabled);
radioStringMixed.Text = string.Format(radioStringMixed.Text, "xx", "xx");
radioStringMixedReverse.Text = string.Format(radioStringMixedReverse.Text,
"xx", "xx");
}
if (nullTermStringCount > 0) {
Debug.Assert(radioStringNullTerm.Enabled);
radioStringNullTerm.Text = string.Format(radioStringNullTerm.Text, nullTermStringCount);
} else {
Debug.Assert(!radioStringNullTerm.Enabled);
radioStringNullTerm.Text = string.Format(radioStringNullTerm.Text, "xx");
}
if (len8StringCount > 0) {
Debug.Assert(radioStringLen8.Enabled);
radioStringLen8.Text = string.Format(radioStringLen8.Text, len8StringCount);
} else {
Debug.Assert(!radioStringLen8.Enabled);
radioStringLen8.Text = string.Format(radioStringLen8.Text, "xx");
}
if (len16StringCount > 0) {
Debug.Assert(radioStringLen16.Enabled);
radioStringLen16.Text = string.Format(radioStringLen16.Text, len16StringCount);
} else {
Debug.Assert(!radioStringLen16.Enabled);
radioStringLen16.Text = string.Format(radioStringLen16.Text, "xx");
}
if (dciStringCount > 0) {
Debug.Assert(radioStringDci.Enabled);
radioStringDci.Text = string.Format(radioStringDci.Text, dciStringCount);
} else {
Debug.Assert(!radioStringDci.Enabled);
radioStringDci.Text = string.Format(radioStringDci.Text, "xx");
}
//if (revDciStringCount > 0) {
// Debug.Assert(radioStringDciReverse.Enabled);
// radioStringDciReverse.Text =
// string.Format(radioStringDciReverse.Text, revDciStringCount);
//} else {
// Debug.Assert(!radioStringDciReverse.Enabled);
// radioStringDciReverse.Text = string.Format(radioStringDciReverse.Text, "xx");
//}
}
/// <summary>
/// Determines whether the data in the buffer can be represented as ASCII values.
/// Using ".DD1 'A'" for 0x41 is obvious, but we also allow ".DD2 'A'" for
/// 0x41 0x00. 16-bit character constants are more likely as intermediate
/// operands, but could be found in data areas.
///
/// High and low ASCII are allowed, and may be freely mixed.
///
/// Testing explicitly is probably excessive, and possibly counter-productive if
/// the user is trying to flag an area that is a mix of ASCII and non-ASCII and
/// just wants hex for the rest, but we'll give it a try.
/// </summary>
/// <param name="wordWidth">Number of bytes per character.</param>
/// <param name="isBigEndian">Word endian-ness.</param>
/// <returns>True if data in all regions can be represented as high or low ASCII.</returns>
private bool IsRawAsciiCompatible(int wordWidth, bool isBigEndian) {
IEnumerator<TypedRangeSet.TypedRange> iter = Selection.RangeListIterator;
while (iter.MoveNext()) {
TypedRangeSet.TypedRange rng = iter.Current;
Debug.Assert(((rng.High - rng.Low + 1) / wordWidth) * wordWidth ==
rng.High - rng.Low + 1);
for (int i = rng.Low; i <= rng.High; i += wordWidth) {
int val = RawData.GetWord(mFileData, rng.Low, wordWidth, isBigEndian);
if (val < 0x20 || (val >= 0x7f && val < 0xa0) || val >= 0xff) {
// bad value, fail
return false;
}
}
}
return true;
}
/// <summary>
/// Configures the dialog controls based on the provided format descriptor. If
/// the desired options are unavailable, a suitable default is selected instead.
/// </summary>
/// <param name="dfd">FormatDescriptor to use.</param>
private void SetControlsFromDescriptor(FormatDescriptor dfd) {
Debug.Assert(mIsInitialSetup);
radioSimpleDataHex.Checked = true;
radioSymbolPartLow.Checked = true;
if (dfd == null) {
radioDefaultFormat.Checked = true;
return;
}
RadioButton preferredFormat;
switch (dfd.FormatType) {
case FormatDescriptor.Type.NumericLE:
case FormatDescriptor.Type.NumericBE:
switch (dfd.Length) {
case 1:
preferredFormat = radioSingleBytes;
break;
case 2:
preferredFormat =
(dfd.FormatType == FormatDescriptor.Type.NumericLE ?
radio16BitLittle : radio16BitBig);
break;
case 3:
preferredFormat = radio24BitLittle;
break;
case 4:
preferredFormat = radio32BitLittle;
break;
default:
Debug.Assert(false);
preferredFormat = radioDefaultFormat;
break;
}
if (preferredFormat.Enabled) {
switch (dfd.FormatSubType) {
case FormatDescriptor.SubType.None:
case FormatDescriptor.SubType.Hex:
radioSimpleDataHex.Checked = true;
break;
case FormatDescriptor.SubType.Decimal:
radioSimpleDataDecimal.Checked = true;
break;
case FormatDescriptor.SubType.Binary:
radioSimpleDataBinary.Checked = true;
break;
case FormatDescriptor.SubType.Ascii:
radioSimpleDataAscii.Checked = true;
break;
case FormatDescriptor.SubType.Address:
radioSimpleDataAddress.Checked = true;
break;
case FormatDescriptor.SubType.Symbol:
radioSimpleDataSymbolic.Checked = true;
switch (dfd.SymbolRef.ValuePart) {
case WeakSymbolRef.Part.Low:
radioSymbolPartLow.Checked = true;
break;
case WeakSymbolRef.Part.High:
radioSymbolPartHigh.Checked = true;
break;
case WeakSymbolRef.Part.Bank:
radioSymbolPartBank.Checked = true;
break;
default:
Debug.Assert(false);
break;
}
Debug.Assert(dfd.HasSymbol);
symbolEntryTextBox.Text = dfd.SymbolRef.Label;
break;
default:
Debug.Assert(false);
break;
}
} else {
// preferred format not enabled; leave Hex/Low checked
}
break;
case FormatDescriptor.Type.String:
switch (dfd.FormatSubType) {
case FormatDescriptor.SubType.None:
preferredFormat = radioStringMixed;
break;
case FormatDescriptor.SubType.Reverse:
preferredFormat = radioStringMixedReverse;
break;
case FormatDescriptor.SubType.CString:
preferredFormat = radioStringNullTerm;
break;
case FormatDescriptor.SubType.L8String:
preferredFormat = radioStringLen8;
break;
case FormatDescriptor.SubType.L16String:
preferredFormat = radioStringLen16;
break;
case FormatDescriptor.SubType.Dci:
preferredFormat = radioStringDci;
break;
case FormatDescriptor.SubType.DciReverse:
preferredFormat = radioDefaultFormat;
break;
default:
Debug.Assert(false);
preferredFormat = radioDefaultFormat;
break;
}
break;
case FormatDescriptor.Type.Dense:
preferredFormat = radioDenseHex;
break;
case FormatDescriptor.Type.Fill:
preferredFormat = radioFill;
break;
default:
// Should not be here.
Debug.Assert(false);
preferredFormat = radioDefaultFormat;
break;
}
if (preferredFormat.Enabled) {
preferredFormat.Checked = true;
} else {
mPreferredFormatUnavailable = true;
radioDefaultFormat.Checked = true;
}
}
/// <summary>
/// Creates a list of FormatDescriptors, based on the current control configuration.
///
/// The entries in the list are guaranteed to be sorted by start address and not
/// overlap.
///
/// We assume that whatever the control gives us is correct, e.g. it's not going
/// to tell us to put a buffer full of zeroes into a DCI string.
/// </summary>
/// <returns>Result list.</returns>
private void CreateDescriptorListFromControls() {
FormatDescriptor.Type type = FormatDescriptor.Type.Default;
FormatDescriptor.SubType subType = FormatDescriptor.SubType.None;
WeakSymbolRef symbolRef = null;
int chunkLength = -1;
// Decode the "display as" panel, if it's relevant.
if (radioSimpleDataHex.Enabled) {
if (radioSimpleDataHex.Checked) {
subType = FormatDescriptor.SubType.Hex;
} else if (radioSimpleDataDecimal.Checked) {
subType = FormatDescriptor.SubType.Decimal;
} else if (radioSimpleDataBinary.Checked) {
subType = FormatDescriptor.SubType.Binary;
} else if (radioSimpleDataAscii.Checked) {
subType = FormatDescriptor.SubType.Ascii;
} else if (radioSimpleDataAddress.Checked) {
subType = FormatDescriptor.SubType.Address;
} else if (radioSimpleDataSymbolic.Checked) {
WeakSymbolRef.Part part;
if (radioSymbolPartLow.Checked) {
part = WeakSymbolRef.Part.Low;
} else if (radioSymbolPartHigh.Checked) {
part = WeakSymbolRef.Part.High;
} else if (radioSymbolPartBank.Checked) {
part = WeakSymbolRef.Part.Bank;
} else {
Debug.Assert(false);
part = WeakSymbolRef.Part.Low;
}
subType = FormatDescriptor.SubType.Symbol;
symbolRef = new WeakSymbolRef(symbolEntryTextBox.Text, part);
} else {
Debug.Assert(false);
}
} else {
subType = 0; // set later, or doesn't matter
}
// Decode the main format.
if (radioDefaultFormat.Checked) {
// Default/None; note this would create a multi-byte Default format, which isn't
// really allowed. What we actually want to do is remove the explicit formatting
// from all spanned offsets, so we use a dedicated type for that.
type = FormatDescriptor.Type.REMOVE;
} else if (radioSingleBytes.Checked) {
type = FormatDescriptor.Type.NumericLE;
chunkLength = 1;
} else if (radio16BitLittle.Checked) {
type = FormatDescriptor.Type.NumericLE;
chunkLength = 2;
} else if (radio16BitBig.Checked) {
type = FormatDescriptor.Type.NumericBE;
chunkLength = 2;
} else if (radio24BitLittle.Checked) {
type = FormatDescriptor.Type.NumericLE;
chunkLength = 3;
} else if (radio32BitLittle.Checked) {
type = FormatDescriptor.Type.NumericLE;
chunkLength = 4;
} else if (radioDenseHex.Checked) {
type = FormatDescriptor.Type.Dense;
} else if (radioFill.Checked) {
type = FormatDescriptor.Type.Fill;
} else if (radioStringMixed.Checked) {
type = FormatDescriptor.Type.String;
} else if (radioStringMixedReverse.Checked) {
type = FormatDescriptor.Type.String;
subType = FormatDescriptor.SubType.Reverse;
} else if (radioStringNullTerm.Checked) {
type = FormatDescriptor.Type.String;
subType = FormatDescriptor.SubType.CString;
} else if (radioStringLen8.Checked) {
type = FormatDescriptor.Type.String;
subType = FormatDescriptor.SubType.L8String;
} else if (radioStringLen16.Checked) {
type = FormatDescriptor.Type.String;
subType = FormatDescriptor.SubType.L16String;
} else if (radioStringDci.Checked) {
type = FormatDescriptor.Type.String;
subType = FormatDescriptor.SubType.Dci;
//} else if (radioStringDciReverse.Checked) {
// type = FormatDescriptor.Type.String;
// subType = FormatDescriptor.SubType.DciReverse;
} else {
Debug.Assert(false);
// default/none
}
Results = new SortedList<int, FormatDescriptor>();
IEnumerator<TypedRangeSet.TypedRange> iter = Selection.RangeListIterator;
while (iter.MoveNext()) {
TypedRangeSet.TypedRange rng = iter.Current;
if (type == FormatDescriptor.Type.String) {
// We want to create one FormatDescriptor object per string. That way
// each string gets its own line.
if ((subType == FormatDescriptor.SubType.None ||
subType == FormatDescriptor.SubType.Reverse)) {
CreateMixedStringEntries(rng.Low, rng.High, subType);
} else if (subType == FormatDescriptor.SubType.CString) {
CreateCStringEntries(rng.Low, rng.High, subType);
} else if (subType == FormatDescriptor.SubType.L8String ||
subType == FormatDescriptor.SubType.L16String) {
CreateLengthStringEntries(rng.Low, rng.High, subType);
} else if (subType == FormatDescriptor.SubType.Dci ||
subType == FormatDescriptor.SubType.DciReverse) {
CreateDciStringEntries(rng.Low, rng.High, subType);
} else {
Debug.Assert(false);
CreateMixedStringEntries(rng.Low, rng.High, subType); // shrug
}
} else {
CreateSimpleEntries(type, subType, chunkLength, symbolRef, rng.Low, rng.High);
}
}
}
/// <summary>
/// Creates one or more FormatDescriptor entries for the specified range, adding them
/// to the Results list.
///
/// This will either create one entry that spans the entire range (for e.g. strings
/// and bulk data), or create equal-sized chunks.
/// </summary>
/// <param name="type">Region data type.</param>
/// <param name="subType">Region data sub-type.</param>
/// <param name="chunkLength">Length of a chunk, or -1 for full buffer.</param>
/// <param name="symbolRef">Symbol reference, or null if not applicable.</param>
/// <param name="low">Offset of first byte in range.</param>
/// <param name="high">Offset of last byte in range.</param>
private void CreateSimpleEntries(FormatDescriptor.Type type,
FormatDescriptor.SubType subType, int chunkLength,
WeakSymbolRef symbolRef, int low, int high) {
if (chunkLength == -1) {
chunkLength = (high - low) + 1;
}
Debug.Assert(((high - low + 1) / chunkLength) * chunkLength == high - low + 1);
// Either we have one chunk, or we have multiple chunks with the same type and
// length. Either way, we only need to create the descriptor once. (This is
// safe because FormatDescriptor instances are immutable.)
//
// Because certain details, like the fill byte and high-vs-low ASCII, are pulled
// out of the data stream at format time, we don't have to dig for them now.
FormatDescriptor dfd;
if (subType == FormatDescriptor.SubType.Symbol) {
dfd = FormatDescriptor.Create(chunkLength, symbolRef,
type == FormatDescriptor.Type.NumericBE);
} else {
dfd = FormatDescriptor.Create(chunkLength, type, subType);
}
while (low <= high) {
Results.Add(low, dfd);
low += chunkLength;
}
}
/// <summary>
/// Creates one or more FormatDescriptor entries for the specified range, adding them
/// to the Results list.
/// </summary>
/// <param name="low">Offset of first byte in range.</param>
/// <param name="high">Offset of last byte in range.</param>
/// <param name="subType">String sub-type.</param>
private void CreateMixedStringEntries(int low, int high,
FormatDescriptor.SubType subType) {
int stringStart = -1;
int highBit = 0;
int cur;
for (cur = low; cur <= high; cur++) {
byte val = mFileData[cur];
if (CommonUtil.TextUtil.IsHiLoAscii(val)) {
// is ASCII
if (stringStart >= 0) {
// was in a string
if (highBit != (val & 0x80)) {
// end of string due to high bit flip, output
CreateStringOrByte(stringStart, cur - stringStart, subType);
// start a new string
stringStart = cur;
} else {
// still in string, keep going
}
} else {
// wasn't in a string, start one
stringStart = cur;
}
highBit = val & 0x80;
} else {
// not ASCII
if (stringStart >= 0) {
// was in a string, output it
CreateStringOrByte(stringStart, cur - stringStart, subType);
stringStart = -1;
}
// output as single byte
CreateByteFD(cur, FormatDescriptor.SubType.Hex);
}
}
if (stringStart >= 0) {
// close out the string
CreateStringOrByte(stringStart, cur - stringStart, subType);
}
}
/// <summary>
/// Creates a format descriptor for ASCII data. If the data is only one byte long,
/// a single-byte ASCII char item is emitted instead.
/// </summary>
/// <param name="offset">Offset of first byte.</param>
/// <param name="length">Length of string.</param>
/// <param name="subType">String sub-type.</param>
private void CreateStringOrByte(int offset, int length,
FormatDescriptor.SubType subType) {
Debug.Assert(length > 0);
if (length == 1) {
// single byte, output as single ASCII char rather than 1-byte string
CreateByteFD(offset, FormatDescriptor.SubType.Ascii);
} else {
FormatDescriptor dfd;
dfd = FormatDescriptor.Create(length,
FormatDescriptor.Type.String, subType);
Results.Add(offset, dfd);
}
}
/// <summary>
/// Creates a format descriptor for a single-byte numeric value.
/// </summary>
/// <param name="offset">File offset.</param>
/// <param name="subType">How to format the item.</param>
private void CreateByteFD(int offset, FormatDescriptor.SubType subType) {
FormatDescriptor dfd = FormatDescriptor.Create(1,
FormatDescriptor.Type.NumericLE, subType);
Results.Add(offset, dfd);
}
/// <summary>
/// Creates one or more FormatDescriptor entries for the specified range, adding them
/// to the Results list.
/// </summary>
/// <param name="low">Offset of first byte in range.</param>
/// <param name="high">Offset of last byte in range.</param>
/// <param name="subType">String sub-type.</param>
private void CreateCStringEntries(int low, int high,
FormatDescriptor.SubType subType) {
int startOffset = low;
for (int i = low; i <= high; i++) {
if (mFileData[i] == 0x00) {
// End of string. Zero-length strings are allowed.
FormatDescriptor dfd = FormatDescriptor.Create(
i - startOffset + 1, FormatDescriptor.Type.String, subType);
Results.Add(startOffset, dfd);
startOffset = i + 1;
} else {
// keep going
}
}
// Earlier analysis guaranteed that the last byte in the buffer is 0x00.
Debug.Assert(startOffset == high + 1);
}
/// <summary>
/// Creates one or more FormatDescriptor entries for the specified range, adding them
/// to the Results list.
/// </summary>
/// <param name="low">Offset of first byte in range.</param>
/// <param name="high">Offset of last byte in range.</param>
/// <param name="subType">String sub-type.</param>
private void CreateLengthStringEntries(int low, int high,
FormatDescriptor.SubType subType) {
int i;
for (i = low; i <= high;) {
int length = mFileData[i];
if (subType == FormatDescriptor.SubType.L16String) {
length |= mFileData[i + 1] << 8;
length += 2;
} else {
length++;
}
// Zero-length strings are allowed.
FormatDescriptor dfd = FormatDescriptor.Create(length,
FormatDescriptor.Type.String, subType);
Results.Add(i, dfd);
i += length;
}
Debug.Assert(i == high + 1);
}
/// <summary>
/// Creates one or more FormatDescriptor entries for the specified range, adding them
/// to the Results list.
/// </summary>
/// <param name="low">Offset of first byte in range.</param>
/// <param name="high">Offset of last byte in range.</param>
/// <param name="subType">String sub-type.</param>
private void CreateDciStringEntries(int low, int high,
FormatDescriptor.SubType subType) {
int start, end, adj, endMask;
if (subType == FormatDescriptor.SubType.Dci) {
start = low;
end = high + 1;
adj = 1;
} else if (subType == FormatDescriptor.SubType.DciReverse) {
start = high;
end = low - 1;
adj = -1;
} else {
Debug.Assert(false);
return;
}
// Zero-length strings aren't a thing for DCI. The analyzer requires that all
// strings in a region have the same polarity, so just grab the last byte.
endMask = mFileData[end - 1] & 0x80;
int stringStart = start;
for (int i = start; i != end; i += adj) {
byte val = mFileData[i];
if ((val & 0x80) == endMask) {
// found the end of a string
int length = (i - stringStart) * adj + 1;
FormatDescriptor dfd = FormatDescriptor.Create(length,
FormatDescriptor.Type.String, subType);
Results.Add(stringStart < i ? stringStart : i, dfd);
stringStart = i + adj;
}
}
Debug.Assert(stringStart == end);
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,265 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class EditDefSymbol {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.labelLabel = new System.Windows.Forms.Label();
this.labelTextBox = new System.Windows.Forms.TextBox();
this.valueTextBox = new System.Windows.Forms.TextBox();
this.labelNotesLabel = new System.Windows.Forms.Label();
this.valueLabel = new System.Windows.Forms.Label();
this.valueNotesLabel = new System.Windows.Forms.Label();
this.commentLabel = new System.Windows.Forms.Label();
this.commentTextBox = new System.Windows.Forms.TextBox();
this.commentNotesLabel = new System.Windows.Forms.Label();
this.symbolTypeGroupBox = new System.Windows.Forms.GroupBox();
this.constantRadioButton = new System.Windows.Forms.RadioButton();
this.addressRadioButton = new System.Windows.Forms.RadioButton();
this.labelUniqueLabel = new System.Windows.Forms.Label();
this.symbolTypeGroupBox.SuspendLayout();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(203, 253);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 5;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(122, 253);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 4;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// labelLabel
//
this.labelLabel.AutoSize = true;
this.labelLabel.Location = new System.Drawing.Point(14, 16);
this.labelLabel.Name = "labelLabel";
this.labelLabel.Size = new System.Drawing.Size(36, 13);
this.labelLabel.TabIndex = 6;
this.labelLabel.Text = "Label:";
//
// labelTextBox
//
this.labelTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelTextBox.Location = new System.Drawing.Point(77, 14);
this.labelTextBox.Name = "labelTextBox";
this.labelTextBox.Size = new System.Drawing.Size(200, 20);
this.labelTextBox.TabIndex = 0;
this.labelTextBox.TextChanged += new System.EventHandler(this.labelTextBox_TextChanged);
//
// valueTextBox
//
this.valueTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.valueTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.valueTextBox.Location = new System.Drawing.Point(77, 81);
this.valueTextBox.Name = "valueTextBox";
this.valueTextBox.Size = new System.Drawing.Size(200, 20);
this.valueTextBox.TabIndex = 1;
this.valueTextBox.TextChanged += new System.EventHandler(this.valueTextBox_TextChanged);
//
// labelNotesLabel
//
this.labelNotesLabel.AutoSize = true;
this.labelNotesLabel.Location = new System.Drawing.Point(74, 37);
this.labelNotesLabel.Name = "labelNotesLabel";
this.labelNotesLabel.Size = new System.Drawing.Size(187, 13);
this.labelNotesLabel.TabIndex = 9;
this.labelNotesLabel.Text = "• 2+ alphanumerics, starting with letter";
//
// valueLabel
//
this.valueLabel.AutoSize = true;
this.valueLabel.Location = new System.Drawing.Point(14, 83);
this.valueLabel.Name = "valueLabel";
this.valueLabel.Size = new System.Drawing.Size(37, 13);
this.valueLabel.TabIndex = 7;
this.valueLabel.Text = "Value:";
//
// valueNotesLabel
//
this.valueNotesLabel.AutoSize = true;
this.valueNotesLabel.Location = new System.Drawing.Point(74, 104);
this.valueNotesLabel.Name = "valueNotesLabel";
this.valueNotesLabel.Size = new System.Drawing.Size(155, 13);
this.valueNotesLabel.TabIndex = 11;
this.valueNotesLabel.Text = "• Decimal, hex ($), or binary (%)";
//
// commentLabel
//
this.commentLabel.AutoSize = true;
this.commentLabel.Location = new System.Drawing.Point(17, 137);
this.commentLabel.Name = "commentLabel";
this.commentLabel.Size = new System.Drawing.Size(54, 13);
this.commentLabel.TabIndex = 8;
this.commentLabel.Text = "Comment:";
//
// commentTextBox
//
this.commentTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.commentTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.commentTextBox.Location = new System.Drawing.Point(77, 134);
this.commentTextBox.Name = "commentTextBox";
this.commentTextBox.Size = new System.Drawing.Size(200, 20);
this.commentTextBox.TabIndex = 2;
//
// commentNotesLabel
//
this.commentNotesLabel.AutoSize = true;
this.commentNotesLabel.Location = new System.Drawing.Point(74, 157);
this.commentNotesLabel.Name = "commentNotesLabel";
this.commentNotesLabel.Size = new System.Drawing.Size(55, 13);
this.commentNotesLabel.TabIndex = 12;
this.commentNotesLabel.Text = "• Optional";
//
// symbolTypeGroupBox
//
this.symbolTypeGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.symbolTypeGroupBox.Controls.Add(this.constantRadioButton);
this.symbolTypeGroupBox.Controls.Add(this.addressRadioButton);
this.symbolTypeGroupBox.Location = new System.Drawing.Point(13, 190);
this.symbolTypeGroupBox.Name = "symbolTypeGroupBox";
this.symbolTypeGroupBox.Size = new System.Drawing.Size(264, 48);
this.symbolTypeGroupBox.TabIndex = 3;
this.symbolTypeGroupBox.TabStop = false;
this.symbolTypeGroupBox.Text = "Symbol Type";
//
// constantRadioButton
//
this.constantRadioButton.AutoSize = true;
this.constantRadioButton.Location = new System.Drawing.Point(99, 20);
this.constantRadioButton.Name = "constantRadioButton";
this.constantRadioButton.Size = new System.Drawing.Size(67, 17);
this.constantRadioButton.TabIndex = 1;
this.constantRadioButton.TabStop = true;
this.constantRadioButton.Text = "Constant";
this.constantRadioButton.UseVisualStyleBackColor = true;
//
// addressRadioButton
//
this.addressRadioButton.AutoSize = true;
this.addressRadioButton.Location = new System.Drawing.Point(6, 20);
this.addressRadioButton.Name = "addressRadioButton";
this.addressRadioButton.Size = new System.Drawing.Size(63, 17);
this.addressRadioButton.TabIndex = 0;
this.addressRadioButton.TabStop = true;
this.addressRadioButton.Text = "Address";
this.addressRadioButton.UseVisualStyleBackColor = true;
//
// labelUniqueLabel
//
this.labelUniqueLabel.AutoSize = true;
this.labelUniqueLabel.Location = new System.Drawing.Point(74, 53);
this.labelUniqueLabel.Name = "labelUniqueLabel";
this.labelUniqueLabel.Size = new System.Drawing.Size(160, 13);
this.labelUniqueLabel.TabIndex = 10;
this.labelUniqueLabel.Text = "• Unique among project symbols";
//
// EditDefSymbol
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(290, 288);
this.Controls.Add(this.labelUniqueLabel);
this.Controls.Add(this.symbolTypeGroupBox);
this.Controls.Add(this.commentNotesLabel);
this.Controls.Add(this.commentTextBox);
this.Controls.Add(this.commentLabel);
this.Controls.Add(this.valueNotesLabel);
this.Controls.Add(this.valueLabel);
this.Controls.Add(this.labelNotesLabel);
this.Controls.Add(this.valueTextBox);
this.Controls.Add(this.labelTextBox);
this.Controls.Add(this.labelLabel);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "EditDefSymbol";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Symbol";
this.Load += new System.EventHandler(this.EditDefSymbol_Load);
this.symbolTypeGroupBox.ResumeLayout(false);
this.symbolTypeGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Label labelLabel;
private System.Windows.Forms.TextBox labelTextBox;
private System.Windows.Forms.TextBox valueTextBox;
private System.Windows.Forms.Label labelNotesLabel;
private System.Windows.Forms.Label valueLabel;
private System.Windows.Forms.Label valueNotesLabel;
private System.Windows.Forms.Label commentLabel;
private System.Windows.Forms.TextBox commentTextBox;
private System.Windows.Forms.Label commentNotesLabel;
private System.Windows.Forms.GroupBox symbolTypeGroupBox;
private System.Windows.Forms.RadioButton constantRadioButton;
private System.Windows.Forms.RadioButton addressRadioButton;
private System.Windows.Forms.Label labelUniqueLabel;
}
}

View File

@ -1,132 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using Asm65;
namespace SourceGenWF.AppForms {
public partial class EditDefSymbol : Form {
/// <summary>
/// Set to previous value before calling; may be null if creating a new symbol.
/// Will be set to new value on OK result.
/// </summary>
public DefSymbol DefSym { get; set; }
/// <summary>
/// Format object to use when formatting addresses and constants.
/// </summary>
private Formatter mNumFormatter;
/// <summary>
/// List of existing symbols, for uniqueness check. The list will not be modified.
/// </summary>
private SortedList<String, DefSymbol> mDefSymbolList;
// Saved off at dialog load time.
private Color mDefaultLabelColor;
public EditDefSymbol(Formatter formatter, SortedList<String, DefSymbol> defList) {
InitializeComponent();
mNumFormatter = formatter;
mDefSymbolList = defList;
}
private void EditDefSymbol_Load(object sender, EventArgs e) {
mDefaultLabelColor = labelNotesLabel.ForeColor;
if (DefSym != null) {
labelTextBox.Text = DefSym.Label;
valueTextBox.Text = mNumFormatter.FormatValueInBase(DefSym.Value,
DefSym.DataDescriptor.NumBase);
commentTextBox.Text = DefSym.Comment;
if (DefSym.SymbolType == Symbol.Type.Constant) {
constantRadioButton.Checked = true;
} else {
addressRadioButton.Checked = true;
}
} else {
addressRadioButton.Checked = true;
}
UpdateControls();
}
private void UpdateControls() {
bool labelValid, labelUnique, valueValid;
// Label must be valid and not already exist in project symbol list. (It's okay
// if it exists elsewhere.)
labelValid = Asm65.Label.ValidateLabel(labelTextBox.Text);
if (mDefSymbolList.TryGetValue(labelTextBox.Text, out DefSymbol existing)) {
// It's okay if it's the same object.
labelUnique = (existing == DefSym);
} else {
labelUnique = true;
}
// Value must be blank, meaning "erase any earlier definition", or valid value.
// (Hmm... don't currently have a way to specify "no symbol" in DefSymbol.)
//if (!string.IsNullOrEmpty(valueTextBox.Text)) {
valueValid = ParseValue(out int unused1, out int unused2);
//} else {
// valueValid = true;
//}
labelNotesLabel.ForeColor = labelValid ? mDefaultLabelColor : Color.Red;
labelUniqueLabel.ForeColor = labelUnique ? mDefaultLabelColor : Color.Red;
valueNotesLabel.ForeColor = valueValid ? mDefaultLabelColor : Color.Red;
okButton.Enabled = labelValid && labelUnique && valueValid;
}
private bool ParseValue(out int value, out int numBase) {
string str = valueTextBox.Text;
if (str.IndexOf('/') >= 0) {
// treat as address
numBase = 16;
return Asm65.Address.ParseAddress(str, (1 << 24) - 1, out value);
} else {
return Asm65.Number.TryParseInt(str, out value, out numBase);
}
}
private void okButton_Click(object sender, EventArgs e) {
bool isConstant = constantRadioButton.Checked;
ParseValue(out int value, out int numBase);
FormatDescriptor.SubType subType = FormatDescriptor.GetSubTypeForBase(numBase);
DefSym = new DefSymbol(labelTextBox.Text, value, Symbol.Source.Project,
isConstant ? Symbol.Type.Constant : Symbol.Type.ExternalAddr,
subType, commentTextBox.Text, string.Empty);
}
private void labelTextBox_TextChanged(object sender, EventArgs e) {
UpdateControls();
}
private void valueTextBox_TextChanged(object sender, EventArgs e) {
UpdateControls();
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,225 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class EditLabel {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.instructionLabel = new System.Windows.Forms.Label();
this.labelTextBox = new System.Windows.Forms.TextBox();
this.maxLengthLabel = new System.Windows.Forms.Label();
this.firstLetterLabel = new System.Windows.Forms.Label();
this.validCharsLabel = new System.Windows.Forms.Label();
this.notDuplicateLabel = new System.Windows.Forms.Label();
this.labelTypeGroupBox = new System.Windows.Forms.GroupBox();
this.radioButtonExport = new System.Windows.Forms.RadioButton();
this.radioButtonGlobal = new System.Windows.Forms.RadioButton();
this.radioButtonLocal = new System.Windows.Forms.RadioButton();
this.labelTypeGroupBox.SuspendLayout();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(267, 202);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 8;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(186, 202);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 7;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// instructionLabel
//
this.instructionLabel.AutoSize = true;
this.instructionLabel.Location = new System.Drawing.Point(13, 13);
this.instructionLabel.Name = "instructionLabel";
this.instructionLabel.Size = new System.Drawing.Size(60, 13);
this.instructionLabel.TabIndex = 0;
this.instructionLabel.Text = "Enter label:";
//
// labelTextBox
//
this.labelTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.labelTextBox.Location = new System.Drawing.Point(13, 30);
this.labelTextBox.Name = "labelTextBox";
this.labelTextBox.Size = new System.Drawing.Size(325, 20);
this.labelTextBox.TabIndex = 1;
this.labelTextBox.TextChanged += new System.EventHandler(this.labelTextBox_TextChanged);
//
// maxLengthLabel
//
this.maxLengthLabel.AutoSize = true;
this.maxLengthLabel.Location = new System.Drawing.Point(13, 57);
this.maxLengthLabel.Name = "maxLengthLabel";
this.maxLengthLabel.Size = new System.Drawing.Size(251, 13);
this.maxLengthLabel.TabIndex = 2;
this.maxLengthLabel.Text = "• Must be 2-32 characters long (or blank to remove)";
//
// firstLetterLabel
//
this.firstLetterLabel.AutoSize = true;
this.firstLetterLabel.Location = new System.Drawing.Point(12, 73);
this.firstLetterLabel.Name = "firstLetterLabel";
this.firstLetterLabel.Size = new System.Drawing.Size(187, 13);
this.firstLetterLabel.TabIndex = 3;
this.firstLetterLabel.Text = "• Must start with a letter or underscore";
//
// validCharsLabel
//
this.validCharsLabel.AutoSize = true;
this.validCharsLabel.Location = new System.Drawing.Point(12, 89);
this.validCharsLabel.Name = "validCharsLabel";
this.validCharsLabel.Size = new System.Drawing.Size(297, 13);
this.validCharsLabel.TabIndex = 4;
this.validCharsLabel.Text = "• Valid characters are ASCII letters, numbers, and underscore";
//
// notDuplicateLabel
//
this.notDuplicateLabel.AutoSize = true;
this.notDuplicateLabel.Location = new System.Drawing.Point(13, 105);
this.notDuplicateLabel.Name = "notDuplicateLabel";
this.notDuplicateLabel.Size = new System.Drawing.Size(217, 13);
this.notDuplicateLabel.TabIndex = 5;
this.notDuplicateLabel.Text = "• Must not be a duplicate of an existing label";
//
// labelTypeGroupBox
//
this.labelTypeGroupBox.Controls.Add(this.radioButtonExport);
this.labelTypeGroupBox.Controls.Add(this.radioButtonGlobal);
this.labelTypeGroupBox.Controls.Add(this.radioButtonLocal);
this.labelTypeGroupBox.Location = new System.Drawing.Point(13, 132);
this.labelTypeGroupBox.Name = "labelTypeGroupBox";
this.labelTypeGroupBox.Size = new System.Drawing.Size(137, 93);
this.labelTypeGroupBox.TabIndex = 6;
this.labelTypeGroupBox.TabStop = false;
this.labelTypeGroupBox.Text = "Label Type";
//
// radioButtonExport
//
this.radioButtonExport.AutoSize = true;
this.radioButtonExport.Location = new System.Drawing.Point(7, 67);
this.radioButtonExport.Name = "radioButtonExport";
this.radioButtonExport.Size = new System.Drawing.Size(120, 17);
this.radioButtonExport.TabIndex = 2;
this.radioButtonExport.TabStop = true;
this.radioButtonExport.Text = "Global and &exported";
this.radioButtonExport.UseVisualStyleBackColor = true;
//
// radioButtonGlobal
//
this.radioButtonGlobal.AutoSize = true;
this.radioButtonGlobal.Location = new System.Drawing.Point(7, 43);
this.radioButtonGlobal.Name = "radioButtonGlobal";
this.radioButtonGlobal.Size = new System.Drawing.Size(55, 17);
this.radioButtonGlobal.TabIndex = 1;
this.radioButtonGlobal.TabStop = true;
this.radioButtonGlobal.Text = "&Global";
this.radioButtonGlobal.UseVisualStyleBackColor = true;
//
// radioButtonLocal
//
this.radioButtonLocal.AutoSize = true;
this.radioButtonLocal.Location = new System.Drawing.Point(7, 20);
this.radioButtonLocal.Name = "radioButtonLocal";
this.radioButtonLocal.Size = new System.Drawing.Size(106, 17);
this.radioButtonLocal.TabIndex = 0;
this.radioButtonLocal.TabStop = true;
this.radioButtonLocal.Text = "&Local (if possible)";
this.radioButtonLocal.UseVisualStyleBackColor = true;
//
// EditLabel
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(354, 237);
this.Controls.Add(this.labelTypeGroupBox);
this.Controls.Add(this.notDuplicateLabel);
this.Controls.Add(this.validCharsLabel);
this.Controls.Add(this.firstLetterLabel);
this.Controls.Add(this.maxLengthLabel);
this.Controls.Add(this.labelTextBox);
this.Controls.Add(this.instructionLabel);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "EditLabel";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Label";
this.Load += new System.EventHandler(this.EditLabel_Load);
this.labelTypeGroupBox.ResumeLayout(false);
this.labelTypeGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Label instructionLabel;
private System.Windows.Forms.TextBox labelTextBox;
private System.Windows.Forms.Label maxLengthLabel;
private System.Windows.Forms.Label firstLetterLabel;
private System.Windows.Forms.Label validCharsLabel;
private System.Windows.Forms.Label notDuplicateLabel;
private System.Windows.Forms.GroupBox labelTypeGroupBox;
private System.Windows.Forms.RadioButton radioButtonLocal;
private System.Windows.Forms.RadioButton radioButtonGlobal;
private System.Windows.Forms.RadioButton radioButtonExport;
}
}

View File

@ -1,152 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace SourceGenWF.AppForms {
public partial class EditLabel : Form {
/// <summary>
/// Symbol object. When the dialog completes successfully,
/// this will have the new symbol, or null if the user deleted the label.
/// </summary>
public Symbol LabelSym { get; private set; }
/// <summary>
/// Address we are editing the label for.
/// </summary>
private int mAddress;
/// <summary>
/// Reference to DisasmProject's SymbolTable.
/// </summary>
private SymbolTable mSymbolTable;
// Dialog label text color, saved off at dialog load time.
private Color mDefaultLabelColor;
public EditLabel(Symbol origSym, int address, SymbolTable symbolTable) {
InitializeComponent();
LabelSym = origSym;
mAddress = address;
mSymbolTable = symbolTable;
}
private void EditLabel_Load(object sender, EventArgs e) {
mDefaultLabelColor = maxLengthLabel.ForeColor;
if (LabelSym == null) {
labelTextBox.Text = string.Empty;
radioButtonLocal.Checked = true;
} else {
labelTextBox.Text = LabelSym.Label;
switch (LabelSym.SymbolType) {
case Symbol.Type.LocalOrGlobalAddr:
radioButtonLocal.Checked = true;
break;
case Symbol.Type.GlobalAddr:
radioButtonGlobal.Checked = true;
break;
case Symbol.Type.GlobalAddrExport:
radioButtonExport.Checked = true;
break;
default:
Debug.Assert(false); // WTF
radioButtonLocal.Checked = true;
break;
}
}
}
private void labelTextBox_TextChanged(object sender, EventArgs e) {
string str = labelTextBox.Text;
bool valid = true;
if (str.Length == 1 || str.Length > Asm65.Label.MAX_LABEL_LEN) {
valid = false;
maxLengthLabel.ForeColor = Color.Red;
} else {
maxLengthLabel.ForeColor = mDefaultLabelColor;
}
// Regex never matches on strings of length 0 or 1, but we don't want
// to complain about that since we're already doing that above.
// TODO(maybe): Ideally this wouldn't light up if the only problem was a
// non-alpha first character, since the next test will call that out.
if (str.Length > 1) {
if (!Asm65.Label.ValidateLabel(str)) {
valid = false;
validCharsLabel.ForeColor = Color.Red;
} else {
validCharsLabel.ForeColor = mDefaultLabelColor;
}
} else {
validCharsLabel.ForeColor = mDefaultLabelColor;
}
if (str.Length > 0 &&
!((str[0] >= 'A' && str[0] <= 'Z') || (str[0] >= 'a' && str[0] <= 'z') ||
str[0] == '_')) {
// This should have been caught by the regex. We just want to set the
// color on the "first character must be" instruction text.
Debug.Assert(!valid);
firstLetterLabel.ForeColor = Color.Red;
} else {
firstLetterLabel.ForeColor = mDefaultLabelColor;
}
// Refuse to continue if the label already exists. The only exception is if
// it's the same symbol, and it's user-defined. (If they're trying to edit an
// auto label, we want to force them to change the name.)
//
// NOTE: if label matching is case-insensitive, we want to allow a situation
// where a label is being renamed from "FOO" to "Foo". We should be able to
// test for object equality on the Symbol to determine if we're renaming a
// symbol to itself.
if (valid && mSymbolTable.TryGetValue(str, out Symbol sym) &&
(sym != LabelSym || LabelSym.SymbolSource != Symbol.Source.User)) {
valid = false;
notDuplicateLabel.ForeColor = Color.Red;
} else {
notDuplicateLabel.ForeColor = mDefaultLabelColor;
}
okButton.Enabled = valid;
}
private void okButton_Click(object sender, EventArgs e) {
if (string.IsNullOrEmpty(labelTextBox.Text)) {
LabelSym = null;
} else {
Symbol.Type symbolType;
if (radioButtonLocal.Checked) {
symbolType = Symbol.Type.LocalOrGlobalAddr;
} else if (radioButtonGlobal.Checked) {
symbolType = Symbol.Type.GlobalAddr;
} else if (radioButtonExport.Checked) {
symbolType = Symbol.Type.GlobalAddrExport;
} else {
Debug.Assert(false); // WTF
symbolType = Symbol.Type.LocalOrGlobalAddr;
}
LabelSym = new Symbol(labelTextBox.Text, mAddress, Symbol.Source.User, symbolType);
}
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,201 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class EditLongComment {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.entryTextBox = new System.Windows.Forms.TextBox();
this.textEntryLabel = new System.Windows.Forms.Label();
this.sampleOutputLabel = new System.Windows.Forms.Label();
this.displayTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.maximumWidthLabel = new System.Windows.Forms.Label();
this.maxWidthComboBox = new System.Windows.Forms.ComboBox();
this.boxModeCheckBox = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// entryTextBox
//
this.entryTextBox.AcceptsReturn = true;
this.entryTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.entryTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.entryTextBox.Location = new System.Drawing.Point(12, 29);
this.entryTextBox.Multiline = true;
this.entryTextBox.Name = "entryTextBox";
this.entryTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.entryTextBox.Size = new System.Drawing.Size(509, 150);
this.entryTextBox.TabIndex = 0;
this.entryTextBox.Text = "01234567890123456789012345678901234567890123456789012345678901234567890123456789";
this.entryTextBox.TextChanged += new System.EventHandler(this.entryTextBox_TextChanged);
//
// textEntryLabel
//
this.textEntryLabel.AutoSize = true;
this.textEntryLabel.Location = new System.Drawing.Point(13, 12);
this.textEntryLabel.Name = "textEntryLabel";
this.textEntryLabel.Size = new System.Drawing.Size(101, 13);
this.textEntryLabel.TabIndex = 1;
this.textEntryLabel.Text = "Enter comment text:";
//
// sampleOutputLabel
//
this.sampleOutputLabel.AutoSize = true;
this.sampleOutputLabel.Location = new System.Drawing.Point(12, 240);
this.sampleOutputLabel.Name = "sampleOutputLabel";
this.sampleOutputLabel.Size = new System.Drawing.Size(88, 13);
this.sampleOutputLabel.TabIndex = 5;
this.sampleOutputLabel.Text = "Expected output:";
//
// displayTextBox
//
this.displayTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.displayTextBox.BackColor = System.Drawing.SystemColors.Window;
this.displayTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.displayTextBox.Location = new System.Drawing.Point(12, 258);
this.displayTextBox.Multiline = true;
this.displayTextBox.Name = "displayTextBox";
this.displayTextBox.ReadOnly = true;
this.displayTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.displayTextBox.Size = new System.Drawing.Size(509, 163);
this.displayTextBox.TabIndex = 6;
this.displayTextBox.Text = "01234567890123456789012345678901234567890123456789012345678901234567890123456789";
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(365, 438);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 7;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(446, 438);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 8;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// maximumWidthLabel
//
this.maximumWidthLabel.AutoSize = true;
this.maximumWidthLabel.Location = new System.Drawing.Point(12, 198);
this.maximumWidthLabel.Name = "maximumWidthLabel";
this.maximumWidthLabel.Size = new System.Drawing.Size(101, 13);
this.maximumWidthLabel.TabIndex = 2;
this.maximumWidthLabel.Text = "Maximum line width:";
//
// maxWidthComboBox
//
this.maxWidthComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.maxWidthComboBox.FormattingEnabled = true;
this.maxWidthComboBox.Items.AddRange(new object[] {
"30",
"40",
"64",
"80"});
this.maxWidthComboBox.Location = new System.Drawing.Point(119, 195);
this.maxWidthComboBox.Name = "maxWidthComboBox";
this.maxWidthComboBox.Size = new System.Drawing.Size(74, 21);
this.maxWidthComboBox.TabIndex = 3;
this.maxWidthComboBox.SelectedIndexChanged += new System.EventHandler(this.maxWidthComboBox_SelectedIndexChanged);
//
// boxModeCheckBox
//
this.boxModeCheckBox.AutoSize = true;
this.boxModeCheckBox.Location = new System.Drawing.Point(264, 197);
this.boxModeCheckBox.Name = "boxModeCheckBox";
this.boxModeCheckBox.Size = new System.Drawing.Size(92, 17);
this.boxModeCheckBox.TabIndex = 4;
this.boxModeCheckBox.Text = "Render in box";
this.boxModeCheckBox.UseVisualStyleBackColor = true;
this.boxModeCheckBox.CheckedChanged += new System.EventHandler(this.boxModeCheckBox_CheckedChanged);
//
// EditLongComment
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(534, 473);
this.Controls.Add(this.boxModeCheckBox);
this.Controls.Add(this.maxWidthComboBox);
this.Controls.Add(this.maximumWidthLabel);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.displayTextBox);
this.Controls.Add(this.sampleOutputLabel);
this.Controls.Add(this.textEntryLabel);
this.Controls.Add(this.entryTextBox);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(550, 512);
this.Name = "EditLongComment";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Long Comment";
this.HelpButtonClicked += new System.ComponentModel.CancelEventHandler(this.EditLongComment_HelpButtonClicked);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EditLongComment_FormClosing);
this.Load += new System.EventHandler(this.EditLongComment_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox entryTextBox;
private System.Windows.Forms.Label textEntryLabel;
private System.Windows.Forms.Label sampleOutputLabel;
private System.Windows.Forms.TextBox displayTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Label maximumWidthLabel;
private System.Windows.Forms.ComboBox maxWidthComboBox;
private System.Windows.Forms.CheckBox boxModeCheckBox;
}
}

View File

@ -1,130 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace SourceGenWF.AppForms {
public partial class EditLongComment : Form {
/// <summary>
/// Get or set the multi-line comment object. On exit, will be set to null if
/// the user wants to delete the comment.
/// </summary>
public MultiLineComment LongComment { get; set; }
private Asm65.Formatter mFormatter;
public EditLongComment(Asm65.Formatter formatter) {
InitializeComponent();
mFormatter = formatter;
LongComment = new MultiLineComment(string.Empty);
}
private void EditLongComment_Load(object sender, EventArgs e) {
Debug.Assert(LongComment != null);
entryTextBox.Text = LongComment.Text;
boxModeCheckBox.Checked = LongComment.BoxMode;
maxWidthComboBox.SelectedIndex = 0;
for (int i = 0; i < maxWidthComboBox.Items.Count; i++) {
string item = (string) maxWidthComboBox.Items[i];
if (int.Parse(item) == LongComment.MaxWidth) {
maxWidthComboBox.SelectedIndex = i;
break;
}
}
FormatInput();
}
// Handle Ctrl+Enter.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
if (keyData == (Keys.Control | Keys.Enter)) {
DialogResult = DialogResult.OK;
Close();
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void EditLongComment_FormClosing(object sender, FormClosingEventArgs e) {
if (string.IsNullOrEmpty(entryTextBox.Text)) {
LongComment = null;
} else {
LongComment = CreateMLC();
}
}
private void entryTextBox_TextChanged(object sender, EventArgs e) {
FormatInput();
}
private void maxWidthComboBox_SelectedIndexChanged(object sender, EventArgs e) {
FormatInput();
}
private void boxModeCheckBox_CheckedChanged(object sender, EventArgs e) {
FormatInput();
}
/// <summary>
/// Creates a MultiLineComment from the current state of the dialog.
/// </summary>
/// <returns>New MultiLineComment object. Returns null if the dialog is still
/// in the process of initializing.</returns>
private MultiLineComment CreateMLC() {
if (maxWidthComboBox.SelectedItem == null) {
return null; // still initializing
}
return new MultiLineComment(entryTextBox.Text, boxModeCheckBox.Checked,
int.Parse((string)maxWidthComboBox.SelectedItem));
}
/// <summary>
/// Formats entryTextBox.Text into displayTextBox.Text.
/// </summary>
private void FormatInput() {
MultiLineComment mlc = CreateMLC();
if (mlc == null) {
return;
}
List<string> lines = mlc.FormatText(mFormatter, string.Empty);
StringBuilder sb = new StringBuilder(entryTextBox.Text.Length + lines.Count * 2);
//sb.AppendFormat("### got {0} lines\r\n", lines.Count);
bool first = true;
foreach (string line in lines) {
if (first) {
first = false;
} else {
sb.Append("\r\n");
}
sb.Append(line);
}
displayTextBox.Text = sb.ToString();
}
private void EditLongComment_HelpButtonClicked(object sender, System.ComponentModel.CancelEventArgs e) {
HelpAccess.ShowHelp(HelpAccess.Topic.EditLongComment);
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,221 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class EditNote {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.headerLabel = new System.Windows.Forms.Label();
this.noteTextBox = new System.Windows.Forms.TextBox();
this.colorGroupBox = new System.Windows.Forms.GroupBox();
this.colorOrangeRadio = new System.Windows.Forms.RadioButton();
this.colorPinkRadio = new System.Windows.Forms.RadioButton();
this.colorYellowRadio = new System.Windows.Forms.RadioButton();
this.colorBlueRadio = new System.Windows.Forms.RadioButton();
this.colorGreenRadio = new System.Windows.Forms.RadioButton();
this.colorDefaultRadio = new System.Windows.Forms.RadioButton();
this.colorGroupBox.SuspendLayout();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(552, 225);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 3;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(471, 225);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 2;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
//
// headerLabel
//
this.headerLabel.AutoSize = true;
this.headerLabel.Location = new System.Drawing.Point(13, 13);
this.headerLabel.Name = "headerLabel";
this.headerLabel.Size = new System.Drawing.Size(59, 13);
this.headerLabel.TabIndex = 0;
this.headerLabel.Text = "Enter note:";
//
// noteTextBox
//
this.noteTextBox.AcceptsReturn = true;
this.noteTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.noteTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.noteTextBox.Location = new System.Drawing.Point(13, 33);
this.noteTextBox.Multiline = true;
this.noteTextBox.Name = "noteTextBox";
this.noteTextBox.Size = new System.Drawing.Size(614, 113);
this.noteTextBox.TabIndex = 1;
//
// colorGroupBox
//
this.colorGroupBox.Controls.Add(this.colorOrangeRadio);
this.colorGroupBox.Controls.Add(this.colorPinkRadio);
this.colorGroupBox.Controls.Add(this.colorYellowRadio);
this.colorGroupBox.Controls.Add(this.colorBlueRadio);
this.colorGroupBox.Controls.Add(this.colorGreenRadio);
this.colorGroupBox.Controls.Add(this.colorDefaultRadio);
this.colorGroupBox.Location = new System.Drawing.Point(13, 153);
this.colorGroupBox.Name = "colorGroupBox";
this.colorGroupBox.Size = new System.Drawing.Size(182, 95);
this.colorGroupBox.TabIndex = 4;
this.colorGroupBox.TabStop = false;
this.colorGroupBox.Text = "Select Highlight Color";
//
// colorOrangeRadio
//
this.colorOrangeRadio.AutoSize = true;
this.colorOrangeRadio.Location = new System.Drawing.Point(98, 68);
this.colorOrangeRadio.Name = "colorOrangeRadio";
this.colorOrangeRadio.Size = new System.Drawing.Size(60, 17);
this.colorOrangeRadio.TabIndex = 5;
this.colorOrangeRadio.TabStop = true;
this.colorOrangeRadio.Text = "&Orange";
this.colorOrangeRadio.UseVisualStyleBackColor = true;
//
// colorPinkRadio
//
this.colorPinkRadio.AutoSize = true;
this.colorPinkRadio.Location = new System.Drawing.Point(98, 44);
this.colorPinkRadio.Name = "colorPinkRadio";
this.colorPinkRadio.Size = new System.Drawing.Size(46, 17);
this.colorPinkRadio.TabIndex = 4;
this.colorPinkRadio.TabStop = true;
this.colorPinkRadio.Text = "&Pink";
this.colorPinkRadio.UseVisualStyleBackColor = true;
//
// colorYellowRadio
//
this.colorYellowRadio.AutoSize = true;
this.colorYellowRadio.Location = new System.Drawing.Point(98, 20);
this.colorYellowRadio.Name = "colorYellowRadio";
this.colorYellowRadio.Size = new System.Drawing.Size(56, 17);
this.colorYellowRadio.TabIndex = 3;
this.colorYellowRadio.TabStop = true;
this.colorYellowRadio.Text = "&Yellow";
this.colorYellowRadio.UseVisualStyleBackColor = true;
//
// colorBlueRadio
//
this.colorBlueRadio.AutoSize = true;
this.colorBlueRadio.Location = new System.Drawing.Point(7, 68);
this.colorBlueRadio.Name = "colorBlueRadio";
this.colorBlueRadio.Size = new System.Drawing.Size(46, 17);
this.colorBlueRadio.TabIndex = 2;
this.colorBlueRadio.TabStop = true;
this.colorBlueRadio.Text = "&Blue";
this.colorBlueRadio.UseVisualStyleBackColor = true;
//
// colorGreenRadio
//
this.colorGreenRadio.AutoSize = true;
this.colorGreenRadio.Location = new System.Drawing.Point(7, 44);
this.colorGreenRadio.Name = "colorGreenRadio";
this.colorGreenRadio.Size = new System.Drawing.Size(54, 17);
this.colorGreenRadio.TabIndex = 1;
this.colorGreenRadio.TabStop = true;
this.colorGreenRadio.Text = "&Green";
this.colorGreenRadio.UseVisualStyleBackColor = true;
//
// colorDefaultRadio
//
this.colorDefaultRadio.AutoSize = true;
this.colorDefaultRadio.Location = new System.Drawing.Point(7, 20);
this.colorDefaultRadio.Name = "colorDefaultRadio";
this.colorDefaultRadio.Size = new System.Drawing.Size(51, 17);
this.colorDefaultRadio.TabIndex = 0;
this.colorDefaultRadio.TabStop = true;
this.colorDefaultRadio.Text = "&None";
this.colorDefaultRadio.UseVisualStyleBackColor = true;
//
// EditNote
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(639, 260);
this.Controls.Add(this.colorGroupBox);
this.Controls.Add(this.noteTextBox);
this.Controls.Add(this.headerLabel);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "EditNote";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Note";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EditNote_FormClosing);
this.Load += new System.EventHandler(this.EditNote_Load);
this.colorGroupBox.ResumeLayout(false);
this.colorGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Label headerLabel;
private System.Windows.Forms.TextBox noteTextBox;
private System.Windows.Forms.GroupBox colorGroupBox;
private System.Windows.Forms.RadioButton colorOrangeRadio;
private System.Windows.Forms.RadioButton colorPinkRadio;
private System.Windows.Forms.RadioButton colorYellowRadio;
private System.Windows.Forms.RadioButton colorBlueRadio;
private System.Windows.Forms.RadioButton colorGreenRadio;
private System.Windows.Forms.RadioButton colorDefaultRadio;
}
}

View File

@ -1,104 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace SourceGenWF.AppForms {
public partial class EditNote : Form {
/// <summary>
/// Get or set the note object. On exit, will be set to null if the user wants
/// to delete the note.
/// </summary>
public MultiLineComment Note { get; set; }
// Highlight color palette. Unless the user has funky theme, the color will be
// replacing a white background, and will be overlaid with black text, so should
// be on the lighter end of the spectrum.
private enum ColorList {
None = 0, Green, Blue, Yellow, Pink, Orange
}
private static Color[] sColors = new Color[] {
Color.FromArgb(0), // None
Color.LightGreen,
Color.LightBlue,
Color.Yellow, //LightGoldenrodYellow,
Color.LightPink,
Color.Orange
};
private RadioButton[] mColorButtons;
public EditNote() {
InitializeComponent();
Note = new MultiLineComment(string.Empty);
}
private void EditNote_Load(object sender, EventArgs e) {
noteTextBox.Text = Note.Text;
mColorButtons = new RadioButton[] {
colorDefaultRadio,
colorGreenRadio,
colorBlueRadio,
colorYellowRadio,
colorPinkRadio,
colorOrangeRadio
};
Debug.Assert(mColorButtons.Length == sColors.Length);
// Configure radio buttons.
colorDefaultRadio.Checked = true;
if (Note != null) {
Color curColor = Note.BackgroundColor;
for (int i = 0; i < sColors.Length; i++) {
// Can't just compare colors, because the sColors entries are "known" and
// have some additional properties set. Comparing the RGB values works.
if (sColors[i].ToArgb() == curColor.ToArgb()) {
mColorButtons[i].Checked = true;
break;
}
}
}
}
// Handle Ctrl+Enter.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
if (keyData == (Keys.Control | Keys.Enter)) {
DialogResult = DialogResult.OK;
Close();
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void EditNote_FormClosing(object sender, FormClosingEventArgs e) {
if (string.IsNullOrEmpty(noteTextBox.Text)) {
Note = null;
} else {
Color bkgndColor = Color.Fuchsia;
for (int i = 0; i < mColorButtons.Length; i++) {
if (mColorButtons[i].Checked) {
bkgndColor = sColors[i];
break;
}
}
Note = new MultiLineComment(noteTextBox.Text, bkgndColor);
}
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,382 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class EditOperand {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.mainRadioPanel = new System.Windows.Forms.Panel();
this.symbolPartPanel = new System.Windows.Forms.Panel();
this.radioButtonBank = new System.Windows.Forms.RadioButton();
this.radioButtonHigh = new System.Windows.Forms.RadioButton();
this.radioButtonLow = new System.Windows.Forms.RadioButton();
this.symbolTextBox = new System.Windows.Forms.TextBox();
this.radioButtonSymbol = new System.Windows.Forms.RadioButton();
this.radioButtonAscii = new System.Windows.Forms.RadioButton();
this.radioButtonBinary = new System.Windows.Forms.RadioButton();
this.radioButtonDecimal = new System.Windows.Forms.RadioButton();
this.radioButtonHex = new System.Windows.Forms.RadioButton();
this.radioButtonDefault = new System.Windows.Forms.RadioButton();
this.selectFormatLabel = new System.Windows.Forms.Label();
this.previewLabel = new System.Windows.Forms.Label();
this.previewTextBox = new System.Windows.Forms.TextBox();
this.symbolShortcutsGroupBox = new System.Windows.Forms.GroupBox();
this.operandAndProjRadioButton = new System.Windows.Forms.RadioButton();
this.operandAndLabelRadioButton = new System.Windows.Forms.RadioButton();
this.labelInsteadRadioButton = new System.Windows.Forms.RadioButton();
this.operandOnlyRadioButton = new System.Windows.Forms.RadioButton();
this.mainRadioPanel.SuspendLayout();
this.symbolPartPanel.SuspendLayout();
this.symbolShortcutsGroupBox.SuspendLayout();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(199, 377);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 4;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(118, 377);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 3;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// mainRadioPanel
//
this.mainRadioPanel.Controls.Add(this.symbolPartPanel);
this.mainRadioPanel.Controls.Add(this.symbolTextBox);
this.mainRadioPanel.Controls.Add(this.radioButtonSymbol);
this.mainRadioPanel.Controls.Add(this.radioButtonAscii);
this.mainRadioPanel.Controls.Add(this.radioButtonBinary);
this.mainRadioPanel.Controls.Add(this.radioButtonDecimal);
this.mainRadioPanel.Controls.Add(this.radioButtonHex);
this.mainRadioPanel.Controls.Add(this.radioButtonDefault);
this.mainRadioPanel.Location = new System.Drawing.Point(12, 29);
this.mainRadioPanel.Name = "mainRadioPanel";
this.mainRadioPanel.Size = new System.Drawing.Size(261, 173);
this.mainRadioPanel.TabIndex = 0;
//
// symbolPartPanel
//
this.symbolPartPanel.Controls.Add(this.radioButtonBank);
this.symbolPartPanel.Controls.Add(this.radioButtonHigh);
this.symbolPartPanel.Controls.Add(this.radioButtonLow);
this.symbolPartPanel.Location = new System.Drawing.Point(69, 150);
this.symbolPartPanel.Name = "symbolPartPanel";
this.symbolPartPanel.Size = new System.Drawing.Size(154, 18);
this.symbolPartPanel.TabIndex = 7;
//
// radioButtonBank
//
this.radioButtonBank.AutoSize = true;
this.radioButtonBank.Location = new System.Drawing.Point(100, 0);
this.radioButtonBank.Name = "radioButtonBank";
this.radioButtonBank.Size = new System.Drawing.Size(50, 17);
this.radioButtonBank.TabIndex = 2;
this.radioButtonBank.TabStop = true;
this.radioButtonBank.Text = "&Bank";
this.radioButtonBank.UseVisualStyleBackColor = true;
this.radioButtonBank.CheckedChanged += new System.EventHandler(this.PartGroup_CheckedChanged);
//
// radioButtonHigh
//
this.radioButtonHigh.AutoSize = true;
this.radioButtonHigh.Location = new System.Drawing.Point(50, 0);
this.radioButtonHigh.Name = "radioButtonHigh";
this.radioButtonHigh.Size = new System.Drawing.Size(47, 17);
this.radioButtonHigh.TabIndex = 1;
this.radioButtonHigh.TabStop = true;
this.radioButtonHigh.Text = "&High";
this.radioButtonHigh.UseVisualStyleBackColor = true;
this.radioButtonHigh.CheckedChanged += new System.EventHandler(this.PartGroup_CheckedChanged);
//
// radioButtonLow
//
this.radioButtonLow.AutoSize = true;
this.radioButtonLow.Location = new System.Drawing.Point(0, 0);
this.radioButtonLow.Name = "radioButtonLow";
this.radioButtonLow.Size = new System.Drawing.Size(45, 17);
this.radioButtonLow.TabIndex = 0;
this.radioButtonLow.TabStop = true;
this.radioButtonLow.Text = "&Low";
this.radioButtonLow.UseVisualStyleBackColor = true;
this.radioButtonLow.CheckedChanged += new System.EventHandler(this.PartGroup_CheckedChanged);
//
// symbolTextBox
//
this.symbolTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.symbolTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.symbolTextBox.Location = new System.Drawing.Point(69, 124);
this.symbolTextBox.MaxLength = 128;
this.symbolTextBox.Name = "symbolTextBox";
this.symbolTextBox.Size = new System.Drawing.Size(179, 20);
this.symbolTextBox.TabIndex = 6;
this.symbolTextBox.TextChanged += new System.EventHandler(this.symbolTextBox_TextChanged);
//
// radioButtonSymbol
//
this.radioButtonSymbol.AutoSize = true;
this.radioButtonSymbol.Location = new System.Drawing.Point(4, 124);
this.radioButtonSymbol.Name = "radioButtonSymbol";
this.radioButtonSymbol.Size = new System.Drawing.Size(59, 17);
this.radioButtonSymbol.TabIndex = 5;
this.radioButtonSymbol.TabStop = true;
this.radioButtonSymbol.Text = "&Symbol";
this.radioButtonSymbol.UseVisualStyleBackColor = true;
this.radioButtonSymbol.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radioButtonAscii
//
this.radioButtonAscii.AutoSize = true;
this.radioButtonAscii.Location = new System.Drawing.Point(4, 100);
this.radioButtonAscii.Name = "radioButtonAscii";
this.radioButtonAscii.Size = new System.Drawing.Size(100, 17);
this.radioButtonAscii.TabIndex = 4;
this.radioButtonAscii.TabStop = true;
this.radioButtonAscii.Text = "&ASCII character";
this.radioButtonAscii.UseVisualStyleBackColor = true;
this.radioButtonAscii.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radioButtonBinary
//
this.radioButtonBinary.AutoSize = true;
this.radioButtonBinary.Location = new System.Drawing.Point(4, 76);
this.radioButtonBinary.Name = "radioButtonBinary";
this.radioButtonBinary.Size = new System.Drawing.Size(54, 17);
this.radioButtonBinary.TabIndex = 3;
this.radioButtonBinary.TabStop = true;
this.radioButtonBinary.Text = "&Binary";
this.radioButtonBinary.UseVisualStyleBackColor = true;
this.radioButtonBinary.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radioButtonDecimal
//
this.radioButtonDecimal.AutoSize = true;
this.radioButtonDecimal.Location = new System.Drawing.Point(4, 52);
this.radioButtonDecimal.Name = "radioButtonDecimal";
this.radioButtonDecimal.Size = new System.Drawing.Size(63, 17);
this.radioButtonDecimal.TabIndex = 2;
this.radioButtonDecimal.TabStop = true;
this.radioButtonDecimal.Text = "&Decimal";
this.radioButtonDecimal.UseVisualStyleBackColor = true;
this.radioButtonDecimal.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radioButtonHex
//
this.radioButtonHex.AutoSize = true;
this.radioButtonHex.Location = new System.Drawing.Point(4, 28);
this.radioButtonHex.Name = "radioButtonHex";
this.radioButtonHex.Size = new System.Drawing.Size(86, 17);
this.radioButtonHex.TabIndex = 1;
this.radioButtonHex.TabStop = true;
this.radioButtonHex.Text = "&Hexadecimal";
this.radioButtonHex.UseVisualStyleBackColor = true;
this.radioButtonHex.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// radioButtonDefault
//
this.radioButtonDefault.AutoSize = true;
this.radioButtonDefault.Location = new System.Drawing.Point(4, 4);
this.radioButtonDefault.Name = "radioButtonDefault";
this.radioButtonDefault.Size = new System.Drawing.Size(59, 17);
this.radioButtonDefault.TabIndex = 0;
this.radioButtonDefault.TabStop = true;
this.radioButtonDefault.Text = "&Default";
this.radioButtonDefault.UseVisualStyleBackColor = true;
this.radioButtonDefault.CheckedChanged += new System.EventHandler(this.MainGroup_CheckedChanged);
//
// selectFormatLabel
//
this.selectFormatLabel.AutoSize = true;
this.selectFormatLabel.Location = new System.Drawing.Point(13, 13);
this.selectFormatLabel.Name = "selectFormatLabel";
this.selectFormatLabel.Size = new System.Drawing.Size(114, 13);
this.selectFormatLabel.TabIndex = 0;
this.selectFormatLabel.Text = "Select operand format:";
//
// previewLabel
//
this.previewLabel.AutoSize = true;
this.previewLabel.Location = new System.Drawing.Point(11, 210);
this.previewLabel.Name = "previewLabel";
this.previewLabel.Size = new System.Drawing.Size(48, 13);
this.previewLabel.TabIndex = 1;
this.previewLabel.Text = "Preview:";
//
// previewTextBox
//
this.previewTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.previewTextBox.Enabled = false;
this.previewTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.previewTextBox.Location = new System.Drawing.Point(66, 208);
this.previewTextBox.Name = "previewTextBox";
this.previewTextBox.Size = new System.Drawing.Size(207, 20);
this.previewTextBox.TabIndex = 2;
//
// symbolShortcutsGroupBox
//
this.symbolShortcutsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.symbolShortcutsGroupBox.Controls.Add(this.operandAndProjRadioButton);
this.symbolShortcutsGroupBox.Controls.Add(this.operandAndLabelRadioButton);
this.symbolShortcutsGroupBox.Controls.Add(this.labelInsteadRadioButton);
this.symbolShortcutsGroupBox.Controls.Add(this.operandOnlyRadioButton);
this.symbolShortcutsGroupBox.Location = new System.Drawing.Point(13, 248);
this.symbolShortcutsGroupBox.Name = "symbolShortcutsGroupBox";
this.symbolShortcutsGroupBox.Size = new System.Drawing.Size(261, 118);
this.symbolShortcutsGroupBox.TabIndex = 5;
this.symbolShortcutsGroupBox.TabStop = false;
this.symbolShortcutsGroupBox.Text = "Symbol Shortcuts";
//
// operandAndProjRadioButton
//
this.operandAndProjRadioButton.AutoSize = true;
this.operandAndProjRadioButton.Location = new System.Drawing.Point(7, 92);
this.operandAndProjRadioButton.Name = "operandAndProjRadioButton";
this.operandAndProjRadioButton.Size = new System.Drawing.Size(212, 17);
this.operandAndProjRadioButton.TabIndex = 3;
this.operandAndProjRadioButton.TabStop = true;
this.operandAndProjRadioButton.Text = "Set operand AND create &project symbol";
this.operandAndProjRadioButton.UseVisualStyleBackColor = true;
//
// operandAndLabelRadioButton
//
this.operandAndLabelRadioButton.AutoSize = true;
this.operandAndLabelRadioButton.Location = new System.Drawing.Point(7, 68);
this.operandAndLabelRadioButton.Name = "operandAndLabelRadioButton";
this.operandAndLabelRadioButton.Size = new System.Drawing.Size(249, 17);
this.operandAndLabelRadioButton.TabIndex = 2;
this.operandAndLabelRadioButton.TabStop = true;
this.operandAndLabelRadioButton.Text = "Set &operand AND create label at target address";
this.operandAndLabelRadioButton.UseVisualStyleBackColor = true;
//
// labelInsteadRadioButton
//
this.labelInsteadRadioButton.AutoSize = true;
this.labelInsteadRadioButton.Location = new System.Drawing.Point(7, 44);
this.labelInsteadRadioButton.Name = "labelInsteadRadioButton";
this.labelInsteadRadioButton.Size = new System.Drawing.Size(200, 17);
this.labelInsteadRadioButton.TabIndex = 1;
this.labelInsteadRadioButton.TabStop = true;
this.labelInsteadRadioButton.Text = "&Create label at target address instead";
this.labelInsteadRadioButton.UseVisualStyleBackColor = true;
//
// operandOnlyRadioButton
//
this.operandOnlyRadioButton.AutoSize = true;
this.operandOnlyRadioButton.Location = new System.Drawing.Point(7, 20);
this.operandOnlyRadioButton.Name = "operandOnlyRadioButton";
this.operandOnlyRadioButton.Size = new System.Drawing.Size(162, 17);
this.operandOnlyRadioButton.TabIndex = 0;
this.operandOnlyRadioButton.TabStop = true;
this.operandOnlyRadioButton.Text = "&Just set the operand (default)";
this.operandOnlyRadioButton.UseVisualStyleBackColor = true;
//
// EditOperand
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(286, 412);
this.Controls.Add(this.symbolShortcutsGroupBox);
this.Controls.Add(this.previewTextBox);
this.Controls.Add(this.previewLabel);
this.Controls.Add(this.selectFormatLabel);
this.Controls.Add(this.mainRadioPanel);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "EditOperand";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Instruction Operand";
this.Load += new System.EventHandler(this.EditOperand_Load);
this.Shown += new System.EventHandler(this.EditOperand_Shown);
this.mainRadioPanel.ResumeLayout(false);
this.mainRadioPanel.PerformLayout();
this.symbolPartPanel.ResumeLayout(false);
this.symbolPartPanel.PerformLayout();
this.symbolShortcutsGroupBox.ResumeLayout(false);
this.symbolShortcutsGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Panel mainRadioPanel;
private System.Windows.Forms.TextBox symbolTextBox;
private System.Windows.Forms.RadioButton radioButtonSymbol;
private System.Windows.Forms.RadioButton radioButtonAscii;
private System.Windows.Forms.RadioButton radioButtonBinary;
private System.Windows.Forms.RadioButton radioButtonDecimal;
private System.Windows.Forms.RadioButton radioButtonHex;
private System.Windows.Forms.RadioButton radioButtonDefault;
private System.Windows.Forms.Label selectFormatLabel;
private System.Windows.Forms.Label previewLabel;
private System.Windows.Forms.TextBox previewTextBox;
private System.Windows.Forms.Panel symbolPartPanel;
private System.Windows.Forms.RadioButton radioButtonBank;
private System.Windows.Forms.RadioButton radioButtonHigh;
private System.Windows.Forms.RadioButton radioButtonLow;
private System.Windows.Forms.GroupBox symbolShortcutsGroupBox;
private System.Windows.Forms.RadioButton operandAndProjRadioButton;
private System.Windows.Forms.RadioButton operandAndLabelRadioButton;
private System.Windows.Forms.RadioButton labelInsteadRadioButton;
private System.Windows.Forms.RadioButton operandOnlyRadioButton;
}
}

View File

@ -1,541 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Diagnostics;
using System.Text;
using System.Windows.Forms;
using Asm65;
namespace SourceGenWF.AppForms {
public partial class EditOperand : Form {
/// <summary>
/// In/out. May be null on entry if the offset doesn't have a format descriptor
/// specified. Will be null on exit if "default" is selected.
/// </summary>
public FormatDescriptor FormatDescriptor { get; set; }
public enum SymbolShortcutAction {
None = 0, CreateLabelInstead, CreateLabelAlso, CreateProjectSymbolAlso
}
/// <summary>
/// Remember the last option we used.
/// </summary>
private static SymbolShortcutAction sLastAction = SymbolShortcutAction.None;
/// <summary>
/// On OK dialog exit, specifies that an additional action should be taken.
/// </summary>
public SymbolShortcutAction ShortcutAction { get; private set; }
/// <summary>
/// Additional argument, meaning dependent on ShortcutAction. This will either be
/// the target label offset or the project symbol value.
/// </summary>
public int ShortcutArg { get; private set; }
/// <summary>
/// Width of full instruction, including opcode.
/// </summary>
private int mInstructionLength;
/// <summary>
/// Number of hexadecimal digits to show in the preview. Sometimes you want
/// to force this to be longer or shorter than InstructionLength would indicate,
/// e.g. "BRA $1000" has a 1-byte operand.
/// </summary>
private int mPreviewHexDigits;
/// <summary>
/// Operand value, extracted from file data. For a relative branch, this will be
/// an address instead. Only used for preview window.
/// </summary>
private int mOperandValue;
/// <summary>
/// Is the operand an immediate value? If so, we enable the symbol part selection.
/// </summary>
private bool mIsExtendedImmediate;
/// <summary>
/// Is the operand a PC relative offset?
/// </summary>
private bool mIsPcRelative;
/// <summary>
/// Special handling for block move instructions (MVN/MVP).
/// </summary>
private bool mIsBlockMove;
/// <summary>
/// If set, show a '#' in the preview indow.
/// </summary>
private bool mShowHashPrefix;
///// <summary>
///// Symbol table to use when resolving symbolic values.
///// </summary>
//private SymbolTable SymbolTable { get; set; }
/// <summary>
/// Project reference.
/// </summary>
private DisasmProject mProject;
/// <summary>
/// Formatter to use when displaying addresses and hex values.
/// </summary>
private Formatter mFormatter;
/// <summary>
/// Copy of operand Anattribs.
/// </summary>
private Anattrib mAttr;
/// <summary>
/// Set this during initial control configuration, so we know to ignore the CheckedChanged
/// events.
/// </summary>
private bool mIsInitialSetup;
/// <summary>
/// Set to true if the user has entered a symbol that matches an auto-generated symbol.
/// </summary>
private bool mIsSymbolAuto;
public EditOperand(int offset, DisasmProject project, Asm65.Formatter formatter) {
InitializeComponent();
mProject = project;
mFormatter = formatter;
// Configure the appearance.
mAttr = mProject.GetAnattrib(offset);
OpDef op = mProject.CpuDef.GetOpDef(mProject.FileData[offset]);
mInstructionLength = mAttr.Length;
mPreviewHexDigits = (mAttr.Length - 1) * 2;
if (mAttr.OperandAddress >= 0) {
// Use this as the operand value when available. This lets us present
// relative branch instructions in the expected form.
mOperandValue = mAttr.OperandAddress;
if (op.AddrMode == OpDef.AddressMode.PCRel) {
mPreviewHexDigits = 4;
mIsPcRelative = true;
} else if (op.AddrMode == OpDef.AddressMode.PCRelLong ||
op.AddrMode == OpDef.AddressMode.StackPCRelLong) {
mIsPcRelative = true;
}
} else {
int opVal = op.GetOperand(mProject.FileData, offset, mAttr.StatusFlags);
mOperandValue = opVal;
if (op.AddrMode == OpDef.AddressMode.BlockMove) {
// MVN and MVP screw things up by having two operands in one instruction.
// We deal with this by passing in the value from the second byte
// (source bank) as the value, and applying the chosen format to both bytes.
mIsBlockMove = true;
mOperandValue = opVal >> 8;
mPreviewHexDigits = 2;
}
}
mIsExtendedImmediate = op.IsExtendedImmediate; // Imm, PEA, MVN/MVP
mShowHashPrefix = op.IsImmediate; // just Imm
}
private void EditOperand_Load(object sender, EventArgs e) {
mIsInitialSetup = true;
// Can this be represented as high or low ASCII?
radioButtonAscii.Enabled = CommonUtil.TextUtil.IsHiLoAscii(mOperandValue);
// Configure the dialog from the FormatDescriptor, if one is available.
SetControlsFromDescriptor(FormatDescriptor);
// Do this whether or not symbol is checked -- want to have this set when the
// dialog is initially in default format.
switch (sLastAction) {
case SymbolShortcutAction.CreateLabelInstead:
labelInsteadRadioButton.Checked = true;
break;
case SymbolShortcutAction.CreateLabelAlso:
operandAndLabelRadioButton.Checked = true;
break;
case SymbolShortcutAction.CreateProjectSymbolAlso:
operandAndProjRadioButton.Checked = true;
break;
default:
operandOnlyRadioButton.Checked = true;
break;
}
mIsInitialSetup = false;
UpdateControls();
}
private void EditOperand_Shown(object sender, EventArgs e) {
// Start with the focus in the text box. This way they can start typing
// immediately.
symbolTextBox.Focus();
}
private void symbolTextBox_TextChanged(object sender, EventArgs e) {
// Make sure Symbol is checked if they're typing text in.
radioButtonSymbol.Checked = true;
UpdateControls();
}
/// <summary>
/// Handles CheckedChanged event for all radio buttons in main group.
/// </summary>
private void MainGroup_CheckedChanged(object sender, EventArgs e) {
// Enable/disable the low/high/bank radio group.
// Update preview window.
UpdateControls();
}
/// <summary>
/// Handles CheckedChanged event for all radio buttons in symbol-part group.
/// </summary>
private void PartGroup_CheckedChanged(object sender, EventArgs e) {
// Update preview window.
UpdateControls();
}
private void okButton_Click(object sender, EventArgs e) {
FormatDescriptor = CreateDescriptorFromControls();
//
// Extract the current shortcut action. For dialog configuration purposes we
// want to capture the current state. For the caller, we force it to "none"
// if we're not using a symbol format.
//
SymbolShortcutAction action = SymbolShortcutAction.None;
if (labelInsteadRadioButton.Checked) {
action = SymbolShortcutAction.CreateLabelInstead;
} else if (operandAndLabelRadioButton.Checked) {
action = SymbolShortcutAction.CreateLabelAlso;
} else if (operandAndProjRadioButton.Checked) {
action = SymbolShortcutAction.CreateProjectSymbolAlso;
} else if (operandOnlyRadioButton.Checked) {
action = SymbolShortcutAction.None;
} else {
Debug.Assert(false);
action = SymbolShortcutAction.None;
}
sLastAction = action;
if (radioButtonSymbol.Checked && FormatDescriptor != null) {
// Only report a shortcut action if they've entered a symbol. If they
// checked symbol but left the field blank, they're just trying to delete
// the format.
ShortcutAction = action;
} else {
ShortcutAction = SymbolShortcutAction.None;
}
}
/// <summary>
/// Updates all of the controls to reflect the current internal state.
/// </summary>
private void UpdateControls() {
if (mIsInitialSetup) {
return;
}
symbolPartPanel.Enabled = radioButtonSymbol.Checked && mIsExtendedImmediate;
symbolShortcutsGroupBox.Enabled = radioButtonSymbol.Checked;
SetPreviewText();
bool isOk = true;
if (radioButtonSymbol.Checked) {
// Just check for correct format. References to non-existent labels are allowed.
//
// We try to block references to auto labels, but it's possible to get around it
// (replace auto label with user label, reference non-existent auto label,
// remove user label). We could try harder, but currently not necessary.
isOk = !mIsSymbolAuto && Asm65.Label.ValidateLabel(symbolTextBox.Text);
// Allow empty strings as a way to delete the label and return to "default".
if (string.IsNullOrEmpty(symbolTextBox.Text)) {
isOk = true;
}
ConfigureSymbolShortcuts();
}
okButton.Enabled = isOk;
}
/// <summary>
/// Sets the text displayed in the "preview" text box.
/// </summary>
private void SetPreviewText() {
//symbolValueLabel.Text = string.Empty;
mIsSymbolAuto = false;
FormatDescriptor dfd = CreateDescriptorFromControls();
if (dfd == null) {
// Default format. We can't actually know what this look like, so just
// clear the box.
previewTextBox.Text = string.Empty;
return;
}
if (dfd.FormatSubType == FormatDescriptor.SubType.Symbol &&
string.IsNullOrEmpty(dfd.SymbolRef.Label)) {
// no label yet, nothing to show
previewTextBox.Text = string.Empty;
return;
}
StringBuilder preview = new StringBuilder();
if (mShowHashPrefix) {
preview.Append('#');
}
switch (dfd.FormatSubType) {
case FormatDescriptor.SubType.Hex:
preview.Append(mFormatter.FormatHexValue(mOperandValue, mPreviewHexDigits));
break;
case FormatDescriptor.SubType.Decimal:
preview.Append(mFormatter.FormatDecimalValue(mOperandValue));
break;
case FormatDescriptor.SubType.Binary:
preview.Append(mFormatter.FormatBinaryValue(mOperandValue, 8));
break;
case FormatDescriptor.SubType.Ascii:
preview.Append(mFormatter.FormatAsciiOrHex(mOperandValue));
break;
case FormatDescriptor.SubType.Symbol:
if (mProject.SymbolTable.TryGetValue(dfd.SymbolRef.Label, out Symbol sym)) {
if (mIsBlockMove) {
// For a 24-bit symbol, we grab the high byte. This is the
// expected behavior, according to Eyes & Lichty; see the
// explanation of the MVP instruction. For an 8-bit symbol
// the assembler just takes the value.
// TODO(someday): allow a different symbol for each part of the
// operand.
if (sym.Value > 0xff) {
radioButtonBank.Checked = true;
} else {
radioButtonLow.Checked = true;
}
dfd = CreateDescriptorFromControls();
}
// Hack to make relative branches look right in the preview window.
// Otherwise they show up like "<LABEL" because they appear to be
// only 8 bits.
int operandLen = dfd.Length - 1;
if (operandLen == 1 && mIsPcRelative) {
operandLen = 2;
}
PseudoOp.FormatNumericOpFlags flags;
if (mIsPcRelative) {
flags = PseudoOp.FormatNumericOpFlags.IsPcRel;
} else if (mShowHashPrefix) {
flags = PseudoOp.FormatNumericOpFlags.HasHashPrefix;
} else {
flags = PseudoOp.FormatNumericOpFlags.None;
}
string str = PseudoOp.FormatNumericOperand(mFormatter,
mProject.SymbolTable, null, dfd,
mOperandValue, operandLen, flags);
preview.Append(str);
if (sym.SymbolSource == Symbol.Source.Auto) {
mIsSymbolAuto = true;
}
} else {
preview.Append(dfd.SymbolRef.Label + " (?)");
Debug.Assert(!string.IsNullOrEmpty(dfd.SymbolRef.Label));
//symbolValueLabel.Text = Properties.Resources.MSG_SYMBOL_NOT_FOUND;
}
break;
default:
Debug.Assert(false);
preview.Append("BUG");
break;
}
previewTextBox.Text = preview.ToString();
}
/// <summary>
/// Configures the buttons in the "symbol shortcuts" group box. The entire box is
/// disabled unless "symbol" is selected. Other options are selectively enabled or
/// disabled as appropriate for the current input. If we disable the selection option,
/// the selection will be reset to default.
/// </summary>
private void ConfigureSymbolShortcuts() {
// operandOnlyRadioButton: always enabled
// labelInsteadRadioButton: symbol is unknown and operand address has no label
// operandAndLabelRadioButton: same as labelInstead
// operandAndProjRadioButton: symbol is unknown and operand address is outside project
string labelStr = symbolTextBox.Text;
ShortcutArg = -1;
// Is this a known symbol? If so, disable most options and bail.
if (mProject.SymbolTable.TryGetValue(labelStr, out Symbol sym)) {
labelInsteadRadioButton.Enabled = operandAndLabelRadioButton.Enabled =
operandAndProjRadioButton.Enabled = false;
operandOnlyRadioButton.Checked = true;
return;
}
if (mAttr.OperandOffset >= 0) {
// Operand target is inside the file. Does the target offset already have a label?
int targetOffset =
DataAnalysis.GetBaseOperandOffset(mProject, mAttr.OperandOffset);
bool hasLabel = mProject.UserLabels.ContainsKey(targetOffset);
labelInsteadRadioButton.Enabled = operandAndLabelRadioButton.Enabled =
!hasLabel;
operandAndProjRadioButton.Enabled = false;
ShortcutArg = targetOffset;
} else if (mAttr.OperandAddress >= 0) {
// Operand target is outside the file.
labelInsteadRadioButton.Enabled = operandAndLabelRadioButton.Enabled = false;
operandAndProjRadioButton.Enabled = true;
ShortcutArg = mAttr.OperandAddress;
} else {
// Probably an immediate operand.
labelInsteadRadioButton.Enabled = operandAndLabelRadioButton.Enabled =
operandAndProjRadioButton.Enabled = false;
}
// Select the default option if the currently-selected option is no longer available.
if ((labelInsteadRadioButton.Checked && !labelInsteadRadioButton.Enabled) ||
(operandAndLabelRadioButton.Checked && !operandAndLabelRadioButton.Enabled) ||
(operandAndProjRadioButton.Checked && !operandAndProjRadioButton.Enabled)) {
operandOnlyRadioButton.Checked = true;
}
}
/// <summary>
/// Configures the dialog controls based on the provided format descriptor.
/// </summary>
/// <param name="dfd">FormatDescriptor to use.</param>
private void SetControlsFromDescriptor(FormatDescriptor dfd) {
Debug.Assert(mIsInitialSetup);
radioButtonLow.Checked = true;
if (dfd == null) {
radioButtonDefault.Checked = true;
return;
}
// NOTE: it's entirely possible to have a weird format (e.g. string) if the
// instruction used to be hinted as data. Handle it gracefully.
switch (dfd.FormatType) {
case FormatDescriptor.Type.NumericLE:
switch (dfd.FormatSubType) {
case FormatDescriptor.SubType.Hex:
radioButtonHex.Checked = true;
break;
case FormatDescriptor.SubType.Decimal:
radioButtonDecimal.Checked = true;
break;
case FormatDescriptor.SubType.Binary:
radioButtonBinary.Checked = true;
break;
case FormatDescriptor.SubType.Ascii:
radioButtonAscii.Checked = true;
break;
case FormatDescriptor.SubType.Symbol:
Debug.Assert(dfd.HasSymbol);
radioButtonSymbol.Checked = true;
switch (dfd.SymbolRef.ValuePart) {
case WeakSymbolRef.Part.Low:
radioButtonLow.Checked = true;
break;
case WeakSymbolRef.Part.High:
radioButtonHigh.Checked = true;
break;
case WeakSymbolRef.Part.Bank:
radioButtonBank.Checked = true;
break;
default:
Debug.Assert(false);
break;
}
symbolTextBox.Text = dfd.SymbolRef.Label;
break;
case FormatDescriptor.SubType.None:
default:
// Unexpected; call it hex.
radioButtonHex.Checked = true;
break;
}
break;
case FormatDescriptor.Type.NumericBE:
case FormatDescriptor.Type.String:
case FormatDescriptor.Type.Fill:
default:
// Unexpected; used to be data?
radioButtonDefault.Checked = true;
break;
}
}
/// <summary>
/// Creates a FormatDescriptor from the current state of the dialog controls.
/// </summary>
/// <returns>New FormatDescriptor.</returns>
private FormatDescriptor CreateDescriptorFromControls() {
if (radioButtonSymbol.Checked) {
if (string.IsNullOrEmpty(symbolTextBox.Text)) {
// empty symbol --> default format (intuitive way to delete label reference)
return null;
}
WeakSymbolRef.Part part;
if (radioButtonLow.Checked) {
part = WeakSymbolRef.Part.Low;
} else if (radioButtonHigh.Checked) {
part = WeakSymbolRef.Part.High;
} else if (radioButtonBank.Checked) {
part = WeakSymbolRef.Part.Bank;
} else {
Debug.Assert(false);
part = WeakSymbolRef.Part.Low;
}
return FormatDescriptor.Create(mInstructionLength,
new WeakSymbolRef(symbolTextBox.Text, part), false);
}
FormatDescriptor.SubType subType;
if (radioButtonDefault.Checked) {
return null;
} else if (radioButtonHex.Checked) {
subType = FormatDescriptor.SubType.Hex;
} else if (radioButtonDecimal.Checked) {
subType = FormatDescriptor.SubType.Decimal;
} else if (radioButtonBinary.Checked) {
subType = FormatDescriptor.SubType.Binary;
} else if (radioButtonAscii.Checked) {
subType = FormatDescriptor.SubType.Ascii;
} else if (radioButtonSymbol.Checked) {
subType = FormatDescriptor.SubType.Symbol;
} else {
Debug.Assert(false);
subType = FormatDescriptor.SubType.None;
}
return FormatDescriptor.Create(mInstructionLength,
FormatDescriptor.Type.NumericLE, subType);
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,676 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class EditProjectProperties {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem(new string[] {
"0123456789AB",
"%00000000",
"Const",
"This is a test to gauge column widths"}, -1);
this.tabControl1 = new System.Windows.Forms.TabControl();
this.generalTab = new System.Windows.Forms.TabPage();
this.miscGroupBox = new System.Windows.Forms.GroupBox();
this.autoLabelStyleComboBox = new System.Windows.Forms.ComboBox();
this.autoLabelStyleLabel = new System.Windows.Forms.Label();
this.analysisGroupBox = new System.Windows.Forms.GroupBox();
this.seekAltTargetCheckBox = new System.Windows.Forms.CheckBox();
this.minStringCharsComboBox = new System.Windows.Forms.ComboBox();
this.minCharsForStringLabel = new System.Windows.Forms.Label();
this.analyzeUncategorizedCheckBox = new System.Windows.Forms.CheckBox();
this.entryFlagsGroupBox = new System.Windows.Forms.GroupBox();
this.flagsLabel = new System.Windows.Forms.Label();
this.currentFlagsLabel = new System.Windows.Forms.Label();
this.changeFlagButton = new System.Windows.Forms.Button();
this.cpuGroupBox = new System.Windows.Forms.GroupBox();
this.undocInstrCheckBox = new System.Windows.Forms.CheckBox();
this.cpuComboBox = new System.Windows.Forms.ComboBox();
this.symbolsTab = new System.Windows.Forms.TabPage();
this.importSymbolsButton = new System.Windows.Forms.Button();
this.editSymbolButton = new System.Windows.Forms.Button();
this.removeSymbolButton = new System.Windows.Forms.Button();
this.newSymbolButton = new System.Windows.Forms.Button();
this.symbolsDefinedLabel = new System.Windows.Forms.Label();
this.projectSymbolsListView = new System.Windows.Forms.ListView();
this.nameColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.valueColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.typeColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.commentColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.symbolFilesTab = new System.Windows.Forms.TabPage();
this.symbolFileDownButton = new System.Windows.Forms.Button();
this.symbolFileUpButton = new System.Windows.Forms.Button();
this.addSymbolFilesButton = new System.Windows.Forms.Button();
this.symbolFileRemoveButton = new System.Windows.Forms.Button();
this.symbolFilesListBox = new System.Windows.Forms.ListBox();
this.configuredFilesLabel = new System.Windows.Forms.Label();
this.extensionScriptsTab = new System.Windows.Forms.TabPage();
this.extensionScriptRemoveButton = new System.Windows.Forms.Button();
this.addExtensionScriptsButton = new System.Windows.Forms.Button();
this.extensionScriptsListBox = new System.Windows.Forms.ListBox();
this.configuredScriptsLabel = new System.Windows.Forms.Label();
this.labelUndoRedoNote = new System.Windows.Forms.Label();
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.applyButton = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.generalTab.SuspendLayout();
this.miscGroupBox.SuspendLayout();
this.analysisGroupBox.SuspendLayout();
this.entryFlagsGroupBox.SuspendLayout();
this.cpuGroupBox.SuspendLayout();
this.symbolsTab.SuspendLayout();
this.symbolFilesTab.SuspendLayout();
this.extensionScriptsTab.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tabControl1.Controls.Add(this.generalTab);
this.tabControl1.Controls.Add(this.symbolsTab);
this.tabControl1.Controls.Add(this.symbolFilesTab);
this.tabControl1.Controls.Add(this.extensionScriptsTab);
this.tabControl1.Location = new System.Drawing.Point(2, 2);
this.tabControl1.Multiline = true;
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(622, 318);
this.tabControl1.TabIndex = 0;
//
// generalTab
//
this.generalTab.Controls.Add(this.miscGroupBox);
this.generalTab.Controls.Add(this.analysisGroupBox);
this.generalTab.Controls.Add(this.entryFlagsGroupBox);
this.generalTab.Controls.Add(this.cpuGroupBox);
this.generalTab.Location = new System.Drawing.Point(4, 22);
this.generalTab.Name = "generalTab";
this.generalTab.Padding = new System.Windows.Forms.Padding(3);
this.generalTab.Size = new System.Drawing.Size(614, 292);
this.generalTab.TabIndex = 0;
this.generalTab.Text = "General";
this.generalTab.UseVisualStyleBackColor = true;
//
// miscGroupBox
//
this.miscGroupBox.Controls.Add(this.autoLabelStyleComboBox);
this.miscGroupBox.Controls.Add(this.autoLabelStyleLabel);
this.miscGroupBox.Location = new System.Drawing.Point(7, 177);
this.miscGroupBox.Name = "miscGroupBox";
this.miscGroupBox.Size = new System.Drawing.Size(422, 100);
this.miscGroupBox.TabIndex = 3;
this.miscGroupBox.TabStop = false;
this.miscGroupBox.Text = "Miscellaneous";
//
// autoLabelStyleComboBox
//
this.autoLabelStyleComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.autoLabelStyleComboBox.FormattingEnabled = true;
this.autoLabelStyleComboBox.Items.AddRange(new object[] {
"Simple (\"L1234\")",
"Annotated (\"W_1234\")",
"Fully Annotated (\"DWR_1234\")"});
this.autoLabelStyleComboBox.Location = new System.Drawing.Point(98, 19);
this.autoLabelStyleComboBox.Name = "autoLabelStyleComboBox";
this.autoLabelStyleComboBox.Size = new System.Drawing.Size(318, 21);
this.autoLabelStyleComboBox.TabIndex = 1;
this.autoLabelStyleComboBox.SelectedIndexChanged += new System.EventHandler(this.autoLabelStyleComboBox_SelectedIndexChanged);
//
// autoLabelStyleLabel
//
this.autoLabelStyleLabel.AutoSize = true;
this.autoLabelStyleLabel.Location = new System.Drawing.Point(6, 22);
this.autoLabelStyleLabel.Name = "autoLabelStyleLabel";
this.autoLabelStyleLabel.Size = new System.Drawing.Size(81, 13);
this.autoLabelStyleLabel.TabIndex = 0;
this.autoLabelStyleLabel.Text = "Auto-label style:";
//
// analysisGroupBox
//
this.analysisGroupBox.Controls.Add(this.seekAltTargetCheckBox);
this.analysisGroupBox.Controls.Add(this.minStringCharsComboBox);
this.analysisGroupBox.Controls.Add(this.minCharsForStringLabel);
this.analysisGroupBox.Controls.Add(this.analyzeUncategorizedCheckBox);
this.analysisGroupBox.Location = new System.Drawing.Point(225, 7);
this.analysisGroupBox.Name = "analysisGroupBox";
this.analysisGroupBox.Size = new System.Drawing.Size(204, 163);
this.analysisGroupBox.TabIndex = 2;
this.analysisGroupBox.TabStop = false;
this.analysisGroupBox.Text = "Analysis Parameters";
//
// seekAltTargetCheckBox
//
this.seekAltTargetCheckBox.AutoSize = true;
this.seekAltTargetCheckBox.Location = new System.Drawing.Point(7, 45);
this.seekAltTargetCheckBox.Name = "seekAltTargetCheckBox";
this.seekAltTargetCheckBox.Size = new System.Drawing.Size(121, 17);
this.seekAltTargetCheckBox.TabIndex = 3;
this.seekAltTargetCheckBox.Text = "Seek nearby targets";
this.seekAltTargetCheckBox.UseVisualStyleBackColor = true;
this.seekAltTargetCheckBox.CheckedChanged += new System.EventHandler(this.seekAltTargetCheckBox_CheckedChanged);
//
// minStringCharsComboBox
//
this.minStringCharsComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.minStringCharsComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.minStringCharsComboBox.FormattingEnabled = true;
this.minStringCharsComboBox.Items.AddRange(new object[] {
"None (disabled)",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10"});
this.minStringCharsComboBox.Location = new System.Drawing.Point(7, 88);
this.minStringCharsComboBox.Name = "minStringCharsComboBox";
this.minStringCharsComboBox.Size = new System.Drawing.Size(191, 21);
this.minStringCharsComboBox.TabIndex = 2;
this.minStringCharsComboBox.SelectedIndexChanged += new System.EventHandler(this.minStringCharsComboBox_SelectedIndexChanged);
//
// minCharsForStringLabel
//
this.minCharsForStringLabel.AutoSize = true;
this.minCharsForStringLabel.Location = new System.Drawing.Point(7, 71);
this.minCharsForStringLabel.Name = "minCharsForStringLabel";
this.minCharsForStringLabel.Size = new System.Drawing.Size(147, 13);
this.minCharsForStringLabel.TabIndex = 1;
this.minCharsForStringLabel.Text = "Minimum characters for string:";
//
// analyzeUncategorizedCheckBox
//
this.analyzeUncategorizedCheckBox.AutoSize = true;
this.analyzeUncategorizedCheckBox.Location = new System.Drawing.Point(7, 21);
this.analyzeUncategorizedCheckBox.Name = "analyzeUncategorizedCheckBox";
this.analyzeUncategorizedCheckBox.Size = new System.Drawing.Size(157, 17);
this.analyzeUncategorizedCheckBox.TabIndex = 0;
this.analyzeUncategorizedCheckBox.Text = "Analyze uncategorized data";
this.analyzeUncategorizedCheckBox.UseVisualStyleBackColor = true;
this.analyzeUncategorizedCheckBox.CheckedChanged += new System.EventHandler(this.analyzeUncategorizedCheckBox_CheckedChanged);
//
// entryFlagsGroupBox
//
this.entryFlagsGroupBox.Controls.Add(this.flagsLabel);
this.entryFlagsGroupBox.Controls.Add(this.currentFlagsLabel);
this.entryFlagsGroupBox.Controls.Add(this.changeFlagButton);
this.entryFlagsGroupBox.Location = new System.Drawing.Point(7, 92);
this.entryFlagsGroupBox.Name = "entryFlagsGroupBox";
this.entryFlagsGroupBox.Size = new System.Drawing.Size(204, 78);
this.entryFlagsGroupBox.TabIndex = 1;
this.entryFlagsGroupBox.TabStop = false;
this.entryFlagsGroupBox.Text = "Entry Flags";
//
// flagsLabel
//
this.flagsLabel.AutoSize = true;
this.flagsLabel.Location = new System.Drawing.Point(7, 20);
this.flagsLabel.Name = "flagsLabel";
this.flagsLabel.Size = new System.Drawing.Size(35, 13);
this.flagsLabel.TabIndex = 0;
this.flagsLabel.Text = "Flags:";
//
// currentFlagsLabel
//
this.currentFlagsLabel.AutoSize = true;
this.currentFlagsLabel.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.currentFlagsLabel.Location = new System.Drawing.Point(38, 21);
this.currentFlagsLabel.Name = "currentFlagsLabel";
this.currentFlagsLabel.Size = new System.Drawing.Size(163, 13);
this.currentFlagsLabel.TabIndex = 1;
this.currentFlagsLabel.Text = "N- V- M- X- D- I- Z- C- E-";
//
// changeFlagButton
//
this.changeFlagButton.Location = new System.Drawing.Point(10, 42);
this.changeFlagButton.Name = "changeFlagButton";
this.changeFlagButton.Size = new System.Drawing.Size(91, 23);
this.changeFlagButton.TabIndex = 2;
this.changeFlagButton.Text = "Change";
this.changeFlagButton.UseVisualStyleBackColor = true;
this.changeFlagButton.Click += new System.EventHandler(this.changeFlagButton_Click);
//
// cpuGroupBox
//
this.cpuGroupBox.Controls.Add(this.undocInstrCheckBox);
this.cpuGroupBox.Controls.Add(this.cpuComboBox);
this.cpuGroupBox.Location = new System.Drawing.Point(7, 7);
this.cpuGroupBox.Name = "cpuGroupBox";
this.cpuGroupBox.Size = new System.Drawing.Size(204, 78);
this.cpuGroupBox.TabIndex = 0;
this.cpuGroupBox.TabStop = false;
this.cpuGroupBox.Text = "CPU";
//
// undocInstrCheckBox
//
this.undocInstrCheckBox.AutoSize = true;
this.undocInstrCheckBox.Location = new System.Drawing.Point(7, 47);
this.undocInstrCheckBox.Name = "undocInstrCheckBox";
this.undocInstrCheckBox.Size = new System.Drawing.Size(189, 17);
this.undocInstrCheckBox.TabIndex = 1;
this.undocInstrCheckBox.Text = "Enable undocumented instructions";
this.undocInstrCheckBox.UseVisualStyleBackColor = true;
this.undocInstrCheckBox.CheckedChanged += new System.EventHandler(this.undocInstrCheckBox_CheckedChanged);
//
// cpuComboBox
//
this.cpuComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cpuComboBox.FormattingEnabled = true;
this.cpuComboBox.Items.AddRange(new object[] {
"MOS 6502",
"WDC W65C02S",
"WDC W65C816S"});
this.cpuComboBox.Location = new System.Drawing.Point(6, 19);
this.cpuComboBox.Name = "cpuComboBox";
this.cpuComboBox.Size = new System.Drawing.Size(190, 21);
this.cpuComboBox.TabIndex = 0;
this.cpuComboBox.SelectedIndexChanged += new System.EventHandler(this.cpuComboBox_SelectedIndexChanged);
//
// symbolsTab
//
this.symbolsTab.Controls.Add(this.importSymbolsButton);
this.symbolsTab.Controls.Add(this.editSymbolButton);
this.symbolsTab.Controls.Add(this.removeSymbolButton);
this.symbolsTab.Controls.Add(this.newSymbolButton);
this.symbolsTab.Controls.Add(this.symbolsDefinedLabel);
this.symbolsTab.Controls.Add(this.projectSymbolsListView);
this.symbolsTab.Location = new System.Drawing.Point(4, 22);
this.symbolsTab.Name = "symbolsTab";
this.symbolsTab.Padding = new System.Windows.Forms.Padding(3);
this.symbolsTab.Size = new System.Drawing.Size(614, 292);
this.symbolsTab.TabIndex = 1;
this.symbolsTab.Text = "Project Symbols";
this.symbolsTab.UseVisualStyleBackColor = true;
//
// importSymbolsButton
//
this.importSymbolsButton.Location = new System.Drawing.Point(506, 158);
this.importSymbolsButton.Name = "importSymbolsButton";
this.importSymbolsButton.Size = new System.Drawing.Size(102, 23);
this.importSymbolsButton.TabIndex = 5;
this.importSymbolsButton.Text = "&Import...";
this.importSymbolsButton.UseVisualStyleBackColor = true;
this.importSymbolsButton.Click += new System.EventHandler(this.importSymbolsButton_Click);
//
// editSymbolButton
//
this.editSymbolButton.Location = new System.Drawing.Point(506, 52);
this.editSymbolButton.Name = "editSymbolButton";
this.editSymbolButton.Size = new System.Drawing.Size(102, 23);
this.editSymbolButton.TabIndex = 3;
this.editSymbolButton.Text = "&Edit Symbol...";
this.editSymbolButton.UseVisualStyleBackColor = true;
this.editSymbolButton.Click += new System.EventHandler(this.editSymbolButton_Click);
//
// removeSymbolButton
//
this.removeSymbolButton.Location = new System.Drawing.Point(506, 81);
this.removeSymbolButton.Name = "removeSymbolButton";
this.removeSymbolButton.Size = new System.Drawing.Size(102, 23);
this.removeSymbolButton.TabIndex = 4;
this.removeSymbolButton.Text = "&Remove";
this.removeSymbolButton.UseVisualStyleBackColor = true;
this.removeSymbolButton.Click += new System.EventHandler(this.removeSymbolButton_Click);
//
// newSymbolButton
//
this.newSymbolButton.Location = new System.Drawing.Point(506, 23);
this.newSymbolButton.Name = "newSymbolButton";
this.newSymbolButton.Size = new System.Drawing.Size(102, 23);
this.newSymbolButton.TabIndex = 2;
this.newSymbolButton.Text = "&New Symbol...";
this.newSymbolButton.UseVisualStyleBackColor = true;
this.newSymbolButton.Click += new System.EventHandler(this.newSymbolButton_Click);
//
// symbolsDefinedLabel
//
this.symbolsDefinedLabel.AutoSize = true;
this.symbolsDefinedLabel.Location = new System.Drawing.Point(7, 7);
this.symbolsDefinedLabel.Name = "symbolsDefinedLabel";
this.symbolsDefinedLabel.Size = new System.Drawing.Size(133, 13);
this.symbolsDefinedLabel.TabIndex = 0;
this.symbolsDefinedLabel.Text = "Symbols defined in project:";
//
// projectSymbolsListView
//
this.projectSymbolsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.nameColumnHeader,
this.valueColumnHeader,
this.typeColumnHeader,
this.commentColumnHeader});
this.projectSymbolsListView.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.projectSymbolsListView.FullRowSelect = true;
this.projectSymbolsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.projectSymbolsListView.HideSelection = false;
this.projectSymbolsListView.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
listViewItem1});
this.projectSymbolsListView.Location = new System.Drawing.Point(11, 23);
this.projectSymbolsListView.MultiSelect = false;
this.projectSymbolsListView.Name = "projectSymbolsListView";
this.projectSymbolsListView.Size = new System.Drawing.Size(489, 259);
this.projectSymbolsListView.TabIndex = 1;
this.projectSymbolsListView.UseCompatibleStateImageBehavior = false;
this.projectSymbolsListView.View = System.Windows.Forms.View.Details;
this.projectSymbolsListView.SelectedIndexChanged += new System.EventHandler(this.projectSymbolsListView_SelectedIndexChanged);
this.projectSymbolsListView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.projectSymbolsListView_MouseDoubleClick);
//
// nameColumnHeader
//
this.nameColumnHeader.Text = "Name";
this.nameColumnHeader.Width = 109;
//
// valueColumnHeader
//
this.valueColumnHeader.Text = "Value";
this.valueColumnHeader.Width = 69;
//
// typeColumnHeader
//
this.typeColumnHeader.Text = "Type";
this.typeColumnHeader.Width = 42;
//
// commentColumnHeader
//
this.commentColumnHeader.Text = "Comment";
this.commentColumnHeader.Width = 264;
//
// symbolFilesTab
//
this.symbolFilesTab.Controls.Add(this.symbolFileDownButton);
this.symbolFilesTab.Controls.Add(this.symbolFileUpButton);
this.symbolFilesTab.Controls.Add(this.addSymbolFilesButton);
this.symbolFilesTab.Controls.Add(this.symbolFileRemoveButton);
this.symbolFilesTab.Controls.Add(this.symbolFilesListBox);
this.symbolFilesTab.Controls.Add(this.configuredFilesLabel);
this.symbolFilesTab.Location = new System.Drawing.Point(4, 22);
this.symbolFilesTab.Name = "symbolFilesTab";
this.symbolFilesTab.Padding = new System.Windows.Forms.Padding(3);
this.symbolFilesTab.Size = new System.Drawing.Size(614, 292);
this.symbolFilesTab.TabIndex = 2;
this.symbolFilesTab.Text = "Symbol Files";
this.symbolFilesTab.UseVisualStyleBackColor = true;
//
// symbolFileDownButton
//
this.symbolFileDownButton.Location = new System.Drawing.Point(319, 57);
this.symbolFileDownButton.Name = "symbolFileDownButton";
this.symbolFileDownButton.Size = new System.Drawing.Size(75, 23);
this.symbolFileDownButton.TabIndex = 4;
this.symbolFileDownButton.Text = "Down";
this.symbolFileDownButton.UseVisualStyleBackColor = true;
this.symbolFileDownButton.Click += new System.EventHandler(this.symbolFileDownButton_Click);
//
// symbolFileUpButton
//
this.symbolFileUpButton.Location = new System.Drawing.Point(319, 28);
this.symbolFileUpButton.Name = "symbolFileUpButton";
this.symbolFileUpButton.Size = new System.Drawing.Size(75, 23);
this.symbolFileUpButton.TabIndex = 3;
this.symbolFileUpButton.Text = "Up";
this.symbolFileUpButton.UseVisualStyleBackColor = true;
this.symbolFileUpButton.Click += new System.EventHandler(this.symbolFileUpButton_Click);
//
// addSymbolFilesButton
//
this.addSymbolFilesButton.Location = new System.Drawing.Point(8, 249);
this.addSymbolFilesButton.Name = "addSymbolFilesButton";
this.addSymbolFilesButton.Size = new System.Drawing.Size(134, 23);
this.addSymbolFilesButton.TabIndex = 2;
this.addSymbolFilesButton.Text = "Add Symbol Files...";
this.addSymbolFilesButton.UseVisualStyleBackColor = true;
this.addSymbolFilesButton.Click += new System.EventHandler(this.addSymbolFilesButton_Click);
//
// symbolFileRemoveButton
//
this.symbolFileRemoveButton.Location = new System.Drawing.Point(319, 97);
this.symbolFileRemoveButton.Name = "symbolFileRemoveButton";
this.symbolFileRemoveButton.Size = new System.Drawing.Size(75, 23);
this.symbolFileRemoveButton.TabIndex = 5;
this.symbolFileRemoveButton.Text = "Remove";
this.symbolFileRemoveButton.UseVisualStyleBackColor = true;
this.symbolFileRemoveButton.Click += new System.EventHandler(this.symbolFileRemoveButton_Click);
//
// symbolFilesListBox
//
this.symbolFilesListBox.FormattingEnabled = true;
this.symbolFilesListBox.Location = new System.Drawing.Point(8, 28);
this.symbolFilesListBox.Name = "symbolFilesListBox";
this.symbolFilesListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.symbolFilesListBox.Size = new System.Drawing.Size(305, 212);
this.symbolFilesListBox.TabIndex = 1;
this.symbolFilesListBox.SelectedIndexChanged += new System.EventHandler(this.symbolFilesListBox_SelectedIndexChanged);
//
// configuredFilesLabel
//
this.configuredFilesLabel.AutoSize = true;
this.configuredFilesLabel.Location = new System.Drawing.Point(7, 7);
this.configuredFilesLabel.Name = "configuredFilesLabel";
this.configuredFilesLabel.Size = new System.Drawing.Size(160, 13);
this.configuredFilesLabel.TabIndex = 0;
this.configuredFilesLabel.Text = "Currently configured symbol files:";
//
// extensionScriptsTab
//
this.extensionScriptsTab.Controls.Add(this.extensionScriptRemoveButton);
this.extensionScriptsTab.Controls.Add(this.addExtensionScriptsButton);
this.extensionScriptsTab.Controls.Add(this.extensionScriptsListBox);
this.extensionScriptsTab.Controls.Add(this.configuredScriptsLabel);
this.extensionScriptsTab.Location = new System.Drawing.Point(4, 22);
this.extensionScriptsTab.Name = "extensionScriptsTab";
this.extensionScriptsTab.Padding = new System.Windows.Forms.Padding(3);
this.extensionScriptsTab.Size = new System.Drawing.Size(614, 292);
this.extensionScriptsTab.TabIndex = 3;
this.extensionScriptsTab.Text = "Extension Scripts";
this.extensionScriptsTab.UseVisualStyleBackColor = true;
//
// extensionScriptRemoveButton
//
this.extensionScriptRemoveButton.Location = new System.Drawing.Point(320, 28);
this.extensionScriptRemoveButton.Name = "extensionScriptRemoveButton";
this.extensionScriptRemoveButton.Size = new System.Drawing.Size(75, 23);
this.extensionScriptRemoveButton.TabIndex = 3;
this.extensionScriptRemoveButton.Text = "Remove";
this.extensionScriptRemoveButton.UseVisualStyleBackColor = true;
this.extensionScriptRemoveButton.Click += new System.EventHandler(this.extensionScriptRemoveButton_Click);
//
// addExtensionScriptsButton
//
this.addExtensionScriptsButton.Location = new System.Drawing.Point(8, 249);
this.addExtensionScriptsButton.Name = "addExtensionScriptsButton";
this.addExtensionScriptsButton.Size = new System.Drawing.Size(134, 23);
this.addExtensionScriptsButton.TabIndex = 2;
this.addExtensionScriptsButton.Text = "Add Scripts...";
this.addExtensionScriptsButton.UseVisualStyleBackColor = true;
this.addExtensionScriptsButton.Click += new System.EventHandler(this.addExtensionScriptsButton_Click);
//
// extensionScriptsListBox
//
this.extensionScriptsListBox.FormattingEnabled = true;
this.extensionScriptsListBox.Location = new System.Drawing.Point(8, 28);
this.extensionScriptsListBox.Name = "extensionScriptsListBox";
this.extensionScriptsListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.extensionScriptsListBox.Size = new System.Drawing.Size(305, 212);
this.extensionScriptsListBox.TabIndex = 1;
this.extensionScriptsListBox.SelectedIndexChanged += new System.EventHandler(this.extensionScriptsListBox_SelectedIndexChanged);
//
// configuredScriptsLabel
//
this.configuredScriptsLabel.AutoSize = true;
this.configuredScriptsLabel.Location = new System.Drawing.Point(7, 7);
this.configuredScriptsLabel.Name = "configuredScriptsLabel";
this.configuredScriptsLabel.Size = new System.Drawing.Size(185, 13);
this.configuredScriptsLabel.TabIndex = 0;
this.configuredScriptsLabel.Text = "Currently configured extension scripts:";
//
// labelUndoRedoNote
//
this.labelUndoRedoNote.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelUndoRedoNote.AutoSize = true;
this.labelUndoRedoNote.Location = new System.Drawing.Point(12, 331);
this.labelUndoRedoNote.Name = "labelUndoRedoNote";
this.labelUndoRedoNote.Size = new System.Drawing.Size(248, 13);
this.labelUndoRedoNote.TabIndex = 1;
this.labelUndoRedoNote.Text = "NOTE: changes are added to the undo/redo buffer";
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(537, 326);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 4;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(456, 326);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 3;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// applyButton
//
this.applyButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.applyButton.Location = new System.Drawing.Point(354, 326);
this.applyButton.Name = "applyButton";
this.applyButton.Size = new System.Drawing.Size(75, 23);
this.applyButton.TabIndex = 2;
this.applyButton.Text = "Apply";
this.applyButton.UseVisualStyleBackColor = true;
this.applyButton.Click += new System.EventHandler(this.applyButton_Click);
//
// EditProjectProperties
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(624, 361);
this.Controls.Add(this.applyButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.labelUndoRedoNote);
this.Controls.Add(this.tabControl1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "EditProjectProperties";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Project Properties";
this.Load += new System.EventHandler(this.EditProperties_Load);
this.tabControl1.ResumeLayout(false);
this.generalTab.ResumeLayout(false);
this.miscGroupBox.ResumeLayout(false);
this.miscGroupBox.PerformLayout();
this.analysisGroupBox.ResumeLayout(false);
this.analysisGroupBox.PerformLayout();
this.entryFlagsGroupBox.ResumeLayout(false);
this.entryFlagsGroupBox.PerformLayout();
this.cpuGroupBox.ResumeLayout(false);
this.cpuGroupBox.PerformLayout();
this.symbolsTab.ResumeLayout(false);
this.symbolsTab.PerformLayout();
this.symbolFilesTab.ResumeLayout(false);
this.symbolFilesTab.PerformLayout();
this.extensionScriptsTab.ResumeLayout(false);
this.extensionScriptsTab.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage generalTab;
private System.Windows.Forms.ComboBox cpuComboBox;
private System.Windows.Forms.TabPage symbolsTab;
private System.Windows.Forms.Label labelUndoRedoNote;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button applyButton;
private System.Windows.Forms.Label currentFlagsLabel;
private System.Windows.Forms.Button changeFlagButton;
private System.Windows.Forms.Label symbolsDefinedLabel;
private System.Windows.Forms.ListView projectSymbolsListView;
private System.Windows.Forms.ColumnHeader nameColumnHeader;
private System.Windows.Forms.ColumnHeader valueColumnHeader;
private System.Windows.Forms.ColumnHeader typeColumnHeader;
private System.Windows.Forms.TabPage symbolFilesTab;
private System.Windows.Forms.Button addSymbolFilesButton;
private System.Windows.Forms.Button symbolFileRemoveButton;
private System.Windows.Forms.ListBox symbolFilesListBox;
private System.Windows.Forms.Label configuredFilesLabel;
private System.Windows.Forms.Button removeSymbolButton;
private System.Windows.Forms.Button newSymbolButton;
private System.Windows.Forms.ColumnHeader commentColumnHeader;
private System.Windows.Forms.GroupBox entryFlagsGroupBox;
private System.Windows.Forms.Label flagsLabel;
private System.Windows.Forms.GroupBox cpuGroupBox;
private System.Windows.Forms.CheckBox undocInstrCheckBox;
private System.Windows.Forms.Button editSymbolButton;
private System.Windows.Forms.Button symbolFileDownButton;
private System.Windows.Forms.Button symbolFileUpButton;
private System.Windows.Forms.GroupBox analysisGroupBox;
private System.Windows.Forms.ComboBox minStringCharsComboBox;
private System.Windows.Forms.Label minCharsForStringLabel;
private System.Windows.Forms.CheckBox analyzeUncategorizedCheckBox;
private System.Windows.Forms.TabPage extensionScriptsTab;
private System.Windows.Forms.Button extensionScriptRemoveButton;
private System.Windows.Forms.Button addExtensionScriptsButton;
private System.Windows.Forms.ListBox extensionScriptsListBox;
private System.Windows.Forms.Label configuredScriptsLabel;
private System.Windows.Forms.Button importSymbolsButton;
private System.Windows.Forms.CheckBox seekAltTargetCheckBox;
private System.Windows.Forms.GroupBox miscGroupBox;
private System.Windows.Forms.ComboBox autoLabelStyleComboBox;
private System.Windows.Forms.Label autoLabelStyleLabel;
}
}

View File

@ -1,646 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Windows.Forms;
using Asm65;
using CommonUtil;
namespace SourceGenWF.AppForms {
/// <summary>
/// Edit project properties.
///
/// Changes are made locally, and pushed to NewProps when OK or Apply is clicked. When
/// the dialog exits, if NewProps is non-null, the caller should apply those changes
/// regardless of the dialog's return value.
/// </summary>
public partial class EditProjectProperties : Form {
/// <summary>
/// New set. Updated when Apply or OK is hit. This will be null if no changes have
/// been applied.
/// </summary>
public ProjectProperties NewProps { get; private set; }
/// <summary>
/// Format object to use when formatting addresses and constants.
/// </summary>
private Formatter mFormatter { get; set; }
/// <summary>
/// Working set. Used internally to hold state.
/// </summary>
private ProjectProperties mWorkProps;
/// <summary>
/// Dirty flag. Ideally this would just be "WorkProps != OldProps", but it doesn't
/// seem worthwhile to maintain an equality operator.
/// </summary>
private bool mDirty;
/// <summary>
/// Project directory, if one has been established; otherwise empty.
/// </summary>
private string mProjectDir;
/// <summary>
/// Constructor. Initial state is configured from an existing ProjectProperties object.
/// </summary>
/// <param name="props">Property holder to clone.</param>
/// <param name="projectDir">Project directory, if known.</param>
/// <param name="formatter">Text formatter.</param>
public EditProjectProperties(ProjectProperties props, string projectDir,
Formatter formatter) {
InitializeComponent();
mWorkProps = new ProjectProperties(props);
mProjectDir = projectDir;
mFormatter = formatter;
}
private void EditProperties_Load(object sender, EventArgs e) {
// Configure CPU chooser. This must match the order of strings in the designer.
switch (mWorkProps.CpuType) {
case CpuDef.CpuType.Cpu6502:
cpuComboBox.SelectedIndex = 0;
break;
case CpuDef.CpuType.Cpu65C02:
cpuComboBox.SelectedIndex = 1;
break;
case CpuDef.CpuType.Cpu65816:
cpuComboBox.SelectedIndex = 2;
break;
default:
Debug.Assert(false);
cpuComboBox.SelectedIndex = 0;
break;
}
undocInstrCheckBox.Checked = mWorkProps.IncludeUndocumentedInstr;
analyzeUncategorizedCheckBox.Checked =
mWorkProps.AnalysisParams.AnalyzeUncategorizedData;
seekAltTargetCheckBox.Checked =
mWorkProps.AnalysisParams.SeekNearbyTargets;
int matchLen = mWorkProps.AnalysisParams.MinCharsForString;
int selIndex;
if (matchLen == DataAnalysis.MIN_CHARS_FOR_STRING_DISABLED) {
selIndex = 0; // disabled
} else {
selIndex = matchLen - 2;
}
if (selIndex < 0 || selIndex >= minStringCharsComboBox.Items.Count) {
Debug.Assert(false, "bad MinCharsForString " + matchLen);
selIndex = 0;
}
minStringCharsComboBox.SelectedIndex = selIndex;
selIndex = (int) mWorkProps.AutoLabelStyle;
if (selIndex < 0 || selIndex >= autoLabelStyleComboBox.Items.Count) {
Debug.Assert(false, "bad AutoLabelStyle " + mWorkProps.AutoLabelStyle);
selIndex = 0;
}
autoLabelStyleComboBox.SelectedIndex = selIndex;
LoadProjectSymbols();
LoadPlatformSymbolFiles();
LoadExtensionScriptNames();
// Various callbacks will have fired while configuring controls. Reset to "clean".
mDirty = false;
UpdateControls();
}
private void okButton_Click(object sender, EventArgs e) {
NewProps = new ProjectProperties(mWorkProps);
}
private void applyButton_Click(object sender, EventArgs e) {
NewProps = new ProjectProperties(mWorkProps);
mDirty = false;
UpdateControls();
}
private void UpdateControls() {
//
// General tab
//
applyButton.Enabled = mDirty;
const string FLAGS = "CZIDXMVNE"; // flags, in order low to high, plus emu bit
const string VALUES = "-?01";
StringBuilder sb = new StringBuilder(27);
StatusFlags flags = mWorkProps.EntryFlags;
for (int i = 0; i < 9; i++) {
// Want to show P reg flags (first 8) in conventional high-to-low order.
int idx = (7 - i) + (i == 8 ? 9 : 0);
int val = flags.GetBit((StatusFlags.FlagBits)idx);
sb.Append(FLAGS[idx]);
sb.Append(VALUES[val + 2]);
sb.Append(' ');
}
currentFlagsLabel.Text = sb.ToString();
//
// Project symbols tab
//
int symSelCount = projectSymbolsListView.SelectedIndices.Count;
removeSymbolButton.Enabled = (symSelCount == 1);
editSymbolButton.Enabled = (symSelCount == 1);
//
// Platform symbol files tab
//
int fileSelCount = symbolFilesListBox.SelectedIndices.Count;
symbolFileRemoveButton.Enabled = (fileSelCount != 0);
symbolFileUpButton.Enabled = (fileSelCount == 1 &&
symbolFilesListBox.SelectedIndices[0] != 0);
symbolFileDownButton.Enabled = (fileSelCount == 1 &&
symbolFilesListBox.SelectedIndices[0] != symbolFilesListBox.Items.Count - 1);
//
// Extension Scripts tab
//
fileSelCount = extensionScriptsListBox.SelectedIndices.Count;
extensionScriptRemoveButton.Enabled = (fileSelCount != 0);
}
#region General
/// <summary>
/// Converts the CPU combo box selection to a CpuType enum value.
/// </summary>
/// <param name="sel">Selection index.</param>
/// <returns>CPU type.</returns>
private CpuDef.CpuType CpuSelectionToCpuType(int sel) {
switch (sel) {
case 0: return CpuDef.CpuType.Cpu6502;
case 1: return CpuDef.CpuType.Cpu65C02;
case 2: return CpuDef.CpuType.Cpu65816;
default:
Debug.Assert(false);
return CpuDef.CpuType.Cpu6502;
}
}
private void cpuComboBox_SelectedIndexChanged(object sender, EventArgs e) {
CpuDef.CpuType cpuType = CpuSelectionToCpuType(cpuComboBox.SelectedIndex);
if (mWorkProps.CpuType != cpuType) {
mWorkProps.CpuType = cpuType;
mDirty = true;
UpdateControls();
}
}
private void undocInstrCheckBox_CheckedChanged(object sender, EventArgs e) {
if (mWorkProps.IncludeUndocumentedInstr != undocInstrCheckBox.Checked) {
mWorkProps.IncludeUndocumentedInstr = undocInstrCheckBox.Checked;
mDirty = true;
UpdateControls();
}
}
private void changeFlagButton_Click(object sender, EventArgs e) {
CpuDef cpuDef = CpuDef.GetBestMatch(mWorkProps.CpuType,
mWorkProps.IncludeUndocumentedInstr);
EditStatusFlags dlg = new EditStatusFlags(mWorkProps.EntryFlags, cpuDef.HasEmuFlag);
dlg.ShowDialog();
if (dlg.DialogResult == DialogResult.OK) {
if (mWorkProps.EntryFlags != dlg.FlagValue) {
// Flags changed.
mWorkProps.EntryFlags = dlg.FlagValue;
mDirty = true;
UpdateControls();
}
}
dlg.Dispose();
}
private void analyzeUncategorizedCheckBox_CheckedChanged(object sender, EventArgs e) {
mWorkProps.AnalysisParams.AnalyzeUncategorizedData =
analyzeUncategorizedCheckBox.Checked;
mDirty = true;
UpdateControls();
}
private void seekAltTargetCheckBox_CheckedChanged(object sender, EventArgs e) {
mWorkProps.AnalysisParams.SeekNearbyTargets =
seekAltTargetCheckBox.Checked;
mDirty = true;
UpdateControls();
}
private void minStringCharsComboBox_SelectedIndexChanged(object sender, EventArgs e) {
// ComboBox must be the value 0, then N+2 in each subsequent entry (3, 4, 5, ...).
int index = minStringCharsComboBox.SelectedIndex;
int newVal;
if (index == 0) {
newVal = DataAnalysis.MIN_CHARS_FOR_STRING_DISABLED;
} else {
newVal = index + 2;
}
if (newVal != mWorkProps.AnalysisParams.MinCharsForString) {
mWorkProps.AnalysisParams.MinCharsForString = newVal;
mDirty = true;
UpdateControls();
}
}
private void autoLabelStyleComboBox_SelectedIndexChanged(object sender, EventArgs e) {
AutoLabel.Style newStyle = (AutoLabel.Style)autoLabelStyleComboBox.SelectedIndex;
if (newStyle != mWorkProps.AutoLabelStyle) {
mWorkProps.AutoLabelStyle = newStyle;
mDirty = true;
UpdateControls();
}
}
#endregion General
#region Project Symbols
private ListViewItem.ListViewSubItem[] mSymbolSubArray =
new ListViewItem.ListViewSubItem[3];
/// <summary>
/// Loads the project symbols into the ListView.
/// </summary>
private void LoadProjectSymbols() {
// The set should be small enough that we don't need to worry about updating
// the item list incrementally.
//Debug.WriteLine("LPS loading " + WorkProps.ProjectSyms.Count + " project symbols");
projectSymbolsListView.BeginUpdate();
projectSymbolsListView.Items.Clear();
foreach (KeyValuePair<string, DefSymbol> kvp in mWorkProps.ProjectSyms) {
DefSymbol defSym = kvp.Value;
string typeStr;
if (defSym.SymbolType == Symbol.Type.Constant) {
typeStr = Properties.Resources.ABBREV_CONSTANT;
} else {
typeStr = Properties.Resources.ABBREV_ADDRESS;
}
ListViewItem lvi = new ListViewItem();
lvi.Text = defSym.Label;
mSymbolSubArray[0] = new ListViewItem.ListViewSubItem(lvi,
mFormatter.FormatValueInBase(defSym.Value, defSym.DataDescriptor.NumBase));
mSymbolSubArray[1] = new ListViewItem.ListViewSubItem(lvi, typeStr);
mSymbolSubArray[2] = new ListViewItem.ListViewSubItem(lvi, defSym.Comment);
lvi.SubItems.AddRange(mSymbolSubArray);
projectSymbolsListView.Items.Add(lvi);
}
projectSymbolsListView.EndUpdate();
}
private void projectSymbolsListView_SelectedIndexChanged(object sender, EventArgs e) {
// Need to enable/disable the edit+remove buttons depending on the number of
// selected items.
UpdateControls();
}
private void newSymbolButton_Click(object sender, EventArgs e) {
EditDefSymbol dlg = new EditDefSymbol(mFormatter, mWorkProps.ProjectSyms);
dlg.ShowDialog();
if (dlg.DialogResult == DialogResult.OK) {
Debug.WriteLine("ADD: " + dlg.DefSym);
mWorkProps.ProjectSyms[dlg.DefSym.Label] = dlg.DefSym;
mDirty = true;
LoadProjectSymbols();
UpdateControls();
}
dlg.Dispose();
}
private void editSymbolButton_Click(object sender, EventArgs e) {
// Single-select list view, button dimmed when no selection.
Debug.Assert(projectSymbolsListView.SelectedItems.Count == 1);
ListViewItem item = projectSymbolsListView.SelectedItems[0];
DefSymbol defSym = mWorkProps.ProjectSyms[item.Text];
DoEditSymbol(defSym);
}
private void projectSymbolsListView_MouseDoubleClick(object sender, MouseEventArgs e) {
ListViewHitTestInfo info = projectSymbolsListView.HitTest(e.X, e.Y);
DefSymbol defSym = mWorkProps.ProjectSyms[info.Item.Text];
DoEditSymbol(defSym);
}
private void DoEditSymbol(DefSymbol defSym) {
EditDefSymbol dlg = new EditDefSymbol(mFormatter, mWorkProps.ProjectSyms);
dlg.DefSym = defSym;
dlg.ShowDialog();
if (dlg.DialogResult == DialogResult.OK) {
// Label might have changed, so remove old before adding new.
mWorkProps.ProjectSyms.Remove(defSym.Label);
mWorkProps.ProjectSyms[dlg.DefSym.Label] = dlg.DefSym;
mDirty = true;
LoadProjectSymbols();
UpdateControls();
}
dlg.Dispose();
}
private void removeSymbolButton_Click(object sender, EventArgs e) {
// Single-select list view, button dimmed when no selection.
Debug.Assert(projectSymbolsListView.SelectedItems.Count == 1);
int selectionIndex = projectSymbolsListView.SelectedIndices[0];
ListViewItem item = projectSymbolsListView.SelectedItems[0];
DefSymbol defSym = mWorkProps.ProjectSyms[item.Text];
mWorkProps.ProjectSyms.Remove(defSym.Label);
mDirty = true;
LoadProjectSymbols();
UpdateControls();
// Restore selection, so you can hit "Remove" repeatedly to delete
// multiple items.
int newCount = projectSymbolsListView.Items.Count;
if (selectionIndex >= newCount) {
selectionIndex = newCount - 1;
}
if (selectionIndex >= 0) {
projectSymbolsListView.SelectedIndices.Add(selectionIndex);
removeSymbolButton.Focus();
}
}
#endregion Project Symbols
#region Platform symbol files
/// <summary>
/// Loads the platform symbol file names into the list control.
/// </summary>
private void LoadPlatformSymbolFiles() {
symbolFilesListBox.BeginUpdate();
symbolFilesListBox.Items.Clear();
foreach (string fileName in mWorkProps.PlatformSymbolFileIdentifiers) {
symbolFilesListBox.Items.Add(fileName);
}
symbolFilesListBox.EndUpdate();
}
private void symbolFilesListBox_SelectedIndexChanged(object sender, EventArgs e) {
// Enable/disable buttons as the selection changes.
UpdateControls();
}
private void addSymbolFilesButton_Click(object sender, EventArgs e) {
OpenFileDialog fileDlg = new OpenFileDialog() {
Filter = PlatformSymbols.FILENAME_FILTER,
Multiselect = true,
InitialDirectory = RuntimeDataAccess.GetDirectory(),
RestoreDirectory = true // doesn't seem to work?
};
if (fileDlg.ShowDialog() != DialogResult.OK) {
return;
}
foreach (string pathName in fileDlg.FileNames) {
// I'm assuming the full names got the Path.GetFullPath() canonicalization and
// don't need further processing. Also, I'm assuming that all files live in
// the same directory, so if one is in an invalid location then they all are.
ExternalFile ef = ExternalFile.CreateFromPath(pathName, mProjectDir);
if (ef == null) {
// Files not found in runtime or project directory.
string projDir = mProjectDir;
if (string.IsNullOrEmpty(projDir)) {
projDir = Properties.Resources.UNSET;
}
string msg = string.Format(Properties.Resources.EXTERNAL_FILE_BAD_DIR,
RuntimeDataAccess.GetDirectory(), projDir, pathName);
MessageBox.Show(this, msg, Properties.Resources.EXTERNAL_FILE_BAD_DIR_CAPTION,
MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
string ident = ef.Identifier;
if (mWorkProps.PlatformSymbolFileIdentifiers.Contains(ident)) {
Debug.WriteLine("Already present: " + ident);
continue;
}
Debug.WriteLine("Adding symbol file: " + ident);
mWorkProps.PlatformSymbolFileIdentifiers.Add(ident);
mDirty = true;
}
if (mDirty) {
LoadPlatformSymbolFiles();
UpdateControls();
}
}
private void symbolFileUpButton_Click(object sender, EventArgs e) {
Debug.Assert(symbolFilesListBox.SelectedIndices.Count == 1);
int selIndex = symbolFilesListBox.SelectedIndices[0];
Debug.Assert(selIndex > 0);
MoveSingleItem(selIndex, symbolFilesListBox.SelectedItem, -1);
}
private void symbolFileDownButton_Click(object sender, EventArgs e) {
Debug.Assert(symbolFilesListBox.SelectedIndices.Count == 1);
int selIndex = symbolFilesListBox.SelectedIndices[0];
Debug.Assert(selIndex < symbolFilesListBox.Items.Count - 1);
MoveSingleItem(selIndex, symbolFilesListBox.SelectedItem, +1);
}
private void MoveSingleItem(int selIndex, object selectedItem, int adj) {
object selected = symbolFilesListBox.SelectedItem;
symbolFilesListBox.Items.Remove(selected);
symbolFilesListBox.Items.Insert(selIndex + adj, selected);
symbolFilesListBox.SetSelected(selIndex + adj, true);
// do the same operation in the file name list
string str = mWorkProps.PlatformSymbolFileIdentifiers[selIndex];
mWorkProps.PlatformSymbolFileIdentifiers.RemoveAt(selIndex);
mWorkProps.PlatformSymbolFileIdentifiers.Insert(selIndex + adj, str);
mDirty = true;
UpdateControls();
}
private void symbolFileRemoveButton_Click(object sender, EventArgs e) {
Debug.Assert(symbolFilesListBox.SelectedIndices.Count > 0);
for (int i = symbolFilesListBox.SelectedIndices.Count - 1; i >= 0; i--) {
int index = symbolFilesListBox.SelectedIndices[i];
symbolFilesListBox.Items.RemoveAt(index);
mWorkProps.PlatformSymbolFileIdentifiers.RemoveAt(index);
}
mDirty = true;
UpdateControls();
}
private void importSymbolsButton_Click(object sender, EventArgs e) {
OpenFileDialog fileDlg = new OpenFileDialog() {
Filter = ProjectFile.FILENAME_FILTER + "|" + Properties.Resources.FILE_FILTER_ALL,
FilterIndex = 1
};
if (fileDlg.ShowDialog() != DialogResult.OK) {
return;
}
string projPathName = Path.GetFullPath(fileDlg.FileName);
DisasmProject newProject = new DisasmProject();
if (!ProjectFile.DeserializeFromFile(projPathName, newProject,
out FileLoadReport report)) {
// Unable to open project file. Report error and bail.
ProjectLoadIssues dlg = new ProjectLoadIssues(report.Format(),
ProjectLoadIssues.Buttons.Cancel);
dlg.ShowDialog();
// ignore dlg.DialogResult
dlg.Dispose();
return;
}
// Import all user labels that were marked as "global export". These become
// external-address project symbols.
int foundCount = 0;
foreach (KeyValuePair<int, Symbol> kvp in newProject.UserLabels) {
if (kvp.Value.SymbolType == Symbol.Type.GlobalAddrExport) {
Symbol sym = kvp.Value;
DefSymbol defSym = new DefSymbol(sym.Label, sym.Value, Symbol.Source.Project,
Symbol.Type.ExternalAddr, FormatDescriptor.SubType.None,
string.Empty, string.Empty);
mWorkProps.ProjectSyms[defSym.Label] = defSym;
foundCount++;
}
}
if (foundCount != 0) {
mDirty = true;
LoadProjectSymbols();
UpdateControls();
}
newProject.Cleanup();
// Tell the user we did something. Might be nice to tell them how many weren't
// already present.
string msg;
if (foundCount == 0) {
msg = Properties.Resources.SYMBOL_IMPORT_NONE;
} else {
msg = string.Format(Properties.Resources.SYMBOL_IMPORT_GOOD, foundCount);
}
MessageBox.Show(this, msg, Properties.Resources.SYMBOL_IMPORT_CAPTION,
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
#endregion Platform symbol files
#region Extension scripts
/// <summary>
/// Loads the extension script file names into the list control.
/// </summary>
private void LoadExtensionScriptNames() {
extensionScriptsListBox.BeginUpdate();
extensionScriptsListBox.Items.Clear();
foreach (string fileName in mWorkProps.ExtensionScriptFileIdentifiers) {
extensionScriptsListBox.Items.Add(fileName);
}
extensionScriptsListBox.EndUpdate();
}
private void extensionScriptsListBox_SelectedIndexChanged(object sender, EventArgs e) {
// Enable/disable buttons as the selection changes.
UpdateControls();
}
private void addExtensionScriptsButton_Click(object sender, EventArgs e) {
OpenFileDialog fileDlg = new OpenFileDialog() {
Filter = Sandbox.ScriptManager.FILENAME_FILTER,
Multiselect = true,
InitialDirectory = RuntimeDataAccess.GetDirectory(),
RestoreDirectory = true // doesn't seem to work?
};
if (fileDlg.ShowDialog() != DialogResult.OK) {
return;
}
foreach (string pathName in fileDlg.FileNames) {
// I'm assuming the full names got the Path.GetFullPath() canonicalization and
// don't need further processing. Also, I'm assuming that all files live in
// the same directory, so if one is in an invalid location then they all are.
ExternalFile ef = ExternalFile.CreateFromPath(pathName, mProjectDir);
if (ef == null) {
// Files not found in runtime or project directory.
string projDir = mProjectDir;
if (string.IsNullOrEmpty(projDir)) {
projDir = Properties.Resources.UNSET;
}
string msg = string.Format(Properties.Resources.EXTERNAL_FILE_BAD_DIR,
RuntimeDataAccess.GetDirectory(), projDir, pathName);
MessageBox.Show(this, msg, Properties.Resources.EXTERNAL_FILE_BAD_DIR_CAPTION,
MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
string ident = ef.Identifier;
if (mWorkProps.ExtensionScriptFileIdentifiers.Contains(ident)) {
Debug.WriteLine("Already present: " + ident);
continue;
}
Debug.WriteLine("Adding extension script: " + ident);
mWorkProps.ExtensionScriptFileIdentifiers.Add(ident);
mDirty = true;
}
if (mDirty) {
LoadExtensionScriptNames();
UpdateControls();
}
}
private void extensionScriptRemoveButton_Click(object sender, EventArgs e) {
Debug.Assert(extensionScriptsListBox.SelectedIndices.Count > 0);
for (int i = extensionScriptsListBox.SelectedIndices.Count - 1; i >= 0; i--) {
int index = extensionScriptsListBox.SelectedIndices[i];
extensionScriptsListBox.Items.RemoveAt(index);
mWorkProps.ExtensionScriptFileIdentifiers.RemoveAt(index);
}
mDirty = true;
UpdateControls();
}
#endregion Extension scripts
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,883 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class EditStatusFlags {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.defaultLabel = new System.Windows.Forms.Label();
this.zeroLabel = new System.Windows.Forms.Label();
this.oneLabel = new System.Windows.Forms.Label();
this.indeterminateLabel = new System.Windows.Forms.Label();
this.panelN = new System.Windows.Forms.Panel();
this.flagNLabel = new System.Windows.Forms.Label();
this.radioNIndeterminate = new System.Windows.Forms.RadioButton();
this.radioNOne = new System.Windows.Forms.RadioButton();
this.radioNZero = new System.Windows.Forms.RadioButton();
this.radioNDefault = new System.Windows.Forms.RadioButton();
this.panelV = new System.Windows.Forms.Panel();
this.flagVLabel = new System.Windows.Forms.Label();
this.radioVIndeterminate = new System.Windows.Forms.RadioButton();
this.radioVOne = new System.Windows.Forms.RadioButton();
this.radioVZero = new System.Windows.Forms.RadioButton();
this.radioVDefault = new System.Windows.Forms.RadioButton();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.panelM = new System.Windows.Forms.Panel();
this.flagMLabel = new System.Windows.Forms.Label();
this.radioMIndeterminate = new System.Windows.Forms.RadioButton();
this.radioMOne = new System.Windows.Forms.RadioButton();
this.radioMZero = new System.Windows.Forms.RadioButton();
this.radioMDefault = new System.Windows.Forms.RadioButton();
this.panelX = new System.Windows.Forms.Panel();
this.flagXLabel = new System.Windows.Forms.Label();
this.radioXIndeterminate = new System.Windows.Forms.RadioButton();
this.radioXOne = new System.Windows.Forms.RadioButton();
this.radioXZero = new System.Windows.Forms.RadioButton();
this.radioXDefault = new System.Windows.Forms.RadioButton();
this.panelD = new System.Windows.Forms.Panel();
this.flagDLabel = new System.Windows.Forms.Label();
this.radioDIndeterminate = new System.Windows.Forms.RadioButton();
this.radioDOne = new System.Windows.Forms.RadioButton();
this.radioDZero = new System.Windows.Forms.RadioButton();
this.radioDDefault = new System.Windows.Forms.RadioButton();
this.panelI = new System.Windows.Forms.Panel();
this.flagILabel = new System.Windows.Forms.Label();
this.radioIIndeterminate = new System.Windows.Forms.RadioButton();
this.radioIOne = new System.Windows.Forms.RadioButton();
this.radioIZero = new System.Windows.Forms.RadioButton();
this.radioIDefault = new System.Windows.Forms.RadioButton();
this.panelZ = new System.Windows.Forms.Panel();
this.flagZLabel = new System.Windows.Forms.Label();
this.radioZIndeterminate = new System.Windows.Forms.RadioButton();
this.radioZOne = new System.Windows.Forms.RadioButton();
this.radioZZero = new System.Windows.Forms.RadioButton();
this.radioZDefault = new System.Windows.Forms.RadioButton();
this.panelC = new System.Windows.Forms.Panel();
this.flagCLabel = new System.Windows.Forms.Label();
this.radioCIndeterminate = new System.Windows.Forms.RadioButton();
this.radioCOne = new System.Windows.Forms.RadioButton();
this.radioCZero = new System.Windows.Forms.RadioButton();
this.radioCDefault = new System.Windows.Forms.RadioButton();
this.panelE = new System.Windows.Forms.Panel();
this.flagELabel = new System.Windows.Forms.Label();
this.radioEIndeterminate = new System.Windows.Forms.RadioButton();
this.radioEOne = new System.Windows.Forms.RadioButton();
this.radioEZero = new System.Windows.Forms.RadioButton();
this.radioEDefault = new System.Windows.Forms.RadioButton();
this.instructionLabel = new System.Windows.Forms.Label();
this.labelLongRegsNote = new System.Windows.Forms.Label();
this.resetButton = new System.Windows.Forms.Button();
this.panelN.SuspendLayout();
this.panelV.SuspendLayout();
this.panelM.SuspendLayout();
this.panelX.SuspendLayout();
this.panelD.SuspendLayout();
this.panelI.SuspendLayout();
this.panelZ.SuspendLayout();
this.panelC.SuspendLayout();
this.panelE.SuspendLayout();
this.SuspendLayout();
//
// defaultLabel
//
this.defaultLabel.Location = new System.Drawing.Point(12, 70);
this.defaultLabel.Name = "defaultLabel";
this.defaultLabel.Size = new System.Drawing.Size(90, 20);
this.defaultLabel.TabIndex = 4;
this.defaultLabel.Text = "Default";
this.defaultLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// zeroLabel
//
this.zeroLabel.Location = new System.Drawing.Point(12, 90);
this.zeroLabel.Name = "zeroLabel";
this.zeroLabel.Size = new System.Drawing.Size(90, 20);
this.zeroLabel.TabIndex = 5;
this.zeroLabel.Text = "Zero";
this.zeroLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// oneLabel
//
this.oneLabel.Location = new System.Drawing.Point(12, 110);
this.oneLabel.Name = "oneLabel";
this.oneLabel.Size = new System.Drawing.Size(90, 20);
this.oneLabel.TabIndex = 6;
this.oneLabel.Text = "One";
this.oneLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// indeterminateLabel
//
this.indeterminateLabel.Location = new System.Drawing.Point(12, 130);
this.indeterminateLabel.Name = "indeterminateLabel";
this.indeterminateLabel.Size = new System.Drawing.Size(90, 20);
this.indeterminateLabel.TabIndex = 7;
this.indeterminateLabel.Text = "Indeterminate";
this.indeterminateLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// panelN
//
this.panelN.Controls.Add(this.flagNLabel);
this.panelN.Controls.Add(this.radioNIndeterminate);
this.panelN.Controls.Add(this.radioNOne);
this.panelN.Controls.Add(this.radioNZero);
this.panelN.Controls.Add(this.radioNDefault);
this.panelN.Location = new System.Drawing.Point(108, 47);
this.panelN.Name = "panelN";
this.panelN.Size = new System.Drawing.Size(26, 110);
this.panelN.TabIndex = 9;
//
// flagNLabel
//
this.flagNLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.flagNLabel.Location = new System.Drawing.Point(3, 0);
this.flagNLabel.Name = "flagNLabel";
this.flagNLabel.Size = new System.Drawing.Size(20, 20);
this.flagNLabel.TabIndex = 0;
this.flagNLabel.Text = "N";
this.flagNLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// radioNIndeterminate
//
this.radioNIndeterminate.AutoSize = true;
this.radioNIndeterminate.Location = new System.Drawing.Point(6, 83);
this.radioNIndeterminate.Name = "radioNIndeterminate";
this.radioNIndeterminate.Size = new System.Drawing.Size(14, 13);
this.radioNIndeterminate.TabIndex = 4;
this.radioNIndeterminate.TabStop = true;
this.radioNIndeterminate.UseVisualStyleBackColor = true;
//
// radioNOne
//
this.radioNOne.AutoSize = true;
this.radioNOne.Location = new System.Drawing.Point(6, 63);
this.radioNOne.Name = "radioNOne";
this.radioNOne.Size = new System.Drawing.Size(14, 13);
this.radioNOne.TabIndex = 3;
this.radioNOne.TabStop = true;
this.radioNOne.UseVisualStyleBackColor = true;
//
// radioNZero
//
this.radioNZero.AutoSize = true;
this.radioNZero.Location = new System.Drawing.Point(6, 43);
this.radioNZero.Name = "radioNZero";
this.radioNZero.Size = new System.Drawing.Size(14, 13);
this.radioNZero.TabIndex = 2;
this.radioNZero.TabStop = true;
this.radioNZero.UseVisualStyleBackColor = true;
//
// radioNDefault
//
this.radioNDefault.AutoSize = true;
this.radioNDefault.Location = new System.Drawing.Point(6, 23);
this.radioNDefault.Name = "radioNDefault";
this.radioNDefault.Size = new System.Drawing.Size(14, 13);
this.radioNDefault.TabIndex = 1;
this.radioNDefault.TabStop = true;
this.radioNDefault.UseVisualStyleBackColor = true;
//
// panelV
//
this.panelV.Controls.Add(this.flagVLabel);
this.panelV.Controls.Add(this.radioVIndeterminate);
this.panelV.Controls.Add(this.radioVOne);
this.panelV.Controls.Add(this.radioVZero);
this.panelV.Controls.Add(this.radioVDefault);
this.panelV.Location = new System.Drawing.Point(140, 47);
this.panelV.Name = "panelV";
this.panelV.Size = new System.Drawing.Size(26, 110);
this.panelV.TabIndex = 14;
//
// flagVLabel
//
this.flagVLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.flagVLabel.Location = new System.Drawing.Point(3, 0);
this.flagVLabel.Name = "flagVLabel";
this.flagVLabel.Size = new System.Drawing.Size(20, 20);
this.flagVLabel.TabIndex = 0;
this.flagVLabel.Text = "V";
this.flagVLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// radioVIndeterminate
//
this.radioVIndeterminate.AutoSize = true;
this.radioVIndeterminate.Location = new System.Drawing.Point(6, 83);
this.radioVIndeterminate.Name = "radioVIndeterminate";
this.radioVIndeterminate.Size = new System.Drawing.Size(14, 13);
this.radioVIndeterminate.TabIndex = 4;
this.radioVIndeterminate.TabStop = true;
this.radioVIndeterminate.UseVisualStyleBackColor = true;
//
// radioVOne
//
this.radioVOne.AutoSize = true;
this.radioVOne.Location = new System.Drawing.Point(6, 63);
this.radioVOne.Name = "radioVOne";
this.radioVOne.Size = new System.Drawing.Size(14, 13);
this.radioVOne.TabIndex = 3;
this.radioVOne.TabStop = true;
this.radioVOne.UseVisualStyleBackColor = true;
//
// radioVZero
//
this.radioVZero.AutoSize = true;
this.radioVZero.Location = new System.Drawing.Point(6, 43);
this.radioVZero.Name = "radioVZero";
this.radioVZero.Size = new System.Drawing.Size(14, 13);
this.radioVZero.TabIndex = 2;
this.radioVZero.TabStop = true;
this.radioVZero.UseVisualStyleBackColor = true;
//
// radioVDefault
//
this.radioVDefault.AutoSize = true;
this.radioVDefault.Location = new System.Drawing.Point(6, 23);
this.radioVDefault.Name = "radioVDefault";
this.radioVDefault.Size = new System.Drawing.Size(14, 13);
this.radioVDefault.TabIndex = 1;
this.radioVDefault.TabStop = true;
this.radioVDefault.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(281, 205);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 0;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(362, 205);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 1;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// panelM
//
this.panelM.Controls.Add(this.flagMLabel);
this.panelM.Controls.Add(this.radioMIndeterminate);
this.panelM.Controls.Add(this.radioMOne);
this.panelM.Controls.Add(this.radioMZero);
this.panelM.Controls.Add(this.radioMDefault);
this.panelM.Location = new System.Drawing.Point(172, 47);
this.panelM.Name = "panelM";
this.panelM.Size = new System.Drawing.Size(26, 110);
this.panelM.TabIndex = 15;
//
// flagMLabel
//
this.flagMLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.flagMLabel.Location = new System.Drawing.Point(3, 0);
this.flagMLabel.Name = "flagMLabel";
this.flagMLabel.Size = new System.Drawing.Size(20, 20);
this.flagMLabel.TabIndex = 0;
this.flagMLabel.Text = "M";
this.flagMLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// radioMIndeterminate
//
this.radioMIndeterminate.AutoSize = true;
this.radioMIndeterminate.Location = new System.Drawing.Point(6, 83);
this.radioMIndeterminate.Name = "radioMIndeterminate";
this.radioMIndeterminate.Size = new System.Drawing.Size(14, 13);
this.radioMIndeterminate.TabIndex = 4;
this.radioMIndeterminate.TabStop = true;
this.radioMIndeterminate.UseVisualStyleBackColor = true;
//
// radioMOne
//
this.radioMOne.AutoSize = true;
this.radioMOne.Location = new System.Drawing.Point(6, 63);
this.radioMOne.Name = "radioMOne";
this.radioMOne.Size = new System.Drawing.Size(14, 13);
this.radioMOne.TabIndex = 3;
this.radioMOne.TabStop = true;
this.radioMOne.UseVisualStyleBackColor = true;
//
// radioMZero
//
this.radioMZero.AutoSize = true;
this.radioMZero.Location = new System.Drawing.Point(6, 43);
this.radioMZero.Name = "radioMZero";
this.radioMZero.Size = new System.Drawing.Size(14, 13);
this.radioMZero.TabIndex = 2;
this.radioMZero.TabStop = true;
this.radioMZero.UseVisualStyleBackColor = true;
//
// radioMDefault
//
this.radioMDefault.AutoSize = true;
this.radioMDefault.Location = new System.Drawing.Point(6, 23);
this.radioMDefault.Name = "radioMDefault";
this.radioMDefault.Size = new System.Drawing.Size(14, 13);
this.radioMDefault.TabIndex = 1;
this.radioMDefault.TabStop = true;
this.radioMDefault.UseVisualStyleBackColor = true;
//
// panelX
//
this.panelX.Controls.Add(this.flagXLabel);
this.panelX.Controls.Add(this.radioXIndeterminate);
this.panelX.Controls.Add(this.radioXOne);
this.panelX.Controls.Add(this.radioXZero);
this.panelX.Controls.Add(this.radioXDefault);
this.panelX.Location = new System.Drawing.Point(204, 47);
this.panelX.Name = "panelX";
this.panelX.Size = new System.Drawing.Size(26, 110);
this.panelX.TabIndex = 16;
//
// flagXLabel
//
this.flagXLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.flagXLabel.Location = new System.Drawing.Point(3, 0);
this.flagXLabel.Name = "flagXLabel";
this.flagXLabel.Size = new System.Drawing.Size(20, 20);
this.flagXLabel.TabIndex = 0;
this.flagXLabel.Text = "X";
this.flagXLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// radioXIndeterminate
//
this.radioXIndeterminate.AutoSize = true;
this.radioXIndeterminate.Location = new System.Drawing.Point(6, 83);
this.radioXIndeterminate.Name = "radioXIndeterminate";
this.radioXIndeterminate.Size = new System.Drawing.Size(14, 13);
this.radioXIndeterminate.TabIndex = 4;
this.radioXIndeterminate.TabStop = true;
this.radioXIndeterminate.UseVisualStyleBackColor = true;
//
// radioXOne
//
this.radioXOne.AutoSize = true;
this.radioXOne.Location = new System.Drawing.Point(6, 63);
this.radioXOne.Name = "radioXOne";
this.radioXOne.Size = new System.Drawing.Size(14, 13);
this.radioXOne.TabIndex = 3;
this.radioXOne.TabStop = true;
this.radioXOne.UseVisualStyleBackColor = true;
//
// radioXZero
//
this.radioXZero.AutoSize = true;
this.radioXZero.Location = new System.Drawing.Point(6, 43);
this.radioXZero.Name = "radioXZero";
this.radioXZero.Size = new System.Drawing.Size(14, 13);
this.radioXZero.TabIndex = 2;
this.radioXZero.TabStop = true;
this.radioXZero.UseVisualStyleBackColor = true;
//
// radioXDefault
//
this.radioXDefault.AutoSize = true;
this.radioXDefault.Location = new System.Drawing.Point(6, 23);
this.radioXDefault.Name = "radioXDefault";
this.radioXDefault.Size = new System.Drawing.Size(14, 13);
this.radioXDefault.TabIndex = 1;
this.radioXDefault.TabStop = true;
this.radioXDefault.UseVisualStyleBackColor = true;
//
// panelD
//
this.panelD.Controls.Add(this.flagDLabel);
this.panelD.Controls.Add(this.radioDIndeterminate);
this.panelD.Controls.Add(this.radioDOne);
this.panelD.Controls.Add(this.radioDZero);
this.panelD.Controls.Add(this.radioDDefault);
this.panelD.Location = new System.Drawing.Point(236, 47);
this.panelD.Name = "panelD";
this.panelD.Size = new System.Drawing.Size(26, 110);
this.panelD.TabIndex = 17;
//
// flagDLabel
//
this.flagDLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.flagDLabel.Location = new System.Drawing.Point(3, 0);
this.flagDLabel.Name = "flagDLabel";
this.flagDLabel.Size = new System.Drawing.Size(20, 20);
this.flagDLabel.TabIndex = 0;
this.flagDLabel.Text = "D";
this.flagDLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// radioDIndeterminate
//
this.radioDIndeterminate.AutoSize = true;
this.radioDIndeterminate.Location = new System.Drawing.Point(6, 83);
this.radioDIndeterminate.Name = "radioDIndeterminate";
this.radioDIndeterminate.Size = new System.Drawing.Size(14, 13);
this.radioDIndeterminate.TabIndex = 4;
this.radioDIndeterminate.TabStop = true;
this.radioDIndeterminate.UseVisualStyleBackColor = true;
//
// radioDOne
//
this.radioDOne.AutoSize = true;
this.radioDOne.Location = new System.Drawing.Point(6, 63);
this.radioDOne.Name = "radioDOne";
this.radioDOne.Size = new System.Drawing.Size(14, 13);
this.radioDOne.TabIndex = 3;
this.radioDOne.TabStop = true;
this.radioDOne.UseVisualStyleBackColor = true;
//
// radioDZero
//
this.radioDZero.AutoSize = true;
this.radioDZero.Location = new System.Drawing.Point(6, 43);
this.radioDZero.Name = "radioDZero";
this.radioDZero.Size = new System.Drawing.Size(14, 13);
this.radioDZero.TabIndex = 2;
this.radioDZero.TabStop = true;
this.radioDZero.UseVisualStyleBackColor = true;
//
// radioDDefault
//
this.radioDDefault.AutoSize = true;
this.radioDDefault.Location = new System.Drawing.Point(6, 23);
this.radioDDefault.Name = "radioDDefault";
this.radioDDefault.Size = new System.Drawing.Size(14, 13);
this.radioDDefault.TabIndex = 1;
this.radioDDefault.TabStop = true;
this.radioDDefault.UseVisualStyleBackColor = true;
//
// panelI
//
this.panelI.Controls.Add(this.flagILabel);
this.panelI.Controls.Add(this.radioIIndeterminate);
this.panelI.Controls.Add(this.radioIOne);
this.panelI.Controls.Add(this.radioIZero);
this.panelI.Controls.Add(this.radioIDefault);
this.panelI.Location = new System.Drawing.Point(268, 47);
this.panelI.Name = "panelI";
this.panelI.Size = new System.Drawing.Size(26, 110);
this.panelI.TabIndex = 18;
//
// flagILabel
//
this.flagILabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.flagILabel.Location = new System.Drawing.Point(3, 0);
this.flagILabel.Name = "flagILabel";
this.flagILabel.Size = new System.Drawing.Size(20, 20);
this.flagILabel.TabIndex = 0;
this.flagILabel.Text = "I";
this.flagILabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// radioIIndeterminate
//
this.radioIIndeterminate.AutoSize = true;
this.radioIIndeterminate.Location = new System.Drawing.Point(6, 83);
this.radioIIndeterminate.Name = "radioIIndeterminate";
this.radioIIndeterminate.Size = new System.Drawing.Size(14, 13);
this.radioIIndeterminate.TabIndex = 4;
this.radioIIndeterminate.TabStop = true;
this.radioIIndeterminate.UseVisualStyleBackColor = true;
//
// radioIOne
//
this.radioIOne.AutoSize = true;
this.radioIOne.Location = new System.Drawing.Point(6, 63);
this.radioIOne.Name = "radioIOne";
this.radioIOne.Size = new System.Drawing.Size(14, 13);
this.radioIOne.TabIndex = 3;
this.radioIOne.TabStop = true;
this.radioIOne.UseVisualStyleBackColor = true;
//
// radioIZero
//
this.radioIZero.AutoSize = true;
this.radioIZero.Location = new System.Drawing.Point(6, 43);
this.radioIZero.Name = "radioIZero";
this.radioIZero.Size = new System.Drawing.Size(14, 13);
this.radioIZero.TabIndex = 2;
this.radioIZero.TabStop = true;
this.radioIZero.UseVisualStyleBackColor = true;
//
// radioIDefault
//
this.radioIDefault.AutoSize = true;
this.radioIDefault.Location = new System.Drawing.Point(6, 23);
this.radioIDefault.Name = "radioIDefault";
this.radioIDefault.Size = new System.Drawing.Size(14, 13);
this.radioIDefault.TabIndex = 1;
this.radioIDefault.TabStop = true;
this.radioIDefault.UseVisualStyleBackColor = true;
//
// panelZ
//
this.panelZ.Controls.Add(this.flagZLabel);
this.panelZ.Controls.Add(this.radioZIndeterminate);
this.panelZ.Controls.Add(this.radioZOne);
this.panelZ.Controls.Add(this.radioZZero);
this.panelZ.Controls.Add(this.radioZDefault);
this.panelZ.Location = new System.Drawing.Point(300, 47);
this.panelZ.Name = "panelZ";
this.panelZ.Size = new System.Drawing.Size(26, 110);
this.panelZ.TabIndex = 19;
//
// flagZLabel
//
this.flagZLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.flagZLabel.Location = new System.Drawing.Point(3, 0);
this.flagZLabel.Name = "flagZLabel";
this.flagZLabel.Size = new System.Drawing.Size(20, 20);
this.flagZLabel.TabIndex = 0;
this.flagZLabel.Text = "Z";
this.flagZLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// radioZIndeterminate
//
this.radioZIndeterminate.AutoSize = true;
this.radioZIndeterminate.Location = new System.Drawing.Point(6, 83);
this.radioZIndeterminate.Name = "radioZIndeterminate";
this.radioZIndeterminate.Size = new System.Drawing.Size(14, 13);
this.radioZIndeterminate.TabIndex = 4;
this.radioZIndeterminate.TabStop = true;
this.radioZIndeterminate.UseVisualStyleBackColor = true;
//
// radioZOne
//
this.radioZOne.AutoSize = true;
this.radioZOne.Location = new System.Drawing.Point(6, 63);
this.radioZOne.Name = "radioZOne";
this.radioZOne.Size = new System.Drawing.Size(14, 13);
this.radioZOne.TabIndex = 3;
this.radioZOne.TabStop = true;
this.radioZOne.UseVisualStyleBackColor = true;
//
// radioZZero
//
this.radioZZero.AutoSize = true;
this.radioZZero.Location = new System.Drawing.Point(6, 43);
this.radioZZero.Name = "radioZZero";
this.radioZZero.Size = new System.Drawing.Size(14, 13);
this.radioZZero.TabIndex = 2;
this.radioZZero.TabStop = true;
this.radioZZero.UseVisualStyleBackColor = true;
//
// radioZDefault
//
this.radioZDefault.AutoSize = true;
this.radioZDefault.Location = new System.Drawing.Point(6, 23);
this.radioZDefault.Name = "radioZDefault";
this.radioZDefault.Size = new System.Drawing.Size(14, 13);
this.radioZDefault.TabIndex = 1;
this.radioZDefault.TabStop = true;
this.radioZDefault.UseVisualStyleBackColor = true;
//
// panelC
//
this.panelC.Controls.Add(this.flagCLabel);
this.panelC.Controls.Add(this.radioCIndeterminate);
this.panelC.Controls.Add(this.radioCOne);
this.panelC.Controls.Add(this.radioCZero);
this.panelC.Controls.Add(this.radioCDefault);
this.panelC.Location = new System.Drawing.Point(332, 47);
this.panelC.Name = "panelC";
this.panelC.Size = new System.Drawing.Size(26, 110);
this.panelC.TabIndex = 20;
//
// flagCLabel
//
this.flagCLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.flagCLabel.Location = new System.Drawing.Point(3, 0);
this.flagCLabel.Name = "flagCLabel";
this.flagCLabel.Size = new System.Drawing.Size(20, 20);
this.flagCLabel.TabIndex = 0;
this.flagCLabel.Text = "C";
this.flagCLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// radioCIndeterminate
//
this.radioCIndeterminate.AutoSize = true;
this.radioCIndeterminate.Location = new System.Drawing.Point(6, 83);
this.radioCIndeterminate.Name = "radioCIndeterminate";
this.radioCIndeterminate.Size = new System.Drawing.Size(14, 13);
this.radioCIndeterminate.TabIndex = 4;
this.radioCIndeterminate.TabStop = true;
this.radioCIndeterminate.UseVisualStyleBackColor = true;
//
// radioCOne
//
this.radioCOne.AutoSize = true;
this.radioCOne.Location = new System.Drawing.Point(6, 63);
this.radioCOne.Name = "radioCOne";
this.radioCOne.Size = new System.Drawing.Size(14, 13);
this.radioCOne.TabIndex = 3;
this.radioCOne.TabStop = true;
this.radioCOne.UseVisualStyleBackColor = true;
//
// radioCZero
//
this.radioCZero.AutoSize = true;
this.radioCZero.Location = new System.Drawing.Point(6, 43);
this.radioCZero.Name = "radioCZero";
this.radioCZero.Size = new System.Drawing.Size(14, 13);
this.radioCZero.TabIndex = 2;
this.radioCZero.TabStop = true;
this.radioCZero.UseVisualStyleBackColor = true;
//
// radioCDefault
//
this.radioCDefault.AutoSize = true;
this.radioCDefault.Location = new System.Drawing.Point(6, 23);
this.radioCDefault.Name = "radioCDefault";
this.radioCDefault.Size = new System.Drawing.Size(14, 13);
this.radioCDefault.TabIndex = 1;
this.radioCDefault.TabStop = true;
this.radioCDefault.UseVisualStyleBackColor = true;
//
// panelE
//
this.panelE.Controls.Add(this.flagELabel);
this.panelE.Controls.Add(this.radioEIndeterminate);
this.panelE.Controls.Add(this.radioEOne);
this.panelE.Controls.Add(this.radioEZero);
this.panelE.Controls.Add(this.radioEDefault);
this.panelE.Location = new System.Drawing.Point(381, 47);
this.panelE.Name = "panelE";
this.panelE.Size = new System.Drawing.Size(26, 110);
this.panelE.TabIndex = 21;
//
// flagELabel
//
this.flagELabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.flagELabel.Location = new System.Drawing.Point(3, 0);
this.flagELabel.Name = "flagELabel";
this.flagELabel.Size = new System.Drawing.Size(20, 20);
this.flagELabel.TabIndex = 0;
this.flagELabel.Text = "E";
this.flagELabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// radioEIndeterminate
//
this.radioEIndeterminate.AutoSize = true;
this.radioEIndeterminate.Location = new System.Drawing.Point(6, 83);
this.radioEIndeterminate.Name = "radioEIndeterminate";
this.radioEIndeterminate.Size = new System.Drawing.Size(14, 13);
this.radioEIndeterminate.TabIndex = 4;
this.radioEIndeterminate.TabStop = true;
this.radioEIndeterminate.UseVisualStyleBackColor = true;
//
// radioEOne
//
this.radioEOne.AutoSize = true;
this.radioEOne.Location = new System.Drawing.Point(6, 63);
this.radioEOne.Name = "radioEOne";
this.radioEOne.Size = new System.Drawing.Size(14, 13);
this.radioEOne.TabIndex = 3;
this.radioEOne.TabStop = true;
this.radioEOne.UseVisualStyleBackColor = true;
//
// radioEZero
//
this.radioEZero.AutoSize = true;
this.radioEZero.Location = new System.Drawing.Point(6, 43);
this.radioEZero.Name = "radioEZero";
this.radioEZero.Size = new System.Drawing.Size(14, 13);
this.radioEZero.TabIndex = 2;
this.radioEZero.TabStop = true;
this.radioEZero.UseVisualStyleBackColor = true;
//
// radioEDefault
//
this.radioEDefault.AutoSize = true;
this.radioEDefault.Location = new System.Drawing.Point(6, 23);
this.radioEDefault.Name = "radioEDefault";
this.radioEDefault.Size = new System.Drawing.Size(14, 13);
this.radioEDefault.TabIndex = 1;
this.radioEDefault.TabStop = true;
this.radioEDefault.UseVisualStyleBackColor = true;
//
// instructionLabel
//
this.instructionLabel.AutoSize = true;
this.instructionLabel.Location = new System.Drawing.Point(12, 9);
this.instructionLabel.Name = "instructionLabel";
this.instructionLabel.Size = new System.Drawing.Size(297, 13);
this.instructionLabel.TabIndex = 3;
this.instructionLabel.Text = "Override processor state values determined by code analyzer:";
//
// labelLongRegsNote
//
this.labelLongRegsNote.AutoSize = true;
this.labelLongRegsNote.Location = new System.Drawing.Point(13, 169);
this.labelLongRegsNote.Name = "labelLongRegsNote";
this.labelLongRegsNote.Size = new System.Drawing.Size(341, 13);
this.labelLongRegsNote.TabIndex = 8;
this.labelLongRegsNote.Text = "Tip: to configure 16-bit registers on 65802/65816, set M, X, and E to 0.";
//
// resetButton
//
this.resetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.resetButton.Location = new System.Drawing.Point(12, 205);
this.resetButton.Name = "resetButton";
this.resetButton.Size = new System.Drawing.Size(112, 23);
this.resetButton.TabIndex = 2;
this.resetButton.Text = "Reset to Default";
this.resetButton.UseVisualStyleBackColor = true;
this.resetButton.Click += new System.EventHandler(this.resetButton_Click);
//
// EditStatusFlags
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(449, 240);
this.Controls.Add(this.resetButton);
this.Controls.Add(this.labelLongRegsNote);
this.Controls.Add(this.instructionLabel);
this.Controls.Add(this.panelE);
this.Controls.Add(this.panelC);
this.Controls.Add(this.panelZ);
this.Controls.Add(this.panelI);
this.Controls.Add(this.panelD);
this.Controls.Add(this.panelX);
this.Controls.Add(this.panelM);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.panelV);
this.Controls.Add(this.panelN);
this.Controls.Add(this.indeterminateLabel);
this.Controls.Add(this.oneLabel);
this.Controls.Add(this.zeroLabel);
this.Controls.Add(this.defaultLabel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "EditStatusFlags";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Edit Status Flag Override";
this.Load += new System.EventHandler(this.EditStatusFlags_Load);
this.panelN.ResumeLayout(false);
this.panelN.PerformLayout();
this.panelV.ResumeLayout(false);
this.panelV.PerformLayout();
this.panelM.ResumeLayout(false);
this.panelM.PerformLayout();
this.panelX.ResumeLayout(false);
this.panelX.PerformLayout();
this.panelD.ResumeLayout(false);
this.panelD.PerformLayout();
this.panelI.ResumeLayout(false);
this.panelI.PerformLayout();
this.panelZ.ResumeLayout(false);
this.panelZ.PerformLayout();
this.panelC.ResumeLayout(false);
this.panelC.PerformLayout();
this.panelE.ResumeLayout(false);
this.panelE.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label defaultLabel;
private System.Windows.Forms.Label zeroLabel;
private System.Windows.Forms.Label oneLabel;
private System.Windows.Forms.Label indeterminateLabel;
private System.Windows.Forms.Panel panelN;
private System.Windows.Forms.Label flagNLabel;
private System.Windows.Forms.RadioButton radioNIndeterminate;
private System.Windows.Forms.RadioButton radioNOne;
private System.Windows.Forms.RadioButton radioNZero;
private System.Windows.Forms.RadioButton radioNDefault;
private System.Windows.Forms.Panel panelV;
private System.Windows.Forms.Label flagVLabel;
private System.Windows.Forms.RadioButton radioVIndeterminate;
private System.Windows.Forms.RadioButton radioVOne;
private System.Windows.Forms.RadioButton radioVZero;
private System.Windows.Forms.RadioButton radioVDefault;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Panel panelM;
private System.Windows.Forms.Label flagMLabel;
private System.Windows.Forms.RadioButton radioMIndeterminate;
private System.Windows.Forms.RadioButton radioMOne;
private System.Windows.Forms.RadioButton radioMZero;
private System.Windows.Forms.RadioButton radioMDefault;
private System.Windows.Forms.Panel panelX;
private System.Windows.Forms.Label flagXLabel;
private System.Windows.Forms.RadioButton radioXIndeterminate;
private System.Windows.Forms.RadioButton radioXOne;
private System.Windows.Forms.RadioButton radioXZero;
private System.Windows.Forms.RadioButton radioXDefault;
private System.Windows.Forms.Panel panelD;
private System.Windows.Forms.Label flagDLabel;
private System.Windows.Forms.RadioButton radioDIndeterminate;
private System.Windows.Forms.RadioButton radioDOne;
private System.Windows.Forms.RadioButton radioDZero;
private System.Windows.Forms.RadioButton radioDDefault;
private System.Windows.Forms.Panel panelI;
private System.Windows.Forms.Label flagILabel;
private System.Windows.Forms.RadioButton radioIIndeterminate;
private System.Windows.Forms.RadioButton radioIOne;
private System.Windows.Forms.RadioButton radioIZero;
private System.Windows.Forms.RadioButton radioIDefault;
private System.Windows.Forms.Panel panelZ;
private System.Windows.Forms.Label flagZLabel;
private System.Windows.Forms.RadioButton radioZIndeterminate;
private System.Windows.Forms.RadioButton radioZOne;
private System.Windows.Forms.RadioButton radioZZero;
private System.Windows.Forms.RadioButton radioZDefault;
private System.Windows.Forms.Panel panelC;
private System.Windows.Forms.Label flagCLabel;
private System.Windows.Forms.RadioButton radioCIndeterminate;
private System.Windows.Forms.RadioButton radioCOne;
private System.Windows.Forms.RadioButton radioCZero;
private System.Windows.Forms.RadioButton radioCDefault;
private System.Windows.Forms.Panel panelE;
private System.Windows.Forms.Label flagELabel;
private System.Windows.Forms.RadioButton radioEIndeterminate;
private System.Windows.Forms.RadioButton radioEOne;
private System.Windows.Forms.RadioButton radioEZero;
private System.Windows.Forms.RadioButton radioEDefault;
private System.Windows.Forms.Label instructionLabel;
private System.Windows.Forms.Label labelLongRegsNote;
private System.Windows.Forms.Button resetButton;
}
}

View File

@ -1,143 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Diagnostics;
using System.Windows.Forms;
using Asm65;
namespace SourceGenWF.AppForms {
public partial class EditStatusFlags : Form {
/// <summary>
/// In/out status flag value.
/// </summary>
public StatusFlags FlagValue { get; private set; }
/// <summary>
/// Set this if the CPU has an emulation flag (65802/65816). If this isn't
/// set, the M, X, and E flag buttons will be disabled.
/// </summary>
private bool mHasEmuFlag;
public EditStatusFlags(StatusFlags flagValue, bool hasEmuFlag) {
InitializeComponent();
FlagValue = flagValue;
mHasEmuFlag = hasEmuFlag;
}
private void EditStatusFlags_Load(object sender, EventArgs e) {
if (!mHasEmuFlag) {
panelM.Enabled = false;
panelX.Enabled = false;
panelE.Enabled = false;
// I'm not going to force the M/X/E flags to have a particular value based
// on the CPU definition. The flags aren't used for non-65802/65816, so
// the values are irrelevant. If somebody is switching between CPUs I think
// it'd be weird to force the values during editing but leave any non-edited
// values alone. If they want to switch to 65816, set M/X/E, and then switch
// back, they're welcome to do so.
}
SetCheckedButtons();
}
/// <summary>
/// Calls SetChecked() for each flag.
/// </summary>
private void SetCheckedButtons() {
SetChecked(FlagValue.N, radioNDefault, radioNZero, radioNOne, radioNIndeterminate);
SetChecked(FlagValue.V, radioVDefault, radioVZero, radioVOne, radioVIndeterminate);
SetChecked(FlagValue.M, radioMDefault, radioMZero, radioMOne, radioMIndeterminate);
SetChecked(FlagValue.X, radioXDefault, radioXZero, radioXOne, radioXIndeterminate);
SetChecked(FlagValue.D, radioDDefault, radioDZero, radioDOne, radioDIndeterminate);
SetChecked(FlagValue.I, radioIDefault, radioIZero, radioIOne, radioIIndeterminate);
SetChecked(FlagValue.Z, radioZDefault, radioZZero, radioZOne, radioZIndeterminate);
SetChecked(FlagValue.C, radioCDefault, radioCZero, radioCOne, radioCIndeterminate);
SetChecked(FlagValue.E, radioEDefault, radioEZero, radioEOne, radioEIndeterminate);
}
/// <summary>
/// Sets the "checked" flag on the appropriate radio button.
/// </summary>
private void SetChecked(int value, RadioButton def, RadioButton zero, RadioButton one,
RadioButton indeterminate) {
switch (value) {
case TriState16.UNSPECIFIED:
def.Checked = true;
break;
case TriState16.INDETERMINATE:
indeterminate.Checked = true;
break;
case 0:
zero.Checked = true;
break;
case 1:
one.Checked = true;
break;
default:
throw new Exception("Unexpected value " + value);
}
}
private void okButton_Click(object sender, EventArgs e) {
StatusFlags flags = new StatusFlags();
flags.N = GetChecked(radioNDefault, radioNZero, radioNOne, radioNIndeterminate);
flags.V = GetChecked(radioVDefault, radioVZero, radioVOne, radioVIndeterminate);
flags.M = GetChecked(radioMDefault, radioMZero, radioMOne, radioMIndeterminate);
flags.X = GetChecked(radioXDefault, radioXZero, radioXOne, radioXIndeterminate);
flags.D = GetChecked(radioDDefault, radioDZero, radioDOne, radioDIndeterminate);
flags.I = GetChecked(radioIDefault, radioIZero, radioIOne, radioIIndeterminate);
flags.Z = GetChecked(radioZDefault, radioZZero, radioZOne, radioZIndeterminate);
flags.C = GetChecked(radioCDefault, radioCZero, radioCOne, radioCIndeterminate);
flags.E = GetChecked(radioEDefault, radioEZero, radioEOne, radioEIndeterminate);
//// If they're setting emulation mode, also set M/X to 1. This is implicitly
//// true, but things are a bit clearer if we make it explicit.
//if (flags.E == 1) {
// flags.M = flags.X = 1;
//}
FlagValue = flags;
}
/// <summary>
/// Identifies the checked radio button and returns the appropriate TriState16 value.
/// </summary>
private int GetChecked(RadioButton def, RadioButton zero, RadioButton one,
RadioButton indeterminate) {
if (zero.Checked) {
return 0;
} else if (one.Checked) {
return 1;
} else if (indeterminate.Checked) {
return TriState16.INDETERMINATE;
} else if (def.Checked) {
return TriState16.UNSPECIFIED;
} else {
throw new Exception("No radio button selected");
}
}
private void resetButton_Click(object sender, EventArgs e) {
FlagValue = new StatusFlags();
SetCheckedButtons();
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,89 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class FindBox {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.okButton = new System.Windows.Forms.Button();
this.findTextBox = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(222, 13);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 1;
this.okButton.Text = "Find";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// findTextBox
//
this.findTextBox.Location = new System.Drawing.Point(12, 15);
this.findTextBox.Name = "findTextBox";
this.findTextBox.Size = new System.Drawing.Size(197, 20);
this.findTextBox.TabIndex = 0;
//
// FindBox
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(309, 48);
this.Controls.Add(this.findTextBox);
this.Controls.Add(this.okButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FindBox";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Find...";
this.Load += new System.EventHandler(this.FindBox_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.TextBox findTextBox;
}
}

View File

@ -1,53 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Windows.Forms;
namespace SourceGenWF.AppForms {
public partial class FindBox : Form {
/// <summary>
/// Text to find. On success, holds the string searched for.
/// </summary>
public string TextToFind { get; private set; }
public FindBox(string findStr) {
InitializeComponent();
TextToFind = findStr;
}
private void FindBox_Load(object sender, EventArgs e) {
if (!string.IsNullOrEmpty(TextToFind)) {
findTextBox.Text = TextToFind;
findTextBox.SelectAll();
}
}
// Without a "cancel" button, the escape key does nothing.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
if (keyData == Keys.Escape) {
Close();
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void okButton_Click(object sender, EventArgs e) {
TextToFind = findTextBox.Text;
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,495 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class FormatSplitAddress {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
System.Windows.Forms.ListViewItem listViewItem8 = new System.Windows.Forms.ListViewItem(new string[] {
"12/3456",
"+123456",
"(+) T_123456"}, -1);
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.selectionInfoLabel = new System.Windows.Forms.Label();
this.addressCharacteristicsGroup = new System.Windows.Forms.GroupBox();
this.pushRtsCheckBox = new System.Windows.Forms.CheckBox();
this.width24Radio = new System.Windows.Forms.RadioButton();
this.width16Radio = new System.Windows.Forms.RadioButton();
this.lowByteGroupBox = new System.Windows.Forms.GroupBox();
this.lowThirdPartRadio = new System.Windows.Forms.RadioButton();
this.lowSecondPartRadio = new System.Windows.Forms.RadioButton();
this.lowFirstPartRadio = new System.Windows.Forms.RadioButton();
this.highByteGroupBox = new System.Windows.Forms.GroupBox();
this.highConstantTextBox = new System.Windows.Forms.TextBox();
this.highConstantRadio = new System.Windows.Forms.RadioButton();
this.highThirdPartRadio = new System.Windows.Forms.RadioButton();
this.highSecondPartRadio = new System.Windows.Forms.RadioButton();
this.highFirstPartRadio = new System.Windows.Forms.RadioButton();
this.bankByteGroupBox = new System.Windows.Forms.GroupBox();
this.bankConstantTextBox = new System.Windows.Forms.TextBox();
this.bankNthPartRadio = new System.Windows.Forms.RadioButton();
this.bankConstantRadio = new System.Windows.Forms.RadioButton();
this.outputPreviewListView = new System.Windows.Forms.ListView();
this.addrColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.symbolColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.outputPreviewGroupBox = new System.Windows.Forms.GroupBox();
this.invalidConstantLabel = new System.Windows.Forms.Label();
this.incompatibleSelectionLabel = new System.Windows.Forms.Label();
this.addCodeHintCheckBox = new System.Windows.Forms.CheckBox();
this.optionsGroupBox = new System.Windows.Forms.GroupBox();
this.offsetColumnHeader = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.addressCharacteristicsGroup.SuspendLayout();
this.lowByteGroupBox.SuspendLayout();
this.highByteGroupBox.SuspendLayout();
this.bankByteGroupBox.SuspendLayout();
this.outputPreviewGroupBox.SuspendLayout();
this.optionsGroupBox.SuspendLayout();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(461, 461);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 8;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(380, 461);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 7;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// selectionInfoLabel
//
this.selectionInfoLabel.AutoSize = true;
this.selectionInfoLabel.Location = new System.Drawing.Point(13, 13);
this.selectionInfoLabel.Name = "selectionInfoLabel";
this.selectionInfoLabel.Size = new System.Drawing.Size(213, 13);
this.selectionInfoLabel.TabIndex = 0;
this.selectionInfoLabel.Text = "There are {0} bytes selected, in {1} group(s)";
//
// addressCharacteristicsGroup
//
this.addressCharacteristicsGroup.Controls.Add(this.pushRtsCheckBox);
this.addressCharacteristicsGroup.Controls.Add(this.width24Radio);
this.addressCharacteristicsGroup.Controls.Add(this.width16Radio);
this.addressCharacteristicsGroup.Location = new System.Drawing.Point(16, 40);
this.addressCharacteristicsGroup.Name = "addressCharacteristicsGroup";
this.addressCharacteristicsGroup.Size = new System.Drawing.Size(204, 90);
this.addressCharacteristicsGroup.TabIndex = 1;
this.addressCharacteristicsGroup.TabStop = false;
this.addressCharacteristicsGroup.Text = "Address Characteristics";
//
// pushRtsCheckBox
//
this.pushRtsCheckBox.AutoSize = true;
this.pushRtsCheckBox.Location = new System.Drawing.Point(7, 68);
this.pushRtsCheckBox.Name = "pushRtsCheckBox";
this.pushRtsCheckBox.Size = new System.Drawing.Size(184, 17);
this.pushRtsCheckBox.TabIndex = 2;
this.pushRtsCheckBox.Text = "Adjusted for RTS/RTL (target - 1)";
this.pushRtsCheckBox.UseVisualStyleBackColor = true;
this.pushRtsCheckBox.CheckedChanged += new System.EventHandler(this.pushRtsCheckBox_CheckedChanged);
//
// width24Radio
//
this.width24Radio.AutoSize = true;
this.width24Radio.Location = new System.Drawing.Point(7, 44);
this.width24Radio.Name = "width24Radio";
this.width24Radio.Size = new System.Drawing.Size(51, 17);
this.width24Radio.TabIndex = 1;
this.width24Radio.TabStop = true;
this.width24Radio.Text = "24-bit";
this.width24Radio.UseVisualStyleBackColor = true;
this.width24Radio.CheckedChanged += new System.EventHandler(this.widthRadio_CheckedChanged);
//
// width16Radio
//
this.width16Radio.AutoSize = true;
this.width16Radio.Location = new System.Drawing.Point(7, 20);
this.width16Radio.Name = "width16Radio";
this.width16Radio.Size = new System.Drawing.Size(51, 17);
this.width16Radio.TabIndex = 0;
this.width16Radio.TabStop = true;
this.width16Radio.Text = "16-bit";
this.width16Radio.UseVisualStyleBackColor = true;
this.width16Radio.CheckedChanged += new System.EventHandler(this.widthRadio_CheckedChanged);
//
// lowByteGroupBox
//
this.lowByteGroupBox.Controls.Add(this.lowThirdPartRadio);
this.lowByteGroupBox.Controls.Add(this.lowSecondPartRadio);
this.lowByteGroupBox.Controls.Add(this.lowFirstPartRadio);
this.lowByteGroupBox.Location = new System.Drawing.Point(13, 136);
this.lowByteGroupBox.Name = "lowByteGroupBox";
this.lowByteGroupBox.Size = new System.Drawing.Size(207, 94);
this.lowByteGroupBox.TabIndex = 2;
this.lowByteGroupBox.TabStop = false;
this.lowByteGroupBox.Text = "Low Bytes";
//
// lowThirdPartRadio
//
this.lowThirdPartRadio.AutoSize = true;
this.lowThirdPartRadio.Location = new System.Drawing.Point(10, 68);
this.lowThirdPartRadio.Name = "lowThirdPartRadio";
this.lowThirdPartRadio.Size = new System.Drawing.Size(127, 17);
this.lowThirdPartRadio.TabIndex = 2;
this.lowThirdPartRadio.TabStop = true;
this.lowThirdPartRadio.Text = "Third part of selection";
this.lowThirdPartRadio.UseVisualStyleBackColor = true;
this.lowThirdPartRadio.CheckedChanged += new System.EventHandler(this.lowByte_CheckedChanged);
//
// lowSecondPartRadio
//
this.lowSecondPartRadio.AutoSize = true;
this.lowSecondPartRadio.Location = new System.Drawing.Point(10, 44);
this.lowSecondPartRadio.Name = "lowSecondPartRadio";
this.lowSecondPartRadio.Size = new System.Drawing.Size(140, 17);
this.lowSecondPartRadio.TabIndex = 1;
this.lowSecondPartRadio.TabStop = true;
this.lowSecondPartRadio.Text = "Second part of selection";
this.lowSecondPartRadio.UseVisualStyleBackColor = true;
this.lowSecondPartRadio.CheckedChanged += new System.EventHandler(this.lowByte_CheckedChanged);
//
// lowFirstPartRadio
//
this.lowFirstPartRadio.AutoSize = true;
this.lowFirstPartRadio.Location = new System.Drawing.Point(10, 20);
this.lowFirstPartRadio.Name = "lowFirstPartRadio";
this.lowFirstPartRadio.Size = new System.Drawing.Size(122, 17);
this.lowFirstPartRadio.TabIndex = 0;
this.lowFirstPartRadio.TabStop = true;
this.lowFirstPartRadio.Text = "First part of selection";
this.lowFirstPartRadio.UseVisualStyleBackColor = true;
this.lowFirstPartRadio.CheckedChanged += new System.EventHandler(this.lowByte_CheckedChanged);
//
// highByteGroupBox
//
this.highByteGroupBox.Controls.Add(this.highConstantTextBox);
this.highByteGroupBox.Controls.Add(this.highConstantRadio);
this.highByteGroupBox.Controls.Add(this.highThirdPartRadio);
this.highByteGroupBox.Controls.Add(this.highSecondPartRadio);
this.highByteGroupBox.Controls.Add(this.highFirstPartRadio);
this.highByteGroupBox.Location = new System.Drawing.Point(13, 236);
this.highByteGroupBox.Name = "highByteGroupBox";
this.highByteGroupBox.Size = new System.Drawing.Size(207, 120);
this.highByteGroupBox.TabIndex = 3;
this.highByteGroupBox.TabStop = false;
this.highByteGroupBox.Text = "High Bytes";
//
// highConstantTextBox
//
this.highConstantTextBox.Location = new System.Drawing.Point(87, 91);
this.highConstantTextBox.MaxLength = 10;
this.highConstantTextBox.Name = "highConstantTextBox";
this.highConstantTextBox.Size = new System.Drawing.Size(93, 20);
this.highConstantTextBox.TabIndex = 4;
this.highConstantTextBox.TextChanged += new System.EventHandler(this.highConstantTextBox_TextChanged);
//
// highConstantRadio
//
this.highConstantRadio.AutoSize = true;
this.highConstantRadio.Location = new System.Drawing.Point(10, 92);
this.highConstantRadio.Name = "highConstantRadio";
this.highConstantRadio.Size = new System.Drawing.Size(70, 17);
this.highConstantRadio.TabIndex = 3;
this.highConstantRadio.TabStop = true;
this.highConstantRadio.Text = "Constant:";
this.highConstantRadio.UseVisualStyleBackColor = true;
this.highConstantRadio.CheckedChanged += new System.EventHandler(this.highByte_CheckedChanged);
//
// highThirdPartRadio
//
this.highThirdPartRadio.AutoSize = true;
this.highThirdPartRadio.Location = new System.Drawing.Point(10, 68);
this.highThirdPartRadio.Name = "highThirdPartRadio";
this.highThirdPartRadio.Size = new System.Drawing.Size(127, 17);
this.highThirdPartRadio.TabIndex = 2;
this.highThirdPartRadio.TabStop = true;
this.highThirdPartRadio.Text = "Third part of selection";
this.highThirdPartRadio.UseVisualStyleBackColor = true;
this.highThirdPartRadio.CheckedChanged += new System.EventHandler(this.highByte_CheckedChanged);
//
// highSecondPartRadio
//
this.highSecondPartRadio.AutoSize = true;
this.highSecondPartRadio.Location = new System.Drawing.Point(10, 44);
this.highSecondPartRadio.Name = "highSecondPartRadio";
this.highSecondPartRadio.Size = new System.Drawing.Size(140, 17);
this.highSecondPartRadio.TabIndex = 1;
this.highSecondPartRadio.TabStop = true;
this.highSecondPartRadio.Text = "Second part of selection";
this.highSecondPartRadio.UseVisualStyleBackColor = true;
this.highSecondPartRadio.CheckedChanged += new System.EventHandler(this.highByte_CheckedChanged);
//
// highFirstPartRadio
//
this.highFirstPartRadio.AutoSize = true;
this.highFirstPartRadio.Location = new System.Drawing.Point(10, 20);
this.highFirstPartRadio.Name = "highFirstPartRadio";
this.highFirstPartRadio.Size = new System.Drawing.Size(122, 17);
this.highFirstPartRadio.TabIndex = 0;
this.highFirstPartRadio.TabStop = true;
this.highFirstPartRadio.Text = "First part of selection";
this.highFirstPartRadio.UseVisualStyleBackColor = true;
this.highFirstPartRadio.CheckedChanged += new System.EventHandler(this.highByte_CheckedChanged);
//
// bankByteGroupBox
//
this.bankByteGroupBox.Controls.Add(this.bankConstantTextBox);
this.bankByteGroupBox.Controls.Add(this.bankNthPartRadio);
this.bankByteGroupBox.Controls.Add(this.bankConstantRadio);
this.bankByteGroupBox.Location = new System.Drawing.Point(13, 362);
this.bankByteGroupBox.Name = "bankByteGroupBox";
this.bankByteGroupBox.Size = new System.Drawing.Size(207, 70);
this.bankByteGroupBox.TabIndex = 4;
this.bankByteGroupBox.TabStop = false;
this.bankByteGroupBox.Text = "Bank Bytes";
//
// bankConstantTextBox
//
this.bankConstantTextBox.Location = new System.Drawing.Point(87, 41);
this.bankConstantTextBox.MaxLength = 10;
this.bankConstantTextBox.Name = "bankConstantTextBox";
this.bankConstantTextBox.Size = new System.Drawing.Size(93, 20);
this.bankConstantTextBox.TabIndex = 2;
this.bankConstantTextBox.TextChanged += new System.EventHandler(this.bankConstantTextBox_TextChanged);
//
// bankNthPartRadio
//
this.bankNthPartRadio.AutoSize = true;
this.bankNthPartRadio.Location = new System.Drawing.Point(10, 19);
this.bankNthPartRadio.Name = "bankNthPartRadio";
this.bankNthPartRadio.Size = new System.Drawing.Size(120, 17);
this.bankNthPartRadio.TabIndex = 0;
this.bankNthPartRadio.TabStop = true;
this.bankNthPartRadio.Text = "Nth part of selection";
this.bankNthPartRadio.UseVisualStyleBackColor = true;
this.bankNthPartRadio.CheckedChanged += new System.EventHandler(this.bankByte_CheckedChanged);
//
// bankConstantRadio
//
this.bankConstantRadio.AutoSize = true;
this.bankConstantRadio.Location = new System.Drawing.Point(10, 42);
this.bankConstantRadio.Name = "bankConstantRadio";
this.bankConstantRadio.Size = new System.Drawing.Size(70, 17);
this.bankConstantRadio.TabIndex = 1;
this.bankConstantRadio.TabStop = true;
this.bankConstantRadio.Text = "Constant:";
this.bankConstantRadio.UseVisualStyleBackColor = true;
this.bankConstantRadio.CheckedChanged += new System.EventHandler(this.bankByte_CheckedChanged);
//
// outputPreviewListView
//
this.outputPreviewListView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.outputPreviewListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.addrColumnHeader,
this.offsetColumnHeader,
this.symbolColumnHeader});
this.outputPreviewListView.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.outputPreviewListView.FullRowSelect = true;
this.outputPreviewListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.outputPreviewListView.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
listViewItem8});
this.outputPreviewListView.Location = new System.Drawing.Point(6, 19);
this.outputPreviewListView.MultiSelect = false;
this.outputPreviewListView.Name = "outputPreviewListView";
this.outputPreviewListView.Size = new System.Drawing.Size(290, 369);
this.outputPreviewListView.TabIndex = 0;
this.outputPreviewListView.UseCompatibleStateImageBehavior = false;
this.outputPreviewListView.View = System.Windows.Forms.View.Details;
//
// addrColumnHeader
//
this.addrColumnHeader.Text = "Addr";
this.addrColumnHeader.Width = 52;
//
// symbolColumnHeader
//
this.symbolColumnHeader.Text = "Symbol";
this.symbolColumnHeader.Width = 174;
//
// outputPreviewGroupBox
//
this.outputPreviewGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.outputPreviewGroupBox.Controls.Add(this.invalidConstantLabel);
this.outputPreviewGroupBox.Controls.Add(this.incompatibleSelectionLabel);
this.outputPreviewGroupBox.Controls.Add(this.outputPreviewListView);
this.outputPreviewGroupBox.Location = new System.Drawing.Point(234, 40);
this.outputPreviewGroupBox.Name = "outputPreviewGroupBox";
this.outputPreviewGroupBox.Size = new System.Drawing.Size(302, 393);
this.outputPreviewGroupBox.TabIndex = 6;
this.outputPreviewGroupBox.TabStop = false;
this.outputPreviewGroupBox.Text = "Generated Addresses";
//
// invalidConstantLabel
//
this.invalidConstantLabel.AutoSize = true;
this.invalidConstantLabel.BackColor = System.Drawing.SystemColors.Window;
this.invalidConstantLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.invalidConstantLabel.ForeColor = System.Drawing.Color.Red;
this.invalidConstantLabel.Location = new System.Drawing.Point(101, 200);
this.invalidConstantLabel.Name = "invalidConstantLabel";
this.invalidConstantLabel.Size = new System.Drawing.Size(100, 16);
this.invalidConstantLabel.TabIndex = 2;
this.invalidConstantLabel.Text = "Invalid constant";
//
// incompatibleSelectionLabel
//
this.incompatibleSelectionLabel.AutoSize = true;
this.incompatibleSelectionLabel.BackColor = System.Drawing.SystemColors.Window;
this.incompatibleSelectionLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.incompatibleSelectionLabel.ForeColor = System.Drawing.Color.Red;
this.incompatibleSelectionLabel.Location = new System.Drawing.Point(43, 177);
this.incompatibleSelectionLabel.Name = "incompatibleSelectionLabel";
this.incompatibleSelectionLabel.Size = new System.Drawing.Size(216, 16);
this.incompatibleSelectionLabel.TabIndex = 1;
this.incompatibleSelectionLabel.Text = "Options incompatible with selection";
//
// addCodeHintCheckBox
//
this.addCodeHintCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.addCodeHintCheckBox.AutoSize = true;
this.addCodeHintCheckBox.Location = new System.Drawing.Point(10, 19);
this.addCodeHintCheckBox.Name = "addCodeHintCheckBox";
this.addCodeHintCheckBox.Size = new System.Drawing.Size(165, 17);
this.addCodeHintCheckBox.TabIndex = 0;
this.addCodeHintCheckBox.Text = "Add code entry hint if needed";
this.addCodeHintCheckBox.UseVisualStyleBackColor = true;
//
// optionsGroupBox
//
this.optionsGroupBox.Controls.Add(this.addCodeHintCheckBox);
this.optionsGroupBox.Location = new System.Drawing.Point(13, 439);
this.optionsGroupBox.Name = "optionsGroupBox";
this.optionsGroupBox.Size = new System.Drawing.Size(207, 43);
this.optionsGroupBox.TabIndex = 5;
this.optionsGroupBox.TabStop = false;
this.optionsGroupBox.Text = "Options";
//
// offsetColumnHeader
//
this.offsetColumnHeader.Text = "Offset";
this.offsetColumnHeader.Width = 55;
//
// FormatSplitAddress
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(548, 496);
this.Controls.Add(this.optionsGroupBox);
this.Controls.Add(this.outputPreviewGroupBox);
this.Controls.Add(this.bankByteGroupBox);
this.Controls.Add(this.highByteGroupBox);
this.Controls.Add(this.lowByteGroupBox);
this.Controls.Add(this.addressCharacteristicsGroup);
this.Controls.Add(this.selectionInfoLabel);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FormatSplitAddress";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Format Split-Address Table";
this.Load += new System.EventHandler(this.FormatSplitAddress_Load);
this.addressCharacteristicsGroup.ResumeLayout(false);
this.addressCharacteristicsGroup.PerformLayout();
this.lowByteGroupBox.ResumeLayout(false);
this.lowByteGroupBox.PerformLayout();
this.highByteGroupBox.ResumeLayout(false);
this.highByteGroupBox.PerformLayout();
this.bankByteGroupBox.ResumeLayout(false);
this.bankByteGroupBox.PerformLayout();
this.outputPreviewGroupBox.ResumeLayout(false);
this.outputPreviewGroupBox.PerformLayout();
this.optionsGroupBox.ResumeLayout(false);
this.optionsGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Label selectionInfoLabel;
private System.Windows.Forms.GroupBox addressCharacteristicsGroup;
private System.Windows.Forms.RadioButton width16Radio;
private System.Windows.Forms.RadioButton width24Radio;
private System.Windows.Forms.CheckBox pushRtsCheckBox;
private System.Windows.Forms.GroupBox lowByteGroupBox;
private System.Windows.Forms.RadioButton lowFirstPartRadio;
private System.Windows.Forms.RadioButton lowSecondPartRadio;
private System.Windows.Forms.RadioButton lowThirdPartRadio;
private System.Windows.Forms.GroupBox highByteGroupBox;
private System.Windows.Forms.RadioButton highFirstPartRadio;
private System.Windows.Forms.RadioButton highSecondPartRadio;
private System.Windows.Forms.RadioButton highThirdPartRadio;
private System.Windows.Forms.RadioButton highConstantRadio;
private System.Windows.Forms.TextBox highConstantTextBox;
private System.Windows.Forms.GroupBox bankByteGroupBox;
private System.Windows.Forms.ListView outputPreviewListView;
private System.Windows.Forms.ColumnHeader addrColumnHeader;
private System.Windows.Forms.ColumnHeader symbolColumnHeader;
private System.Windows.Forms.RadioButton bankConstantRadio;
private System.Windows.Forms.RadioButton bankNthPartRadio;
private System.Windows.Forms.TextBox bankConstantTextBox;
private System.Windows.Forms.GroupBox outputPreviewGroupBox;
private System.Windows.Forms.CheckBox addCodeHintCheckBox;
private System.Windows.Forms.GroupBox optionsGroupBox;
private System.Windows.Forms.Label incompatibleSelectionLabel;
private System.Windows.Forms.Label invalidConstantLabel;
private System.Windows.Forms.ColumnHeader offsetColumnHeader;
}
}

View File

@ -1,434 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
using Asm65;
using CommonUtil;
using CommonWinForms;
namespace SourceGenWF.AppForms {
public partial class FormatSplitAddress : Form {
/// <summary>
/// Format descriptors to apply.
/// </summary>
public SortedList<int, FormatDescriptor> NewFormatDescriptors { get; private set; }
/// <summary>
/// User labels to apply.
/// </summary>
public Dictionary<int, Symbol> NewUserLabels { get; private set; }
/// <summary>
/// All target offsets found. The list may contain redundant entries.
/// </summary>
public List<int> AllTargetOffsets { get; private set; }
public bool WantCodeHints {
get {
return addCodeHintCheckBox.Checked;
}
}
/// <summary>
/// Selected offsets. An otherwise contiguous range of offsets can be broken up
/// by user-specified labels and address discontinuities, so this needs to be
/// processed by range.
/// </summary>
private TypedRangeSet mSelection;
/// <summary>
/// Project reference.
/// </summary>
private DisasmProject mProject;
/// <summary>
/// Formatter to use when displaying addresses and hex values.
/// </summary>
private Formatter mFormatter;
/// <summary>
/// Set to prevent controls from going nuts while initializing.
/// </summary>
private bool mInitializing;
/// <summary>
/// Set to true when valid output is available.
/// </summary>
private bool mOutputReady;
public FormatSplitAddress(DisasmProject project, TypedRangeSet selection,
Formatter formatter) {
InitializeComponent();
mProject = project;
mFormatter = formatter;
mSelection = selection;
mOutputReady = false;
}
private void FormatSplitAddress_Load(object sender, EventArgs e) {
mInitializing = true;
string fmt = selectionInfoLabel.Text;
selectionInfoLabel.Text = string.Format(fmt, mSelection.Count, mSelection.RangeCount);
width16Radio.Checked = true;
lowFirstPartRadio.Checked = true;
highSecondPartRadio.Checked = true;
bankNthPartRadio.Checked = true;
incompatibleSelectionLabel.Visible = invalidConstantLabel.Visible = false;
if (mProject.CpuDef.HasAddr16) {
// Disable the 24-bit option. Having 16-bit selected will disable the rest.
width24Radio.Enabled = false;
}
outputPreviewListView.SetDoubleBuffered(true);
mInitializing = false;
UpdateControls();
}
private void okButton_Click(object sender, EventArgs e) { }
private void UpdateControls() {
if (mInitializing) {
return;
}
mInitializing = true; // no re-entry
lowThirdPartRadio.Enabled = width24Radio.Checked;
highThirdPartRadio.Enabled = width24Radio.Checked;
bankByteGroupBox.Enabled = width24Radio.Checked;
lowSecondPartRadio.Enabled = true;
// If the user selects "constant" for high byte or bank byte, then there is no
// 3rd part available for low/high, so we need to turn those back off.
if (width24Radio.Checked) {
bool haveThree = !(highConstantRadio.Checked || bankConstantRadio.Checked);
lowThirdPartRadio.Enabled = haveThree;
highThirdPartRadio.Enabled = haveThree;
// If "constant" is selected for high byte *and* bank byte, then there's no
// 2nd part available for low.
if (highConstantRadio.Checked && bankConstantRadio.Checked) {
lowSecondPartRadio.Enabled = false;
}
} else {
// For 16-bit address, if high byte is constant, then there's no second
// part for the low byte.
if (highConstantRadio.Checked) {
lowSecondPartRadio.Enabled = false;
}
}
// Was a now-invalidated radio button selected before?
if (!lowThirdPartRadio.Enabled && lowThirdPartRadio.Checked) {
// low now invalid, switch to whatever high isn't using
if (highFirstPartRadio.Checked) {
lowSecondPartRadio.Checked = true;
} else {
lowFirstPartRadio.Checked = true;
}
}
if (!highThirdPartRadio.Enabled && highThirdPartRadio.Checked) {
// high now invalid, switch to whatever low isn't using
if (lowFirstPartRadio.Checked) {
highSecondPartRadio.Checked = true;
} else {
highFirstPartRadio.Checked = true;
}
}
if (!lowSecondPartRadio.Enabled && lowSecondPartRadio.Checked) {
// Should only happen when high part is constant.
Debug.Assert(highFirstPartRadio.Checked == false);
lowFirstPartRadio.Checked = true;
}
mInitializing = false;
UpdatePreview();
okButton.Enabled = mOutputReady;
}
private void widthRadio_CheckedChanged(object sender, EventArgs e) {
UpdateControls();
}
private void pushRtsCheckBox_CheckedChanged(object sender, EventArgs e) {
UpdateControls();
}
private void lowByte_CheckedChanged(object sender, EventArgs e) {
// If we conflict with the high byte, change the high byte.
if (lowFirstPartRadio.Checked && highFirstPartRadio.Checked) {
highSecondPartRadio.Checked = true;
} else if (lowSecondPartRadio.Checked && highSecondPartRadio.Checked) {
highFirstPartRadio.Checked = true;
} else if (lowThirdPartRadio.Checked && highThirdPartRadio.Checked) {
highFirstPartRadio.Checked = true;
}
UpdateControls();
}
private void highByte_CheckedChanged(object sender, EventArgs e) {
// If we conflict with the low byte, change the low byte.
if (lowFirstPartRadio.Checked && highFirstPartRadio.Checked) {
lowSecondPartRadio.Checked = true;
} else if (lowSecondPartRadio.Checked && highSecondPartRadio.Checked) {
lowFirstPartRadio.Checked = true;
} else if (lowThirdPartRadio.Checked && highThirdPartRadio.Checked) {
lowFirstPartRadio.Checked = true;
}
UpdateControls();
}
private void bankByte_CheckedChanged(object sender, EventArgs e) {
UpdateControls();
}
private void highConstantTextBox_TextChanged(object sender, EventArgs e) {
highConstantRadio.Checked = true;
UpdateControls();
}
private void bankConstantTextBox_TextChanged(object sender, EventArgs e) {
bankConstantRadio.Checked = true;
UpdateControls();
}
private void UpdatePreview() {
mOutputReady = false;
int minDiv;
if (width16Radio.Checked) {
if (highConstantRadio.Checked) {
minDiv = 1;
} else {
minDiv = 2;
}
} else {
if (highConstantRadio.Checked) {
if (bankConstantRadio.Checked) {
minDiv = 1;
} else {
minDiv = 2;
}
} else {
if (bankConstantRadio.Checked) {
minDiv = 2;
} else {
minDiv = 3;
}
}
}
incompatibleSelectionLabel.Visible = invalidConstantLabel.Visible = false;
try {
// Start by clearing the previous contents of the list. If something goes
// wrong, we want to show the error messages on an empty list.
outputPreviewListView.BeginUpdate();
outputPreviewListView.Items.Clear();
if ((mSelection.Count % minDiv) != 0) {
incompatibleSelectionLabel.Visible = true;
return;
}
int highConstant = -1;
if (highConstantRadio.Checked) {
if (!Number.TryParseInt(highConstantTextBox.Text, out highConstant,
out int unused) || (highConstant != (byte) highConstant)) {
invalidConstantLabel.Visible = true;
return;
}
}
int bankConstant = -1;
if (bankConstantRadio.Enabled && bankConstantRadio.Checked) {
if (!Number.TryParseInt(bankConstantTextBox.Text, out bankConstant,
out int unused) || (bankConstant != (byte) bankConstant)) {
invalidConstantLabel.Visible = true;
return;
}
}
// Looks valid, generate format list.
GenerateFormats(minDiv, highConstant, bankConstant);
} finally {
outputPreviewListView.EndUpdate();
}
}
private void GenerateFormats(int div, int highConst, int bankConst) {
SortedList<int, FormatDescriptor> newDfds = new SortedList<int, FormatDescriptor>();
Dictionary<int, Symbol> newLabels = new Dictionary<int, Symbol>();
List<int> targetOffsets = new List<int>();
// Identify the offset where each set of data starts.
int span = mSelection.Count / div;
int lowOff, highOff, bankOff;
if (lowFirstPartRadio.Checked) {
lowOff = 0;
} else if (lowSecondPartRadio.Checked) {
lowOff = span;
} else if (lowThirdPartRadio.Checked) {
lowOff = span * 2;
} else {
Debug.Assert(false);
lowOff = -1;
}
if (highFirstPartRadio.Checked) {
highOff = 0;
} else if (highSecondPartRadio.Checked) {
highOff = span;
} else if (highThirdPartRadio.Checked) {
highOff = span * 2;
} else {
highOff = -1; // use constant
}
if (width24Radio.Checked) {
if (bankNthPartRadio.Checked) {
// Use whichever part isn't being used by the other two.
if (lowOff != 0 && highOff != 0) {
bankOff = 0;
} else if (lowOff != span && highOff != span) {
bankOff = span;
} else {
Debug.Assert(lowOff != span * 2 && highOff != span * 2);
bankOff = span * 2;
}
} else {
bankOff = -1; // use constant
}
} else {
bankOff = -1; // use constant
bankConst = 0; // always bank 0
}
Debug.WriteLine("Extract from low=" + lowOff + " high=" + highOff +
" bank=" + bankOff);
// The TypedRangeSet doesn't have an index operation, so copy the values into
// an array.
int[] offsets = new int[mSelection.Count];
int index = 0;
foreach (TypedRangeSet.Tuple tup in mSelection) {
offsets[index++] = tup.Value;
}
int adj = 0;
if (pushRtsCheckBox.Checked) {
adj = 1;
}
// Walk through the file data, generating addresses as we go.
byte[] fileData = mProject.FileData;
for (int i = 0; i < span; i++) {
byte low, high, bank;
low = fileData[offsets[lowOff + i]];
if (highOff >= 0) {
high = fileData[offsets[highOff + i]];
} else {
high = (byte) highConst;
}
if (bankOff >= 0) {
bank = fileData[offsets[bankOff + i]];
} else {
bank = (byte) bankConst;
}
int addr = ((bank << 16) | (high << 8) | low) + adj;
int targetOffset = mProject.AddrMap.AddressToOffset(offsets[0], addr);
if (targetOffset < 0) {
// Address not within file bounds.
// TODO(maybe): look for matching platform/project symbols
AddPreviewItem(addr, -1, Properties.Resources.INVALID_ADDRESS);
} else {
// Note the same target offset may appear more than once.
targetOffsets.Add(targetOffset);
// If there's a user-defined label there already, use it. Otherwise, we'll
// need to generate one.
string targetLabel;
if (mProject.UserLabels.TryGetValue(targetOffset, out Symbol sym)) {
targetLabel = sym.Label;
AddPreviewItem(addr, targetOffset, targetLabel);
} else {
// Generate a symbol that's unique vs. the symbol table. We don't need
// it to be unique vs. the labels we're generating here, because we
// won't generate identical labels for different addresses, and we do
// want to generate a single label if more than one table entry refers
// to the same target.
Symbol tmpSym = AutoLabel.GenerateUniqueForAddress(addr,
mProject.SymbolTable, "T");
// tmpSym was returned as an auto-label, make it a user label instead
tmpSym = new Symbol(tmpSym.Label, tmpSym.Value, Symbol.Source.User,
Symbol.Type.LocalOrGlobalAddr);
newLabels[targetOffset] = tmpSym; // overwrites previous
targetLabel = tmpSym.Label;
AddPreviewItem(addr, targetOffset, "(+) " + targetLabel);
}
// Now we need to create format descriptors for the addresses where we
// extracted the low, high, and bank values.
newDfds.Add(offsets[lowOff + i], FormatDescriptor.Create(1,
new WeakSymbolRef(targetLabel, WeakSymbolRef.Part.Low), false));
if (highOff >= 0) {
newDfds.Add(offsets[highOff + i], FormatDescriptor.Create(1,
new WeakSymbolRef(targetLabel, WeakSymbolRef.Part.High), false));
}
if (bankOff >= 0) {
newDfds.Add(offsets[bankOff + i], FormatDescriptor.Create(1,
new WeakSymbolRef(targetLabel, WeakSymbolRef.Part.Bank), false));
}
}
}
NewFormatDescriptors = newDfds;
NewUserLabels = newLabels;
AllTargetOffsets = targetOffsets;
// Don't show ready if all addresses are invalid.
mOutputReady = (AllTargetOffsets.Count > 0);
}
private void AddPreviewItem(int addr, int offset, string label) {
ListViewItem lvi = new ListViewItem(mFormatter.FormatAddress(addr,
!mProject.CpuDef.HasAddr16));
if (offset >= 0) {
lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi,
mFormatter.FormatOffset24(offset)));
} else {
lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, "---"));
}
lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, label));
outputPreviewListView.Items.Add(lvi);
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,181 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class GotoBox {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.instructionLabel = new System.Windows.Forms.Label();
this.targetTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.offsetLabel = new System.Windows.Forms.Label();
this.addressLabel = new System.Windows.Forms.Label();
this.labelLabel = new System.Windows.Forms.Label();
this.addressValueLabel = new System.Windows.Forms.Label();
this.offsetValueLabel = new System.Windows.Forms.Label();
this.labelValueLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// instructionLabel
//
this.instructionLabel.AutoSize = true;
this.instructionLabel.Location = new System.Drawing.Point(13, 13);
this.instructionLabel.Name = "instructionLabel";
this.instructionLabel.Size = new System.Drawing.Size(215, 52);
this.instructionLabel.TabIndex = 0;
this.instructionLabel.Text = "Enter target location as one of:\r\n • Hex file offset (with \'+\', e.g. +500)\r\n • He" +
"x address (e.g. 1000, $1000, 00/1000)\r\n • Label (case-sensitive)\r\n";
//
// targetTextBox
//
this.targetTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.targetTextBox.Location = new System.Drawing.Point(13, 78);
this.targetTextBox.Name = "targetTextBox";
this.targetTextBox.Size = new System.Drawing.Size(215, 20);
this.targetTextBox.TabIndex = 1;
this.targetTextBox.TextChanged += new System.EventHandler(this.targetTextBox_TextChanged);
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(240, 76);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 2;
this.okButton.Text = "Go";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// offsetLabel
//
this.offsetLabel.AutoSize = true;
this.offsetLabel.Location = new System.Drawing.Point(13, 111);
this.offsetLabel.Name = "offsetLabel";
this.offsetLabel.Size = new System.Drawing.Size(38, 13);
this.offsetLabel.TabIndex = 3;
this.offsetLabel.Text = "Offset:";
//
// addressLabel
//
this.addressLabel.AutoSize = true;
this.addressLabel.Location = new System.Drawing.Point(12, 129);
this.addressLabel.Name = "addressLabel";
this.addressLabel.Size = new System.Drawing.Size(48, 13);
this.addressLabel.TabIndex = 4;
this.addressLabel.Text = "Address:";
//
// labelLabel
//
this.labelLabel.AutoSize = true;
this.labelLabel.Location = new System.Drawing.Point(12, 147);
this.labelLabel.Name = "labelLabel";
this.labelLabel.Size = new System.Drawing.Size(36, 13);
this.labelLabel.TabIndex = 5;
this.labelLabel.Text = "Label:";
//
// addressValueLabel
//
this.addressValueLabel.AutoSize = true;
this.addressValueLabel.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.addressValueLabel.Location = new System.Drawing.Point(66, 129);
this.addressValueLabel.Name = "addressValueLabel";
this.addressValueLabel.Size = new System.Drawing.Size(49, 13);
this.addressValueLabel.TabIndex = 6;
this.addressValueLabel.Text = "01/2345";
//
// offsetValueLabel
//
this.offsetValueLabel.AutoSize = true;
this.offsetValueLabel.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.offsetValueLabel.Location = new System.Drawing.Point(66, 111);
this.offsetValueLabel.Name = "offsetValueLabel";
this.offsetValueLabel.Size = new System.Drawing.Size(37, 13);
this.offsetValueLabel.TabIndex = 7;
this.offsetValueLabel.Text = "+1234";
//
// labelValueLabel
//
this.labelValueLabel.AutoSize = true;
this.labelValueLabel.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelValueLabel.Location = new System.Drawing.Point(66, 147);
this.labelValueLabel.Name = "labelValueLabel";
this.labelValueLabel.Size = new System.Drawing.Size(37, 13);
this.labelValueLabel.TabIndex = 8;
this.labelValueLabel.Text = "FUBAR";
//
// GotoBox
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(327, 171);
this.Controls.Add(this.labelValueLabel);
this.Controls.Add(this.offsetValueLabel);
this.Controls.Add(this.addressValueLabel);
this.Controls.Add(this.labelLabel);
this.Controls.Add(this.addressLabel);
this.Controls.Add(this.offsetLabel);
this.Controls.Add(this.okButton);
this.Controls.Add(this.targetTextBox);
this.Controls.Add(this.instructionLabel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "GotoBox";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Go To Line";
this.Load += new System.EventHandler(this.GotoBox_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label instructionLabel;
private System.Windows.Forms.TextBox targetTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Label offsetLabel;
private System.Windows.Forms.Label addressLabel;
private System.Windows.Forms.Label labelLabel;
private System.Windows.Forms.Label addressValueLabel;
private System.Windows.Forms.Label offsetValueLabel;
private System.Windows.Forms.Label labelValueLabel;
}
}

View File

@ -1,119 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Windows.Forms;
using Asm65;
namespace SourceGenWF.AppForms {
public partial class GotoBox : Form {
/// <summary>
/// On success, this will hold the target offset.
/// </summary>
public int TargetOffset { get; private set; }
/// <summary>
/// Reference to project.
/// </summary>
private DisasmProject mProject;
/// <summary>
/// Reference to formatter. This determines how values are displayed.
/// </summary>
private Formatter mFormatter;
public GotoBox(DisasmProject proj, Formatter formatter) {
InitializeComponent();
mProject = proj;
mFormatter = formatter;
TargetOffset = -1;
}
private void GotoBox_Load(object sender, EventArgs e) {
UpdateDisplay();
}
// Without a "cancel" button, the escape key does nothing.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
if (keyData == Keys.Escape) {
Close();
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
private void okButton_Click(object sender, EventArgs e) {
}
private void targetTextBox_TextChanged(object sender, EventArgs e) {
ProcessInput();
UpdateDisplay();
okButton.Enabled = (TargetOffset >= 0);
}
private void ProcessInput() {
TargetOffset = -1;
string input = targetTextBox.Text.Trim();
if (string.IsNullOrEmpty(input)) {
return;
}
if (input[0] == '+') {
// this can only be an offset; convert as hexadecimal number
try {
TargetOffset = Convert.ToInt32(input.Substring(1), 16);
} catch (Exception) {
}
return;
}
// Try it as a label. If they give the label a hex name (e.g. "A001") they
// can prefix it with '$' to disambiguate the address.
int labelOffset = mProject.FindLabelOffsetByName(input);
if (labelOffset >= 0) {
TargetOffset = labelOffset;
} else if (Address.ParseAddress(input, 1<<24, out int addr)) {
// could be a valid address
int offset = mProject.AddrMap.AddressToOffset(0, addr);
if (offset >= 0) {
TargetOffset = offset;
}
}
}
private void UpdateDisplay() {
string offsetStr = string.Empty;
string addressStr = string.Empty;
string labelStr = string.Empty;
if (TargetOffset >= 0) {
offsetStr = mFormatter.FormatOffset24(TargetOffset);
int addr = mProject.GetAnattrib(TargetOffset).Address;
addressStr = mFormatter.FormatAddress(addr, addr > 0xffff);
Symbol sym = mProject.GetAnattrib(TargetOffset).Symbol;
if (sym != null) {
labelStr = sym.Label;
}
}
offsetValueLabel.Text = offsetStr;
addressValueLabel.Text = addressStr;
labelValueLabel.Text = labelStr;
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,134 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AppForms {
partial class ProjectLoadIssues {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.labelSomeIssues = new System.Windows.Forms.Label();
this.messageTextBox = new System.Windows.Forms.TextBox();
this.invalidDiscardLabel = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(469, 184);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 1;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(388, 184);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 0;
this.okButton.Text = "Continue";
this.okButton.UseVisualStyleBackColor = true;
//
// labelSomeIssues
//
this.labelSomeIssues.AutoSize = true;
this.labelSomeIssues.Location = new System.Drawing.Point(13, 13);
this.labelSomeIssues.Name = "labelSomeIssues";
this.labelSomeIssues.Size = new System.Drawing.Size(257, 13);
this.labelSomeIssues.TabIndex = 2;
this.labelSomeIssues.Text = "Problems were detected while loading the project file:";
//
// messageTextBox
//
this.messageTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.messageTextBox.BackColor = System.Drawing.SystemColors.Window;
this.messageTextBox.Location = new System.Drawing.Point(12, 37);
this.messageTextBox.Multiline = true;
this.messageTextBox.Name = "messageTextBox";
this.messageTextBox.ReadOnly = true;
this.messageTextBox.Size = new System.Drawing.Size(533, 113);
this.messageTextBox.TabIndex = 3;
//
// invalidDiscardLabel
//
this.invalidDiscardLabel.AutoSize = true;
this.invalidDiscardLabel.ForeColor = System.Drawing.Color.Red;
this.invalidDiscardLabel.Location = new System.Drawing.Point(13, 158);
this.invalidDiscardLabel.Name = "invalidDiscardLabel";
this.invalidDiscardLabel.Size = new System.Drawing.Size(301, 13);
this.invalidDiscardLabel.TabIndex = 4;
this.invalidDiscardLabel.Text = "Invalid data items will be discarded when you save the project.";
//
// ProjectLoadIssues
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(556, 219);
this.Controls.Add(this.invalidDiscardLabel);
this.Controls.Add(this.messageTextBox);
this.Controls.Add(this.labelSomeIssues);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ProjectLoadIssues";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Project Load Issues";
this.Load += new System.EventHandler(this.ProjectLoadIssues_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Label labelSomeIssues;
private System.Windows.Forms.TextBox messageTextBox;
private System.Windows.Forms.Label invalidDiscardLabel;
}
}

View File

@ -1,64 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Windows.Forms;
namespace SourceGenWF.AppForms {
/// <summary>
/// Display errors and warnings generated while attempting to open a project.
/// </summary>
public partial class ProjectLoadIssues : Form {
/// <summary>
/// Multi-line message for text box.
/// </summary>
private string mMessages;
/// <summary>
/// Which buttons are enabled.
/// </summary>
private Buttons mAllowedButtons;
public enum Buttons {
Unknown = 0, Continue, Cancel, ContinueOrCancel
}
public ProjectLoadIssues(string msgs, Buttons allowedButtons) {
InitializeComponent();
mMessages = msgs;
mAllowedButtons = allowedButtons;
}
private void ProjectLoadIssues_Load(object sender, EventArgs e) {
messageTextBox.Text = mMessages;
if (mAllowedButtons == Buttons.Cancel) {
// Continue not allowed
okButton.Enabled = false;
// No point warning them about invalid data if they can't continue.
invalidDiscardLabel.Visible = false;
}
if (mAllowedButtons == Buttons.Continue) {
// Cancel not allowed.
cancelButton.Enabled = false;
// They're stuck with the problem.
invalidDiscardLabel.Visible = false;
}
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,319 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="mainMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="mainStatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
<metadata name="mainToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>269, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="navigateBackToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA8SURBVDhPY8AHOGPO/ocySQcgzWQbANNMlgHImkk2YJho
JhVTbgA2V4AFSQXD2BCoEOmAYgNAgLABDAwANqCmjcoYW+kAAAAASUVORK5CYII=
</value>
</data>
<data name="navigateFwdToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA5SURBVDhPYyAEOGPO/ocyyQMgAygyBGYA2YYgGzBcDUEX
JBVTbgApYCRqBgGKNIMARZpBAL9mBgYAlSmmjRN9gzIAAAAASUVORK5CYII=
</value>
</data>
<data name="newToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAERSURBVDhPrZDbSgJRGIXnpewd6jXsjSQvIrwoI0RQMChU
0iiDPCGiE3ZCRkvR8VzTeBhnyR5/ccaZNnPhB4t9sdf6Ln5hb8QeathNJFVFKF5C8DqL4ksDVHWGDf7j
LHyPg6NjviSaFqlu5yQYR+KpupaIkrMknCxT3Y7v/NYYb0ITK1c3BarbWWhLQ7IR0cTKReyZ6lZ0XYei
ztHpK4bAc+h1FgQijzSxMptrGIxVSO0xX3AaStFki7bUMVFmaMm/eJMGfIH/MkGzLep0AXn4h/r3CJV3
mS9gn2bY4UY/UzQ7E9TqfeTFtnuB+XAfzSHKr11kSl/uBebDiZ89ZCst3OUkdwL28sIVsE83ock+EIQV
2Mz2wxeg6/UAAAAASUVORK5CYII=
</value>
</data>
<data name="openToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJHSURBVDhPxZBdSNNhFMb/F110ZZEVhVBgeeHNICiiuggp
olAUyyxI0oSaH1QYC3N+tKnp5ubm1JUua5uuqdNKMwr7kApFItTUkWZqVhSVYmao5Nevvy7UoYR3HXh4
4XCe33nOKyy3lAY7l9RWMo0O/raWXxEyo5spVYTNvOGyfIRPfW+ptOkXqaPl6T83hcRmExSdgzAz3NVm
YWyoYla/B+1M9JtxWLPpaH22JORIjI6gKAMB0jyEimIdo4OlbuaprwVMOOMovammpDADc34qppwUrmnl
5Kni3aFlFg2j3y1z5mnRTJccnNIltQhwq0jFry+mOXNtpWZWDx1Z1NhV3C3JwGFOw25SYjVe5oYhiUKd
HKMmwQUrMWUw/CF3NnZvvYKqUh1TvUroS3fXe7HXkwidMngTS2t5KLbregSzMY2f3Wr4qKW6LJvGR1rX
0MLor8OhKYTJBn/GHvvxrliCTBrsOqXIoOBHh5K+hmSq7FqmexTQHuUytkaKxuNMNgYyVneA4Qd7GKjc
hjLaRzxH7gIU6JIZaEvgtk1D8wsxSWecCDgNzWFMvwxm/PkhRmr3Mli1nW9lvjRdWc0Jf+/5jzRmyWmv
S+GOLQu6U6BFjPvqKOP1AYw88WOoZif9DgmfLVtxaj1RSLdwNvrkPCA3M54KqxrnvRia9MKcGrUrqFOt
5H7qKsqT1mGO9+Lqhc2ELdw+U/r0i+gVZ8hMiCDx3DHORwZyKnQ/hw/uYt9uCTskPvh6e7Fp41rWr/Fg
g6eHO+A/lyD8ARfG3mk9fv1YAAAAAElFTkSuQmCC
</value>
</data>
<data name="saveToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIySURBVDhPrZLfS5NRGMfff6H7boIuuq2pMZyL1eAt11CW
DcOKsB9vpFmaLtNExco0av6CbIVLJ61Wk3BSkT/AFCkRZSpZmrmiJQ41xSaCwdfznL15XEUX0Reem5f3
8znnec4j/Zc8fxYGla91CS3eRTx0z6OpMYS7jmnU1X6B/VYA18snUVoyjsKCt8jLHcH5c36ouCQR2NUJ
1Nas4G9ZXlmFKbULh1Kf8lJxSfI+WeCCyopv6q+/h+DQ/DJ2WV5Ao1FgPegRAveDOS4oLfmq/h6dn/DH
4AJizD4UXJrCAUuzEDgbZrjgou2DiohshIcnQtgme5GTPYbkJKcQ1N8OckHW2REVi+RXuM8fxGaDG4oy
ALPZIQQ11Z+5QDk1oKJ/hjv7P2FTfCMOH3mFxMQ6IbhROYWOdrCnBI4dfwPr0V4+bRoY9UzXppMjcDdS
rC8hy3YhuFI2gTYf2A4Aza4f7N2/o/zaLB8qDYx6zszwr8P7k1thNFYIweXCMXgeAfedq2xxwjClZUeV
Jd2GtDNFETiJwfs8MBjKhMCWN8pgoLoqzE8miH1GjE7G4PsZjE7OQsm9ij2mFg7rdrug1xcJAa2l4w7W
r00Cgk/n38S7wBwC04u4UGxHrMHF4CbEJtyDLj5fCDIzhljfSxzeavRgyw4Zj9t64GvvQ0d3P3pfD2Kv
2QqNvgFxDN6urYdWmyMElJMnevh60obRktA701PRtGlg1DOdSkXwzrisaMG/RZLWAE60OMW5fNhvAAAA
AElFTkSuQmCC
</value>
</data>
<data name="printToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIpSURBVDhPtZL/T1JRGMb5p1itrVZbbRpqZbawnBENV1I0
jGlByTSyJTXJwq2oKZQb1KAv6JCYWSxvBrkkZUq4CeQEiRABFeLL072Xa0zRra31bO8v57zP5znnPYf1
X+TxhWF6O7VtGYcnwbSWijKPOLzYrPSvLPwLS3huGUMlT7o9wGD9grVUBj+icdid03S9tDmgNxNwTgVQ
J+rA8XNtWwM+uuZATMwxmQVRycuJFNyzIRitDlScugKzjSgFRGJJaIwEsrk8AsHIhnSL/Ssck37UNipQ
I5DjtuYV7uksRYhr2kebhx2eP6nrycFIEh5fBA/1Nvru8q5+PDaOovK0rABwfwugWzcErfkzHhjsePL6
E7q1VrTdNUDcrgGvSYlDZHN5XTNOnL8BVe8AJAoNDtZfLgDu9L1BPJmikzcrk81hlRwodZJwdBXziwnI
OrVoaOkiT8C8hKLHBPO7CbywOaE1jeC+bhAd6meQdvZC1KoG/5IS3MZ2HObLUHZSggvkWq3wOvbWiAqA
VpWeyStVfCUNf3AZ4zNhfHCFMEDMgye+hYr6FrDLzxQAUuVTpr0ocn74mchg5vsKRt1RcHp2Qv9+kZ78
UcE17KkWFgHNN/uQzgBkGKLJPBZiecyGchjzrmFwPIF++xJUbDbUQzEacIArLpopSRSP4CUN1Obf1Abz
uqob5KjiXwWH/GVl5HPt5zZh37GL2H1EiF1VZ7GDI6CNW5r/TSzWbwHYL0mKJ5czAAAAAElFTkSuQmCC
</value>
</data>
<data name="cutToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGDSURBVDhPrZFNSwJRGIX9NYGbFoUlFElY1EJQKEYhCJsi
LaVsERnRF5iCaSZJO1toCDVGFkgoFpWQWWRR2aIvUxm1BKN1wSnHCFw4TOCzue+9nPNw4eVVnav4Izzb
QfxeGZ5TWaxT/rK3irzmC7CsusvC1G4IkbNLboIiDieF4GGUKeTeClDpppF8eeEu2PIfwfrzizSdw3Hk
EnKlFpkMzV2wH77AosOFTV8A+vkl9CiHuJeLJNNZjM8tYWB0FkTvMAwmy/8ERTR6CwjlGAi1Ccence6C
1NsXzN4PKIxJLLgeIJ2MoXvmFraNBKK3eXZRIveJPvs7FIYniEkXZENOdE+GIZ2Ko10TwLK7tJmKmL0F
EEYarYM+NMnt0C1sQzpx/lcSEnZ2gcKY/gs0dlmZuWvmjjmpwA1qxVp2AWFIMAF/OAGBzMjMI7ZrtJCb
4Df3o4Zfxy7QrdxDRFKol5khkpR2H4qmIOzUQNBGwrsXYxccnNOQqNbQ0KGGZ+eEPVwdeLxvqqrf4wGh
TNAAAAAASUVORK5CYII=
</value>
</data>
<data name="copyToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHkSURBVDhPvZHfS1NhHIf3p5QypLr2D4goMwoMCi/qIugH
Xe1Cr7qKDIMkZixwNhfWLGWbnuki0kXKzLU023KubBNPJrbRdOzocm6e2dPOO21mMS+CHvjcvOf9PF++
79H9M+7RT2iRRsIi9sEAXe43yAvf2LpSHq28G9uAnytNT4jMLewtcQ2Ht2pF8ps/aOt+gccX5lxD694S
+1BQFD1RkN5DSFa4Z3uONKbgHE3h8KZ4OJTC1J8UiSzmfhd2uf1CoJHbyKOsZokl0kKwm+aeJaov+wjO
rpQkVqdXfOz0bWAcVLghfaXxkUz3y2VxvpMGSwL3uMKh+gHezSSLEnNhX23vtYzKUirDfGyFj/Iy1mdx
UWqR8iKhwtQLxjgH659y4EwvVXWPiwJt3/Ws+muywRrlqvkDdx3zQrCN8l1ldnEd3/QqFmkS/akHJYGS
zjLzOUEwEsMf+sLI2zmaOou/93pPGoM5zvk7UU7fnBKxSBPoT7SXBNW1F/9Io2lKCNTCeomUyrS8xnBA
wfUqyf1eP5U1ptJD/o1LzeNCsHPydtqdr6k4aiwvOHvNSya3ibU/QIdrEkvfhJislc32MfYfuV1eUGPw
FF7bIVJVZ0N/soPK421UHGstlFvYd/hWecF/Qqf7CR0A5wwgSQA2AAAAAElFTkSuQmCC
</value>
</data>
<data name="pasteToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJSSURBVDhPtZJrSJNRGMdf6IN9KbpQn/pUEH2JIoLqQ0Zh
FqYZRmJG1iKmUqKyLB2pqSm6vC1Nm5GXoeatEsVJ0RASR3eNzegikRq5lrV3857Fr/d9ddlICoL+8OfA
Oef/e57zcIT/os7WLMw302muSGJ2689qqi7A44q8IzjtNYzarzHQm8tZtT8FmRqu6LToMxN+B8qhCbGR
KVcDE85ajKUaxoaryEuL4UVXIudPB5Ko2oy98xjDptXERuz3hsgAOTzlqqMk6yjdllzE90UM9Wp5azlB
S1kwkeG+1CSv4mmBQPThfd6Ahqq8GYB4A11yBKmaMLQxoZyLDkGjDiZOFUhUuB+FsWsUQFiArzegtlzH
pFjPpMPA2GA2jucx2KqWK7ZWLqO7dBGP9D5KWLbfto3eAKMhi3FHBeP9GYy9PMXos4OIrYvJrzSRbWjm
wuV6EnVG4tLLiEzSExGf4w0oL05nZEDPaK+akceBuO9v4uPtFUrYo6npbzhdE/QPOQmNSiPouHYOUpaf
gvgqA/dDf9wd63G1r2SgUlAqyyq/1anYUGfG2mdXwne7bOwJUc1AinOS+NxzBpd5HWLbUhyNPvRdF5S2
v05/54tbqvzBifWNHUvPOwLC4/CXwrv2HsB3+w6EwosJOB5ESeElfGpayGD1AmwlArHSm+W2PR1clToo
MrbT0mFTVtlbN6xFuJQar3wQz5Q9VksD+7XyPctrJdx4p5s605M5gKz8lJPSDwtGFbKboJ1blAN52vKb
PdXm80/AfDokTVu+8DfPXv9XCcIPTvjvLQ8YoakAAAAASUVORK5CYII=
</value>
</data>
<data name="helpToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIVSURBVDhPtVJNaxNRFM1PyE+Yn1AUXLjK0uWgDWQZwUUX
KsGFBEEcCkIwqBEpGiydsSo2kupsasdo7Yi2toh0sFZjG5JpiZo20/TpVOmH5njvm8BYahEXHji8+968
c+55l4n8F0zM+rhVWkHmdg29A/PoK1Yw8uIjOp/3xpvqBgrjLeilZbjNLXxZ34bwt6jexMVCGRndQenl
0p+NWHzPXoP3rQ3bAbQhQM0E5Np2BKprbZzrm8TIs8puE+68+r0NwwZiacCwALEBCVcAqet8JlAjk1PZ
JzsNJt6u4+FMS3ZmMV9mmFNAMhesbBZLC6oFdOsd8oVXocmdx018Ej9k1FgqiJ0zgS6qlR6BVI4iEFRN
IJlxMF/1cfTMcGiQvbskB6ZqgairJ6BCTJKYu9tlAUW1oSRsNDwfB+JXQ4PzN6s07W0ZPxDS5aSgJEFn
06Y9CaOqSauJRvMr9qmXQ4P8/RoWvU16eyBUEq5kbigwiKoOMTBQ0zbKlTq6TxihwejkZ1iOJwfEwmiC
BQ49yaW50J7Fh0xJw3IxbM3hwo2x0ICRHZzFgveTunYERK5lgo5YMxx8WPFw5Li+U8wYm66jNz+Naov+
Beqiao58N5NrPluoryJO0QeKU7sNGKPPazh9aRzGo/eYmVvEMk270fTlmzl2N3XW9xL/jv7iaxw7+wAH
E9ew//AVxE8OItv/9O/Cf0ck8gud2vKswuxNZgAAAABJRU5ErkJggg==
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAGACoDAAAFgAAACgAAAAgAAAAQAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AABKTUFQUkdxb2eDfnRbXFJnZ1xLTkFOUEJKTjtWWUhsaVxybWBraWJVVkpBRTZARTQ9QzhZV1NxbmZa
WE9UVUxESkU8QS48QDB0c29zcGdmaGB9eXBAQjY/Qjk/QjlQUk1SUk07PjU2OS81OC80Nyc2Oi13dG9S
VktqaWE4OSw/QTI+QDI8PzI9PjF3c2lcXVFLSz8/QjhISj4zNSc4OSx3dGxHS0JkZVleYlxeYlhYXlRg
YltrbGU8QDdeYVhLTUYaGBsfHCEmIiQsKS0jICQnIyknIykpKSckIygqJikuKi8wLDEuKS80MDUhHiEj
ICItKjEuKS41MDUpJCknIiguLDIgHB0bGSA5NS9RUEhPS0A2My0bFxwQDg8UExksKzIXFxsbGR8gHSUh
HiYiICctKjIqJy4YGRsdHSMnIioqJS0mIiouKTE/PEYfHCEWFhowLjgnIyslISknIisnIiksKzMgGyAm
JCwwLS80MjQzMTMoJikmIioPDRAWFBkjHyUUFBkaGR4iICgnJCshHiYrKjErKjMZGBocHSMrJi0rJy4o
JCstKTA5Nj8gHSIWFRsvLTcrKC8pJCsrJi4qJSwsLDQiHiQrJy81OC8/QzU7PzMgJR0oJS0REBMZGB0o
JygVFRobGR4hHyYlIysiICcmJCwtKzQcGh4aGiEwKzItKTAsKDAuKTI3Mz0hHiMWFRouKzMvKzMvKjMx
LTQpJCwsKjIlISYwKzMvMy04PTM2OjEhIx0pJy8SEBMdGiAsKywWFRkfHiUpJSsrKTAvLDMnJSwvLzgd
HSEbGyIyLjZAPEUpJS45NT01MjwhHyQXFxwtKjI/O0QvKzMyLTYtKDApJy8oJSorKDBER0NLUUtCSUQp
LSomJCsSERUeHCMyMTQTEhYcGyJmYm89OURFQkomIyo2NUAcHB8bGyIxLjU7OEM/PEZKR081MjskIScY
GB0yLjczMDg2Mjw5NT8uKjEpKTEoJCovLDQeIRchJRkYGxQMDwoqJi0UFBgdHCIjIiUSEhUiIScrJzA0
Mjw9OUMnJCw7O0YcHCAeHiYqJi1IRU89O0U5N0M4NT4mIykZGB02Mzw5NTw6Nj81MToxLDUxMDkoIykw
Ljc3Mjc0LjQxKzIsJy0oJi0WFBcgHycqJSsSEhYoJy45NT0vLTY/O0clIyo6OUYfHyMjJCsrJy5GRFFA
PEhIRlE7OEImIigWFhw2Mzw3Mjw2MTo2MjstKDEyMjsnIicxLjY9Pzw8QDozNjQfISAqJy4XFRkkIysv
LjATExYtKzM3NDwsKTIlIisnJSw7O0ggHyIkJS0tKTIrJzAsKDAwLDQ7OEQoJSoXFxw3NT81MTg1MDo1
MDkvKjMwMDgnIygwLDYaHhsjKiMjKCQVGBcpJS0ZFhofHiUlJSYQEBMoKDAnJCwnJCwnJC0lIyk7PEgf
HiInJy8uKTAwLDMwLDUyLTY7OUQqJisYGB06N0EzLjc2Mjo0LzcwLDQvLjYnIic1MTgjHyAkISEiHyAg
HCAmIikaFxwiISgjHyQZGRsbGiYcGSQlIi0nJS4eGiY1NUU8QD4dHioqJTAtKDUqJjIvKjQ6N0IuLDEc
HSQyLz00MDkrJzMwKzcrJzIsKTEuLDMoJDJgaGBQWFVNVlRDR0QbFyIfHiIUEh5HS0ouMjiOkFulpmm0
sm47OzXFxXi8u2+anqbJyIGpqW+ko2eioHNXVkY7OTw5PDjJyHmqqmk9Ozy1s3GVl2Nsa1F6e1S6unPW
1YBLT0W+vnOhpGw7QUDIyHlGTT+hpGk6QDw2Ozs2PUJlak/V1X99gVhjZktna1bIyajR0IyMj5TExY66
u5Cxs6yFhoeZm4uvsYqOkp2XmaLV1IO5u4u/v57X1Yqcm5jBwnLCwaPQ0ZSrrHFaYEq9vXJITzWWml05
QTM0OTqVlmKYmmZDSD9VV0a/v3a+vnVTWU3IyHw/RT2qq2uOkV6zs3HMy3g0ODnBwXOVl19ARj2wsW6Q
k2GFh1zGxndLT0RqbFBVWUeys3C5unNMUkfb2n6qrGiAg1A9RDZQUVJucE2ysm+urnhycGxeXlg5QD1I
UEwoLykxNzI7QThCRT0zNzQuMy8uNTFBRkhgYVplZmBARD1ITD5XWVhydFTDw3nBwnlBRUBTWlJfZl5Y
XlZ1dnRwcGZdX1ZJUEgPDAwmIyVQT1MwKzMXFBMZFRUzMTU/PT0hHiEjICIiHyAkICAdGhscGRwfHB4i
ICIkICMnJCQeGhogHB0pJSggHR0XExkWFBkdGhosKyVLS0MzMTEXExMSEREbGhtDREAzLzZIRUonKS4Q
ERo9Nz82Mj40MzskJCcrJy8mIisuKzAhHiQdGyIfGyMjICQjICkmIisuKS0rJy0kISofHSIeGyIlIiYf
HiYrKS4vLjAyNDYhICIkJTEpJi0XFyAaHRMwLTR8eWWxsWympmZJRUWwr3KzsnAqKDCjoWiurG5nZE+R
j2G3tXG0snBLR0K3tXGzsW43MzqgnWefnWZlYUyXlWEvKzKtq2onIiy3tm6trWseHSG3tnU3NTSFhlog
Ih8qJzDMyYo3OTSqqWZOSUs/PEeRkGJvbU/V1H5BPT++vHQoJDOxsG9BPT9bWEqGhGBoZU+EgmPOzXqR
jmFsalGioWkyLje6uXJdWkl6eVIeHyMICBS8u3M5NzSPj14RFA4uKjG5t32Skl9jZEVUTk7NzX9yclA4
ODeYlmSNi2DFw3gnIzItKTXAvnVXU0vHxn2urGxoZVu1s3B0cVWOjGChoGiUkmTCwHY1MDfEw3aCglUV
Fhzg34STkWB7fFUfIhovKzJiYFe2tnCBgU9STU/V032vrmgvLTKysXChn2mEgVx1clajoWiwrm5YVEmF
glxKRkQ3Mz40MDtQTEYxLTpAPD9CPUI+OT8xLjYuKzNHSD0MDRm8unQ5ODcREhkoLCUoJSxQTVMpLjUN
EBhEQEo5NkIbHCgzNzsVFB0aGiAZGCAYFyAYGB8WFR8pKCc5OTIiISghICchICggHyYgHyYfHiYgHyYi
ICcdHCEtLjI4OzsYGiFWVUUiICsSFBopMSwoJy1VWV08QUQpLTE4Nj07O0E3PD4+REc9QkY9Q0YtLzEl
JyoxNjc6P0M6PkI5PD8zODorLzAoLS4rMDI1OjwyNjg1OTsmKSoqLC8oKywzODk1O0ItLDIgICgXGhsw
OTJFTEpkaXFBSUgfIyMICQgKDAopLjBFTkttc3xJUVEJDAkICwgLDgk2Pz4+REJKUVQrLiwVGBQNEQwn
LC02PjosNzg4PzsHCgYYGRsPERMkKCotMTAvNjAeIxoJDAcdJRVITExBR0g0Oj48Pj88PT0+Pz9AQkFR
V1hOVVU2PD9DREQ9Pj5TVVU8QT1UV1JCRkRFSElYWllJS0tJSko6REK3s7IxNzMyNTYqLS8vMjUfICI5
Oz0uMiomKSQbHBwnLSZYWlxCRUgsMDRISU4iIiEuLS5JSkpbXl5DSEk8QkpTUVQQDw5CQUJQUlBjZmhG
TExGR0o4NzYgISJAQEI0OztxdnY1PDwtLjEKCQkdHiAjJSkuMTQ4PTsxNDMbGhsQFwdaYFhbZWJKVVM4
Ozg3ODY0NDNLT0lxeHNXYl5NWVc0MzE5OTg3NjRtc21jbGZbZGFGS0cuLi0uLiwyNTRWYFteaWNXYlwc
HBwVFhcOEBEsMzRES0lJUkw/RT4UFBUuNDA9Pzo3OjomKiskJSEkJyMoKic8PDhLTU0xNTcpLC8qKyUj
JiEnKCJPUUs+QUA1OTosLSsiJSMnKScrLCo2ODg3OTo3OToWFxcQEhIODxAUFhYgICElKCchJCALDQw0
NzdCRUI5Pj8sMjVNTEwdIy4iJy5PUE9KTk42PD41Oz1KTE0ZIjEsLjBUV1Y+Q0M7QUNAQkQ3PEEVHCQx
MzQ5Pj46P0A7Pj41NzkHCw8VGh0nKS0hJCYkKCcjJiQRERE2OTwuMjExNTYsMTM1OkEiMUEpOkpCQkFN
T1YzNzg3Oz5BU2ATHi46Rk9BRUQ0Ojs2Ojw3ODguQ1YfNEcsLTA2OzszOTk0ODkiJSkSITIhNkojJCYf
IiUgJSQeIiAYJzUzOUQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
</value>
</data>
</root>

View File

@ -1,355 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Web.Script.Serialization;
namespace SourceGenWF {
/// <summary>
/// Application settings registry. This holds both user-accessible settings and saved
/// values like window widths.
///
/// Everything is stored as name/value pairs, where the value is serialized as a string.
/// Names are case-sensitive.
///
/// We don't discard things we don't recognize. If we somehow end up reading a config
/// file from a newer version of the app, the various settings will be retained.
/// </summary>
public class AppSettings {
#region Names
// Name constants. Having them defined here avoids collisions and misspellings, and
// makes it easy to find all uses.
// Main window.
public const string MAIN_WINDOW_WIDTH = "main-window-width";
public const string MAIN_WINDOW_HEIGHT = "main-window-height";
public const string MAIN_WINDOW_LOC_X = "main-window-loc-x";
public const string MAIN_WINDOW_LOC_Y = "main-window-loc-y";
public const string MAIN_WINDOW_MAXIMIZED = "main-window-maximized";
public const string MAIN_LEFT_PANEL_WIDTH = "main-left-panel-width";
public const string MAIN_RIGHT_PANEL_WIDTH = "main-right-panel-width";
public const string MAIN_LEFT_SIDE_SPLITTER_DIST = "main-left-side-splitter-dist";
public const string MAIN_RIGHT_SIDE_SPLITTER_DIST = "main-right-side-splitter-dist";
// New project dialog.
public const string NEWP_SELECTED_SYSTEM = "newp-selected-system";
// Formatting choices.
public const string FMT_UPPER_HEX_DIGITS = "fmt-upper-hex-digits";
public const string FMT_UPPER_OP_MNEMONIC = "fmt-upper-op-mnemonic";
public const string FMT_UPPER_PSEUDO_OP_MNEMONIC = "fmt-upper-pseudo-op-mnemonic";
public const string FMT_UPPER_OPERAND_A = "fmt-upper-operand-a";
public const string FMT_UPPER_OPERAND_S = "fmt-upper-operand-s";
public const string FMT_UPPER_OPERAND_XY = "fmt-upper-operand-xy";
public const string FMT_ADD_SPACE_FULL_COMMENT = "fmt-add-space-full-comment";
public const string FMT_SPACES_BETWEEN_BYTES = "fmt-spaces-between-bytes";
public const string FMT_OPCODE_SUFFIX_ABS = "fmt-opcode-suffix-abs";
public const string FMT_OPCODE_SUFFIX_LONG = "fmt-opcode-suffix-long";
public const string FMT_OPERAND_PREFIX_ABS = "fmt-operand-prefix-abs";
public const string FMT_OPERAND_PREFIX_LONG = "fmt-operand-prefix-long";
public const string FMT_EXPRESSION_MODE = "fmt-expression-mode";
public const string FMT_PSEUDO_OP_NAMES = "fmt-pseudo-op-names";
public const string CLIP_LINE_FORMAT = "clip-line-format";
// Symbol-list window options.
public const string SYMWIN_SHOW_USER = "symwin-show-user";
public const string SYMWIN_SHOW_AUTO = "symwin-show-auto";
public const string SYMWIN_SHOW_PROJECT = "symwin-show-project";
public const string SYMWIN_SHOW_PLATFORM = "symwin-show-platform";
public const string SYMWIN_SHOW_CONST = "symwin-show-const";
public const string SYMWIN_SHOW_ADDR = "symwin-show-addr";
public const string SYMWIN_SORT_ASCENDING = "symwin-sort-ascending";
public const string SYMWIN_SORT_COL = "symwin-sort-col";
public const string SYMWIN_COL_WIDTHS = "symwin-col-widths";
// References window options.
public const string REFWIN_COL_WIDTHS = "refwin-col-widths";
// Notes window options.
public const string NOTEWIN_COL_WIDTHS = "notewin-col-widths";
// Code List View settings.
public const string CDLV_COL_WIDTHS = "cdlv-col-widths";
public const string CDLV_FONT = "cdlv-font";
// Hex dump viewer settings.
public const string HEXD_ASCII_ONLY = "hexd-ascii-only";
public const string HEXD_CHAR_CONV = "hexd-char-conv";
// ASCII chart viewer settings.
public const string ASCCH_MODE = "ascch-mode";
// Source generation settings.
public const string SRCGEN_DEFAULT_ASM = "srcgen-default-asm";
public const string SRCGEN_ADD_IDENT_COMMENT = "srcgen-add-ident-comment";
public const string SRCGEN_DISABLE_LABEL_LOCALIZATION = "srcgen-disable-label-localization";
public const string SRCGEN_LONG_LABEL_NEW_LINE = "srcgen-long-label-new-line";
public const string SRCGEN_SHOW_CYCLE_COUNTS = "srcgen-show-cycle-counts";
// Main project view settings.
public const string PRVW_RECENT_PROJECT_LIST = "prvw-recent-project-list";
// Assembler settings prefix
public const string ASM_CONFIG_PREFIX = "asm-config-";
// Internal debugging features.
public const string DEBUG_MENU_ENABLED = "debug-menu-enabled";
#endregion Names
#region Implementation
// App settings file header.
public const string MAGIC = "### 6502bench SourceGen settings v1.0 ###";
/// <summary>
/// Single global instance of app settings.
/// </summary>
public static AppSettings Global {
get {
return sSingleton;
}
}
private static AppSettings sSingleton = new AppSettings();
/// <summary>
/// Dirty flag, set to true by every "set" call.
/// </summary>
public bool Dirty { get; set; }
/// <summary>
/// Settings storage.
/// </summary>
private Dictionary<string, string> mSettings = new Dictionary<string, string>();
private AppSettings() { }
/// <summary>
/// Creates a copy of this object.
/// </summary>
/// <returns></returns>
public AppSettings GetCopy() {
AppSettings copy = new AppSettings();
//copy.mSettings.EnsureCapacity(mSettings.Count);
foreach (KeyValuePair<string, string> kvp in mSettings) {
copy.mSettings.Add(kvp.Key, kvp.Value);
}
return copy;
}
/// <summary>
/// Replaces the existing list of settings with a new list.
///
/// This can be used to replace the contents of the global settings object without
/// discarding the object itself, which is useful in case something has cached a
/// reference to the singleton.
/// </summary>
/// <param name="newSettings"></param>
public void ReplaceSettings(AppSettings newSettings) {
// Clone the new list, and stuff it into the old object. This way the
// objects aren't sharing lists.
mSettings = newSettings.GetCopy().mSettings;
Dirty = true;
}
/// <summary>
/// Merges settings from another settings object into this one.
/// </summary>
/// <param name="settings"></param>
/// <param name="newSettings"></param>
public void MergeSettings(AppSettings newSettings) {
foreach (KeyValuePair<string, string> kvp in newSettings.mSettings) {
mSettings[kvp.Key] = kvp.Value;
}
Dirty = true;
}
/// <summary>
/// Retrieves an integer setting.
/// </summary>
/// <param name="name">Setting name.</param>
/// <param name="defaultValue">Setting default value.</param>
/// <returns>The value found, or the default value if no setting with the specified
/// name exists, or the stored value is not an integer.</returns>
public int GetInt(string name, int defaultValue) {
if (!mSettings.TryGetValue(name, out string valueStr)) {
return defaultValue;
}
if (!int.TryParse(valueStr, out int value)) {
Debug.WriteLine("Warning: int parse failed on " + name + "=" + valueStr);
return defaultValue;
}
return value;
}
/// <summary>
/// Sets an integer setting.
/// </summary>
/// <param name="name">Setting name.</param>
/// <param name="value">Setting value.</param>
public void SetInt(string name, int value) {
mSettings[name] = value.ToString();
Dirty = true;
}
/// <summary>
/// Retrieves a boolean setting.
/// </summary>
/// <param name="name">Setting name.</param>
/// <param name="defaultValue">Setting default value.</param>
/// <returns>The value found, or the default value if no setting with the specified
/// name exists, or the stored value is not a boolean.</returns>
public bool GetBool(string name, bool defaultValue) {
if (!mSettings.TryGetValue(name, out string valueStr)) {
return defaultValue;
}
if (!bool.TryParse(valueStr, out bool value)) {
Debug.WriteLine("Warning: bool parse failed on " + name + "=" + valueStr);
return defaultValue;
}
return value;
}
/// <summary>
/// Sets a boolean setting.
/// </summary>
/// <param name="name">Setting name.</param>
/// <param name="value">Setting value.</param>
public void SetBool(string name, bool value) {
mSettings[name] = value.ToString();
Dirty = true;
}
/// <summary>
/// Retrieves an enumerated value setting.
/// </summary>
/// <param name="name">Setting name.</param>
/// <param name="enumType">Enum type that the value is part of.</param>
/// <param name="defaultValue">Setting default value.</param>
/// <returns>The value found, or the default value if no setting with the specified
/// name exists, or the stored value is not a member of the specified enumerated
/// type.</returns>
public int GetEnum(string name, Type enumType, int defaultValue) {
if (!mSettings.TryGetValue(name, out string valueStr)) {
return defaultValue;
}
try {
object o = Enum.Parse(enumType, valueStr);
return (int)o;
} catch (ArgumentException ae) {
Debug.WriteLine("Failed to parse " + valueStr + " (enum " + enumType + "): " +
ae.Message);
return defaultValue;
}
}
/// <summary>
/// Sets an enumerated setting.
/// </summary>
/// <param name="name">Setting name.</param>
/// <param name="enumType">Enum type.</param>
/// <param name="value">Setting value (integer enum index).</param>
public void SetEnum(string name, Type enumType, int value) {
mSettings[name] = Enum.GetName(enumType, value);
Dirty = true;
}
/// <summary>
/// Retrieves a string setting. The default value will be returned if the key
/// is not found, or if the value is null.
/// </summary>
/// <param name="name">Setting name.</param>
/// <param name="defaultValue">Setting default value.</param>
/// <returns>The value found, or defaultValue if not value is found.</returns>
public string GetString(string name, string defaultValue) {
if (!mSettings.TryGetValue(name, out string valueStr) || valueStr == null) {
return defaultValue;
}
return valueStr;
}
/// <summary>
/// Sets a string setting.
/// </summary>
/// <param name="name">Setting name.</param>
/// <param name="value">Setting value.</param>
public void SetString(string name, string value) {
if (value == null) {
mSettings.Remove(name);
} else {
mSettings[name] = value;
}
Dirty = true;
}
/// <summary>
/// Serializes settings dictionary into a string, for saving settings to a file.
/// </summary>
/// <returns>Serialized settings.</returns>
public string Serialize() {
StringBuilder sb = new StringBuilder(1024);
sb.Append(MAGIC); // augment with version string, which will be stripped
sb.Append("\r\n"); // will be ignored by deserializer; might get converted to \n
JavaScriptSerializer ser = new JavaScriptSerializer();
string cereal = ser.Serialize(mSettings);
// add some linefeeds to make it easier for humans
cereal = CommonUtil.TextUtil.NonQuoteReplace(cereal, ",\"", ",\r\n\"");
sb.Append(cereal);
// Stick a linefeed at the end.
sb.Append("\r\n");
return sb.ToString();
}
/// <summary>
/// Deserializes settings from a string, for loading settings from a file.
/// </summary>
/// <param name="cereal">Serialized settings.</param>
/// <returns>Deserialized settings, or null if deserialization failed.</returns>
public static AppSettings Deserialize(string cereal) {
if (!cereal.StartsWith(MAGIC)) {
return null;
}
// Skip past header.
cereal = cereal.Substring(MAGIC.Length);
AppSettings settings = new AppSettings();
JavaScriptSerializer ser = new JavaScriptSerializer();
try {
settings.mSettings = ser.Deserialize<Dictionary<string, string>>(cereal);
return settings;
} catch (Exception ex) {
Debug.WriteLine("Settings deserialization failed: " + ex.Message);
return null;
}
}
#endregion Implementation
}
}

View File

@ -1,869 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Text;
using Asm65;
using CommonUtil;
namespace SourceGenWF.AsmGen {
#region IGenerator
/// <summary>
/// Generate source code compatible with the cc65 assembler (https://github.com/cc65/cc65).
/// </summary>
public class GenCc65 : IGenerator {
private const string ASM_FILE_SUFFIX = "_cc65.S"; // must start with underscore
private const string CFG_FILE_SUFFIX = "_cc65.cfg"; // ditto
private const int MAX_OPERAND_LEN = 64;
// IGenerator
public DisasmProject Project { get; private set; }
// IGenerator
public Formatter SourceFormatter { get; private set; }
// IGenerator
public AppSettings Settings { get; private set; }
// IGenerator
public AssemblerQuirks Quirks { get; private set; }
// IGenerator
public LabelLocalizer Localizer { get { return mLocalizer; } }
/// <summary>
/// Working directory, i.e. where we write our output file(s).
/// </summary>
private string mWorkDirectory;
/// <summary>
/// If set, long labels get their own line.
/// </summary>
private bool mLongLabelNewLine;
/// <summary>
/// Output column widths.
/// </summary>
private int[] mColumnWidths;
/// <summary>
/// Base filename. Typically the project file name without the ".dis65" extension.
/// </summary>
private string mFileNameBase;
/// <summary>
/// StringBuilder to use when composing a line. Held here to reduce allocations.
/// </summary>
private StringBuilder mLineBuilder = new StringBuilder(100);
/// <summary>
/// Label localization helper.
/// </summary>
private LabelLocalizer mLocalizer;
/// <summary>
/// Stream to send the output to.
/// </summary>
private StreamWriter mOutStream;
/// <summary>
/// The first time we output a high-ASCII string, we generate a macro for it.
/// </summary>
private bool mHighAsciiMacroOutput;
/// <summary>
/// Holds detected version of configured assembler.
/// </summary>
private CommonUtil.Version mAsmVersion = CommonUtil.Version.NO_VERSION;
// We test against this in a few places.
private static CommonUtil.Version V2_17 = new CommonUtil.Version(2, 17);
// Pseudo-op string constants.
private static PseudoOp.PseudoOpNames sDataOpNames = new PseudoOp.PseudoOpNames() {
EquDirective = "=",
OrgDirective = ".org",
//RegWidthDirective // .a8, .a16, .i8, .i16
DefineData1 = ".byte",
DefineData2 = ".word",
DefineData3 = ".faraddr",
DefineData4 = ".dword",
DefineBigData2 = ".dbyt",
//DefineBigData3
//DefineBigData4
Fill = ".res",
//Dense // no equivalent, use .byte with comma-separated args
StrGeneric = ".byte",
//StrReverse
StrNullTerm = ".asciiz",
//StrLen8 // macro with .strlen?
//StrLen16
//StrDci
//StrDciReverse
};
// IGenerator
public void GetDefaultDisplayFormat(out PseudoOp.PseudoOpNames pseudoOps,
out Formatter.FormatConfig formatConfig) {
pseudoOps = new PseudoOp.PseudoOpNames() {
EquDirective = "=",
OrgDirective = ".org",
DefineData1 = ".byte",
DefineData2 = ".word",
DefineData3 = ".faraddr",
DefineData4 = ".dword",
DefineBigData2 = ".dbyt",
Fill = ".res",
StrGeneric = ".byte",
StrNullTerm = ".asciiz",
};
formatConfig = new Formatter.FormatConfig();
SetFormatConfigValues(ref formatConfig);
}
// IGenerator
public void Configure(DisasmProject project, string workDirectory, string fileNameBase,
AssemblerVersion asmVersion, AppSettings settings) {
Debug.Assert(project != null);
Debug.Assert(!string.IsNullOrEmpty(workDirectory));
Debug.Assert(!string.IsNullOrEmpty(fileNameBase));
Project = project;
Quirks = new AssemblerQuirks();
if (asmVersion != null) {
// Use the actual version. If it's > 2.17 we'll try to take advantage of
// bug fixes.
mAsmVersion = asmVersion.Version;
} else {
// No assembler installed. Use 2.17.
mAsmVersion = V2_17;
}
if (mAsmVersion <= V2_17) {
// cc65 v2.17: https://github.com/cc65/cc65/issues/717
Quirks.BlockMoveArgsReversed = true;
// cc65 v2.17: https://github.com/cc65/cc65/issues/754
Quirks.NoPcRelBankWrap = true;
}
Quirks.SinglePassAssembler = true;
mWorkDirectory = workDirectory;
mFileNameBase = fileNameBase;
Settings = settings;
mLongLabelNewLine = Settings.GetBool(AppSettings.SRCGEN_LONG_LABEL_NEW_LINE, false);
AssemblerConfig config = AssemblerConfig.GetConfig(settings,
AssemblerInfo.Id.Cc65);
mColumnWidths = (int[])config.ColumnWidths.Clone();
}
/// <summary>
/// Configures the assembler-specific format items.
/// </summary>
private void SetFormatConfigValues(ref Formatter.FormatConfig config) {
config.mForceAbsOpcodeSuffix = string.Empty;
config.mForceLongOpcodeSuffix = string.Empty;
config.mForceDirectOperandPrefix = "z:"; // zero
config.mForceAbsOperandPrefix = "a:"; // absolute
config.mForceLongOperandPrefix = "f:"; // far
config.mEndOfLineCommentDelimiter = ";";
config.mFullLineCommentDelimiterBase = ";";
config.mBoxLineCommentDelimiter = ";";
config.mAllowHighAsciiCharConst = false;
config.mExpressionMode = Formatter.FormatConfig.ExpressionMode.Cc65;
}
// IGenerator
public List<string> GenerateSource(BackgroundWorker worker) {
List<string> pathNames = new List<string>(1);
string pathName = Path.Combine(mWorkDirectory, mFileNameBase + ASM_FILE_SUFFIX);
pathNames.Add(pathName);
string cfgName = Path.Combine(mWorkDirectory, mFileNameBase + CFG_FILE_SUFFIX);
pathNames.Add(cfgName);
Formatter.FormatConfig config = new Formatter.FormatConfig();
GenCommon.ConfigureFormatterFromSettings(Settings, ref config);
SetFormatConfigValues(ref config);
SourceFormatter = new Formatter(config);
string msg = string.Format(Properties.Resources.PROGRESS_GENERATING_FMT, pathName);
worker.ReportProgress(0, msg);
mLocalizer = new LabelLocalizer(Project);
if (!Settings.GetBool(AppSettings.SRCGEN_DISABLE_LABEL_LOCALIZATION, false)) {
mLocalizer.LocalPrefix = "@";
mLocalizer.Analyze();
}
// Use UTF-8 encoding, without a byte-order mark.
using (StreamWriter sw = new StreamWriter(cfgName, false, new UTF8Encoding(false))) {
GenerateLinkerScript(sw);
}
using (StreamWriter sw = new StreamWriter(pathName, false, new UTF8Encoding(false))) {
mOutStream = sw;
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
//if (mAsmVersion.IsValid && mAsmVersion <= V2_17) {
// OutputLine(SourceFormatter.FullLineCommentDelimiter +
// string.Format(Properties.Resources.GENERATED_FOR_VERSION,
// "cc65", mAsmVersion.ToString()));
//} else {
// OutputLine(SourceFormatter.FullLineCommentDelimiter +
// string.Format(Properties.Resources.GENERATED_FOR_LATEST, "cc65"));
//}
// Currently generating code for v2.17.
OutputLine(SourceFormatter.FullLineCommentDelimiter +
string.Format(Properties.Resources.GENERATED_FOR_VERSION,
"cc65", V2_17,
AsmCc65.OPTIONS + " -C " + Path.GetFileName(cfgName)));
}
GenCommon.Generate(this, sw, worker);
}
mOutStream = null;
return pathNames;
}
private void GenerateLinkerScript(StreamWriter sw) {
sw.WriteLine("# 6502bench SourceGen generated linker script for " + mFileNameBase);
sw.WriteLine("MEMORY {");
sw.WriteLine(" MAIN: file=%O, start=%S, size=65536;");
for (int i = 0; i < Project.AddrMap.Count; i++) {
AddressMap.AddressMapEntry ame = Project.AddrMap[i];
sw.WriteLine(string.Format("# MEM{0:D3}: file=%O, start=${1:x4}, size={2};",
i, ame.Addr, ame.Length));
}
sw.WriteLine("}");
sw.WriteLine("SEGMENTS {");
sw.WriteLine(" CODE: load=MAIN, type=rw;");
for (int i = 0; i < Project.AddrMap.Count; i++) {
sw.WriteLine(string.Format("# SEG{0:D3}: load=MEM{0:D3}, type=rw;", i));
}
sw.WriteLine("}");
sw.WriteLine("FEATURES {}");
sw.WriteLine("SYMBOLS {}");
}
// IGenerator
public void OutputAsmConfig() {
CpuDef cpuDef = Project.CpuDef;
string cpuStr;
if (cpuDef.Type == CpuDef.CpuType.Cpu65816) {
cpuStr = "65816";
} else if (cpuDef.Type == CpuDef.CpuType.Cpu65C02) {
cpuStr = "65C02";
} else if (cpuDef.Type == CpuDef.CpuType.Cpu6502 && cpuDef.HasUndocumented) {
cpuStr = "6502X";
} else {
cpuStr = "6502";
}
OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(".setcpu"),
'\"' + cpuStr + '\"', string.Empty);
}
/// <summary>
/// Map the undocumented opcodes to the cc65 mnemonics. There's almost no difference
/// vs. the Unintended Opcodes mnemonics.
///
/// We don't include the double- and triple-byte NOPs here, as cc65 doesn't
/// appear to have a definition for them (as of 2.17). We also omit the alias
/// for SBC. These will all be output as hex.
/// </summary>
private static Dictionary<string, string> sUndocMap = new Dictionary<string, string>() {
{ OpName.ALR, "alr" }, // imm 0x4b
{ OpName.ANC, "anc" }, // imm 0x0b (and others)
{ OpName.ANE, "ane" }, // imm 0x8b
{ OpName.ARR, "arr" }, // imm 0x6b
{ OpName.DCP, "dcp" }, // abs 0xcf
{ OpName.ISC, "isc" }, // abs 0xef
{ OpName.JAM, "jam" }, // abs 0x02 (and others)
{ OpName.LAS, "las" }, // abs,y 0xbb
{ OpName.LAX, "lax" }, // imm 0xab; abs 0xaf
{ OpName.RLA, "rla" }, // abs 0x2f
{ OpName.RRA, "rra" }, // abs 0x6f
{ OpName.SAX, "sax" }, // abs 0x8f
{ OpName.SBX, "axs" }, //* imm 0xcb
{ OpName.SHA, "sha" }, // abs,y 0x9f
{ OpName.SHX, "shx" }, // abs,y 0x9e
{ OpName.SHY, "shy" }, // abs,x 0x9c
{ OpName.SLO, "slo" }, // abs 0x0f
{ OpName.SRE, "sre" }, // abs 0x4f
{ OpName.TAS, "tas" }, // abs,y 0x9b
};
// IGenerator
public string ModifyOpcode(int offset, OpDef op) {
if ((op == OpDef.OpWDM_WDM || op == OpDef.OpBRK_StackInt) && mAsmVersion <= V2_17) {
// cc65 v2.17 doesn't support WDM, and assembles BRK <arg> to opcode $05.
// https://github.com/cc65/cc65/issues/715
// https://github.com/cc65/cc65/issues/716
return null;
} else if (op.IsUndocumented) {
if (sUndocMap.TryGetValue(op.Mnemonic, out string newValue)) {
if ((op.Mnemonic == OpName.ANC && op.Opcode != 0x0b) ||
(op.Mnemonic == OpName.JAM && op.Opcode != 0x02)) {
// There are multiple opcodes for the same thing. cc65 outputs
// one specific thing, so we need to match that, and just do a hex
// dump for the others.
return null;
}
return newValue;
}
// Unmapped values include DOP, TOP, and the alternate SBC. Output hex.
return null;
} else {
return string.Empty;
}
}
// IGenerator
public void GenerateShortSequence(int offset, int length, out string opcode,
out string operand) {
Debug.Assert(length >= 1 && length <= 4);
// Use a comma-separated list of individual hex bytes.
opcode = sDataOpNames.DefineData1;
StringBuilder sb = new StringBuilder(length * 4);
for (int i = 0; i < length; i++) {
if (i != 0) {
sb.Append(',');
}
sb.Append(SourceFormatter.FormatHexValue(Project.FileData[offset + i], 2));
}
operand = sb.ToString();
}
// IGenerator
public void OutputDataOp(int offset) {
Formatter formatter = SourceFormatter;
byte[] data = Project.FileData;
Anattrib attr = Project.GetAnattrib(offset);
string labelStr = string.Empty;
if (attr.Symbol != null) {
labelStr = mLocalizer.ConvLabel(attr.Symbol.Label);
}
string commentStr = SourceFormatter.FormatEolComment(Project.Comments[offset]);
string opcodeStr, operandStr;
FormatDescriptor dfd = attr.DataDescriptor;
Debug.Assert(dfd != null);
int length = dfd.Length;
Debug.Assert(length > 0);
bool multiLine = false;
switch (dfd.FormatType) {
case FormatDescriptor.Type.Default:
if (length != 1) {
Debug.Assert(false);
length = 1;
}
opcodeStr = sDataOpNames.DefineData1;
int operand = RawData.GetWord(data, offset, length, false);
operandStr = formatter.FormatHexValue(operand, length * 2);
break;
case FormatDescriptor.Type.NumericLE:
opcodeStr = sDataOpNames.GetDefineData(length);
operand = RawData.GetWord(data, offset, length, false);
operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable,
mLocalizer.LabelMap, dfd, operand, length,
PseudoOp.FormatNumericOpFlags.None);
break;
case FormatDescriptor.Type.NumericBE:
opcodeStr = sDataOpNames.GetDefineBigData(length);
if (opcodeStr == null) {
// Nothing defined, output as comma-separated single-byte values.
GenerateShortSequence(offset, length, out opcodeStr, out operandStr);
} else {
operand = RawData.GetWord(data, offset, length, true);
operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable,
mLocalizer.LabelMap, dfd, operand, length,
PseudoOp.FormatNumericOpFlags.None);
}
break;
case FormatDescriptor.Type.Fill:
opcodeStr = sDataOpNames.Fill;
operandStr = length + "," + formatter.FormatHexValue(data[offset], 2);
break;
case FormatDescriptor.Type.Dense:
multiLine = true;
opcodeStr = operandStr = null;
OutputDenseHex(offset, length, labelStr, commentStr);
break;
case FormatDescriptor.Type.String:
multiLine = true;
opcodeStr = operandStr = null;
OutputString(offset, labelStr, commentStr);
break;
default:
opcodeStr = "???";
operandStr = "***";
break;
}
if (!multiLine) {
opcodeStr = formatter.FormatPseudoOp(opcodeStr);
OutputLine(labelStr, opcodeStr, operandStr, commentStr);
}
}
private void OutputDenseHex(int offset, int length, string labelStr, string commentStr) {
Formatter formatter = SourceFormatter;
byte[] data = Project.FileData;
StringBuilder sb = new StringBuilder(MAX_OPERAND_LEN);
string opcodeStr = formatter.FormatPseudoOp(sDataOpNames.DefineData1);
int maxPerLine = MAX_OPERAND_LEN / 4;
int numChunks = (length + maxPerLine - 1) / maxPerLine;
for (int chunk = 0; chunk < numChunks; chunk++) {
int chunkStart = chunk * maxPerLine;
int chunkEnd = Math.Min((chunk + 1) * maxPerLine, length);
for (int i = chunkStart; i < chunkEnd; i++) {
if (i != chunkStart) {
sb.Append(',');
}
sb.Append(formatter.FormatHexValue(data[offset + i], 2));
}
OutputLine(labelStr, opcodeStr, sb.ToString(), commentStr);
labelStr = commentStr = string.Empty;
sb.Clear();
}
}
/// <summary>
/// Outputs formatted data in an unformatted way, because the code generator couldn't
/// figure out how to do something better.
/// </summary>
private void OutputNoJoy(int offset, int length, string labelStr, string commentStr) {
byte[] data = Project.FileData;
Debug.Assert(length > 0);
Debug.Assert(offset >= 0 && offset < data.Length);
bool singleValue = true;
byte val = data[offset];
for (int i = 1; i < length; i++) {
if (data[offset + i] != val) {
singleValue = false;
break;
}
}
if (singleValue) {
string opcodeStr = SourceFormatter.FormatPseudoOp(sDataOpNames.Fill);
string operandStr = length + "," + SourceFormatter.FormatHexValue(val, 2);
OutputLine(labelStr, opcodeStr, operandStr, commentStr);
} else {
OutputDenseHex(offset, length, labelStr, commentStr);
}
}
// IGenerator
public void OutputEquDirective(string name, string valueStr, string comment) {
OutputLine(name, SourceFormatter.FormatPseudoOp(sDataOpNames.EquDirective),
valueStr, SourceFormatter.FormatEolComment(comment));
}
// IGenerator
public void OutputOrgDirective(int offset, int address) {
// Linear search for offset. List should be small, so this should be quick.
int index = 0;
foreach (AddressMap.AddressMapEntry ame in Project.AddrMap) {
if (ame.Offset == offset) {
break;
}
index++;
}
mLineBuilder.Clear();
TextUtil.AppendPaddedString(mLineBuilder, ";", mColumnWidths[0]);
TextUtil.AppendPaddedString(mLineBuilder, SourceFormatter.FormatPseudoOp(" .segment"),
mColumnWidths[1]);
mLineBuilder.AppendFormat("\"SEG{0:D3}\"", index);
OutputLine(mLineBuilder.ToString());
OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(sDataOpNames.OrgDirective),
SourceFormatter.FormatHexValue(address, 4), string.Empty);
}
// IGenerator
public void OutputRegWidthDirective(int offset, int prevM, int prevX, int newM, int newX) {
if (prevM != newM) {
string mop = (newM == 0) ? ".a16" : ".a8";
OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(mop),
string.Empty, string.Empty);
}
if (prevX != newX) {
string xop = (newX == 0) ? ".i16" : ".i8";
OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(xop),
string.Empty, string.Empty);
}
}
// IGenerator
public void OutputLine(string fullLine) {
mOutStream.WriteLine(fullLine);
}
// IGenerator
public void OutputLine(string label, string opcode, string operand, string comment) {
// If a label is provided, and it doesn't start with a '.' (indicating that it's
// a directive), and this isn't an EQU directive, add a ':'. Might be easier to
// just ".feature labels_without_colons", but I'm trying to do things the way
// that cc65 users will expect.
if (!string.IsNullOrEmpty(label) && label[0] != '.' &&
!string.Equals(opcode, sDataOpNames.EquDirective,
StringComparison.InvariantCultureIgnoreCase)) {
label += ':';
if (mLongLabelNewLine && label.Length >= mColumnWidths[0]) {
mOutStream.WriteLine(label);
label = string.Empty;
}
}
mLineBuilder.Clear();
TextUtil.AppendPaddedString(mLineBuilder, label, mColumnWidths[0]);
TextUtil.AppendPaddedString(mLineBuilder, opcode, mColumnWidths[0] + mColumnWidths[1]);
TextUtil.AppendPaddedString(mLineBuilder, operand,
mColumnWidths[0] + mColumnWidths[1] + mColumnWidths[2]);
if (string.IsNullOrEmpty(comment)) {
// Trim trailing spaces off of opcode or operand. If they want trailing
// spaces at the end of a comment, that's fine.
CommonUtil.TextUtil.TrimEnd(mLineBuilder);
} else {
mLineBuilder.Append(comment);
}
mOutStream.WriteLine(mLineBuilder.ToString());
}
private void OutputString(int offset, string labelStr, string commentStr) {
// Normal ASCII strings are straightforward: they're just part of a .byte
// directive, and can mix with anything else in the .byte.
//
// For CString we can use .asciiz, but only if the string fits on one line
// and doesn't include delimiters. For L8String and L16String we can
// define simple macros, but their use has a similar restriction. High-ASCII
// strings also require a macro.
//
// We might be able to define a macro for DCI and Reverse as well.
//
// The limitation on strings with delimiters arises because (1) I don't see a
// way to escape them within a string, and (2) the simple macro workarounds
// only take a single argument, not a comma-separated list of stuff.
//
// Some ideas here:
// https://groups.google.com/forum/#!topic/comp.sys.apple2.programmer/5Wkw8mUPcU0
Formatter formatter = SourceFormatter;
byte[] data = Project.FileData;
Anattrib attr = Project.GetAnattrib(offset);
FormatDescriptor dfd = attr.DataDescriptor;
Debug.Assert(dfd != null);
Debug.Assert(dfd.FormatType == FormatDescriptor.Type.String);
Debug.Assert(dfd.Length > 0);
bool highAscii = false;
int leadingBytes = 0;
int trailingBytes = 0;
bool showLeading = false;
bool showTrailing = false;
switch (dfd.FormatSubType) {
case FormatDescriptor.SubType.None:
highAscii = (data[offset] & 0x80) != 0;
break;
case FormatDescriptor.SubType.Dci:
highAscii = (data[offset] & 0x80) != 0;
trailingBytes = 1;
showTrailing = true;
break;
case FormatDescriptor.SubType.Reverse:
highAscii = (data[offset] & 0x80) != 0;
break;
case FormatDescriptor.SubType.DciReverse:
highAscii = (data[offset + dfd.Length - 1] & 0x80) != 0;
leadingBytes = 1;
showLeading = true;
break;
case FormatDescriptor.SubType.CString:
highAscii = (data[offset] & 0x80) != 0;
trailingBytes = 1;
showTrailing = true;
break;
case FormatDescriptor.SubType.L8String:
if (dfd.Length > 1) {
highAscii = (data[offset + 1] & 0x80) != 0;
}
leadingBytes = 1;
showLeading = true;
break;
case FormatDescriptor.SubType.L16String:
if (dfd.Length > 2) {
highAscii = (data[offset + 2] & 0x80) != 0;
}
leadingBytes = 2;
showLeading = true;
break;
default:
Debug.Assert(false);
return;
}
char delim = '"';
StringGather gath = null;
// Run the string through so we can see if it'll fit on one line. As a minor
// optimization, we skip this step for "generic" strings, which are probably
// the most common thing.
if (dfd.FormatSubType != FormatDescriptor.SubType.None || highAscii) {
gath = new StringGather(this, labelStr, "???", commentStr, delim,
delim, StringGather.ByteStyle.CommaSep, MAX_OPERAND_LEN, true);
FeedGath(gath, data, offset, dfd.Length, leadingBytes, showLeading,
trailingBytes, showTrailing);
Debug.Assert(gath.NumLinesOutput > 0);
}
string opcodeStr = formatter.FormatPseudoOp(sDataOpNames.StrGeneric);
switch (dfd.FormatSubType) {
case FormatDescriptor.SubType.None:
// Special case for simple short high-ASCII strings. These have no
// leading or trailing bytes. We can improve this a bit by handling
// arbitrarily long strings by simply breaking them across lines.
Debug.Assert(leadingBytes == 0);
Debug.Assert(trailingBytes == 0);
if (highAscii && gath.NumLinesOutput == 1 && !gath.HasDelimiter) {
if (!mHighAsciiMacroOutput) {
mHighAsciiMacroOutput = true;
// Output a macro for high-ASCII strings.
OutputLine(".macro", "HiAscii", "Arg", string.Empty);
OutputLine(string.Empty, ".repeat", ".strlen(Arg), I", string.Empty);
OutputLine(string.Empty, ".byte", ".strat(Arg, I) | $80", string.Empty);
OutputLine(string.Empty, ".endrep", string.Empty, string.Empty);
OutputLine(".endmacro", string.Empty, string.Empty, string.Empty);
}
opcodeStr = formatter.FormatPseudoOp("HiAscii");
highAscii = false;
}
break;
case FormatDescriptor.SubType.Dci:
case FormatDescriptor.SubType.Reverse:
case FormatDescriptor.SubType.DciReverse:
// Full configured above.
break;
case FormatDescriptor.SubType.CString:
if (gath.NumLinesOutput == 1 && !gath.HasDelimiter) {
opcodeStr = sDataOpNames.StrNullTerm;
showTrailing = false;
}
break;
case FormatDescriptor.SubType.L8String:
case FormatDescriptor.SubType.L16String:
// Implement macros?
break;
default:
Debug.Assert(false);
return;
}
if (highAscii) {
OutputNoJoy(offset, dfd.Length, labelStr, commentStr);
return;
}
// Create a new StringGather, with the final opcode choice.
gath = new StringGather(this, labelStr, opcodeStr, commentStr, delim,
delim, StringGather.ByteStyle.CommaSep, MAX_OPERAND_LEN, false);
FeedGath(gath, data, offset, dfd.Length, leadingBytes, showLeading,
trailingBytes, showTrailing);
}
/// <summary>
/// Feeds the bytes into the StringGather.
/// </summary>
private void FeedGath(StringGather gath, byte[] data, int offset, int length,
int leadingBytes, bool showLeading, int trailingBytes, bool showTrailing) {
int startOffset = offset;
int strEndOffset = offset + length - trailingBytes;
if (showLeading) {
while (leadingBytes-- > 0) {
gath.WriteByte(data[offset++]);
}
} else {
offset += leadingBytes;
}
for (; offset < strEndOffset; offset++) {
gath.WriteChar((char)(data[offset] & 0x7f));
}
while (showTrailing && trailingBytes-- > 0) {
gath.WriteByte(data[offset++]);
}
gath.Finish();
}
}
#endregion IGenerator
#region IAssembler
/// <summary>
/// Cross-assembler execution interface.
/// </summary>
public class AsmCc65 : IAssembler {
// Fixed options. "--target none" is needed to neutralize the character encoding,
// which seems to default to PETSCII.
public const string OPTIONS = "--target none";
// Paths from generator.
private List<string> mPathNames;
// Directory to make current before executing assembler.
private string mWorkDirectory;
// IAssembler
public void GetExeIdentifiers(out string humanName, out string exeName) {
humanName = "cc65 CL";
exeName = "cl65";
}
// IAssembler
public AssemblerConfig GetDefaultConfig() {
return new AssemblerConfig(string.Empty, new int[] { 9, 8, 11, 72 });
}
// IAssembler
public AssemblerVersion QueryVersion() {
AssemblerConfig config =
AssemblerConfig.GetConfig(AppSettings.Global, AssemblerInfo.Id.Cc65);
if (config == null || string.IsNullOrEmpty(config.ExecutablePath)) {
return null;
}
ShellCommand cmd = new ShellCommand(config.ExecutablePath, "--version",
Directory.GetCurrentDirectory(), null);
cmd.Execute();
if (string.IsNullOrEmpty(cmd.Stdout)) {
return null;
}
// Windows - Stderr: "cl65.exe V2.17\r\n"
// Linux - Stderr: "cl65 V2.17 - Git N/A\n"
// Other platforms may not have the ".exe". Find first occurrence of " V".
const string PREFIX = " V";
string str = cmd.Stderr;
int start = str.IndexOf(PREFIX);
int end = (start < 0) ? -1 : str.IndexOfAny(new char[] { ' ', '\r', '\n' }, start + 1);
if (start < 0 || end < 0 || start + PREFIX.Length >= end) {
Debug.WriteLine("Couldn't find version in " + str);
return null;
}
start += PREFIX.Length;
string versionStr = str.Substring(start, end - start);
CommonUtil.Version version = CommonUtil.Version.Parse(versionStr);
if (!version.IsValid) {
return null;
}
return new AssemblerVersion(versionStr, version);
}
// IAssembler
public void Configure(List<string> pathNames, string workDirectory) {
// Clone pathNames, in case the caller decides to modify the original.
mPathNames = new List<string>(pathNames.Count);
foreach (string str in pathNames) {
mPathNames.Add(str);
}
mWorkDirectory = workDirectory;
}
// IAssembler
public AssemblerResults RunAssembler(BackgroundWorker worker) {
Debug.Assert(mPathNames.Count == 2);
string pathName = StripWorkDirectory(mPathNames[0]);
string cfgName = StripWorkDirectory(mPathNames[1]);
AssemblerConfig config =
AssemblerConfig.GetConfig(AppSettings.Global, AssemblerInfo.Id.Cc65);
if (string.IsNullOrEmpty(config.ExecutablePath)) {
Debug.WriteLine("Assembler not configured");
return null;
}
string cfgOpt = " -C \"" + cfgName + "\"";
worker.ReportProgress(0, Properties.Resources.PROGRESS_ASSEMBLING);
// Wrap pathname in quotes in case it has spaces.
// (Do we need to shell-escape quotes in the pathName?)
ShellCommand cmd = new ShellCommand(config.ExecutablePath,
OPTIONS + cfgOpt + " \"" + pathName + "\"", mWorkDirectory, null);
cmd.Execute();
// Can't really do anything with a "cancel" request.
// Output filename is the input filename without the ".S". Since the filename
// was generated by us we can be confident in the format.
string outputFile = mPathNames[0].Substring(0, mPathNames[0].Length - 2);
return new AssemblerResults(cmd.FullCommandLine, cmd.ExitCode, cmd.Stdout,
cmd.Stderr, outputFile);
}
/// <summary>
/// Reduce input file to a partial path if possible. This is just to make
/// what we display to the user a little easier to read.
/// </summary>
/// <param name="pathName">Full pathname of file.</param>
/// <returns>Pathname with working directory prefix stripped off.</returns>
private string StripWorkDirectory(string pathName) {
if (pathName.StartsWith(mWorkDirectory)) {
return pathName.Remove(0, mWorkDirectory.Length + 1);
} else {
// Unexpected, but shouldn't be a problem.
Debug.WriteLine("NOTE: source file is not in work directory");
return pathName;
}
}
}
#endregion IAssembler
}

View File

@ -1,790 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Text;
using Asm65;
using CommonUtil;
namespace SourceGenWF.AsmGen {
#region IGenerator
/// <summary>
/// Generate source code compatible with Brutal Deluxe's Merlin 32 assembler
/// (https://www.brutaldeluxe.fr/products/crossdevtools/merlin/).
/// </summary>
public class GenMerlin32 : IGenerator {
private const string ASM_FILE_SUFFIX = "_Merlin32.S"; // must start with underscore
private const int MAX_OPERAND_LEN = 64;
// IGenerator
public DisasmProject Project { get; private set; }
// IGenerator
public Formatter SourceFormatter { get; private set; }
// IGenerator
public AppSettings Settings { get; private set; }
// IGenerator
public AssemblerQuirks Quirks { get; private set; }
// IGenerator
public LabelLocalizer Localizer { get { return mLocalizer; } }
/// <summary>
/// Working directory, i.e. where we write our output file(s).
/// </summary>
private string mWorkDirectory;
/// <summary>
/// If set, long labels get their own line.
/// </summary>
private bool mLongLabelNewLine;
/// <summary>
/// Output column widths.
/// </summary>
private int[] mColumnWidths;
/// <summary>
/// Base filename. Typically the project file name without the ".dis65" extension.
/// </summary>
private string mFileNameBase;
/// <summary>
/// StringBuilder to use when composing a line. Held here to reduce allocations.
/// </summary>
private StringBuilder mLineBuilder = new StringBuilder(100);
/// <summary>
/// Label localization helper.
/// </summary>
private LabelLocalizer mLocalizer;
/// <summary>
/// Stream to send the output to.
/// </summary>
private StreamWriter mOutStream;
/// <summary>
/// Holds detected version of configured assembler.
/// </summary>
private CommonUtil.Version mAsmVersion = CommonUtil.Version.NO_VERSION;
// Semi-convenient way to hold all the interesting string constants in one place.
// Note the actual usage of the pseudo-op may not match what the main app does,
// e.g. RegWidthDirective behaves differently from "mx". I'm just trying to avoid
// having string constants scattered all over.
private static PseudoOp.PseudoOpNames sDataOpNames = new PseudoOp.PseudoOpNames() {
EquDirective = "equ",
OrgDirective = "org",
RegWidthDirective = "mx",
DefineData1 = "dfb",
DefineData2 = "dw",
DefineData3 = "adr",
DefineData4 = "adrl",
DefineBigData2 = "ddb",
//DefineBigData3
//DefineBigData4
Fill = "ds",
Dense = "hex",
StrGeneric = "asc",
StrGenericHi = "asc",
StrReverse = "rev",
StrReverseHi = "rev",
//StrNullTerm
StrLen8 = "str",
StrLen8Hi = "str",
StrLen16 = "strl",
StrLen16Hi = "strl",
StrDci = "dci",
StrDciHi = "dci",
//StrDciReverse
};
// IGenerator
public void GetDefaultDisplayFormat(out PseudoOp.PseudoOpNames pseudoOps,
out Formatter.FormatConfig formatConfig) {
// This is not intended to match up with the Merlin generator, which uses
// the same pseudo-op for low/high ASCII but different string delimiters. We
// don't change the delimiters for the display list, so instead we tweak the
// opcode slightly.
char hiAscii = '\u2191';
pseudoOps = new PseudoOp.PseudoOpNames() {
EquDirective = "equ",
OrgDirective = "org",
DefineData1 = "dfb",
DefineData2 = "dw",
DefineData3 = "adr",
DefineData4 = "adrl",
DefineBigData2 = "ddb",
Fill = "ds",
Dense = "hex",
StrGeneric = "asc",
StrGenericHi = "asc" + hiAscii,
StrReverse = "rev",
StrReverseHi = "rev" + hiAscii,
StrLen8 = "str",
StrLen8Hi = "str" + hiAscii,
StrLen16 = "strl",
StrLen16Hi = "strl" + hiAscii,
StrDci = "dci",
StrDciHi = "dci" + hiAscii,
};
formatConfig = new Formatter.FormatConfig();
SetFormatConfigValues(ref formatConfig);
}
// IGenerator
public void Configure(DisasmProject project, string workDirectory, string fileNameBase,
AssemblerVersion asmVersion, AppSettings settings) {
Debug.Assert(project != null);
Debug.Assert(!string.IsNullOrEmpty(workDirectory));
Debug.Assert(!string.IsNullOrEmpty(fileNameBase));
Project = project;
Quirks = new AssemblerQuirks();
Quirks.TracksSepRepNotEmu = true;
Quirks.NoPcRelBankWrap = true;
mWorkDirectory = workDirectory;
mFileNameBase = fileNameBase;
Settings = settings;
mLongLabelNewLine = Settings.GetBool(AppSettings.SRCGEN_LONG_LABEL_NEW_LINE, false);
AssemblerConfig config = AssemblerConfig.GetConfig(settings,
AssemblerInfo.Id.Merlin32);
mColumnWidths = (int[])config.ColumnWidths.Clone();
}
/// <summary>
/// Configures the assembler-specific format items.
/// </summary>
private void SetFormatConfigValues(ref Formatter.FormatConfig config) {
config.mForceAbsOpcodeSuffix = ":";
config.mForceLongOpcodeSuffix = "l";
config.mForceDirectOperandPrefix = string.Empty;
config.mForceAbsOperandPrefix = string.Empty;
config.mForceLongOperandPrefix = string.Empty;
config.mEndOfLineCommentDelimiter = ";";
config.mFullLineCommentDelimiterBase = ";";
config.mBoxLineCommentDelimiter = string.Empty;
config.mAllowHighAsciiCharConst = true;
config.mExpressionMode = Formatter.FormatConfig.ExpressionMode.Merlin;
}
// IGenerator; executes on background thread
public List<string> GenerateSource(BackgroundWorker worker) {
List<string> pathNames = new List<string>(1);
string fileName = mFileNameBase + ASM_FILE_SUFFIX;
string pathName = Path.Combine(mWorkDirectory, fileName);
pathNames.Add(pathName);
Formatter.FormatConfig config = new Formatter.FormatConfig();
GenCommon.ConfigureFormatterFromSettings(Settings, ref config);
SetFormatConfigValues(ref config);
SourceFormatter = new Formatter(config);
string msg = string.Format(Properties.Resources.PROGRESS_GENERATING_FMT, pathName);
worker.ReportProgress(0, msg);
mLocalizer = new LabelLocalizer(Project);
if (!Settings.GetBool(AppSettings.SRCGEN_DISABLE_LABEL_LOCALIZATION, false)) {
mLocalizer.LocalPrefix = ":";
mLocalizer.Analyze();
}
// Use UTF-8 encoding, without a byte-order mark.
using (StreamWriter sw = new StreamWriter(pathName, false, new UTF8Encoding(false))) {
mOutStream = sw;
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
// No version-specific stuff yet. We're generating code for v1.0.
OutputLine(SourceFormatter.FullLineCommentDelimiter +
string.Format(Properties.Resources.GENERATED_FOR_VERSION,
"Merlin 32", new CommonUtil.Version(1, 0), string.Empty));
}
GenCommon.Generate(this, sw, worker);
}
mOutStream = null;
return pathNames;
}
// IGenerator
public void OutputDataOp(int offset) {
Formatter formatter = SourceFormatter;
byte[] data = Project.FileData;
Anattrib attr = Project.GetAnattrib(offset);
string labelStr = string.Empty;
if (attr.Symbol != null) {
labelStr = mLocalizer.ConvLabel(attr.Symbol.Label);
}
string commentStr = SourceFormatter.FormatEolComment(Project.Comments[offset]);
string opcodeStr, operandStr;
FormatDescriptor dfd = attr.DataDescriptor;
Debug.Assert(dfd != null);
int length = dfd.Length;
Debug.Assert(length > 0);
bool multiLine = false;
switch (dfd.FormatType) {
case FormatDescriptor.Type.Default:
if (length != 1) {
Debug.Assert(false);
length = 1;
}
opcodeStr = sDataOpNames.DefineData1;
int operand = RawData.GetWord(data, offset, length, false);
operandStr = formatter.FormatHexValue(operand, length * 2);
break;
case FormatDescriptor.Type.NumericLE:
opcodeStr = sDataOpNames.GetDefineData(length);
operand = RawData.GetWord(data, offset, length, false);
operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable,
mLocalizer.LabelMap, dfd, operand, length,
PseudoOp.FormatNumericOpFlags.None);
break;
case FormatDescriptor.Type.NumericBE:
opcodeStr = sDataOpNames.GetDefineBigData(length);
if (opcodeStr == null) {
// Nothing defined, output as comma-separated single-byte values.
GenerateShortSequence(offset, length, out opcodeStr, out operandStr);
} else {
operand = RawData.GetWord(data, offset, length, true);
operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable,
mLocalizer.LabelMap, dfd, operand, length,
PseudoOp.FormatNumericOpFlags.None);
}
break;
case FormatDescriptor.Type.Fill:
opcodeStr = sDataOpNames.Fill;
operandStr = length + "," + formatter.FormatHexValue(data[offset], 2);
break;
case FormatDescriptor.Type.Dense:
multiLine = true;
opcodeStr = operandStr = null;
OutputDenseHex(offset, length, labelStr, commentStr);
break;
case FormatDescriptor.Type.String:
multiLine = true;
opcodeStr = operandStr = null;
OutputString(offset, labelStr, commentStr);
break;
default:
opcodeStr = "???";
operandStr = "***";
break;
}
if (!multiLine) {
opcodeStr = formatter.FormatPseudoOp(opcodeStr);
OutputLine(labelStr, opcodeStr, operandStr, commentStr);
}
}
private void OutputDenseHex(int offset, int length, string labelStr, string commentStr) {
Formatter formatter = SourceFormatter;
byte[] data = Project.FileData;
int maxPerLine = MAX_OPERAND_LEN / 2;
string opcodeStr = formatter.FormatPseudoOp(sDataOpNames.Dense);
for (int i = 0; i < length; i += maxPerLine) {
int subLen = length - i;
if (subLen > maxPerLine) {
subLen = maxPerLine;
}
string operandStr = formatter.FormatDenseHex(data, offset + i, subLen);
OutputLine(labelStr, opcodeStr, operandStr, commentStr);
labelStr = commentStr = string.Empty;
}
}
// IGenerator
public string ModifyOpcode(int offset, OpDef op) {
if (op.IsUndocumented) {
return null;
}
// The assembler works correctly if the symbol is defined as a two-digit hex
// value (e.g. "foo equ $80") but fails if it's four (e.g. "foo equ $0080"). We
// output symbols with minimal digits, but this doesn't help if the code itself
// lives on zero page. If the operand is a reference to a zero-page user label,
// we need to output the instruction as hex.
// More info: https://github.com/apple2accumulator/merlin32/issues/8
if (op == OpDef.OpPEI_StackDPInd ||
op == OpDef.OpSTY_DPIndexX ||
op == OpDef.OpSTX_DPIndexY ||
op.AddrMode == OpDef.AddressMode.DPIndLong ||
op.AddrMode == OpDef.AddressMode.DPInd ||
op.AddrMode == OpDef.AddressMode.DPIndexXInd) {
FormatDescriptor dfd = Project.GetAnattrib(offset).DataDescriptor;
if (dfd != null && dfd.HasSymbol) {
// It has a symbol. See if the symbol target is a label (auto or user).
if (Project.SymbolTable.TryGetValue(dfd.SymbolRef.Label, out Symbol sym)) {
if (sym.IsInternalLabel) {
return null;
}
}
}
}
return string.Empty;
}
// IGenerator
public void GenerateShortSequence(int offset, int length, out string opcode,
out string operand) {
Debug.Assert(length >= 1 && length <= 4);
// Use a comma-separated list of individual hex bytes.
opcode = sDataOpNames.DefineData1;
StringBuilder sb = new StringBuilder(length * 4);
for (int i = 0; i < length; i++) {
if (i != 0) {
sb.Append(',');
}
sb.Append(SourceFormatter.FormatHexValue(Project.FileData[offset + i], 2));
}
operand = sb.ToString();
}
// IGenerator
public void OutputAsmConfig() {
// nothing to do
}
// IGenerator
public void OutputEquDirective(string name, string valueStr, string comment) {
OutputLine(name, SourceFormatter.FormatPseudoOp(sDataOpNames.EquDirective),
valueStr, SourceFormatter.FormatEolComment(comment));
}
// IGenerator
public void OutputOrgDirective(int offset, int address) {
OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(sDataOpNames.OrgDirective),
SourceFormatter.FormatHexValue(address, 4), string.Empty);
}
// IGenerator
public void OutputRegWidthDirective(int offset, int prevM, int prevX, int newM, int newX) {
// prevM/prevX may be ambiguous for offset 0, but otherwise everything
// should be either 0 or 1.
Debug.Assert(newM == 0 || newM == 1);
Debug.Assert(newX == 0 || newX == 1);
if (offset == 0 && newM == 1 && newX == 1) {
// Assembler defaults to short regs, so we can skip this.
return;
}
OutputLine(string.Empty,
SourceFormatter.FormatPseudoOp(sDataOpNames.RegWidthDirective),
"%" + newM + newX, string.Empty);
}
// IGenerator
public void OutputLine(string fullLine) {
mOutStream.WriteLine(fullLine);
}
// IGenerator
public void OutputLine(string label, string opcode, string operand, string comment) {
// Split long label, but not on EQU directives (confuses the assembler).
if (mLongLabelNewLine && label.Length >= mColumnWidths[0] &&
!string.Equals(opcode, sDataOpNames.EquDirective,
StringComparison.InvariantCultureIgnoreCase)) {
mOutStream.WriteLine(label);
label = string.Empty;
}
mLineBuilder.Clear();
TextUtil.AppendPaddedString(mLineBuilder, label, mColumnWidths[0]);
TextUtil.AppendPaddedString(mLineBuilder, opcode, mColumnWidths[0] + mColumnWidths[1]);
TextUtil.AppendPaddedString(mLineBuilder, operand,
mColumnWidths[0] + mColumnWidths[1] + mColumnWidths[2]);
if (string.IsNullOrEmpty(comment)) {
// Trim trailing spaces off of opcode or operand. If they want trailing
// spaces at the end of a comment, that's fine.
CommonUtil.TextUtil.TrimEnd(mLineBuilder);
} else {
mLineBuilder.Append(comment);
}
mOutStream.WriteLine(mLineBuilder.ToString());
}
private enum RevMode { Forward, Reverse, BlockReverse };
private void OutputString(int offset, string labelStr, string commentStr) {
// This gets complicated.
//
// For Dci, L8String, and L16String, the entire string needs to fit in the
// operand of one line. If it can't, we need to separate the length byte/word
// or inverted character out, and just dump the rest as ASCII. Computing the
// line length requires factoring delimiter character escapes. (NOTE: contrary
// to the documentation, STR and STRL do include trailing hex characters in the
// length calculation, so it's possible to escape delimiters.)
//
// For Reverse, we can span lines, but only if we emit the lines in
// backward order. Also, Merlin doesn't allow hex to be embedded in a REV
// operation, so we can't use REV if the string contains a delimiter.
//
// DciReverse is deprecated, but we can handle it as a Reverse string with a
// trailing byte on a following line.
//
// For aesthetic purposes, zero-length CString, L8String, and L16String
// should be output as DFB/DW zeroes rather than an empty string -- makes
// it easier to read.
Formatter formatter = SourceFormatter;
byte[] data = Project.FileData;
Anattrib attr = Project.GetAnattrib(offset);
FormatDescriptor dfd = attr.DataDescriptor;
Debug.Assert(dfd != null);
Debug.Assert(dfd.FormatType == FormatDescriptor.Type.String);
Debug.Assert(dfd.Length > 0);
bool highAscii = false;
int showZeroes = 0;
int leadingBytes = 0;
int trailingBytes = 0;
bool showLeading = false;
bool showTrailing = false;
RevMode revMode = RevMode.Forward;
switch (dfd.FormatSubType) {
case FormatDescriptor.SubType.None:
highAscii = (data[offset] & 0x80) != 0;
break;
case FormatDescriptor.SubType.Dci:
highAscii = (data[offset] & 0x80) != 0;
break;
case FormatDescriptor.SubType.Reverse:
highAscii = (data[offset] & 0x80) != 0;
revMode = RevMode.Reverse;
break;
case FormatDescriptor.SubType.DciReverse:
highAscii = (data[offset + dfd.Length - 1] & 0x80) != 0;
revMode = RevMode.Reverse;
break;
case FormatDescriptor.SubType.CString:
highAscii = (data[offset] & 0x80) != 0;
if (dfd.Length == 1) {
showZeroes = 1; // empty null-terminated string
}
trailingBytes = 1;
showTrailing = true;
break;
case FormatDescriptor.SubType.L8String:
if (dfd.Length > 1) {
highAscii = (data[offset + 1] & 0x80) != 0;
} else {
//showZeroes = 1;
}
leadingBytes = 1;
break;
case FormatDescriptor.SubType.L16String:
if (dfd.Length > 2) {
highAscii = (data[offset + 2] & 0x80) != 0;
} else {
//showZeroes = 2;
}
leadingBytes = 2;
break;
default:
Debug.Assert(false);
return;
}
if (showZeroes != 0) {
// Empty string. Just output the length byte(s) or null terminator.
GenerateShortSequence(offset, showZeroes, out string opcode, out string operand);
OutputLine(labelStr, opcode, operand, commentStr);
return;
}
// Merlin 32 uses single-quote for low ASCII, double-quote for high ASCII. When
// quoting the delimiter we use a hexadecimal value. We need to bear in mind that
// we're forcing the characters to low ASCII, but the actual character being
// escaped might be in high ASCII. Hence delim vs. delimReplace.
char delim = highAscii ? '"' : '\'';
char delimReplace = highAscii ? ((char)(delim | 0x80)) : delim;
StringGather gath = null;
// Run the string through so we can see if it'll fit on one line. As a minor
// optimization, we skip this step for "generic" strings, which are probably
// the most common thing.
if (dfd.FormatSubType != FormatDescriptor.SubType.None) {
gath = new StringGather(this, labelStr, "???", commentStr, delim,
delimReplace, StringGather.ByteStyle.DenseHex, MAX_OPERAND_LEN, true);
FeedGath(gath, data, offset, dfd.Length, revMode, leadingBytes, showLeading,
trailingBytes, showTrailing);
Debug.Assert(gath.NumLinesOutput > 0);
}
string opcodeStr;
switch (dfd.FormatSubType) {
case FormatDescriptor.SubType.None:
opcodeStr = highAscii ? sDataOpNames.StrGenericHi : sDataOpNames.StrGeneric;
break;
case FormatDescriptor.SubType.Dci:
if (gath.NumLinesOutput == 1) {
opcodeStr = highAscii ? sDataOpNames.StrDciHi : sDataOpNames.StrDci;
} else {
opcodeStr = highAscii ? sDataOpNames.StrGenericHi : sDataOpNames.StrGeneric;
trailingBytes = 1;
showTrailing = true;
}
break;
case FormatDescriptor.SubType.Reverse:
if (gath.HasDelimiter) {
// can't include escaped delimiters in REV
opcodeStr = highAscii ? sDataOpNames.StrGenericHi : sDataOpNames.StrGeneric;
revMode = RevMode.Forward;
} else if (gath.NumLinesOutput > 1) {
opcodeStr = highAscii ? sDataOpNames.StrReverseHi : sDataOpNames.StrReverse;
revMode = RevMode.BlockReverse;
} else {
opcodeStr = highAscii ? sDataOpNames.StrReverseHi : sDataOpNames.StrReverse;
Debug.Assert(revMode == RevMode.Reverse);
}
break;
case FormatDescriptor.SubType.DciReverse:
// Mostly punt -- output as ASCII with special handling for first byte.
opcodeStr = highAscii ? sDataOpNames.StrGenericHi : sDataOpNames.StrGeneric;
revMode = RevMode.Forward;
leadingBytes = 1;
showLeading = true;
break;
case FormatDescriptor.SubType.CString:
//opcodeStr = sDataOpNames.StrNullTerm[highAscii ? 1 : 0];
opcodeStr = highAscii ? sDataOpNames.StrGenericHi : sDataOpNames.StrGeneric;
break;
case FormatDescriptor.SubType.L8String:
if (gath.NumLinesOutput == 1) {
opcodeStr = highAscii ? sDataOpNames.StrLen8Hi : sDataOpNames.StrLen8;
} else {
opcodeStr = highAscii ? sDataOpNames.StrGenericHi : sDataOpNames.StrGeneric;
leadingBytes = 1;
showLeading = true;
}
break;
case FormatDescriptor.SubType.L16String:
if (gath.NumLinesOutput == 1) {
opcodeStr = highAscii ? sDataOpNames.StrLen16Hi : sDataOpNames.StrLen16;
} else {
opcodeStr = highAscii ? sDataOpNames.StrGenericHi : sDataOpNames.StrGeneric;
leadingBytes = 2;
showLeading = true;
}
break;
default:
Debug.Assert(false);
return;
}
opcodeStr = formatter.FormatPseudoOp(opcodeStr);
// Create a new StringGather, with the final opcode choice.
gath = new StringGather(this, labelStr, opcodeStr, commentStr, delim,
delimReplace, StringGather.ByteStyle.DenseHex, MAX_OPERAND_LEN, false);
FeedGath(gath, data, offset, dfd.Length, revMode, leadingBytes, showLeading,
trailingBytes, showTrailing);
}
/// <summary>
/// Feeds the bytes into the StringGather.
/// </summary>
private void FeedGath(StringGather gath, byte[] data, int offset, int length,
RevMode revMode, int leadingBytes, bool showLeading,
int trailingBytes, bool showTrailing) {
int startOffset = offset;
int strEndOffset = offset + length - trailingBytes;
if (showLeading) {
while (leadingBytes-- > 0) {
gath.WriteByte(data[offset++]);
}
} else {
offset += leadingBytes;
}
if (revMode == RevMode.BlockReverse) {
const int maxPerLine = MAX_OPERAND_LEN - 2;
int numBlockLines = (length + maxPerLine - 1) / maxPerLine;
for (int chunk = 0; chunk < numBlockLines; chunk++) {
int chunkOffset = startOffset + chunk * maxPerLine;
int endOffset = chunkOffset + maxPerLine;
if (endOffset > strEndOffset) {
endOffset = strEndOffset;
}
for (int off = endOffset - 1; off >= chunkOffset; off--) {
gath.WriteChar((char)(data[off] & 0x7f));
}
}
} else {
for (; offset < strEndOffset; offset++) {
if (revMode == RevMode.Forward) {
gath.WriteChar((char)(data[offset] & 0x7f));
} else if (revMode == RevMode.Reverse) {
int posn = startOffset + (strEndOffset - offset) - 1;
gath.WriteChar((char)(data[posn] & 0x7f));
} else {
Debug.Assert(false);
}
}
}
while (showTrailing && trailingBytes-- > 0) {
gath.WriteByte(data[offset++]);
}
gath.Finish();
}
}
#endregion IGenerator
#region IAssembler
/// <summary>
/// Cross-assembler execution interface.
/// </summary>
public class AsmMerlin32 : IAssembler {
// Paths from generator.
private List<string> mPathNames;
// Directory to make current before executing assembler.
private string mWorkDirectory;
// IAssembler
public void GetExeIdentifiers(out string humanName, out string exeName) {
humanName = "Merlin Assembler";
exeName = "Merlin32";
}
// IAssembler
public AssemblerConfig GetDefaultConfig() {
return new AssemblerConfig(string.Empty, new int[] { 9, 6, 11, 74 });
}
// IAssembler
public AssemblerVersion QueryVersion() {
AssemblerConfig config =
AssemblerConfig.GetConfig(AppSettings.Global, AssemblerInfo.Id.Merlin32);
if (config == null || string.IsNullOrEmpty(config.ExecutablePath)) {
return null;
}
ShellCommand cmd = new ShellCommand(config.ExecutablePath, string.Empty,
Directory.GetCurrentDirectory(), null);
cmd.Execute();
if (string.IsNullOrEmpty(cmd.Stdout)) {
return null;
}
// Stdout: "C:\Src\WorkBench\Merlin32.exe v 1.0, (c) Brutal Deluxe ..."
// Other platforms may not have the ".exe". Find first occurrence of " v ".
const string PREFIX = " v "; // not expecting this to appear in the path
string str = cmd.Stdout;
int start = str.IndexOf(PREFIX);
int end = (start < 0) ? -1 : str.IndexOf(',', start);
if (start < 0 || end < 0 || start + PREFIX.Length >= end) {
Debug.WriteLine("Couldn't find version in " + str);
return null;
}
start += PREFIX.Length;
string versionStr = str.Substring(start, end - start);
CommonUtil.Version version = CommonUtil.Version.Parse(versionStr);
if (!version.IsValid) {
return null;
}
return new AssemblerVersion(versionStr, version);
}
// IAssembler
public void Configure(List<string> pathNames, string workDirectory) {
// Clone pathNames, in case the caller decides to modify the original.
mPathNames = new List<string>(pathNames.Count);
foreach (string str in pathNames) {
mPathNames.Add(str);
}
mWorkDirectory = workDirectory;
}
// IAssembler
public AssemblerResults RunAssembler(BackgroundWorker worker) {
// Reduce input file to a partial path if possible. This is really just to make
// what we display to the user a little easier to read.
string pathName = mPathNames[0];
if (pathName.StartsWith(mWorkDirectory)) {
pathName = pathName.Remove(0, mWorkDirectory.Length + 1);
} else {
// Unexpected, but shouldn't be a problem.
Debug.WriteLine("NOTE: source file is not in work directory");
}
AssemblerConfig config =
AssemblerConfig.GetConfig(AppSettings.Global, AssemblerInfo.Id.Merlin32);
if (string.IsNullOrEmpty(config.ExecutablePath)) {
Debug.WriteLine("Assembler not configured");
return null;
}
worker.ReportProgress(0, Properties.Resources.PROGRESS_ASSEMBLING);
// Wrap pathname in quotes in case it has spaces.
// (Do we need to shell-escape quotes in the pathName?)
//
// Merlin 32 has no options. The second argument is the macro include file path.
ShellCommand cmd = new ShellCommand(config.ExecutablePath, ". \"" + pathName + "\"",
mWorkDirectory, null);
cmd.Execute();
// Can't really do anything with a "cancel" request.
// Output filename is the input filename without the ".S". Since the filename
// was generated by us we can be confident in the format.
string outputFile = mPathNames[0].Substring(0, mPathNames[0].Length - 2);
return new AssemblerResults(cmd.FullCommandLine, cmd.ExitCode, cmd.Stdout,
cmd.Stderr, outputFile);
}
}
#endregion IAssembler
}

View File

@ -1,778 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Text;
using Asm65;
using CommonUtil;
namespace SourceGenWF.AsmGen {
#region IGenerator
/// <summary>
/// Generate source code compatible with the 64tass assembler
/// (https://sourceforge.net/projects/tass64/).
///
/// The assembler is officially called "64tass", but it's sometimes written "tass64" because
/// in some cases you can't start an identifier with a number.
///
/// We need to deal with a couple of unusual aspects:
/// (1) The prefix for a local label is '_', which is generally a legal character. So
/// if somebody creates a label with a leading '_', and it's not actually local, we have
/// to "de-local" it somehow.
/// (2) By default, labels are handled in a case-insensitive fashion, which is extremely
/// rare for programming languages. Case sensitivity can be enabled with the "-C" flag.
/// Anybody who wants to assemble the generated code will need to be aware of this.
/// </summary>
public class GenTass64 : IGenerator {
private const string ASM_FILE_SUFFIX = "_64tass.S"; // must start with underscore
private const int MAX_OPERAND_LEN = 64;
// IGenerator
public DisasmProject Project { get; private set; }
// IGenerator
public Formatter SourceFormatter { get; private set; }
// IGenerator
public AppSettings Settings { get; private set; }
// IGenerator
public AssemblerQuirks Quirks { get; private set; }
// IGenerator
public LabelLocalizer Localizer { get { return mLocalizer; } }
/// <summary>
/// Working directory, i.e. where we write our output file(s).
/// </summary>
private string mWorkDirectory;
/// <summary>
/// If set, long labels get their own line.
/// </summary>
private bool mLongLabelNewLine;
/// <summary>
/// Output column widths.
/// </summary>
private int[] mColumnWidths;
/// <summary>
/// Base filename. Typically the project file name without the ".dis65" extension.
/// </summary>
private string mFileNameBase;
/// <summary>
/// StringBuilder to use when composing a line. Held here to reduce allocations.
/// </summary>
private StringBuilder mLineBuilder = new StringBuilder(100);
/// <summary>
/// Label localization helper.
/// </summary>
private LabelLocalizer mLocalizer;
/// <summary>
/// Stream to send the output to.
/// </summary>
private StreamWriter mOutStream;
/// <summary>
/// If we output a ".logical", we will need a ".here" eventually.
/// </summary>
private bool mNeedHereOp;
/// <summary>
/// Holds detected version of configured assembler.
/// </summary>
private CommonUtil.Version mAsmVersion = CommonUtil.Version.NO_VERSION;
// Version we're coded against.
private static CommonUtil.Version V1_53 = new CommonUtil.Version(1, 53, 1515);
// Pseudo-op string constants.
private static PseudoOp.PseudoOpNames sDataOpNames = new PseudoOp.PseudoOpNames() {
EquDirective = "=",
OrgDirective = ".logical",
//RegWidthDirective // .as, .al, .xs, .xl
DefineData1 = ".byte",
DefineData2 = ".word",
DefineData3 = ".long",
DefineData4 = ".dword",
//DefineBigData2
//DefineBigData3
//DefineBigData4
Fill = ".fill",
//Dense // no equivalent, use .byte with comma-separated args
StrGeneric = ".text",
//StrReverse
StrNullTerm = ".null",
StrLen8 = ".ptext",
//StrLen16
//StrDci
//StrDciReverse
};
private const string HERE_PSEUDO_OP = ".here";
// IGenerator
public void GetDefaultDisplayFormat(out PseudoOp.PseudoOpNames pseudoOps,
out Formatter.FormatConfig formatConfig) {
pseudoOps = sDataOpNames;
formatConfig = new Formatter.FormatConfig();
SetFormatConfigValues(ref formatConfig);
}
// IGenerator
public void Configure(DisasmProject project, string workDirectory, string fileNameBase,
AssemblerVersion asmVersion, AppSettings settings) {
Debug.Assert(project != null);
Debug.Assert(!string.IsNullOrEmpty(workDirectory));
Debug.Assert(!string.IsNullOrEmpty(fileNameBase));
Project = project;
Quirks = new AssemblerQuirks();
mWorkDirectory = workDirectory;
mFileNameBase = fileNameBase;
Settings = settings;
mLongLabelNewLine = Settings.GetBool(AppSettings.SRCGEN_LONG_LABEL_NEW_LINE, false);
AssemblerConfig config = AssemblerConfig.GetConfig(settings,
AssemblerInfo.Id.Tass64);
mColumnWidths = (int[])config.ColumnWidths.Clone();
}
/// <summary>
/// Configures the assembler-specific format items.
/// </summary>
private void SetFormatConfigValues(ref Formatter.FormatConfig config) {
// Must be lower case when --case-sensitive is used.
config.mUpperOpcodes = false;
config.mUpperPseudoOpcodes = false;
config.mUpperOperandA = false;
config.mUpperOperandS = false;
config.mUpperOperandXY = false;
config.mBankSelectBackQuote = true;
config.mForceAbsOpcodeSuffix = string.Empty;
config.mForceLongOpcodeSuffix = string.Empty;
config.mForceDirectOperandPrefix = string.Empty;
config.mForceAbsOperandPrefix = "@w"; // word
config.mForceLongOperandPrefix = "@l"; // long
config.mEndOfLineCommentDelimiter = ";";
config.mFullLineCommentDelimiterBase = ";";
config.mBoxLineCommentDelimiter = ";";
config.mAllowHighAsciiCharConst = false;
config.mExpressionMode = Formatter.FormatConfig.ExpressionMode.Common;
}
// IGenerator
public List<string> GenerateSource(BackgroundWorker worker) {
List<string> pathNames = new List<string>(1);
string fileName = mFileNameBase + ASM_FILE_SUFFIX;
string pathName = Path.Combine(mWorkDirectory, fileName);
pathNames.Add(pathName);
Formatter.FormatConfig config = new Formatter.FormatConfig();
GenCommon.ConfigureFormatterFromSettings(Settings, ref config);
SetFormatConfigValues(ref config);
SourceFormatter = new Formatter(config);
string msg = string.Format(Properties.Resources.PROGRESS_GENERATING_FMT, pathName);
worker.ReportProgress(0, msg);
mLocalizer = new LabelLocalizer(Project);
if (!Settings.GetBool(AppSettings.SRCGEN_DISABLE_LABEL_LOCALIZATION, false)) {
mLocalizer.LocalPrefix = "_";
mLocalizer.Analyze();
}
mLocalizer.MaskLeadingUnderscores();
// Use UTF-8 encoding, without a byte-order mark.
using (StreamWriter sw = new StreamWriter(pathName, false, new UTF8Encoding(false))) {
mOutStream = sw;
if (Settings.GetBool(AppSettings.SRCGEN_ADD_IDENT_COMMENT, false)) {
OutputLine(SourceFormatter.FullLineCommentDelimiter +
string.Format(Properties.Resources.GENERATED_FOR_VERSION,
"64tass", V1_53, AsmTass64.OPTIONS));
}
GenCommon.Generate(this, sw, worker);
if (mNeedHereOp) {
OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(HERE_PSEUDO_OP),
string.Empty, string.Empty);
}
}
mOutStream = null;
return pathNames;
}
// IGenerator
public void OutputAsmConfig() {
CpuDef cpuDef = Project.CpuDef;
string cpuStr;
if (cpuDef.Type == CpuDef.CpuType.Cpu65816) {
cpuStr = "65816";
} else if (cpuDef.Type == CpuDef.CpuType.Cpu65C02) {
cpuStr = "65c02";
} else if (cpuDef.Type == CpuDef.CpuType.Cpu6502 && cpuDef.HasUndocumented) {
cpuStr = "6502i";
} else {
cpuStr = "6502";
}
OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(".cpu"),
'\"' + cpuStr + '\"', string.Empty);
}
// IGenerator
public string ModifyOpcode(int offset, OpDef op) {
if (op.IsUndocumented) {
if (Project.CpuDef.Type == CpuDef.CpuType.Cpu65C02) {
// none of the "LDD" stuff is handled
return null;
}
if ((op.Mnemonic == OpName.ANC && op.Opcode != 0x0b) ||
(op.Mnemonic == OpName.JAM && op.Opcode != 0x02)) {
// There are multiple opcodes that match the mnemonic. Output the
// mnemonic for the first one and hex for the rest.
return null;
} else if (op.Mnemonic == OpName.NOP || op.Mnemonic == OpName.DOP ||
op.Mnemonic == OpName.TOP) {
// the various undocumented no-ops aren't handled
return null;
} else if (op.Mnemonic == OpName.SBC) {
// this is the alternate reference to SBC
return null;
} else if (op == OpDef.OpSHA_DPIndIndexY) {
// not recognized ($93)
return null;
}
}
if (op == OpDef.OpBRK_StackInt || op == OpDef.OpCOP_StackInt ||
op == OpDef.OpWDM_WDM) {
// 64tass doesn't like these to have an operand. Output as hex.
return null;
}
return string.Empty; // indicate original is fine
}
// IGenerator
public void GenerateShortSequence(int offset, int length, out string opcode,
out string operand) {
Debug.Assert(length >= 1 && length <= 4);
// Use a comma-separated list of individual hex bytes.
opcode = sDataOpNames.DefineData1;
StringBuilder sb = new StringBuilder(length * 4);
for (int i = 0; i < length; i++) {
if (i != 0) {
sb.Append(',');
}
sb.Append(SourceFormatter.FormatHexValue(Project.FileData[offset + i], 2));
}
operand = sb.ToString();
}
// IGenerator
public void OutputDataOp(int offset) {
Formatter formatter = SourceFormatter;
byte[] data = Project.FileData;
Anattrib attr = Project.GetAnattrib(offset);
string labelStr = string.Empty;
if (attr.Symbol != null) {
labelStr = mLocalizer.ConvLabel(attr.Symbol.Label);
}
string commentStr = SourceFormatter.FormatEolComment(Project.Comments[offset]);
string opcodeStr, operandStr;
FormatDescriptor dfd = attr.DataDescriptor;
Debug.Assert(dfd != null);
int length = dfd.Length;
Debug.Assert(length > 0);
bool multiLine = false;
switch (dfd.FormatType) {
case FormatDescriptor.Type.Default:
if (length != 1) {
Debug.Assert(false);
length = 1;
}
opcodeStr = sDataOpNames.DefineData1;
int operand = RawData.GetWord(data, offset, length, false);
operandStr = formatter.FormatHexValue(operand, length * 2);
break;
case FormatDescriptor.Type.NumericLE:
opcodeStr = sDataOpNames.GetDefineData(length);
operand = RawData.GetWord(data, offset, length, false);
operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable,
mLocalizer.LabelMap, dfd, operand, length,
PseudoOp.FormatNumericOpFlags.None);
break;
case FormatDescriptor.Type.NumericBE:
opcodeStr = sDataOpNames.GetDefineBigData(length);
if (opcodeStr == null) {
// Nothing defined, output as comma-separated single-byte values.
GenerateShortSequence(offset, length, out opcodeStr, out operandStr);
} else {
operand = RawData.GetWord(data, offset, length, true);
operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable,
mLocalizer.LabelMap, dfd, operand, length,
PseudoOp.FormatNumericOpFlags.None);
}
break;
case FormatDescriptor.Type.Fill:
opcodeStr = sDataOpNames.Fill;
operandStr = length + "," + formatter.FormatHexValue(data[offset], 2);
break;
case FormatDescriptor.Type.Dense:
multiLine = true;
opcodeStr = operandStr = null;
OutputDenseHex(offset, length, labelStr, commentStr);
break;
case FormatDescriptor.Type.String:
multiLine = true;
opcodeStr = operandStr = null;
OutputString(offset, labelStr, commentStr);
break;
default:
opcodeStr = "???";
operandStr = "***";
break;
}
if (!multiLine) {
opcodeStr = formatter.FormatPseudoOp(opcodeStr);
OutputLine(labelStr, opcodeStr, operandStr, commentStr);
}
}
private void OutputDenseHex(int offset, int length, string labelStr, string commentStr) {
Formatter formatter = SourceFormatter;
byte[] data = Project.FileData;
StringBuilder sb = new StringBuilder(MAX_OPERAND_LEN);
string opcodeStr = formatter.FormatPseudoOp(sDataOpNames.DefineData1);
int maxPerLine = MAX_OPERAND_LEN / 4;
int numChunks = (length + maxPerLine - 1) / maxPerLine;
for (int chunk = 0; chunk < numChunks; chunk++) {
int chunkStart = chunk * maxPerLine;
int chunkEnd = Math.Min((chunk + 1) * maxPerLine, length);
for (int i = chunkStart; i < chunkEnd; i++) {
if (i != chunkStart) {
sb.Append(',');
}
sb.Append(formatter.FormatHexValue(data[offset + i], 2));
}
OutputLine(labelStr, opcodeStr, sb.ToString(), commentStr);
labelStr = commentStr = string.Empty;
sb.Clear();
}
}
/// <summary>
/// Outputs formatted data in an unformatted way, because the code generator couldn't
/// figure out how to do something better.
/// </summary>
private void OutputNoJoy(int offset, int length, string labelStr, string commentStr) {
byte[] data = Project.FileData;
Debug.Assert(length > 0);
Debug.Assert(offset >= 0 && offset < data.Length);
bool singleValue = true;
byte val = data[offset];
for (int i = 1; i < length; i++) {
if (data[offset + i] != val) {
singleValue = false;
break;
}
}
if (singleValue) {
string opcodeStr = SourceFormatter.FormatPseudoOp(sDataOpNames.Fill);
string operandStr = length + "," + SourceFormatter.FormatHexValue(val, 2);
OutputLine(labelStr, opcodeStr, operandStr, commentStr);
} else {
OutputDenseHex(offset, length, labelStr, commentStr);
}
}
// IGenerator
public void OutputEquDirective(string name, string valueStr, string comment) {
OutputLine(name, SourceFormatter.FormatPseudoOp(sDataOpNames.EquDirective),
valueStr, SourceFormatter.FormatEolComment(comment));
}
// IGenerator
public void OutputOrgDirective(int offset, int address) {
// 64tass separates the "compile offset", which determines where the output fits
// into the generated binary, and "program counter", which determines the code
// the assembler generates. Since we need to explicitly specify every byte in
// the output file, the compile offset isn't very useful. We want to set it once
// before the first line of code, then leave it alone.
//
// Any subsequent ORG changes are made to the program counter, and take the form
// of a pair of ops (.logical <addr> to open, .here to end). Omitting the .here
// causes an error.
if (offset == 0) {
// Set the "compile offset" to the initial address.
OutputLine("*", "=", SourceFormatter.FormatHexValue(Project.AddrMap.Get(0), 4),
string.Empty);
} else {
if (mNeedHereOp) {
OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(HERE_PSEUDO_OP),
string.Empty, string.Empty);
}
OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(sDataOpNames.OrgDirective),
SourceFormatter.FormatHexValue(address, 4), string.Empty);
mNeedHereOp = true;
}
}
// IGenerator
public void OutputRegWidthDirective(int offset, int prevM, int prevX, int newM, int newX) {
if (prevM != newM) {
string mop = (newM == 0) ? ".al" : ".as";
OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(mop),
string.Empty, string.Empty);
}
if (prevX != newX) {
string xop = (newX == 0) ? ".xl" : ".xs";
OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(xop),
string.Empty, string.Empty);
}
}
// IGenerator
public void OutputLine(string fullLine) {
mOutStream.WriteLine(fullLine);
}
// IGenerator
public void OutputLine(string label, string opcode, string operand, string comment) {
// Break the line if the label is long and it's not a .EQ directive.
if (!string.IsNullOrEmpty(label) &&
!string.Equals(opcode, sDataOpNames.EquDirective,
StringComparison.InvariantCultureIgnoreCase)) {
if (mLongLabelNewLine && label.Length >= mColumnWidths[0]) {
mOutStream.WriteLine(label);
label = string.Empty;
}
}
mLineBuilder.Clear();
TextUtil.AppendPaddedString(mLineBuilder, label, mColumnWidths[0]);
TextUtil.AppendPaddedString(mLineBuilder, opcode, mColumnWidths[0] + mColumnWidths[1]);
TextUtil.AppendPaddedString(mLineBuilder, operand,
mColumnWidths[0] + mColumnWidths[1] + mColumnWidths[2]);
if (string.IsNullOrEmpty(comment)) {
// Trim trailing spaces off of opcode or operand. If they want trailing
// spaces at the end of a comment, that's fine.
CommonUtil.TextUtil.TrimEnd(mLineBuilder);
} else {
mLineBuilder.Append(comment);
}
mOutStream.WriteLine(mLineBuilder.ToString());
}
private void OutputString(int offset, string labelStr, string commentStr) {
// Normal ASCII strings are handled with a simple .text directive.
//
// CString and L8String have directives (.null, .ptext), but we can only use
// them if the string fits on one line and doesn't include delimiters.
//
// We could probably do something fancy with the character encoding options to
// make high-ASCII work nicely.
//
// We might be able to define a macro for DCI and Reverse.
Formatter formatter = SourceFormatter;
byte[] data = Project.FileData;
Anattrib attr = Project.GetAnattrib(offset);
FormatDescriptor dfd = attr.DataDescriptor;
Debug.Assert(dfd != null);
Debug.Assert(dfd.FormatType == FormatDescriptor.Type.String);
Debug.Assert(dfd.Length > 0);
bool highAscii = false;
int leadingBytes = 0;
int trailingBytes = 0;
bool showLeading = false;
bool showTrailing = false;
switch (dfd.FormatSubType) {
case FormatDescriptor.SubType.None:
highAscii = (data[offset] & 0x80) != 0;
break;
case FormatDescriptor.SubType.Dci:
highAscii = (data[offset] & 0x80) != 0;
trailingBytes = 1;
showTrailing = true;
break;
case FormatDescriptor.SubType.Reverse:
highAscii = (data[offset] & 0x80) != 0;
break;
case FormatDescriptor.SubType.DciReverse:
highAscii = (data[offset + dfd.Length - 1] & 0x80) != 0;
leadingBytes = 1;
showLeading = true;
break;
case FormatDescriptor.SubType.CString:
highAscii = (data[offset] & 0x80) != 0;
trailingBytes = 1;
showTrailing = true;
break;
case FormatDescriptor.SubType.L8String:
if (dfd.Length > 1) {
highAscii = (data[offset + 1] & 0x80) != 0;
}
leadingBytes = 1;
showLeading = true;
break;
case FormatDescriptor.SubType.L16String:
if (dfd.Length > 2) {
highAscii = (data[offset + 2] & 0x80) != 0;
}
leadingBytes = 2;
showLeading = true;
break;
default:
Debug.Assert(false);
return;
}
char delim = '"';
StringGather gath = null;
// Run the string through so we can see if it'll fit on one line. As a minor
// optimization, we skip this step for "generic" strings, which are probably
// the most common thing.
if (dfd.FormatSubType != FormatDescriptor.SubType.None || highAscii) {
gath = new StringGather(this, labelStr, "???", commentStr, delim,
delim, StringGather.ByteStyle.CommaSep, MAX_OPERAND_LEN, true);
FeedGath(gath, data, offset, dfd.Length, leadingBytes, showLeading,
trailingBytes, showTrailing);
Debug.Assert(gath.NumLinesOutput > 0);
}
string opcodeStr = formatter.FormatPseudoOp(sDataOpNames.StrGeneric);
switch (dfd.FormatSubType) {
case FormatDescriptor.SubType.None:
// TODO(someday): something fancy with encodings to handle high-ASCII text?
break;
case FormatDescriptor.SubType.Dci:
case FormatDescriptor.SubType.Reverse:
case FormatDescriptor.SubType.DciReverse:
// Fully configured above.
break;
case FormatDescriptor.SubType.CString:
if (gath.NumLinesOutput == 1 && !gath.HasDelimiter) {
opcodeStr = sDataOpNames.StrNullTerm;
showTrailing = false;
}
break;
case FormatDescriptor.SubType.L8String:
if (gath.NumLinesOutput == 1 && !gath.HasDelimiter) {
opcodeStr = sDataOpNames.StrLen8;
showLeading = false;
}
break;
case FormatDescriptor.SubType.L16String:
// Implement as macro?
break;
default:
Debug.Assert(false);
return;
}
if (highAscii) {
OutputNoJoy(offset, dfd.Length, labelStr, commentStr);
return;
}
// Create a new StringGather, with the final opcode choice.
gath = new StringGather(this, labelStr, opcodeStr, commentStr, delim,
delim, StringGather.ByteStyle.CommaSep, MAX_OPERAND_LEN, false);
FeedGath(gath, data, offset, dfd.Length, leadingBytes, showLeading,
trailingBytes, showTrailing);
}
/// <summary>
/// Feeds the bytes into the StringGather.
/// </summary>
private void FeedGath(StringGather gath, byte[] data, int offset, int length,
int leadingBytes, bool showLeading, int trailingBytes, bool showTrailing) {
int startOffset = offset;
int strEndOffset = offset + length - trailingBytes;
if (showLeading) {
while (leadingBytes-- > 0) {
gath.WriteByte(data[offset++]);
}
} else {
offset += leadingBytes;
}
for (; offset < strEndOffset; offset++) {
gath.WriteChar((char)(data[offset] & 0x7f));
}
while (showTrailing && trailingBytes-- > 0) {
gath.WriteByte(data[offset++]);
}
gath.Finish();
}
}
#endregion IGenerator
#region IAssembler
/// <summary>
/// Cross-assembler execution interface.
/// </summary>
public class AsmTass64 : IAssembler {
public const string OPTIONS = "--case-sensitive --nostart --long-address -Wall";
// Paths from generator.
private List<string> mPathNames;
// Directory to make current before executing assembler.
private string mWorkDirectory;
// IAssembler
public void GetExeIdentifiers(out string humanName, out string exeName) {
humanName = "64tass Assembler";
exeName = "64tass";
}
// IAssembler
public AssemblerConfig GetDefaultConfig() {
return new AssemblerConfig(string.Empty, new int[] { 8, 8, 11, 73 });
}
// IAssembler
public AssemblerVersion QueryVersion() {
AssemblerConfig config =
AssemblerConfig.GetConfig(AppSettings.Global, AssemblerInfo.Id.Tass64);
if (config == null || string.IsNullOrEmpty(config.ExecutablePath)) {
return null;
}
ShellCommand cmd = new ShellCommand(config.ExecutablePath, "--version",
Directory.GetCurrentDirectory(), null);
cmd.Execute();
if (string.IsNullOrEmpty(cmd.Stdout)) {
return null;
}
// Windows - Stdout: "64tass Turbo Assembler Macro V1.53.1515\r\n"
// Linux - Stdout: "64tass Turbo Assembler Macro V1.53.1515?\n"
const string PREFIX = "Macro V";
string str = cmd.Stdout;
int start = str.IndexOf(PREFIX);
int end = (start < 0) ? -1 : str.IndexOfAny(new char[] { '?', '\r', '\n' }, start + 1);
if (start < 0 || end < 0 || start + PREFIX.Length >= end) {
Debug.WriteLine("Couldn't find version in " + str);
return null;
}
start += PREFIX.Length;
string versionStr = str.Substring(start, end - start);
CommonUtil.Version version = CommonUtil.Version.Parse(versionStr);
if (!version.IsValid) {
return null;
}
return new AssemblerVersion(versionStr, version);
}
// IAssembler
public void Configure(List<string> pathNames, string workDirectory) {
// Clone pathNames, in case the caller decides to modify the original.
mPathNames = new List<string>(pathNames.Count);
foreach (string str in pathNames) {
mPathNames.Add(str);
}
mWorkDirectory = workDirectory;
}
// IAssembler
public AssemblerResults RunAssembler(BackgroundWorker worker) {
// Reduce input file to a partial path if possible. This is really just to make
// what we display to the user a little easier to read.
string pathName = mPathNames[0];
if (pathName.StartsWith(mWorkDirectory)) {
pathName = pathName.Remove(0, mWorkDirectory.Length + 1);
} else {
// Unexpected, but shouldn't be a problem.
Debug.WriteLine("NOTE: source file is not in work directory");
}
AssemblerConfig config =
AssemblerConfig.GetConfig(AppSettings.Global, AssemblerInfo.Id.Tass64);
if (string.IsNullOrEmpty(config.ExecutablePath)) {
Debug.WriteLine("Assembler not configured");
return null;
}
worker.ReportProgress(0, Properties.Resources.PROGRESS_ASSEMBLING);
string outFileName = pathName.Substring(0, pathName.Length - 2);
// Wrap pathname in quotes in case it has spaces.
// (Do we need to shell-escape quotes in the pathName?)
ShellCommand cmd = new ShellCommand(config.ExecutablePath,
OPTIONS + " \"" + pathName + "\"" + " -o \"" + outFileName + "\"",
mWorkDirectory, null);
cmd.Execute();
// Can't really do anything with a "cancel" request.
// Output filename is the input filename without the ".S". Since the filename
// was generated by us we can be confident in the format.
string outputFile = mPathNames[0].Substring(0, mPathNames[0].Length - 2);
return new AssemblerResults(cmd.FullCommandLine, cmd.ExitCode, cmd.Stdout,
cmd.Stderr, outputFile);
}
}
#endregion IAssembler
}

View File

@ -1,114 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Web.Script.Serialization;
namespace SourceGenWF.AsmGen {
/// <summary>
/// Assembler configuration holder. Serializes and deserializes information held in
/// application settings.
/// </summary>
public class AssemblerConfig {
// Public fields are deserialized from JSON. Changing the names will break compatibility.
/// <summary>
/// Path to cross-assembler executable. Will be null or empty if this assembler
/// is not configured.
/// </summary>
public string ExecutablePath { get; set; }
/// <summary>
/// Column display widths.
/// </summary>
public int[] ColumnWidths { get; set; }
public const int NUM_COLUMNS = 4; // label, opcode, operand, comment
/// <summary>
/// Nullary constructor, for serialization.
/// </summary>
public AssemblerConfig() { }
/// <summary>
/// Constructor.
/// </summary>
/// <param name="exePath">Path to executable. May be empty.</param>
/// <param name="widths">Column widths.</param>
public AssemblerConfig(string exePath, int[] widths) {
if (exePath == null) {
throw new Exception("Bad exe path");
}
if (widths.Length != NUM_COLUMNS) {
throw new Exception("Bad widths.Length " + widths.Length);
}
ExecutablePath = exePath;
ColumnWidths = widths;
}
private static string GetSettingName(AssemblerInfo.Id id) {
return AppSettings.ASM_CONFIG_PREFIX + id.ToString();
}
/// <summary>
/// Creates a populated AssemblerConfig from the app settings for the specified ID.
/// If the assembler hasn't been configured yet, the default configuration object
/// will be returned.
/// </summary>
/// <param name="settings">Settings object to pull the values from.</param>
/// <param name="id">Assembler ID.</param>
/// <returns>The AssemblerConfig.</returns>
public static AssemblerConfig GetConfig(AppSettings settings, AssemblerInfo.Id id) {
string cereal = settings.GetString(GetSettingName(id), null);
if (string.IsNullOrEmpty(cereal)) {
IAssembler asm = AssemblerInfo.GetAssembler(id);
return asm.GetDefaultConfig();
}
JavaScriptSerializer ser = new JavaScriptSerializer();
try {
AssemblerConfig config = ser.Deserialize<AssemblerConfig>(cereal);
if (config.ColumnWidths == null || config.ColumnWidths.Length != NUM_COLUMNS) {
throw new Exception("Bad column widths");
}
if (config.ExecutablePath == null) {
throw new Exception("Missing exe path");
}
return config;
} catch (Exception ex) {
Debug.WriteLine("AssemblerConfig deserialization failed: " + ex.Message);
return null;
}
}
/// <summary>
/// Updates the assembler settings for the specified ID.
/// </summary>
/// <param name="settings">Settings object to update.</param>
/// <param name="id">Assembler ID.</param>
/// <param name="config">Asm configuration.</param>
public static void SetConfig(AppSettings settings, AssemblerInfo.Id id,
AssemblerConfig config) {
JavaScriptSerializer ser = new JavaScriptSerializer();
string cereal = ser.Serialize(config);
settings.SetString(GetSettingName(id), cereal);
}
}
}

View File

@ -1,170 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
namespace SourceGenWF.AsmGen {
/// <summary>
/// Static information on assemblers supported by SourceGen. This is relevant for both
/// assembly source generation and assembler execution. Nothing here is affected
/// by whether or not the assembler in question is actually installed.
/// </summary>
public class AssemblerInfo {
/// <summary>
/// Enumeration of supported assemblers. Alphabetical order looks nicest.
/// </summary>
public enum Id {
Unknown = 0,
Tass64,
Cc65,
Merlin32,
}
/// <summary>
/// Static information for all known assemblers.
///
/// The AsmType argument may be null. This is useful for non-cross assemblers.
/// </summary>
private static AssemblerInfo[] sInfo = new AssemblerInfo[] {
new AssemblerInfo(Id.Unknown, "???", null, null),
new AssemblerInfo(Id.Tass64, "64tass", typeof(GenTass64), typeof(AsmTass64)),
new AssemblerInfo(Id.Cc65, "cc65", typeof(GenCc65), typeof(AsmCc65)),
new AssemblerInfo(Id.Merlin32, "Merlin 32", typeof(GenMerlin32), typeof(AsmMerlin32)),
};
/// <summary>
/// Identifier.
/// </summary>
public Id AssemblerId { get; private set; }
/// <summary>
/// Human-readable name.
/// </summary>
public string Name { get; private set; }
/// <summary>
/// Type of generator class.
/// </summary>
public Type GenType { get; private set; }
/// <summary>
/// Type of assembler class.
/// </summary>
public Type AsmType { get; private set; }
private AssemblerInfo(Id id, string name, Type genType, Type asmType) {
AssemblerId = id;
Name = name;
GenType = genType;
AsmType = asmType;
}
/// <summary>
/// Returns an AssemblerInfo object for the specified id.
/// </summary>
/// <param name="id">Assembler identifier.</param>
/// <returns>Reference to AssemblerInfo object.</returns>
public static AssemblerInfo GetAssemblerInfo(Id id) {
return sInfo[(int)id];
}
/// <summary>
/// Generator factory method.
/// </summary>
/// <param name="id">ID of assembler to return generator instance for.</param>
/// <returns>New source generator object.</returns>
public static IGenerator GetGenerator(Id id) {
Type genType = sInfo[(int)id].GenType;
if (genType == null) {
Debug.Assert(false); // unexpected for generator
return null;
} else {
return (IGenerator)Activator.CreateInstance(genType);
}
}
/// <summary>
/// Assembler factory method.
/// </summary>
/// <param name="id">ID of assembler to return assembler instance for.</param>
/// <returns>New assembler interface object.</returns>
public static IAssembler GetAssembler(Id id) {
Type asmType = sInfo[(int)id].AsmType;
if (asmType == null) {
return null;
} else {
return (IAssembler)Activator.CreateInstance(asmType);
}
}
/// <summary>
/// Provides a way to iterate through the set of known assemblers. This is probably
/// YAGNI -- we could just return the array -- but it would allow us to apply filters,
/// e.g. strip out assemblers that don't support 65816 code when that's the selected
/// CPU definition.
/// </summary>
private class AssemblerInfoIterator : IEnumerator<AssemblerInfo> {
private int mIndex = -1;
public AssemblerInfo Current {
get {
if (mIndex < 0) {
// not started
return null;
}
return sInfo[mIndex];
}
}
object IEnumerator.Current {
get {
return Current;
}
}
public void Dispose() { }
public bool MoveNext() {
if (mIndex < 0) {
// skip element 0 (Unknown)
mIndex = 1;
} else {
mIndex++;
if (mIndex >= sInfo.Length) {
return false;
}
}
return true;
}
public void Reset() {
mIndex = -1;
}
}
public static IEnumerator<AssemblerInfo> GetInfoEnumerator() {
return new AssemblerInfoIterator();
}
public override string ToString() {
return "Asm " + ((int)AssemblerId).ToString() + ": " + Name;
}
}
}

View File

@ -1,113 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AsmGen {
partial class AssemblerProgress {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.progressLabel = new System.Windows.Forms.Label();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.cancelButton = new System.Windows.Forms.Button();
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.SuspendLayout();
//
// progressLabel
//
this.progressLabel.AutoSize = true;
this.progressLabel.Location = new System.Drawing.Point(13, 13);
this.progressLabel.Name = "progressLabel";
this.progressLabel.Size = new System.Drawing.Size(61, 13);
this.progressLabel.TabIndex = 1;
this.progressLabel.Text = "Preparing...";
//
// progressBar1
//
this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.progressBar1.Location = new System.Drawing.Point(12, 39);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(600, 23);
this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
this.progressBar1.TabIndex = 2;
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cancelButton.Location = new System.Drawing.Point(275, 79);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 0;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// backgroundWorker1
//
this.backgroundWorker1.WorkerReportsProgress = true;
this.backgroundWorker1.WorkerSupportsCancellation = true;
this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
this.backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);
this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
//
// AssemblerProgress
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(624, 114);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.progressLabel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AssemblerProgress";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Assembling Source...";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AssemblerProgress_FormClosing);
this.Load += new System.EventHandler(this.AssemblerProgress_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label progressLabel;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Button cancelButton;
private System.ComponentModel.BackgroundWorker backgroundWorker1;
}
}

View File

@ -1,124 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows.Forms;
namespace SourceGenWF.AsmGen {
/// <summary>
/// Dialog that shows the progress of the assembler, and allows cancellation.
/// </summary>
public partial class AssemblerProgress : Form {
/// <summary>
/// On success, assembler results will be here.
/// </summary>
public AssemblerResults Results { get; private set; }
/// <summary>
/// Assembler executor.
/// </summary>
private IAssembler mAssembler;
/// <summary>
/// Constructor.
/// </summary>
/// <param name="gen">Fully-configured source generator.</param>
public AssemblerProgress(IAssembler asm) {
InitializeComponent();
mAssembler = asm;
}
private void AssemblerProgress_Load(object sender, EventArgs e) {
backgroundWorker1.RunWorkerAsync();
}
private void cancelButton_Click(object sender, EventArgs e) {
backgroundWorker1.CancelAsync();
cancelButton.Enabled = false;
// We don't have a polite way to ask a shell command to stop, so we should
// kill the process here. Need to figure out how to do that. We don't need
// to clean up partial output.
}
private void AssemblerProgress_FormClosing(object sender, FormClosingEventArgs e) {
// Strictly speaking, we should treat this as a cancel request, and set
// e.Cancel = true to prevent the form from closing until the assembler stops.
// However, we don't currently kill runaway processes, which would leave the
// user with no way to close the dialog, potentially requiring them to kill the
// entire app with unsaved work. Better to abandon the runaway process.
//
// We call CancelAsync so that the results are discarded should the worker
// eventually finish.
if (backgroundWorker1.IsBusy) {
backgroundWorker1.CancelAsync();
DialogResult = DialogResult.Cancel;
}
}
// NOTE: executes on work thread. DO NOT do any UI work here. DO NOT access
// the Results property directly.
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) {
BackgroundWorker worker = sender as BackgroundWorker;
AssemblerResults results = mAssembler.RunAssembler(worker);
if (worker.CancellationPending) {
e.Cancel = true;
} else {
e.Result = results;
}
}
// Callback that fires when a progress update is made.
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) {
int percent = e.ProgressPercentage;
string msg = e.UserState as string;
Debug.Assert(percent >= 0 && percent <= 100);
if (!string.IsNullOrEmpty(msg)) {
progressLabel.Text = msg;
}
progressBar1.Value = percent;
}
// Callback that fires when execution completes.
private void backgroundWorker1_RunWorkerCompleted(object sender,
RunWorkerCompletedEventArgs e) {
if (e.Cancelled) {
Debug.WriteLine("CANCELED");
DialogResult = DialogResult.Cancel;
} else if (e.Error != null) {
// Unexpected -- shell command execution shouldn't throw exceptions.
MessageBox.Show(this, e.Error.ToString(), Properties.Resources.OPERATION_FAILED,
MessageBoxButtons.OK, MessageBoxIcon.Error);
DialogResult = DialogResult.Cancel;
} else {
// Make results available in properties.
Results = e.Result as AssemblerResults;
Debug.WriteLine("Asm complete, exit=" + Results.ExitCode);
DialogResult = DialogResult.OK;
}
// Whatever the case, we're done.
this.Close();
}
}
}

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -1,104 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace SourceGenWF.AsmGen {
public class AssemblerVersion {
/// <summary>
/// Version string reported by the assembler. Retained mostly for debugging.
/// </summary>
public string VersionStr { get; private set; }
/// <summary>
/// Version string converted to a Version object. For very complex version strings,
/// some information may be lost in the conversion.
/// </summary>
public CommonUtil.Version Version { get; private set; }
//// Command pathname and modification date. Useful for caching values.
//private string ExeName { get; set; }
//private DateTime ExeModWhen { get; set; }
public AssemblerVersion(string versionStr, CommonUtil.Version version) {
VersionStr = versionStr;
Version = version;
}
public static AssemblerVersion GetVersion(AssemblerInfo.Id id) {
IAssembler asm = AssemblerInfo.GetAssembler(id);
if (asm == null) {
Debug.WriteLine("Assembler " + id + " not configured");
return null;
}
return asm.QueryVersion();
}
public override string ToString() {
return "['" + VersionStr + "'/" + Version + "]";
}
}
/// <summary>
/// Maintains a cache of the versions of installed assemblers.
/// </summary>
public static class AssemblerVersionCache {
private static Dictionary<AssemblerInfo.Id, AssemblerVersion> sVersions =
new Dictionary<AssemblerInfo.Id, AssemblerVersion>();
private static bool sQueried = false;
/// <summary>
/// Queries the versions from all known assemblers, replacing any previously held data.
/// </summary>
public static void QueryVersions() {
IEnumerator<AssemblerInfo> iter = AssemblerInfo.GetInfoEnumerator();
while (iter.MoveNext()) {
AssemblerInfo.Id id = iter.Current.AssemblerId;
if (id == AssemblerInfo.Id.Unknown) {
continue;
}
AssemblerVersion vers = null;
IAssembler asm = AssemblerInfo.GetAssembler(id);
if (asm != null) {
vers = asm.QueryVersion();
}
Debug.WriteLine("Asm version query: " + id + "=" + vers);
sVersions[id] = vers;
}
sQueried = true;
}
/// <summary>
/// Returns the version information, or null if the query failed for this assembler.
/// </summary>
/// <param name="id">Assembler identifier.</param>
/// <returns>Version info.</returns>
public static AssemblerVersion GetVersion(AssemblerInfo.Id id) {
if (!sQueried) {
QueryVersions();
}
if (sVersions.TryGetValue(id, out AssemblerVersion vers)) {
return vers;
} else {
return null;
}
}
}
}

View File

@ -1,298 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AsmGen {
partial class GenAndAsm {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.assemblerSettingsButton = new System.Windows.Forms.Button();
this.previewFileComboBox = new System.Windows.Forms.ComboBox();
this.previewFileLabel = new System.Windows.Forms.Label();
this.workDirectoryTextBox = new System.Windows.Forms.TextBox();
this.outputFileLabel = new System.Windows.Forms.Label();
this.generateButton = new System.Windows.Forms.Button();
this.previewTextBox = new System.Windows.Forms.TextBox();
this.assemblerComboBox = new System.Windows.Forms.ComboBox();
this.assemblerLabel = new System.Windows.Forms.Label();
this.configureAsmLinkLabel = new System.Windows.Forms.LinkLabel();
this.cmdOutputTextBox = new System.Windows.Forms.TextBox();
this.runAssemblerButton = new System.Windows.Forms.Button();
this.basePanel = new System.Windows.Forms.Panel();
this.closeButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.basePanel.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.assemblerSettingsButton);
this.splitContainer1.Panel1.Controls.Add(this.previewFileComboBox);
this.splitContainer1.Panel1.Controls.Add(this.previewFileLabel);
this.splitContainer1.Panel1.Controls.Add(this.workDirectoryTextBox);
this.splitContainer1.Panel1.Controls.Add(this.outputFileLabel);
this.splitContainer1.Panel1.Controls.Add(this.generateButton);
this.splitContainer1.Panel1.Controls.Add(this.previewTextBox);
this.splitContainer1.Panel1.Controls.Add(this.assemblerComboBox);
this.splitContainer1.Panel1.Controls.Add(this.assemblerLabel);
this.splitContainer1.Panel1MinSize = 150;
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.configureAsmLinkLabel);
this.splitContainer1.Panel2.Controls.Add(this.cmdOutputTextBox);
this.splitContainer1.Panel2.Controls.Add(this.runAssemblerButton);
this.splitContainer1.Panel2MinSize = 100;
this.splitContainer1.Size = new System.Drawing.Size(784, 612);
this.splitContainer1.SplitterDistance = 400;
this.splitContainer1.TabIndex = 0;
//
// assemblerSettingsButton
//
this.assemblerSettingsButton.Location = new System.Drawing.Point(241, 10);
this.assemblerSettingsButton.Name = "assemblerSettingsButton";
this.assemblerSettingsButton.Size = new System.Drawing.Size(75, 23);
this.assemblerSettingsButton.TabIndex = 3;
this.assemblerSettingsButton.Text = "Settings";
this.assemblerSettingsButton.UseVisualStyleBackColor = true;
this.assemblerSettingsButton.Click += new System.EventHandler(this.assemblerSettingsButton_Click);
//
// previewFileComboBox
//
this.previewFileComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.previewFileComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.previewFileComboBox.FormattingEnabled = true;
this.previewFileComboBox.Items.AddRange(new object[] {
"SampleFile#031234_Merlin32.S"});
this.previewFileComboBox.Location = new System.Drawing.Point(83, 58);
this.previewFileComboBox.Name = "previewFileComboBox";
this.previewFileComboBox.Size = new System.Drawing.Size(262, 21);
this.previewFileComboBox.TabIndex = 5;
this.previewFileComboBox.SelectedIndexChanged += new System.EventHandler(this.previewFileComboBox_SelectedIndexChanged);
//
// previewFileLabel
//
this.previewFileLabel.AutoSize = true;
this.previewFileLabel.Location = new System.Drawing.Point(13, 61);
this.previewFileLabel.Name = "previewFileLabel";
this.previewFileLabel.Size = new System.Drawing.Size(64, 13);
this.previewFileLabel.TabIndex = 4;
this.previewFileLabel.Text = "Preview file:";
//
// workDirectoryTextBox
//
this.workDirectoryTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.workDirectoryTextBox.Location = new System.Drawing.Point(445, 59);
this.workDirectoryTextBox.Name = "workDirectoryTextBox";
this.workDirectoryTextBox.ReadOnly = true;
this.workDirectoryTextBox.Size = new System.Drawing.Size(327, 20);
this.workDirectoryTextBox.TabIndex = 7;
this.workDirectoryTextBox.Text = "C:\\this\\that\\theother";
//
// outputFileLabel
//
this.outputFileLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.outputFileLabel.AutoSize = true;
this.outputFileLabel.Location = new System.Drawing.Point(360, 62);
this.outputFileLabel.Name = "outputFileLabel";
this.outputFileLabel.Size = new System.Drawing.Size(79, 13);
this.outputFileLabel.TabIndex = 6;
this.outputFileLabel.Text = "Work directory:";
//
// generateButton
//
this.generateButton.Location = new System.Drawing.Point(363, 10);
this.generateButton.Name = "generateButton";
this.generateButton.Size = new System.Drawing.Size(94, 23);
this.generateButton.TabIndex = 0;
this.generateButton.Text = "Generate";
this.generateButton.UseVisualStyleBackColor = true;
this.generateButton.Click += new System.EventHandler(this.generateButton_Click);
//
// previewTextBox
//
this.previewTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.previewTextBox.BackColor = System.Drawing.SystemColors.Window;
this.previewTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.previewTextBox.Location = new System.Drawing.Point(13, 85);
this.previewTextBox.MaxLength = 0;
this.previewTextBox.Multiline = true;
this.previewTextBox.Name = "previewTextBox";
this.previewTextBox.ReadOnly = true;
this.previewTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.previewTextBox.Size = new System.Drawing.Size(759, 303);
this.previewTextBox.TabIndex = 8;
//
// assemblerComboBox
//
this.assemblerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.assemblerComboBox.FormattingEnabled = true;
this.assemblerComboBox.Items.AddRange(new object[] {
"Merlin32",
"CA65"});
this.assemblerComboBox.Location = new System.Drawing.Point(83, 12);
this.assemblerComboBox.Name = "assemblerComboBox";
this.assemblerComboBox.Size = new System.Drawing.Size(152, 21);
this.assemblerComboBox.TabIndex = 2;
this.assemblerComboBox.SelectedIndexChanged += new System.EventHandler(this.assemblerComboBox_SelectedIndexChanged);
//
// assemblerLabel
//
this.assemblerLabel.AutoSize = true;
this.assemblerLabel.Location = new System.Drawing.Point(13, 15);
this.assemblerLabel.Name = "assemblerLabel";
this.assemblerLabel.Size = new System.Drawing.Size(58, 13);
this.assemblerLabel.TabIndex = 1;
this.assemblerLabel.Text = "Assembler:";
//
// configureAsmLinkLabel
//
this.configureAsmLinkLabel.AutoSize = true;
this.configureAsmLinkLabel.Location = new System.Drawing.Point(124, 11);
this.configureAsmLinkLabel.Name = "configureAsmLinkLabel";
this.configureAsmLinkLabel.Size = new System.Drawing.Size(126, 13);
this.configureAsmLinkLabel.TabIndex = 1;
this.configureAsmLinkLabel.TabStop = true;
this.configureAsmLinkLabel.Text = "Assembler not configured";
this.configureAsmLinkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.configureAsmLinkLabel_LinkClicked);
//
// cmdOutputTextBox
//
this.cmdOutputTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cmdOutputTextBox.BackColor = System.Drawing.SystemColors.Window;
this.cmdOutputTextBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.cmdOutputTextBox.Location = new System.Drawing.Point(10, 36);
this.cmdOutputTextBox.MaxLength = 0;
this.cmdOutputTextBox.Multiline = true;
this.cmdOutputTextBox.Name = "cmdOutputTextBox";
this.cmdOutputTextBox.ReadOnly = true;
this.cmdOutputTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.cmdOutputTextBox.Size = new System.Drawing.Size(762, 169);
this.cmdOutputTextBox.TabIndex = 2;
//
// runAssemblerButton
//
this.runAssemblerButton.Location = new System.Drawing.Point(10, 6);
this.runAssemblerButton.Name = "runAssemblerButton";
this.runAssemblerButton.Size = new System.Drawing.Size(97, 23);
this.runAssemblerButton.TabIndex = 0;
this.runAssemblerButton.Text = "Run Assembler";
this.runAssemblerButton.UseVisualStyleBackColor = true;
this.runAssemblerButton.Click += new System.EventHandler(this.runAssemblerButton_Click);
//
// basePanel
//
this.basePanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.basePanel.Controls.Add(this.splitContainer1);
this.basePanel.Location = new System.Drawing.Point(0, 0);
this.basePanel.Name = "basePanel";
this.basePanel.Size = new System.Drawing.Size(784, 612);
this.basePanel.TabIndex = 0;
//
// closeButton
//
this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.closeButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.closeButton.Location = new System.Drawing.Point(697, 626);
this.closeButton.Name = "closeButton";
this.closeButton.Size = new System.Drawing.Size(75, 23);
this.closeButton.TabIndex = 0;
this.closeButton.Text = "Close";
this.closeButton.UseVisualStyleBackColor = true;
//
// GenAndAsm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.closeButton;
this.ClientSize = new System.Drawing.Size(784, 661);
this.Controls.Add(this.closeButton);
this.Controls.Add(this.basePanel);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(800, 600);
this.Name = "GenAndAsm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Generate and Assemble";
this.Load += new System.EventHandler(this.GenAndAsm_Load);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.basePanel.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Panel basePanel;
private System.Windows.Forms.Button closeButton;
private System.Windows.Forms.Button generateButton;
private System.Windows.Forms.TextBox previewTextBox;
private System.Windows.Forms.ComboBox assemblerComboBox;
private System.Windows.Forms.Label assemblerLabel;
private System.Windows.Forms.TextBox cmdOutputTextBox;
private System.Windows.Forms.Button runAssemblerButton;
private System.Windows.Forms.TextBox workDirectoryTextBox;
private System.Windows.Forms.Label outputFileLabel;
private System.Windows.Forms.ComboBox previewFileComboBox;
private System.Windows.Forms.Label previewFileLabel;
private System.Windows.Forms.Button assemblerSettingsButton;
private System.Windows.Forms.LinkLabel configureAsmLinkLabel;
}
}

View File

@ -1,402 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
namespace SourceGenWF.AsmGen {
public partial class GenAndAsm : Form {
private const int PREVIEW_BUF_SIZE = 64 * 1024; // 64KB should be enough for preview
private static string NO_PREVIEW_FILES =
"<" + Properties.Resources.NO_FILES_AVAILABLE + ">";
/// <summary>
/// Holds data for the preview combo box.
/// </summary>
private class ComboPath {
public string FileName { get; private set; }
public string PathName { get; private set; }
public ComboPath(string pathName) {
PathName = pathName;
if (string.IsNullOrEmpty(pathName)) {
FileName = NO_PREVIEW_FILES;
} else {
FileName = Path.GetFileName(pathName);
}
}
public override string ToString() {
return FileName;
}
}
/// <summary>
/// Project view. Needed so we can pop open the assembler settings dialog.
/// </summary>
private AppForms.ProjectView mProjView;
/// <summary>
/// Project with data.
/// </summary>
private DisasmProject mProject;
/// <summary>
/// Directory where generated files and assembler output will go.
/// </summary>
private string mWorkDirectory;
/// <summary>
/// Base file name. For example, if this is "GenFile", we might generate
/// "GenFile_Cc65.S".
/// </summary>
private string mBaseFileName;
/// <summary>
/// Currently-selected assembler ID.
/// </summary>
private AssemblerInfo.Id mSelectedAssemblerId;
/// <summary>
/// Results from last source generation.
/// </summary>
private List<string> mGenerationResults;
/// <summary>
/// Holds an item for the pick-your-assembler combox box.
/// </summary>
private class AsmComboItem {
public AssemblerInfo.Id AssemblerId { get; private set; }
public string Name { get; private set; }
public AssemblerVersion AsmVersion { get; private set; }
public AsmComboItem(AssemblerInfo info, AssemblerVersion version) {
AssemblerId = info.AssemblerId;
Name = info.Name;
AsmVersion = version;
}
// This determines what the combo box shows.
public override string ToString() {
if (AsmVersion == null) {
return Name + " " + Properties.Resources.ASM_LATEST_VERSION;
} else {
return Name + " v" + AsmVersion.VersionStr;
}
}
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="projectPathName">Full path to the project file.</param>
public GenAndAsm(AppForms.ProjectView projectView, DisasmProject project,
string projectPathName) {
InitializeComponent();
mProjView = projectView;
mProject = project;
mWorkDirectory = Path.GetDirectoryName(projectPathName);
mBaseFileName = Path.GetFileNameWithoutExtension(projectPathName);
workDirectoryTextBox.Text = mWorkDirectory;
// Make the splitter visible. This is a little tricky because the parent color
// affects the children as well.
// https://stackoverflow.com/a/22888877/294248
this.splitContainer1.Panel1.BackColor = SystemColors.ControlDark;
this.splitContainer1.Panel2.BackColor = SystemColors.ControlDark;
this.splitContainer1.BackColor = SystemColors.ControlDark;
this.splitContainer1.Panel1.BackColor = SystemColors.Control;
this.splitContainer1.Panel2.BackColor = SystemColors.Control;
}
private void GenAndAsm_Load(object sender, EventArgs e) {
// Try to select the previously-used asm format.
string defaultAsm =
AppSettings.Global.GetString(AppSettings.SRCGEN_DEFAULT_ASM, string.Empty);
PopulateAssemblerComboBox(defaultAsm);
ResetElements();
}
/// <summary>
/// Populates the assembler combo box. Attempts to match the defaultAsm arg with
/// the entries to configure the initial value.
/// </summary>
private void PopulateAssemblerComboBox(string defaultAsm) {
//assemblerComboBox.DisplayMember = "Name"; // show this property
assemblerComboBox.Items.Clear();
IEnumerator<AssemblerInfo> iter = AssemblerInfo.GetInfoEnumerator();
bool foundMatch = false;
while (iter.MoveNext()) {
AssemblerInfo info = iter.Current;
AssemblerVersion version = AssemblerVersionCache.GetVersion(info.AssemblerId);
AsmComboItem item = new AsmComboItem(info, version);
assemblerComboBox.Items.Add(item);
if (item.AssemblerId.ToString() == defaultAsm) {
Debug.WriteLine("matched current " + defaultAsm);
assemblerComboBox.SelectedItem = item;
foundMatch = true;
}
}
if (!foundMatch) {
// Need to do this or box will show empty.
assemblerComboBox.SelectedIndex = 0;
}
}
private void assemblerComboBox_SelectedIndexChanged(object sender, EventArgs e) {
AsmComboItem sel = (AsmComboItem)assemblerComboBox.SelectedItem;
if (mSelectedAssemblerId != sel.AssemblerId) {
// Selection changed, discard window contents.
mSelectedAssemblerId = sel.AssemblerId;
AppSettings.Global.SetString(AppSettings.SRCGEN_DEFAULT_ASM,
mSelectedAssemblerId.ToString());
ResetElements();
}
}
private void previewFileComboBox_SelectedIndexChanged(object sender, EventArgs e) {
ComboPath cpath = (ComboPath) previewFileComboBox.SelectedItem;
if (string.IsNullOrEmpty(cpath.PathName)) {
// nothing to do
return;
}
previewTextBox.BackColor = SystemColors.Window;
previewTextBox.Enabled = true;
LoadPreviewFile(cpath.PathName);
}
/// <summary>
/// Resets all of the active elements to the initial state, before any source code
/// was generated.
/// </summary>
private void ResetElements() {
mGenerationResults = null;
previewFileComboBox.Items.Clear();
previewFileComboBox.Items.Add(new ComboPath(null));
previewFileComboBox.SelectedIndex = 0;
previewTextBox.Text = string.Empty;
previewTextBox.BackColor = SystemColors.Control;
previewTextBox.Enabled = false;
cmdOutputTextBox.Text = string.Empty;
cmdOutputTextBox.BackColor = SystemColors.Control;
UpdateAssemblerControls();
}
/// <summary>
/// Updates the controls in the lower (assembler) half of the dialog.
/// </summary>
private void UpdateAssemblerControls() {
bool asmConf = IsAssemblerConfigured();
//Debug.WriteLine("ID=" + mSelectedAssemblerId + " asmConf=" + asmConf);
configureAsmLinkLabel.Visible = !asmConf;
if (mGenerationResults == null || !asmConf) {
runAssemblerButton.Enabled = false;
} else {
runAssemblerButton.Enabled = true;
}
}
/// <summary>
/// Returns true if the selected cross-assembler executable has been configured.
/// </summary>
private bool IsAssemblerConfigured() {
AssemblerConfig config =
AssemblerConfig.GetConfig(AppSettings.Global, mSelectedAssemblerId);
return config != null && !string.IsNullOrEmpty(config.ExecutablePath);
}
private void assemblerSettingsButton_Click(object sender, EventArgs e) {
DoSettings();
}
private void configureAsmLinkLabel_LinkClicked(object sender,
LinkLabelLinkClickedEventArgs e) {
DoSettings();
}
/// <summary>
/// Configures assembler-specific items, such as the installation directory of the
/// assembler binary.
/// </summary>
private void DoSettings() {
// Pop open the app settings dialog, with the appropriate tab selected.
mProjView.ShowAppSettings(AppForms.EditAppSettings.Tab.AsmConfig,
mSelectedAssemblerId);
// Update the controls based on whether or not the assembler is now available.
UpdateAssemblerControls();
AsmComboItem item = (AsmComboItem)assemblerComboBox.SelectedItem;
PopulateAssemblerComboBox(item.AssemblerId.ToString());
}
private void generateButton_Click(object sender, EventArgs e) {
IGenerator gen = AssemblerInfo.GetGenerator(mSelectedAssemblerId);
if (gen == null) {
Debug.WriteLine("Unable to get generator for " + mSelectedAssemblerId);
return;
}
gen.Configure(mProject, mWorkDirectory, mBaseFileName,
AssemblerVersionCache.GetVersion(mSelectedAssemblerId), AppSettings.Global);
GeneratorProgress dlg = new GeneratorProgress(gen);
dlg.ShowDialog();
Debug.WriteLine("Dialog returned: " + dlg.DialogResult);
List<string> pathNames = dlg.Results;
dlg.Dispose();
if (pathNames == null) {
// errors already reported
return;
}
ResetElements();
mGenerationResults = pathNames;
previewFileComboBox.Items.Clear();
foreach (string str in pathNames) {
previewFileComboBox.Items.Add(new ComboPath(str));
}
previewFileComboBox.SelectedIndex = 0; // should trigger update
UpdateAssemblerControls();
}
private void LoadPreviewFile(string pathName) {
Debug.WriteLine("LOAD " + pathName);
try {
using (StreamReader sr = new StreamReader(pathName, Encoding.UTF8)) {
char[] bigbuf = new char[PREVIEW_BUF_SIZE];
int actual = sr.Read(bigbuf, 0, bigbuf.Length);
string str = CharArrayToLineNumberedString(bigbuf);
if (actual < PREVIEW_BUF_SIZE) {
previewTextBox.Text = str;
} else {
previewTextBox.Text = str + "\r\n" +
Properties.Resources.ERR_TOO_LARGE_FOR_PREVIEW;
}
}
} catch (Exception ex) {
previewTextBox.Text = ex.ToString();
}
}
/// <summary>
/// Converts a char[] to a string, inserting line numbers.
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
private static string CharArrayToLineNumberedString(char[] data) {
StringBuilder sb = new StringBuilder(data.Length + data.Length / 40);
int lineStart = 0;
int lineNum = 0;
for (int i = 0; i < data.Length; i++) {
if (data[i] == '\n') {
sb.AppendFormat("{0,4:D0} ", ++lineNum);
sb.Append(data, lineStart, i - lineStart + 1);
lineStart = i + 1;
}
}
return sb.ToString();
}
private void runAssemblerButton_Click(object sender, EventArgs e) {
IAssembler asm = AssemblerInfo.GetAssembler(mSelectedAssemblerId);
if (asm == null) {
Debug.WriteLine("Unable to get assembler for " + mSelectedAssemblerId);
return;
}
asm.Configure(mGenerationResults, mWorkDirectory);
AssemblerProgress dlg = new AssemblerProgress(asm);
dlg.ShowDialog();
Debug.WriteLine("Dialog returned: " + dlg.DialogResult);
if (dlg.DialogResult != DialogResult.OK) {
// Cancelled, or failed to even run the assembler.
return;
}
AssemblerResults results = dlg.Results;
if (results == null) {
Debug.WriteLine("Dialog returned OK, but no assembler results found");
Debug.Assert(false);
return;
}
StringBuilder sb =
new StringBuilder(results.Stdout.Length + results.Stderr.Length + 200);
sb.Append(results.CommandLine);
sb.Append("\r\n");
sb.AppendFormat("ExitCode={0} - ", results.ExitCode);
if (results.ExitCode == 0) {
FileInfo fi = new FileInfo(results.OutputPathName);
if (!fi.Exists) {
MessageBox.Show(this, Properties.Resources.ASM_OUTPUT_NOT_FOUND,
Properties.Resources.ASM_MISMATCH_CAPTION,
MessageBoxButtons.OK, MessageBoxIcon.Error);
sb.Append(Properties.Resources.ASM_MATCH_FAILURE);
} else if (!CommonUtil.FileUtil.CompareBinaryFile(mProject.FileData,
results.OutputPathName, out int offset, out byte fileVal)) {
if (fi.Length != mProject.FileData.Length &&
offset == fi.Length || offset == mProject.FileData.Length) {
// The files matched up to the point where one ended.
string msg = string.Format(Properties.Resources.ASM_MISMATCH_LENGTH_FMT,
fi.Length, mProject.FileData.Length);
MessageBox.Show(this, msg, Properties.Resources.ASM_MISMATCH_CAPTION,
MessageBoxButtons.OK, MessageBoxIcon.Error);
sb.Append(msg);
} else {
string msg = string.Format(Properties.Resources.ASM_MISMATCH_DATA_FMT,
offset, fileVal, mProject.FileData[offset]);
MessageBox.Show(this, msg, Properties.Resources.ASM_MISMATCH_CAPTION,
MessageBoxButtons.OK, MessageBoxIcon.Error);
sb.Append(msg);
}
} else {
sb.Append(Properties.Resources.ASM_MATCH_SUCCESS);
}
}
sb.Append("\r\n\r\n");
if (results.Stdout != null && results.Stdout.Length > 2) {
sb.Append("----- stdout -----\r\n");
sb.Append(results.Stdout);
sb.Append("\r\n");
}
if (results.Stderr != null && results.Stderr.Length > 2) {
sb.Append("----- stderr -----\r\n");
sb.Append(results.Stderr);
sb.Append("\r\n");
}
cmdOutputTextBox.Text = sb.ToString();
cmdOutputTextBox.BackColor = SystemColors.Window;
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,371 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using Asm65;
namespace SourceGenWF.AsmGen {
public class GenCommon {
/// <summary>
/// Generates assembly source.
///
/// This code is common to all generators.
/// </summary>
/// <param name="gen">Reference to generator object (presumably the caller).</param>
/// <param name="sw">Text output sink.</param>
/// <param name="worker">Background worker object, for progress updates and
/// cancelation requests.</param>
public static void Generate(IGenerator gen, StreamWriter sw, BackgroundWorker worker) {
DisasmProject proj = gen.Project;
Formatter formatter = gen.SourceFormatter;
int offset = 0;
bool doAddCycles = gen.Settings.GetBool(AppSettings.SRCGEN_SHOW_CYCLE_COUNTS, false);
GenerateHeader(gen, sw);
// Used for M/X flag tracking.
StatusFlags prevFlags = StatusFlags.AllIndeterminate;
int lastProgress = 0;
while (offset < proj.FileData.Length) {
Anattrib attr = proj.GetAnattrib(offset);
if (attr.IsInstructionStart && offset > 0 &&
proj.GetAnattrib(offset - 1).IsData) {
// Transition from data to code. (Don't add blank line for inline data.)
gen.OutputLine(string.Empty);
}
// Long comments come first.
if (proj.LongComments.TryGetValue(offset, out MultiLineComment longComment)) {
List<string> formatted = longComment.FormatText(formatter, string.Empty);
foreach (string str in formatted) {
gen.OutputLine(str);
}
}
// Check for address change.
int orgAddr = proj.AddrMap.Get(offset);
if (orgAddr >= 0) {
gen.OutputOrgDirective(offset, orgAddr);
}
if (attr.IsInstructionStart) {
// Generate M/X reg width directive, if necessary.
// NOTE: we can suppress the initial directive if we know what the
// target assembler's default assumption is. Probably want to handle
// that in the ORG output handler.
if (proj.CpuDef.HasEmuFlag) {
StatusFlags curFlags = attr.StatusFlags;
curFlags.M = attr.StatusFlags.ShortM ? 1 : 0;
curFlags.X = attr.StatusFlags.ShortX ? 1 : 0;
if (curFlags.M != prevFlags.M || curFlags.X != prevFlags.X) {
// changed, output directive
gen.OutputRegWidthDirective(offset, prevFlags.M, prevFlags.X,
curFlags.M, curFlags.X);
}
prevFlags = curFlags;
}
// Look for embedded instructions.
int len;
for (len = 1; len < attr.Length; len++) {
if (proj.GetAnattrib(offset + len).IsInstructionStart) {
break;
}
}
// Output instruction.
GenerateInstruction(gen, sw, offset, len, doAddCycles);
if (attr.DoesNotContinue) {
gen.OutputLine(string.Empty);
}
offset += len;
} else {
gen.OutputDataOp(offset);
offset += attr.Length;
}
// Update progress meter. We don't want to spam it, so just ping it 10x.
int curProgress = (offset * 10) / proj.FileData.Length;
if (lastProgress != curProgress) {
if (worker.CancellationPending) {
Debug.WriteLine("GenCommon got cancellation request");
return;
}
lastProgress = curProgress;
worker.ReportProgress(curProgress * 10);
//System.Threading.Thread.Sleep(500);
}
}
}
private static void GenerateHeader(IGenerator gen, StreamWriter sw) {
DisasmProject proj = gen.Project;
Formatter formatter = gen.SourceFormatter;
// Check for header comment.
if (proj.LongComments.TryGetValue(DisplayList.Line.HEADER_COMMENT_OFFSET,
out MultiLineComment headerComment)) {
List<string> formatted = headerComment.FormatText(formatter, string.Empty);
foreach (string str in formatted) {
gen.OutputLine(str);
}
}
gen.OutputAsmConfig();
// Format symbols.
foreach (DefSymbol defSym in proj.ActiveDefSymbolList) {
// Use an operand length of 1 so things are shown as concisely as possible.
string valueStr = PseudoOp.FormatNumericOperand(formatter, proj.SymbolTable,
gen.Localizer.LabelMap, defSym.DataDescriptor, defSym.Value, 1,
PseudoOp.FormatNumericOpFlags.None);
gen.OutputEquDirective(defSym.Label, valueStr, defSym.Comment);
}
// If there was at least one symbol, output a blank line.
if (proj.ActiveDefSymbolList.Count != 0) {
gen.OutputLine(string.Empty);
}
}
private static void GenerateInstruction(IGenerator gen, StreamWriter sw, int offset,
int instrBytes, bool doAddCycles) {
DisasmProject proj = gen.Project;
Formatter formatter = gen.SourceFormatter;
byte[] data = proj.FileData;
Anattrib attr = proj.GetAnattrib(offset);
string labelStr = string.Empty;
if (attr.Symbol != null) {
labelStr = gen.Localizer.ConvLabel(attr.Symbol.Label);
}
OpDef op = proj.CpuDef.GetOpDef(data[offset]);
int operand = op.GetOperand(data, offset, attr.StatusFlags);
int instrLen = op.GetLength(attr.StatusFlags);
OpDef.WidthDisambiguation wdis = OpDef.WidthDisambiguation.None;
if (op.IsWidthPotentiallyAmbiguous) {
wdis = OpDef.GetWidthDisambiguation(instrLen, operand);
}
if (gen.Quirks.SinglePassAssembler && wdis == OpDef.WidthDisambiguation.None &&
(op.AddrMode == OpDef.AddressMode.DP ||
op.AddrMode == OpDef.AddressMode.DPIndexX) ||
op.AddrMode == OpDef.AddressMode.DPIndexY) {
// Could be a forward reference to a direct-page label.
if (IsForwardLabelReference(gen, offset)) {
wdis = OpDef.WidthDisambiguation.ForceDirect;
}
}
string opcodeStr = formatter.FormatOpcode(op, wdis);
string formattedOperand = null;
int operandLen = instrLen - 1;
PseudoOp.FormatNumericOpFlags opFlags = PseudoOp.FormatNumericOpFlags.None;
bool isPcRelBankWrap = false;
// Tweak branch instructions. We want to show the absolute address rather
// than the relative offset (which happens with the OperandAddress assignment
// below), and 1-byte branches should always appear as a 4-byte hex value.
if (op.AddrMode == OpDef.AddressMode.PCRel) {
Debug.Assert(attr.OperandAddress >= 0);
operandLen = 2;
opFlags = PseudoOp.FormatNumericOpFlags.IsPcRel;
} else if (op.AddrMode == OpDef.AddressMode.PCRelLong ||
op.AddrMode == OpDef.AddressMode.StackPCRelLong) {
opFlags = PseudoOp.FormatNumericOpFlags.IsPcRel;
} else if (op.AddrMode == OpDef.AddressMode.Imm ||
op.AddrMode == OpDef.AddressMode.ImmLongA ||
op.AddrMode == OpDef.AddressMode.ImmLongXY) {
opFlags = PseudoOp.FormatNumericOpFlags.HasHashPrefix;
}
if (opFlags == PseudoOp.FormatNumericOpFlags.IsPcRel) {
int branchDist = attr.Address - attr.OperandAddress;
isPcRelBankWrap = branchDist > 32767 || branchDist < -32768;
}
// 16-bit operands outside bank 0 need to include the bank when computing
// symbol adjustment.
int operandForSymbol = operand;
if (attr.OperandAddress >= 0) {
operandForSymbol = attr.OperandAddress;
}
// Check Length to watch for bogus descriptors. (ApplyFormatDescriptors() should
// now be screening bad descriptors out, so we may not need the Length test.)
if (attr.DataDescriptor != null && attr.Length == attr.DataDescriptor.Length) {
// Format operand as directed.
if (op.AddrMode == OpDef.AddressMode.BlockMove) {
// Special handling for the double-operand block move.
string opstr1 = PseudoOp.FormatNumericOperand(formatter, proj.SymbolTable,
gen.Localizer.LabelMap, attr.DataDescriptor, operand >> 8, 1,
PseudoOp.FormatNumericOpFlags.None);
string opstr2 = PseudoOp.FormatNumericOperand(formatter, proj.SymbolTable,
gen.Localizer.LabelMap, attr.DataDescriptor, operand & 0xff, 1,
PseudoOp.FormatNumericOpFlags.None);
if (gen.Quirks.BlockMoveArgsReversed) {
string tmp = opstr1;
opstr1 = opstr2;
opstr2 = tmp;
}
formattedOperand = opstr1 + "," + opstr2;
} else {
formattedOperand = PseudoOp.FormatNumericOperand(formatter, proj.SymbolTable,
gen.Localizer.LabelMap, attr.DataDescriptor,
operandForSymbol, operandLen, opFlags);
}
} else {
// Show operand value in hex.
if (op.AddrMode == OpDef.AddressMode.BlockMove) {
int arg1, arg2;
if (gen.Quirks.BlockMoveArgsReversed) {
arg1 = operand & 0xff;
arg2 = operand >> 8;
} else {
arg1 = operand >> 8;
arg2 = operand & 0xff;
}
formattedOperand = formatter.FormatHexValue(arg1, 2) + "," +
formatter.FormatHexValue(arg2, 2);
} else {
if (operandLen == 2) {
// This is necessary for 16-bit operands, like "LDA abs" and "PEA val",
// when outside bank zero. The bank is included in the operand address,
// but we don't want to show it here.
operandForSymbol &= 0xffff;
}
formattedOperand = formatter.FormatHexValue(operandForSymbol, operandLen * 2);
}
}
string operandStr = formatter.FormatOperand(op, formattedOperand, wdis);
string eolComment = proj.Comments[offset];
if (doAddCycles) {
bool branchCross = (attr.Address & 0xff00) != (operandForSymbol & 0xff00);
int cycles = proj.CpuDef.GetCycles(op.Opcode, attr.StatusFlags, attr.BranchTaken,
branchCross);
if (cycles > 0) {
eolComment = cycles.ToString() + " " + eolComment;
} else {
eolComment = (-cycles).ToString() + "+ " + eolComment;
}
}
string commentStr = formatter.FormatEolComment(eolComment);
string replMnemonic = gen.ModifyOpcode(offset, op);
if (attr.Length != instrBytes) {
// This instruction has another instruction inside it. Throw out what we
// computed and just output as bytes.
gen.GenerateShortSequence(offset, instrBytes, out opcodeStr, out operandStr);
} else if (isPcRelBankWrap && gen.Quirks.NoPcRelBankWrap) {
// Some assemblers have trouble generating PC-relative operands that wrap
// around the bank. Output as raw hex.
gen.GenerateShortSequence(offset, instrBytes, out opcodeStr, out operandStr);
} else if (op.AddrMode == OpDef.AddressMode.BlockMove &&
gen.Quirks.BlockMoveArgsReversed) {
// On second thought, just don't even output the wrong thing.
gen.GenerateShortSequence(offset, instrBytes, out opcodeStr, out operandStr);
} else if (replMnemonic == null) {
// No mnemonic exists for this opcode.
gen.GenerateShortSequence(offset, instrBytes, out opcodeStr, out operandStr);
} else if (replMnemonic != string.Empty) {
// A replacement mnemonic has been provided.
opcodeStr = formatter.FormatMnemonic(replMnemonic, wdis);
}
gen.OutputLine(labelStr, opcodeStr, operandStr, commentStr);
// Assemblers like Merlin32 try to be helpful and track SEP/REP, but they do the
// wrong thing if we're in emulation mode. Force flags back to short.
if (proj.CpuDef.HasEmuFlag && gen.Quirks.TracksSepRepNotEmu && op == OpDef.OpREP_Imm) {
if ((operand & 0x30) != 0 && attr.StatusFlags.E == 1) {
gen.OutputRegWidthDirective(offset, 0, 0, 1, 1);
}
}
}
/// <summary>
/// Determines whether the instruction at the specified offset has an operand that is
/// a forward reference. This only matters for single-pass assemblers.
/// </summary>
/// <param name="gen">Source generator reference.</param>
/// <param name="offset">Offset of instruction opcode.</param>
/// <returns>True if the instruction's operand is a forward reference to a label.</returns>
private static bool IsForwardLabelReference(IGenerator gen, int offset) {
DisasmProject proj = gen.Project;
Debug.Assert(proj.GetAnattrib(offset).IsInstructionStart);
FormatDescriptor dfd = proj.GetAnattrib(offset).DataDescriptor;
if (dfd == null || !dfd.HasSymbol) {
return false;
}
int labelOffset = proj.FindLabelOffsetByName(dfd.SymbolRef.Label);
if (labelOffset <= offset) {
// Doesn't exist, or is backward reference.
return false;
}
return true;
}
/// <summary>
/// Configures some common format config items from the app settings. Uses a
/// passed-in settings object, rather than the global settings.
/// </summary>
/// <param name="settings">Application settings.</param>
/// <param name="config">Format config struct.</param>
public static void ConfigureFormatterFromSettings(AppSettings settings,
ref Formatter.FormatConfig config) {
config.mUpperHexDigits =
settings.GetBool(AppSettings.FMT_UPPER_HEX_DIGITS, false);
config.mUpperOpcodes =
settings.GetBool(AppSettings.FMT_UPPER_OP_MNEMONIC, false);
config.mUpperPseudoOpcodes =
settings.GetBool(AppSettings.FMT_UPPER_PSEUDO_OP_MNEMONIC, false);
config.mUpperOperandA =
settings.GetBool(AppSettings.FMT_UPPER_OPERAND_A, false);
config.mUpperOperandS =
settings.GetBool(AppSettings.FMT_UPPER_OPERAND_S, false);
config.mUpperOperandXY =
settings.GetBool(AppSettings.FMT_UPPER_OPERAND_XY, false);
config.mSpacesBetweenBytes =
settings.GetBool(AppSettings.FMT_SPACES_BETWEEN_BYTES, false);
config.mAddSpaceLongComment =
settings.GetBool(AppSettings.FMT_ADD_SPACE_FULL_COMMENT, true);
config.mForceAbsOpcodeSuffix =
settings.GetString(AppSettings.FMT_OPCODE_SUFFIX_ABS, string.Empty);
config.mForceLongOpcodeSuffix =
settings.GetString(AppSettings.FMT_OPCODE_SUFFIX_LONG, string.Empty);
config.mForceAbsOperandPrefix =
settings.GetString(AppSettings.FMT_OPERAND_PREFIX_ABS, string.Empty);
config.mForceLongOperandPrefix =
settings.GetString(AppSettings.FMT_OPERAND_PREFIX_LONG, string.Empty);
string exprMode = settings.GetString(AppSettings.FMT_EXPRESSION_MODE, string.Empty);
config.mExpressionMode = Formatter.FormatConfig.ParseExpressionMode(exprMode);
}
}
}

View File

@ -1,114 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace SourceGenWF.AsmGen {
partial class GeneratorProgress {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.progressLabel = new System.Windows.Forms.Label();
this.cancelButton = new System.Windows.Forms.Button();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.SuspendLayout();
//
// progressLabel
//
this.progressLabel.AutoSize = true;
this.progressLabel.Location = new System.Drawing.Point(13, 13);
this.progressLabel.Name = "progressLabel";
this.progressLabel.Size = new System.Drawing.Size(61, 13);
this.progressLabel.TabIndex = 1;
this.progressLabel.Text = "Preparing...";
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cancelButton.Location = new System.Drawing.Point(275, 79);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 0;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// progressBar1
//
this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.progressBar1.Location = new System.Drawing.Point(12, 39);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(600, 23);
this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.progressBar1.TabIndex = 2;
//
// backgroundWorker1
//
this.backgroundWorker1.WorkerReportsProgress = true;
this.backgroundWorker1.WorkerSupportsCancellation = true;
this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
this.backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);
this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
//
// GeneratorProgress
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(624, 114);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.progressLabel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "GeneratorProgress";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Generating Source...";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GeneratorProgress_FormClosing);
this.Load += new System.EventHandler(this.GeneratorProgress_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label progressLabel;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.ProgressBar progressBar1;
private System.ComponentModel.BackgroundWorker backgroundWorker1;
}
}

View File

@ -1,124 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows.Forms;
namespace SourceGenWF.AsmGen {
/// <summary>
/// Dialog that shows the progress of the assembler, and allows cancellation.
/// </summary>
public partial class GeneratorProgress : Form {
/// <summary>
/// Full pathnames of generated files. Will be null on error or user cancelation.
/// </summary>
public List<string> Results { get; private set; }
private IGenerator mGenerator;
/// <summary>
/// Constructor.
/// </summary>
/// <param name="gen">Fully-configured source generator.</param>
public GeneratorProgress(IGenerator gen) {
InitializeComponent();
mGenerator = gen;
}
private void GeneratorProgress_Load(object sender, EventArgs e) {
backgroundWorker1.RunWorkerAsync();
}
private void cancelButton_Click(object sender, EventArgs e) {
backgroundWorker1.CancelAsync();
cancelButton.Enabled = false;
}
private void GeneratorProgress_FormClosing(object sender, FormClosingEventArgs e) {
// The close button will close the dialog without canceling the event. We
// cancel it here, which should cause it to stop relatively quickly, but we don't
// wait for it on the off chance that something weird is going on and it got
// stuck. If nothing else, this gives the user a chance to save their work.
if (backgroundWorker1.IsBusy) {
backgroundWorker1.CancelAsync();
DialogResult = DialogResult.Cancel;
}
}
// NOTE: executes on work thread. DO NOT do any UI work here. DO NOT access
// the Results property directly.
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) {
BackgroundWorker worker = sender as BackgroundWorker;
// This will throw an I/O exception if there's a problem with the file. This
// will be caught and transferred to RunWorkerCompleted.
List<string> fileNames = mGenerator.GenerateSource(worker);
if (worker.CancellationPending) {
e.Cancel = true;
} else {
e.Result = fileNames;
}
}
// Callback that fires when a progress update is made.
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) {
int percent = e.ProgressPercentage;
string msg = e.UserState as string;
Debug.Assert(percent >= 0 && percent <= 100);
if (!string.IsNullOrEmpty(msg)) {
progressLabel.Text = msg;
}
progressBar1.Value = percent;
}
// Callback that fires when execution completes.
private void backgroundWorker1_RunWorkerCompleted(object sender,
RunWorkerCompletedEventArgs e) {
if (e.Cancelled) {
Debug.WriteLine("CANCELED");
DialogResult = DialogResult.Cancel;
} else if (e.Error != null) {
// This should only happen on a file I/O error, e.g. out of disk space or
// unable to overwrite an existing file.
MessageBox.Show(this, e.Error.ToString(), Properties.Resources.OPERATION_FAILED,
MessageBoxButtons.OK, MessageBoxIcon.Error);
DialogResult = DialogResult.Cancel;
} else {
// Make results available in property.
Results = e.Result as List<string>;
if (Results == null || Results.Count == 0) {
// Shouldn't happen -- generator should have reported error.
MessageBox.Show(this, "Internal error: no files generated",
Properties.Resources.OPERATION_FAILED,
MessageBoxButtons.OK, MessageBoxIcon.Error);
} else {
Debug.WriteLine("SUCCESS " + Results.Count);
}
DialogResult = DialogResult.OK;
}
// Whatever the case, we're done.
this.Close();
}
}
}

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -1,82 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
namespace SourceGenWF.AsmGen {
/// <summary>
/// Common interface for executing assemblers.
/// </summary>
public interface IAssembler {
/// <summary>
/// Gets identification strings for the executable. These are used when browsing for
/// the assembler binary.
/// </summary>
/// <param name="humanName">Human-readable name to show in the "open" dialog.</param>
/// <param name="exeName">Name of executable to find, without ".exe".</param>
void GetExeIdentifiers(out string humanName, out string exeName);
/// <summary>
/// Queries the assembler for its default configuration.
/// </summary>
/// <returns>Config object with default values.</returns>
AssemblerConfig GetDefaultConfig();
/// <summary>
/// Queries the assembler for its version. Assembler executable paths are queried from
/// the global settings object.
/// </summary>
/// <returns>Assembler version info, or null if query failed.</returns>
AssemblerVersion QueryVersion();
/// <summary>
/// Configures the object. Pass in the list of pathnames returned by IGenerator.Run(),
/// and the working directory to use for the shell command.
/// </summary>
/// <param name="pathNames">Assembler source pathnames.</param>
/// <param name="workDirectory">Working directory for shell command.</param>
void Configure(List<string> pathNames, string workDirectory);
/// <summary>
/// Executes the assembler. Must call Configure() first. Executed on background thread.
/// </summary>
/// <param name="worker">Async work object, used to report progress updates and
/// check for cancellation.</param>
/// <returns>Execution results, or null on internal failure.</returns>
AssemblerResults RunAssembler(BackgroundWorker worker);
}
/// <summary>
/// Set of values returned by the assembler.
/// </summary>
public class AssemblerResults {
public string CommandLine { get; private set; }
public int ExitCode { get; private set; }
public string Stdout { get; private set; }
public string Stderr { get; private set; }
public string OutputPathName { get; private set; }
public AssemblerResults(string commandLine, int exitCode, string stdout, string stderr,
string outputFile) {
CommandLine = commandLine;
ExitCode = exitCode;
Stdout = stdout;
Stderr = stderr;
OutputPathName = outputFile;
}
}
}

View File

@ -1,192 +0,0 @@
/*
* Copyright 2018 faddenSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Asm65;
namespace SourceGenWF.AsmGen {
/// <summary>
/// Common interface for generating assembler-specific source code.
/// </summary>
public interface IGenerator {
/// <summary>
/// Returns some strings and format options for use in for the display list, configurable
/// through the app settings "quick set" feature. These are not used when generating
/// source code.
///
/// This may be called on an unconfigured IGenerator.
/// </summary>
/// <param name="pseudoOps">Table of pseudo-op names.</param>
/// <param name="formatConfig">Format configuration.</param>
void GetDefaultDisplayFormat(out PseudoOp.PseudoOpNames pseudoOps,
out Formatter.FormatConfig formatConfig);
/// <summary>
/// Configure generator. Must be called before calling any other method or using
/// properties, unless otherwise noted.
/// </summary>
/// <param name="project">Project to generate source for.</param>
/// <param name="workDirectory">Directory in which to create output files.</param>
/// <param name="fileNameBase">Name to use as base for filenames.</param>
/// <param name="asmVersion">Version of assembler to target. Pass in null
/// to target latest known version.</param>
/// <param name="settings">App settings object.</param>
void Configure(DisasmProject project, string workDirectory, string fileNameBase,
AssemblerVersion asmVersion, AppSettings settings);
/// <summary>
/// Project object with file data and Anattribs.
/// </summary>
DisasmProject Project { get; }
/// <summary>
/// Source code formatter.
/// </summary>
Formatter SourceFormatter { get; }
/// <summary>
/// Application settings.
/// </summary>
AppSettings Settings { get; }
/// <summary>
/// Assembler-specific behavior. Used to handle quirky behavior for things that
/// are otherwise managed by common code.
/// </summary>
AssemblerQuirks Quirks { get; }
/// <summary>
/// Label localization object. Behavior is assembler-specific.
/// </summary>
LabelLocalizer Localizer { get; }
/// <summary>
/// Generates source files on a background thread. Method must not make any UI calls.
/// </summary>
/// <param name="worker">Async work object, used to report progress updates and
/// check for cancellation.</param>
/// <returns>List of pathnames of generated files.</returns>
List<string> GenerateSource(BackgroundWorker worker);
/// <summary>
/// Provides an opportunity for the assembler to replace a mnemonic with another, or
/// output an instruction as hex bytes.
/// </summary>
/// <param name="offset">Opcode offset.</param>
/// <param name="op">Opcode to replace.</param>
/// <returns>Replacement mnemonic, an empty string if the original is fine, or
/// null if the op is unsupported or broken and should be emitted as hex.</returns>
string ModifyOpcode(int offset, OpDef op);
/// <summary>
/// Generates an opcode/operand pair for a short sequence of bytes (1-4 bytes).
/// Does not produce any source output.
/// </summary>
/// <param name="offset">Offset to data.</param>
/// <param name="count">Number of bytes (1-4).</param>
/// <param name="opcode">Opcode mnemonic.</param>
/// <param name="operand">Formatted operand.</param>
void GenerateShortSequence(int offset, int length, out string opcode, out string operand);
/// <summary>
/// Outputs zero or more lines of assembler configuration. This comes after the
/// header comment but before any directives. Useful for configuring the CPU type
/// and assembler options.
/// </summary>
void OutputAsmConfig();
/// <summary>
/// Outputs one or more lines of data for the specified offset.
/// </summary>
/// <param name="offset">Offset to data.</param>
void OutputDataOp(int offset);
/// <summary>
/// Outputs an equate directive. The numeric value is already formatted.
/// </summary>
/// <param name="name">Symbol label.</param>
/// <param name="valueStr">Formatted value.</param>
/// <param name="comment">End-of-line comment.</param>
void OutputEquDirective(string name, string valueStr, string comment);
/// <summary>
/// Outputs a code origin directive.
/// </summary>
/// <param name="offset">Offset of code targeted to new address.</param>
/// <param name="address">24-bit address.</param>
void OutputOrgDirective(int offset, int address);
/// <summary>
/// Notify the assembler of a change in register width.
///
/// Merlin32 always sets both values (e.g. "MX %00"), cc65 sets each register
/// individually (".A16", ".I8"). We need to accommodate both styles.
/// </summary>
/// <param name="offset">Offset of change.</param>
/// <param name="prevM">Previous value for M flag.</param>
/// <param name="prevX">Previous value for X flag.</param>
/// <param name="newM">New value for M flag.</param>
/// <param name="newX">New value for X flag.</param>
void OutputRegWidthDirective(int offset, int prevM, int prevX, int newM, int newX);
/// <summary>
/// Output a line of source code. All elements must be fully formatted, except for
/// certain assembler-specific things like ':' on labels. The items will be padded
/// with spaces to fit specific column widths.
/// </summary>
/// <param name="label">Optional label.</param>
/// <param name="opcode">Opcode mnemonic.</param>
/// <param name="operand">Operand; may be empty.</param>
/// <param name="comment">Optional comment.</param>
void OutputLine(string label, string opcode, string operand, string comment);
/// <summary>
/// Output a line of source code. This will be output as-is.
/// </summary>
/// <param name="fullLine">Full text of line to outut.</param>
void OutputLine(string fullLine);
}
/// <summary>
/// Enumeration of quirky or buggy behavior that GenCommon needs to handle.
/// </summary>
public class AssemblerQuirks {
/// <summary>
/// Are the arguments to MVN/MVP reversed?
/// </summary>
public bool BlockMoveArgsReversed { get; set; }
/// <summary>
/// Does the assembler configure assembler widths based on SEP/REP, but doesn't
/// track the emulation bit?
/// </summary>
public bool TracksSepRepNotEmu { get; set; }
/// <summary>
/// Is the assembler unable to generate relative branches that wrap around banks?
/// (Note this affects long-distance BRLs that don't appear to wrap.)
/// </summary>
public bool NoPcRelBankWrap { get; set; }
/// <summary>
/// Is the assembler implemented as a single pass?
/// </summary>
public bool SinglePassAssembler { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More