1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-02-12 15:30:48 +00:00

Remove "high" versions of string pseudo-ops

High ASCII and other encodings will be noted in the operand field,
not the opcode, so we no longer need these.

This removes the six input fields from the Pseudo-Op tab of app
settings.  Values were stored as a serialized class in settings,
which generally works correctly as far as forward/backward
compatibility goes, so no worries there.

This also adds four "delimiter pattern" fields to the Code View tab,
allowing the user to customize how encoded strings are marked up
for the code list.  The values aren't actually used yet.

Also, fixed an issue where changes to text fields on the Pseudo-Op
tab weren't raising the dirty flag.
This commit is contained in:
Andy McFadden 2019-08-11 16:22:16 -07:00
parent bc633288ad
commit 068b3a44c7
5 changed files with 212 additions and 121 deletions

View File

@ -89,6 +89,11 @@ namespace SourceGen {
public const string CDLV_FONT_FAMILY = "cdlv-font-family"; public const string CDLV_FONT_FAMILY = "cdlv-font-family";
public const string CDLV_FONT_SIZE = "cdlv-font-size"; public const string CDLV_FONT_SIZE = "cdlv-font-size";
public const string CHR_ASCII_DELIM_PAT = "chr-ascii-delim-pat";
public const string CHR_HIGH_ASCII_DELIM_PAT = "chr-high-ascii-delim-pat";
public const string CHR_C64_PETSCII_DELIM_PAT = "chr-c64-petscii-delim-pat";
public const string CHR_C64_SCREEN_CODE_DELIM_PAT = "chr-c64-screen-code-delim-pat";
// Hex dump viewer settings. // Hex dump viewer settings.
public const string HEXD_ASCII_ONLY = "hexd-ascii-only"; public const string HEXD_ASCII_ONLY = "hexd-ascii-only";
public const string HEXD_CHAR_CONV = "hexd-char-conv1"; public const string HEXD_CHAR_CONV = "hexd-char-conv1";

View File

@ -108,48 +108,19 @@ namespace SourceGen.AsmGen {
Fill = "ds", Fill = "ds",
Dense = "hex", Dense = "hex",
StrGeneric = "asc", StrGeneric = "asc",
StrGenericHi = "asc",
StrReverse = "rev", StrReverse = "rev",
StrReverseHi = "rev",
//StrNullTerm //StrNullTerm
StrLen8 = "str", StrLen8 = "str",
StrLen8Hi = "str",
StrLen16 = "strl", StrLen16 = "strl",
StrLen16Hi = "strl",
StrDci = "dci", StrDci = "dci",
StrDciHi = "dci",
}; };
// IGenerator // IGenerator
public void GetDefaultDisplayFormat(out PseudoOp.PseudoOpNames pseudoOps, public void GetDefaultDisplayFormat(out PseudoOp.PseudoOpNames pseudoOps,
out Formatter.FormatConfig formatConfig) { out Formatter.FormatConfig formatConfig) {
// This is not intended to match up with the Merlin generator, which uses pseudoOps = sDataOpNames.GetCopy();
// the same pseudo-op for low/high ASCII but different string delimiters. We pseudoOps.RegWidthDirective = string.Empty;
// 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(); formatConfig = new Formatter.FormatConfig();
SetFormatConfigValues(ref formatConfig); SetFormatConfigValues(ref formatConfig);

View File

@ -76,17 +76,11 @@ namespace SourceGen {
public string Fill { get; set; } public string Fill { get; set; }
public string Dense { get; set; } public string Dense { get; set; }
public string StrGeneric { get; set; } public string StrGeneric { get; set; }
public string StrGenericHi { get; set; }
public string StrReverse { get; set; } public string StrReverse { get; set; }
public string StrReverseHi { get; set; }
public string StrLen8 { get; set; } public string StrLen8 { get; set; }
public string StrLen8Hi { get; set; }
public string StrLen16 { get; set; } public string StrLen16 { get; set; }
public string StrLen16Hi { get; set; }
public string StrNullTerm { get; set; } public string StrNullTerm { get; set; }
public string StrNullTermHi { get; set; }
public string StrDci { get; set; } public string StrDci { get; set; }
public string StrDciHi { get; set; }
public string GetDefineData(int width) { public string GetDefineData(int width) {
switch (width) { switch (width) {
@ -167,18 +161,12 @@ namespace SourceGen {
Dense = ".bulk", Dense = ".bulk",
StrGeneric = ".str", StrGeneric = ".str",
StrGenericHi = ".strh",
StrReverse = ".rstr", StrReverse = ".rstr",
StrReverseHi = ".rstrh",
StrLen8 = ".l1str", StrLen8 = ".l1str",
StrLen8Hi = ".l1strh",
StrLen16 = ".l2str", StrLen16 = ".l2str",
StrLen16Hi = ".l2strh",
StrNullTerm = ".zstr", StrNullTerm = ".zstr",
StrNullTermHi = ".zstrh",
StrDci = ".dstr", StrDci = ".dstr",
StrDciHi = ".dstrh", };
};
/// <summary> /// <summary>
@ -385,7 +373,6 @@ namespace SourceGen {
// See also GenMerlin32.OutputString(). // See also GenMerlin32.OutputString().
int strOffset = offset; int strOffset = offset;
int strLen = length; int strLen = length;
bool highAscii = false;
bool reverse = false; bool reverse = false;
showHexZeroes = 0; showHexZeroes = 0;
@ -393,26 +380,22 @@ namespace SourceGen {
switch (formatType) { switch (formatType) {
case FormatDescriptor.Type.StringGeneric: case FormatDescriptor.Type.StringGeneric:
// High or low ASCII, full width specified by formatter. // High or low ASCII, full width specified by formatter.
highAscii = (data[offset] & 0x80) != 0; popcode = opNames.StrGeneric;
popcode = highAscii ? opNames.StrGenericHi : opNames.StrGeneric;
break; break;
case FormatDescriptor.Type.StringDci: case FormatDescriptor.Type.StringDci:
// High or low ASCII, full width specified by formatter. // High or low ASCII, full width specified by formatter.
highAscii = (data[offset] & 0x80) != 0; popcode = opNames.StrDci;
popcode = highAscii ? opNames.StrDciHi : opNames.StrDci;
break; break;
case FormatDescriptor.Type.StringReverse: case FormatDescriptor.Type.StringReverse:
// High or low ASCII, full width specified by formatter. Show characters // High or low ASCII, full width specified by formatter. Show characters
// in reverse order. // in reverse order.
highAscii = (data[offset + strLen - 1] & 0x80) != 0; popcode = opNames.StrReverse;
popcode = highAscii ? opNames.StrReverseHi : opNames.StrReverse;
reverse = true; reverse = true;
break; break;
case FormatDescriptor.Type.StringNullTerm: case FormatDescriptor.Type.StringNullTerm:
// High or low ASCII, with a terminating null. Don't show the null. If // High or low ASCII, with a terminating null. Don't show the null. If
// it's an empty string, just show the null byte as hex. // it's an empty string, just show the null byte as hex.
highAscii = (data[offset] & 0x80) != 0; popcode = opNames.StrNullTerm;
popcode = highAscii ? opNames.StrNullTermHi : opNames.StrNullTerm;
strLen--; strLen--;
if (strLen == 0) { if (strLen == 0) {
showHexZeroes = 1; showHexZeroes = 1;
@ -425,10 +408,8 @@ namespace SourceGen {
strLen--; strLen--;
if (strLen == 0) { if (strLen == 0) {
showHexZeroes = 1; showHexZeroes = 1;
} else {
highAscii = (data[strOffset] & 0x80) != 0;
} }
popcode = highAscii ? opNames.StrLen8Hi : opNames.StrLen8; popcode = opNames.StrLen8;
break; break;
case FormatDescriptor.Type.StringL16: case FormatDescriptor.Type.StringL16:
// High or low ASCII, with a leading length word. Don't show the null. // High or low ASCII, with a leading length word. Don't show the null.
@ -438,10 +419,8 @@ namespace SourceGen {
strLen -= 2; strLen -= 2;
if (strLen == 0) { if (strLen == 0) {
showHexZeroes = 2; showHexZeroes = 2;
} else {
highAscii = (data[strOffset] & 0x80) != 0;
} }
popcode = highAscii ? opNames.StrLen16Hi : opNames.StrLen16; popcode = opNames.StrLen16;
break; break;
default: default:
Debug.Assert(false); Debug.Assert(false);

View File

@ -45,13 +45,14 @@ limitations under the License.
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<GroupBox Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Header="Column Visibility" <GroupBox Grid.Column="0" Grid.Row="0" Grid.RowSpan="3" Header="Column Visibility"
Margin="0,0,10,0"> Margin="0,0,10,0">
<StackPanel> <StackPanel>
<Button Name="showCol0" Content="{}{0} Offset" Width="120" Margin="0,4" <Button Name="showCol0" Content="{}{0} Offset" Width="120" Margin="0,4"
@ -85,7 +86,7 @@ limitations under the License.
</StackPanel> </StackPanel>
</GroupBox> </GroupBox>
<GroupBox Grid.Column="1" Grid.Row="1" Header="Upper Case Display" <GroupBox Grid.Column="1" Grid.Row="1" Grid.RowSpan="2" Header="Upper Case Display"
Margin="5,0,5,0"> Margin="5,0,5,0">
<StackPanel> <StackPanel>
<CheckBox Content="Hexadecimal Values" Margin="0,4" <CheckBox Content="Hexadecimal Values" Margin="0,4"
@ -117,13 +118,110 @@ limitations under the License.
</StackPanel> </StackPanel>
</GroupBox> </GroupBox>
<GroupBox Grid.Column="2" Grid.Row="1" Header="Miscellaneous" <GroupBox Grid.Column="2" Grid.Row="1" Header="Text Delimiters"
Margin="10,0,0,0"> Margin="10,0,0,0">
<CheckBox Content="Add spaces in bytes column" Margin="0,4,0,0" <StackPanel>
IsChecked="{Binding SpacesBetweenBytes}"/> <Grid>
<Grid.Resources>
<!-- TextBox spacer -->
<Thickness x:Key="TBS" Left="6" Top="4" Right="0" Bottom="0"/>
<Thickness x:Key="ASC" Left="0" Top="2" Right="0" Bottom="0"/>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.8*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="ASCII:" Grid.Column="0" Grid.Row="0"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="{StaticResource ASC}"/>
<TextBox Grid.Column="1" Grid.Row="0"
HorizontalAlignment="Left" VerticalAlignment="Center"
Margin="{StaticResource TBS}" Width="80" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}">
<TextBox.Text>
<Binding Path="AsciiDelimPat" UpdateSourceTrigger="PropertyChanged"
FallbackValue="[#]">
<Binding.ValidationRules>
<local:StringDelimiterRule ValidatesOnTargetUpdated="True"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBlock Text="High ASCII:" Grid.Column="0" Grid.Row="1"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="{StaticResource ASC}"/>
<TextBox Grid.Column="1" Grid.Row="1"
HorizontalAlignment="Left" VerticalAlignment="Center"
Margin="{StaticResource TBS}" Width="80" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}">
<TextBox.Text>
<Binding Path="HighAsciiDelimPat" UpdateSourceTrigger="PropertyChanged"
FallbackValue="[#]">
<Binding.ValidationRules>
<local:StringDelimiterRule ValidatesOnTargetUpdated="True"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBlock Text="C64 PETSCII:" Grid.Column="0" Grid.Row="2"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="{StaticResource ASC}"/>
<TextBox Grid.Column="1" Grid.Row="2"
HorizontalAlignment="Left" VerticalAlignment="Center"
Margin="{StaticResource TBS}" Width="80" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}">
<TextBox.Text>
<Binding Path="PetsciiDelimPat" UpdateSourceTrigger="PropertyChanged"
FallbackValue="[#]">
<Binding.ValidationRules>
<local:StringDelimiterRule ValidatesOnTargetUpdated="True"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBlock Text="C64 Screen:" Grid.Column="0" Grid.Row="3"
HorizontalAlignment="Right" VerticalAlignment="Center"
Margin="{StaticResource ASC}"/>
<TextBox Grid.Column="1" Grid.Row="3"
HorizontalAlignment="Left" VerticalAlignment="Center"
Margin="{StaticResource TBS}" Width="80" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}">
<TextBox.Text>
<Binding Path="ScreenCodeDelimPat" UpdateSourceTrigger="PropertyChanged"
FallbackValue="[#]">
<Binding.ValidationRules>
<local:StringDelimiterRule ValidatesOnTargetUpdated="True"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
</Grid>
<Button Name="defaultTextDelimitersButton" Content="Default" Margin="4,8,0,0"
Width="70" HorizontalAlignment="Left"
Click="DefaultTextDelimitersButton_Click"/>
</StackPanel>
</GroupBox> </GroupBox>
<CheckBox Grid.Column="0" Grid.Row="3" Content="Enable DEBUG menu" Margin="4,16,0,0" <GroupBox Grid.Column="2" Grid.Row="2" Header="Miscellaneous"
Margin="10,0,0,0">
<StackPanel>
<CheckBox Content="Add spaces in bytes column" Margin="0,4,0,0"
IsChecked="{Binding SpacesBetweenBytes}"/>
</StackPanel>
</GroupBox>
<CheckBox Grid.Column="0" Grid.Row="4" Content="Enable DEBUG menu" Margin="4,16,0,0"
IsChecked="{Binding EnableDebugMenu}"/> IsChecked="{Binding EnableDebugMenu}"/>
</Grid> </Grid>
</TabItem> </TabItem>
@ -298,15 +396,15 @@ limitations under the License.
<TabItem Name="pseudoOpTab" Header="Pseudo-Op"> <TabItem Name="pseudoOpTab" Header="Pseudo-Op">
<TabItem.Resources>
<!-- TextBox spacer -->
<Thickness x:Key="TBS" Left="6" Top="0" Right="0" Bottom="0"/>
</TabItem.Resources>
<DockPanel LastChildFill="False"> <DockPanel LastChildFill="False">
<TextBlock DockPanel.Dock="Top" Margin="4,0,0,0" <TextBlock DockPanel.Dock="Top" Margin="4,0,0,0"
Text="Select pseudo-op names for display. This does not affect source code generation. Blank entries get a default value."/> Text="Select pseudo-op names for display. This does not affect source code generation. Blank entries get a default value."/>
<Grid DockPanel.Dock="Top" Height="240" Margin="4,0"> <Grid DockPanel.Dock="Top" Height="240" Margin="4,0">
<Grid.Resources>
<!-- TextBox spacer -->
<Thickness x:Key="TBS" Left="6" Top="0" Right="0" Bottom="0"/>
</Grid.Resources>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="0.8*"/> <ColumnDefinition Width="0.8*"/>
@ -340,11 +438,9 @@ limitations under the License.
<TextBlock Text="Big-endian data," HorizontalAlignment="Right"/> <TextBlock Text="Big-endian data," HorizontalAlignment="Right"/>
<TextBlock Text="two bytes:" HorizontalAlignment="Right"/> <TextBlock Text="two bytes:" HorizontalAlignment="Right"/>
</StackPanel> </StackPanel>
<TextBlock Grid.Column="0" Grid.Row="3" Text="Generic string:" <TextBlock Grid.Column="0" Grid.Row="3" Text="Generic str:"
HorizontalAlignment="Right" VerticalAlignment="Center"/> HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="0" Grid.Row="4" Text="1-byte len:" <TextBlock Grid.Column="0" Grid.Row="4" Text="1-byte len str:"
HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="0" Grid.Row="5" Text="Null term string:"
HorizontalAlignment="Right" VerticalAlignment="Center"/> HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Name="equDirectiveTextBox" Grid.Column="1" Grid.Row="0" <TextBox Name="equDirectiveTextBox" Grid.Column="1" Grid.Row="0"
@ -367,21 +463,15 @@ limitations under the License.
VerticalAlignment="Center" Margin="{StaticResource TBS}" VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8" Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/> FontFamily="{StaticResource GeneralMonoFont}"/>
<TextBox Name="strNullTermTextBox" Grid.Column="1" Grid.Row="5"
VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/>
<!-- second column --> <!-- second column -->
<TextBlock Grid.Column="3" Grid.Row="0" Text="Origin:" <TextBlock Grid.Column="3" Grid.Row="0" Text="Origin:"
HorizontalAlignment="Right" VerticalAlignment="Center"/> HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="3" Grid.Row="1" Text="Two bytes:" <TextBlock Grid.Column="3" Grid.Row="1" Text="Two bytes:"
HorizontalAlignment="Right" VerticalAlignment="Center"/> HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="3" Grid.Row="3" Text="Generic/hi:" <TextBlock Grid.Column="3" Grid.Row="3" Text="Reverse str:"
HorizontalAlignment="Right" VerticalAlignment="Center"/> HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="3" Grid.Row="4" Text="1-byte len/hi:" <TextBlock Grid.Column="3" Grid.Row="4" Text="2-byte len str:"
HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="3" Grid.Row="5" Text="Null term/hi:"
HorizontalAlignment="Right" VerticalAlignment="Center"/> HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Name="orgDirectiveTextBox" Grid.Column="4" Grid.Row="0" <TextBox Name="orgDirectiveTextBox" Grid.Column="4" Grid.Row="0"
@ -392,15 +482,11 @@ limitations under the License.
VerticalAlignment="Center" Margin="{StaticResource TBS}" VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8" Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/> FontFamily="{StaticResource GeneralMonoFont}"/>
<TextBox Name="strGenericHiTextBox" Grid.Column="4" Grid.Row="3" <TextBox Name="strReverseTextBox" Grid.Column="4" Grid.Row="3"
VerticalAlignment="Center" Margin="{StaticResource TBS}" VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8" Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/> FontFamily="{StaticResource GeneralMonoFont}"/>
<TextBox Name="strLen8HiTextBox" Grid.Column="4" Grid.Row="4" <TextBox Name="strLen16TextBox" Grid.Column="4" Grid.Row="4"
VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/>
<TextBox Name="strNullTermHiTextBox" Grid.Column="4" Grid.Row="5"
VerticalAlignment="Center" Margin="{StaticResource TBS}" VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8" Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/> FontFamily="{StaticResource GeneralMonoFont}"/>
@ -412,11 +498,7 @@ limitations under the License.
HorizontalAlignment="Right" VerticalAlignment="Center"/> HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="6" Grid.Row="2" Text="Fill:" <TextBlock Grid.Column="6" Grid.Row="2" Text="Fill:"
HorizontalAlignment="Right" VerticalAlignment="Center"/> HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="6" Grid.Row="3" Text="Reverse:" <TextBlock Grid.Column="6" Grid.Row="3" Text="Null-term str:"
HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="6" Grid.Row="4" Text="2-byte len:"
HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="6" Grid.Row="5" Text="DCI:"
HorizontalAlignment="Right" VerticalAlignment="Center"/> HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Name="regWidthDirectiveTextBox" Grid.Column="7" Grid.Row="0" <TextBox Name="regWidthDirectiveTextBox" Grid.Column="7" Grid.Row="0"
@ -431,15 +513,7 @@ limitations under the License.
VerticalAlignment="Center" Margin="{StaticResource TBS}" VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8" Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/> FontFamily="{StaticResource GeneralMonoFont}"/>
<TextBox Name="strReverseTextBox" Grid.Column="7" Grid.Row="3" <TextBox Name="strNullTermTextBox" Grid.Column="7" Grid.Row="3"
VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/>
<TextBox Name="strLen16TextBox" Grid.Column="7" Grid.Row="4"
VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/>
<TextBox Name="strDciTextBox" Grid.Column="7" Grid.Row="5"
VerticalAlignment="Center" Margin="{StaticResource TBS}" VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8" Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/> FontFamily="{StaticResource GeneralMonoFont}"/>
@ -449,11 +523,7 @@ limitations under the License.
HorizontalAlignment="Right" VerticalAlignment="Center"/> HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="9" Grid.Row="2" Text="Bulk data:" <TextBlock Grid.Column="9" Grid.Row="2" Text="Bulk data:"
HorizontalAlignment="Right" VerticalAlignment="Center"/> HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="9" Grid.Row="3" Text="Reverse/hi:" <TextBlock Grid.Column="9" Grid.Row="3" Text="DCI str:"
HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="9" Grid.Row="4" Text="2-byte len/hi:"
HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBlock Grid.Column="9" Grid.Row="5" Text="DCI/hi:"
HorizontalAlignment="Right" VerticalAlignment="Center"/> HorizontalAlignment="Right" VerticalAlignment="Center"/>
<TextBox Name="defineData4TextBox" Grid.Column="10" Grid.Row="1" <TextBox Name="defineData4TextBox" Grid.Column="10" Grid.Row="1"
@ -464,15 +534,7 @@ limitations under the License.
VerticalAlignment="Center" Margin="{StaticResource TBS}" VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8" Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/> FontFamily="{StaticResource GeneralMonoFont}"/>
<TextBox Name="strReverseHiTextBox" Grid.Column="10" Grid.Row="3" <TextBox Name="strDciTextBox" Grid.Column="10" Grid.Row="3"
VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/>
<TextBox Name="strLen16HiTextBox" Grid.Column="10" Grid.Row="4"
VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/>
<TextBox Name="strDciHiTextBox" Grid.Column="10" Grid.Row="5"
VerticalAlignment="Center" Margin="{StaticResource TBS}" VerticalAlignment="Center" Margin="{StaticResource TBS}"
Text=".placeho" MaxLength="8" Text=".placeho" MaxLength="8"
FontFamily="{StaticResource GeneralMonoFont}"/> FontFamily="{StaticResource GeneralMonoFont}"/>

View File

@ -146,17 +146,11 @@ namespace SourceGen.WpfGui {
new TextBoxPropertyMap(fillTextBox, "Fill"), new TextBoxPropertyMap(fillTextBox, "Fill"),
new TextBoxPropertyMap(denseTextBox, "Dense"), new TextBoxPropertyMap(denseTextBox, "Dense"),
new TextBoxPropertyMap(strGenericTextBox, "StrGeneric"), new TextBoxPropertyMap(strGenericTextBox, "StrGeneric"),
new TextBoxPropertyMap(strGenericHiTextBox, "StrGenericHi"),
new TextBoxPropertyMap(strReverseTextBox, "StrReverse"), new TextBoxPropertyMap(strReverseTextBox, "StrReverse"),
new TextBoxPropertyMap(strReverseHiTextBox, "StrReverseHi"),
new TextBoxPropertyMap(strLen8TextBox, "StrLen8"), new TextBoxPropertyMap(strLen8TextBox, "StrLen8"),
new TextBoxPropertyMap(strLen8HiTextBox, "StrLen8Hi"),
new TextBoxPropertyMap(strLen16TextBox, "StrLen16"), new TextBoxPropertyMap(strLen16TextBox, "StrLen16"),
new TextBoxPropertyMap(strLen16HiTextBox, "StrLen16Hi"),
new TextBoxPropertyMap(strNullTermTextBox, "StrNullTerm"), new TextBoxPropertyMap(strNullTermTextBox, "StrNullTerm"),
new TextBoxPropertyMap(strNullTermHiTextBox, "StrNullTermHi"),
new TextBoxPropertyMap(strDciTextBox, "StrDci"), new TextBoxPropertyMap(strDciTextBox, "StrDci"),
new TextBoxPropertyMap(strDciHiTextBox, "StrDciHi"),
}; };
} }
@ -422,6 +416,61 @@ namespace SourceGen.WpfGui {
} }
} }
private const string DEFAULT_ASCII_DELIM_PAT = "\u2018#\u2019";
private const string DEFAULT_HIGH_ASCII_DELIM_PAT = "\u201c#\u201d";
private const string DEFAULT_C64_PETSCII_DELIM_PAT = "pet:#";
private const string DEFAULT_C64_SCREEN_CODE_DELIM_PAT = "scr:#";
public string AsciiDelimPat {
get {
return mSettings.GetString(AppSettings.CHR_ASCII_DELIM_PAT, DEFAULT_ASCII_DELIM_PAT);
}
set {
mSettings.SetString(AppSettings.CHR_ASCII_DELIM_PAT, value);
OnPropertyChanged();
IsDirty = true;
}
}
public string HighAsciiDelimPat {
get {
return mSettings.GetString(AppSettings.CHR_HIGH_ASCII_DELIM_PAT,
DEFAULT_HIGH_ASCII_DELIM_PAT);
}
set {
mSettings.SetString(AppSettings.CHR_HIGH_ASCII_DELIM_PAT, value);
OnPropertyChanged();
IsDirty = true;
}
}
public string PetsciiDelimPat {
get {
return mSettings.GetString(AppSettings.CHR_C64_PETSCII_DELIM_PAT,
DEFAULT_C64_PETSCII_DELIM_PAT);
}
set {
mSettings.SetString(AppSettings.CHR_C64_PETSCII_DELIM_PAT, value);
OnPropertyChanged();
IsDirty = true;
}
}
public string ScreenCodeDelimPat {
get {
return mSettings.GetString(AppSettings.CHR_C64_SCREEN_CODE_DELIM_PAT,
DEFAULT_C64_SCREEN_CODE_DELIM_PAT);
}
set {
mSettings.SetString(AppSettings.CHR_C64_SCREEN_CODE_DELIM_PAT, value);
OnPropertyChanged();
IsDirty = true;
}
}
private void DefaultTextDelimitersButton_Click(object sender, RoutedEventArgs e) {
AsciiDelimPat = DEFAULT_ASCII_DELIM_PAT;
HighAsciiDelimPat = DEFAULT_HIGH_ASCII_DELIM_PAT;
PetsciiDelimPat = DEFAULT_C64_PETSCII_DELIM_PAT;
ScreenCodeDelimPat = DEFAULT_C64_SCREEN_CODE_DELIM_PAT;
}
#endregion Code View #endregion Code View
#region Asm Config #region Asm Config
@ -834,6 +883,11 @@ namespace SourceGen.WpfGui {
// No need to set this to anything specific. // No need to set this to anything specific.
pseudoOpQuickComboBox.SelectedIndex = 0; pseudoOpQuickComboBox.SelectedIndex = 0;
// Create text field listeners.
foreach (TextBoxPropertyMap pmap in mPseudoNameMap) {
pmap.TextBox.TextChanged += PseudoOpTextChanged;
}
} }
/// <summary> /// <summary>
@ -885,6 +939,9 @@ namespace SourceGen.WpfGui {
#endregion PseudoOp #endregion PseudoOp
} }
/// <summary>
/// Text entry validation rule for assembler column widths.
/// </summary>
public class AsmColWidthRule : ValidationRule { public class AsmColWidthRule : ValidationRule {
public override ValidationResult Validate(object value, CultureInfo cultureInfo) { public override ValidationResult Validate(object value, CultureInfo cultureInfo) {
// Validating TextBox input, so value should always be a string. Check anyway. // Validating TextBox input, so value should always be a string. Check anyway.
@ -907,4 +964,21 @@ namespace SourceGen.WpfGui {
return new ValidationResult(false, "Invalid integer value: '" + strValue + "'"); return new ValidationResult(false, "Invalid integer value: '" + strValue + "'");
} }
} }
/// <summary>
/// Text entry validation rule for text string delimiter patterns.
/// </summary>
public class StringDelimiterRule : ValidationRule {
public override ValidationResult Validate(object value, CultureInfo cultureInfo) {
string strValue = Convert.ToString(value);
int firstHash = strValue.IndexOf('#');
if (firstHash < 0) {
return new ValidationResult(false, "Must include exactly one '#'");
}
if (strValue.LastIndexOf('#') != firstHash) {
return new ValidationResult(false, "Found more than one '#'");
}
return ValidationResult.ValidResult;
}
}
} }