mirror of
https://github.com/fadden/6502bench.git
synced 2025-02-08 05:30:35 +00:00
Replace character operand output method
The previous code output a character in single-quotes if it was standard ASCII, double-quotes if high ASCII, or hex if it was neither of those. If a flag was set, high ASCII would also be output as hex. The new system takes the character value and an encoding identifier. The identifier selects the character converter and delimiter pattern, and puts the two together to generate the operand. While doing this I realized that I could trivially support high ASCII character arguments in all assemblers by setting the delimiter pattern to "'#' | $80". In FormatDescriptor, I had previously renamed the "Ascii" sub-type "LowAscii" so it wouldn't be confused, but I dislike filling the project file with "LowAscii" when "Ascii" is more accurate and less confusing. So I switched it back, and we now check the project file version number when deciding what to do with an ASCII item. The CharEncoding tests/converters were also renamed. Moved the default delimiter patterns to the string table. Widened the delimiter pattern input fields slightly. Added a read- only TextBox with assorted non-typewriter quotes and things so people have something to copy text from.
This commit is contained in:
parent
068b3a44c7
commit
f33cd7d8a6
@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Asm65 {
|
||||
@ -41,18 +40,25 @@ namespace Asm65 {
|
||||
/// </remarks>
|
||||
public delegate char Convert(byte val);
|
||||
|
||||
public enum Encoding {
|
||||
Unknown = 0,
|
||||
Ascii,
|
||||
HighAscii,
|
||||
C64Petscii,
|
||||
C64ScreenCode,
|
||||
}
|
||||
|
||||
//
|
||||
// Standard ASCII.
|
||||
//
|
||||
public static bool IsPrintableLowAscii(byte val) {
|
||||
public static bool IsPrintableAscii(byte val) {
|
||||
return (val >= 0x20 && val < 0x7f);
|
||||
}
|
||||
public static bool IsExtendedLowAscii(byte val) {
|
||||
return IsPrintableLowAscii(val) || val == 0x07 || val == 0x0a || val == 0x0d;
|
||||
public static bool IsExtendedAscii(byte val) {
|
||||
return IsPrintableAscii(val) || val == 0x07 || val == 0x0a || val == 0x0d;
|
||||
}
|
||||
public static char ConvertLowAscii(byte val) {
|
||||
if (IsPrintableLowAscii(val)) {
|
||||
public static char ConvertAscii(byte val) {
|
||||
if (IsPrintableAscii(val)) {
|
||||
return (char)val;
|
||||
} else {
|
||||
return UNPRINTABLE_CHAR;
|
||||
@ -80,7 +86,7 @@ namespace Asm65 {
|
||||
// High *or* low ASCII.
|
||||
//
|
||||
public static char ConvertLowAndHighAscii(byte val) {
|
||||
if (IsPrintableLowAscii(val) || IsPrintableHighAscii(val)) {
|
||||
if (IsPrintableAscii(val) || IsPrintableHighAscii(val)) {
|
||||
return (char)(val & 0x7f);
|
||||
} else {
|
||||
return UNPRINTABLE_CHAR;
|
||||
|
@ -61,9 +61,6 @@ namespace Asm65 {
|
||||
public bool mSuppressHexNotation; // omit '$' before hex digits
|
||||
public bool mSuppressImpliedAcc; // emit just "LSR" rather than "LSR A"?
|
||||
|
||||
public bool mAllowHighAsciiCharConst; // can we do high-ASCII character constants?
|
||||
// (this might need to be generalized)
|
||||
|
||||
public string mForceDirectOperandPrefix; // these may be null or empty
|
||||
public string mForceAbsOpcodeSuffix;
|
||||
public string mForceAbsOperandPrefix;
|
||||
@ -75,11 +72,16 @@ namespace Asm65 {
|
||||
public string mFullLineCommentDelimiterBase; // usually ';' or '*', WITHOUT extra space
|
||||
public string mBoxLineCommentDelimiter; // usually blank or ';'
|
||||
|
||||
public string mAsciiDelimPattern; // delimiter pattern for ASCII constants
|
||||
public string mHighAsciiDelimPattern; // delimiter pattern for high ASCII
|
||||
public string mC64PetsciiDelimPattern; // delimiter pattern for C64 PETSCII
|
||||
public string mC64ScreenCodeDelimPattern; // delimiter pattern for C64 screen code
|
||||
|
||||
// miscellaneous
|
||||
public bool mSpacesBetweenBytes; // "20edfd" vs. "20 ed fd"
|
||||
|
||||
// hex dumps
|
||||
public bool mHexDumpAsciiOnly; // disallow non-ASCII chars in hex dumps?
|
||||
|
||||
public bool mSpacesBetweenBytes; // "20edfd" vs. "20 ed fd"
|
||||
|
||||
public enum CharConvMode { Unknown = 0, PlainAscii, HighLowAscii };
|
||||
public CharConvMode mHexDumpCharConvMode; // character conversion mode for dumps
|
||||
|
||||
@ -131,6 +133,13 @@ namespace Asm65 {
|
||||
private string mAddrFormatNoBank;
|
||||
private string mAddrFormatWithBank;
|
||||
|
||||
// Character data delimiter format strings, processed from the delimiter patterns.
|
||||
private string mAsciiDelimFmt;
|
||||
private string mHighAsciiDelimFmt;
|
||||
private string mC64PetsciiDelimFmt;
|
||||
private string mC64ScreenCodeDelimFmt;
|
||||
|
||||
|
||||
// Generated opcode strings. The index is the bitwise OR of the opcode value and
|
||||
// the disambiguation value. In most cases this just helps us avoid calling
|
||||
// ToUpper incessantly.
|
||||
@ -155,7 +164,6 @@ namespace Asm65 {
|
||||
// Buffer to use when generating hex dump lines.
|
||||
private char[] mHexDumpBuffer;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A 16-character array with 0-9a-f, for hex conversions. The letters will be
|
||||
/// upper or lower case, per the format config.
|
||||
@ -199,8 +207,12 @@ namespace Asm65 {
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructor. Initializes various fields based on the configuration. We want to
|
||||
/// do as much work as possible here.
|
||||
/// </summary>
|
||||
public Formatter(FormatConfig config) {
|
||||
mFormatConfig = config;
|
||||
mFormatConfig = config; // copy struct
|
||||
if (mFormatConfig.mEndOfLineCommentDelimiter == null) {
|
||||
mFormatConfig.mEndOfLineCommentDelimiter = string.Empty;
|
||||
}
|
||||
@ -217,30 +229,14 @@ namespace Asm65 {
|
||||
mFullLineCommentDelimiterPlus = mFormatConfig.mFullLineCommentDelimiterBase;
|
||||
}
|
||||
|
||||
Reset();
|
||||
|
||||
// Prep the static parts of the hex dump buffer.
|
||||
mHexDumpBuffer = new char[73];
|
||||
for (int i = 0; i < mHexDumpBuffer.Length; i++) {
|
||||
mHexDumpBuffer[i] = ' ';
|
||||
}
|
||||
mHexDumpBuffer[6] = ':';
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the pieces we use to build format strings.
|
||||
/// </summary>
|
||||
private void Reset() {
|
||||
// Clear old data. (No longer needed.)
|
||||
//mAddrFormatNoBank = mAddrFormatWithBank = null;
|
||||
//mOffset24Format = null;
|
||||
//mOpcodeStrings.Clear();
|
||||
//mPseudoOpStrings.Clear();
|
||||
//mOperandFormats.Clear();
|
||||
//for (int i = 0; i < MAX_BYTE_DUMP; i++) {
|
||||
// mByteDumpFormats[i] = null;
|
||||
//}
|
||||
|
||||
// Resolve boolean flags to character or string values.
|
||||
if (mFormatConfig.mUpperHexDigits) {
|
||||
mHexFmtChar = 'X';
|
||||
} else {
|
||||
@ -251,7 +247,9 @@ namespace Asm65 {
|
||||
} else {
|
||||
mHexPrefix = "$";
|
||||
}
|
||||
if (mFormatConfig.mUpperOperandA) {
|
||||
if (mFormatConfig.mSuppressImpliedAcc) {
|
||||
mAccChar = "";
|
||||
} else if (mFormatConfig.mUpperOperandA) {
|
||||
mAccChar = "A";
|
||||
} else {
|
||||
mAccChar = "a";
|
||||
@ -268,6 +266,27 @@ namespace Asm65 {
|
||||
} else {
|
||||
mSregChar = 's';
|
||||
}
|
||||
|
||||
// process the delimiter patterns
|
||||
mAsciiDelimFmt = PatternToFormat(mFormatConfig.mAsciiDelimPattern);
|
||||
mHighAsciiDelimFmt = PatternToFormat(mFormatConfig.mHighAsciiDelimPattern);
|
||||
mC64PetsciiDelimFmt = PatternToFormat(mFormatConfig.mC64PetsciiDelimPattern);
|
||||
mC64ScreenCodeDelimFmt = PatternToFormat(mFormatConfig.mC64ScreenCodeDelimPattern);
|
||||
}
|
||||
|
||||
private string PatternToFormat(string pat) {
|
||||
if (string.IsNullOrEmpty(pat)) {
|
||||
return string.Empty;
|
||||
}
|
||||
// Must be exactly one '#'.
|
||||
int firstHash = pat.IndexOf('#');
|
||||
int lastHash = pat.LastIndexOf('#');
|
||||
if (firstHash < 0 || firstHash != lastHash) {
|
||||
Debug.WriteLine("Invalid delimiter pattern '" + pat + "'");
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return pat.Replace("#", "{0}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -352,69 +371,43 @@ namespace Asm65 {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formats a value as an ASCII character, surrounded by quotes. Must be a valid
|
||||
/// low- or high-ASCII value.
|
||||
/// Formats a single-character operand. Output will be a delimited printable character
|
||||
/// when possible, a hex value when the converted character is unprintable.
|
||||
/// </summary>
|
||||
/// <param name="value">Value to format.</param>
|
||||
/// <param name="value">Value to format. Could be a 16-bit immediate value.</param>
|
||||
/// <param name="enc">Character encoding to use for value.</param>
|
||||
/// <returns>Formatted string.</returns>
|
||||
private string FormatAsciiChar(int value) {
|
||||
Debug.Assert(CommonUtil.TextUtil.IsHiLoAscii(value));
|
||||
char ch = (char)(value & 0x7f);
|
||||
bool hiAscii = ((value & 0x80) != 0);
|
||||
|
||||
StringBuilder sb;
|
||||
int method = -1;
|
||||
switch (method) {
|
||||
case 0:
|
||||
default:
|
||||
// Convention is from Merlin: single quote for low-ASCII, double-quote
|
||||
// for high-ASCII. Add a backslash if we're quoting the delimiter.
|
||||
sb = new StringBuilder(4);
|
||||
char quoteChar = ((value & 0x80) == 0) ? '\'' : '"';
|
||||
sb.Append(quoteChar);
|
||||
if (quoteChar == ch) {
|
||||
sb.Append('\\');
|
||||
}
|
||||
sb.Append(ch);
|
||||
sb.Append(quoteChar);
|
||||
break;
|
||||
case 1:
|
||||
// Convention is similar to Merlin, but with curly-quotes so it doesn't
|
||||
// look weird when quoting ' or ".
|
||||
sb = new StringBuilder(3);
|
||||
sb.Append(hiAscii ? '\u201c' : '\u2018');
|
||||
sb.Append(ch);
|
||||
sb.Append(hiAscii ? '\u201d' : '\u2019');
|
||||
break;
|
||||
case 2:
|
||||
// Always use apostrophe, but follow it with an up-arrow to indicate
|
||||
// that it's high-ASCII.
|
||||
sb = new StringBuilder(4);
|
||||
sb.Append("'");
|
||||
sb.Append(ch);
|
||||
sb.Append("'");
|
||||
if (hiAscii) {
|
||||
sb.Append('\u21e1'); // UPWARDS DASHED ARROW
|
||||
//sb.Append('\u2912'); // UPWARDS ARROW TO BAR
|
||||
}
|
||||
break;
|
||||
public string FormatCharacterValue(int value, CharEncoding.Encoding enc) {
|
||||
if (value < 0 || value > 0xff) {
|
||||
return FormatHexValue(value, 2);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formats a value as an ASCII character, if possible, or as a hex value.
|
||||
/// </summary>
|
||||
/// <param name="value">Value to format.</param>
|
||||
/// <returns>Formatted string.</returns>
|
||||
public string FormatAsciiOrHex(int value) {
|
||||
bool hiAscii = ((value & 0x80) != 0);
|
||||
if (hiAscii && !mFormatConfig.mAllowHighAsciiCharConst) {
|
||||
string fmt;
|
||||
CharEncoding.Convert conv;
|
||||
switch (enc) {
|
||||
case CharEncoding.Encoding.Ascii:
|
||||
fmt = mAsciiDelimFmt;
|
||||
conv = CharEncoding.ConvertAscii;
|
||||
break;
|
||||
case CharEncoding.Encoding.HighAscii:
|
||||
fmt = mHighAsciiDelimFmt;
|
||||
conv = CharEncoding.ConvertHighAscii;
|
||||
break;
|
||||
case CharEncoding.Encoding.C64Petscii:
|
||||
case CharEncoding.Encoding.C64ScreenCode:
|
||||
default:
|
||||
return FormatHexValue(value, 2);
|
||||
}
|
||||
if (string.IsNullOrEmpty(fmt)) {
|
||||
return FormatHexValue(value, 2);
|
||||
}
|
||||
|
||||
char ch = conv((byte)value);
|
||||
if (ch == CharEncoding.UNPRINTABLE_CHAR) {
|
||||
return FormatHexValue(value, 2);
|
||||
} else if (CommonUtil.TextUtil.IsHiLoAscii(value)) {
|
||||
return FormatAsciiChar(value);
|
||||
} else {
|
||||
return FormatHexValue(value, 2);
|
||||
// possible optimization: replace fmt with a prefix/suffix pair, and just concat
|
||||
return string.Format(fmt, ch);
|
||||
}
|
||||
}
|
||||
|
||||
@ -577,11 +570,7 @@ namespace Asm65 {
|
||||
fmt = "[{0}]";
|
||||
break;
|
||||
case AddressMode.Acc:
|
||||
if (mFormatConfig.mSuppressImpliedAcc) {
|
||||
fmt = string.Empty;
|
||||
} else {
|
||||
fmt = mAccChar;
|
||||
}
|
||||
fmt = mAccChar;
|
||||
break;
|
||||
case AddressMode.DPIndIndexY:
|
||||
fmt = "({0})," + mYregChar;
|
||||
|
@ -189,8 +189,9 @@ namespace SourceGen.AsmGen {
|
||||
config.mEndOfLineCommentDelimiter = ";";
|
||||
config.mFullLineCommentDelimiterBase = ";";
|
||||
config.mBoxLineCommentDelimiter = ";";
|
||||
config.mAllowHighAsciiCharConst = false;
|
||||
config.mExpressionMode = Formatter.FormatConfig.ExpressionMode.Common;
|
||||
config.mAsciiDelimPattern = "'#'";
|
||||
config.mHighAsciiDelimPattern = "'#' | $80";
|
||||
}
|
||||
|
||||
// IGenerator
|
||||
@ -566,7 +567,7 @@ namespace SourceGen.AsmGen {
|
||||
|
||||
StringOpFormatter stropf = new StringOpFormatter(SourceFormatter, '"',
|
||||
StringOpFormatter.RawOutputStyle.CommaSep, MAX_OPERAND_LEN,
|
||||
CharEncoding.ConvertLowAscii);
|
||||
CharEncoding.ConvertAscii);
|
||||
stropf.FeedBytes(data, offset, dfd.Length, leadingBytes, false);
|
||||
|
||||
string opcodeStr = formatter.FormatPseudoOp(sDataOpNames.StrGeneric);
|
||||
|
@ -186,8 +186,9 @@ namespace SourceGen.AsmGen {
|
||||
config.mEndOfLineCommentDelimiter = ";";
|
||||
config.mFullLineCommentDelimiterBase = ";";
|
||||
config.mBoxLineCommentDelimiter = ";";
|
||||
config.mAllowHighAsciiCharConst = false;
|
||||
config.mExpressionMode = Formatter.FormatConfig.ExpressionMode.Cc65;
|
||||
config.mAsciiDelimPattern = "'#'";
|
||||
config.mHighAsciiDelimPattern = "'#' | $80";
|
||||
}
|
||||
|
||||
// IGenerator
|
||||
@ -627,7 +628,7 @@ namespace SourceGen.AsmGen {
|
||||
if (highAscii) {
|
||||
charConv = CharEncoding.ConvertHighAscii;
|
||||
} else {
|
||||
charConv = CharEncoding.ConvertLowAscii;
|
||||
charConv = CharEncoding.ConvertAscii;
|
||||
}
|
||||
|
||||
StringOpFormatter stropf = new StringOpFormatter(SourceFormatter, '"',
|
||||
|
@ -162,8 +162,10 @@ namespace SourceGen.AsmGen {
|
||||
config.mEndOfLineCommentDelimiter = ";";
|
||||
config.mFullLineCommentDelimiterBase = ";";
|
||||
config.mBoxLineCommentDelimiter = string.Empty;
|
||||
config.mAllowHighAsciiCharConst = true;
|
||||
config.mExpressionMode = Formatter.FormatConfig.ExpressionMode.Merlin;
|
||||
|
||||
config.mAsciiDelimPattern = "'#'";
|
||||
config.mHighAsciiDelimPattern = "\"#\"";
|
||||
}
|
||||
|
||||
// IGenerator; executes on background thread
|
||||
@ -494,7 +496,7 @@ namespace SourceGen.AsmGen {
|
||||
charConv = CharEncoding.ConvertHighAscii;
|
||||
delim = '"';
|
||||
} else {
|
||||
charConv = CharEncoding.ConvertLowAscii;
|
||||
charConv = CharEncoding.ConvertAscii;
|
||||
delim = '\'';
|
||||
}
|
||||
|
||||
|
@ -185,8 +185,9 @@ namespace SourceGen.AsmGen {
|
||||
config.mEndOfLineCommentDelimiter = ";";
|
||||
config.mFullLineCommentDelimiterBase = ";";
|
||||
config.mBoxLineCommentDelimiter = ";";
|
||||
config.mAllowHighAsciiCharConst = false;
|
||||
config.mExpressionMode = Formatter.FormatConfig.ExpressionMode.Common;
|
||||
config.mAsciiDelimPattern = "'#'";
|
||||
config.mHighAsciiDelimPattern = "'#' | $80";
|
||||
}
|
||||
|
||||
// IGenerator
|
||||
@ -569,7 +570,7 @@ namespace SourceGen.AsmGen {
|
||||
|
||||
StringOpFormatter stropf = new StringOpFormatter(SourceFormatter, '"',
|
||||
StringOpFormatter.RawOutputStyle.CommaSep, MAX_OPERAND_LEN,
|
||||
CharEncoding.ConvertLowAscii);
|
||||
CharEncoding.ConvertAscii);
|
||||
if (dfd.FormatType == FormatDescriptor.Type.StringDci) {
|
||||
// DCI is awkward because the character encoding flips on the last byte. Rather
|
||||
// than clutter up StringOpFormatter for this rare item, we just accept low/high
|
||||
@ -596,7 +597,7 @@ namespace SourceGen.AsmGen {
|
||||
if (stropf.Lines.Count != 1) {
|
||||
// Must be single-line.
|
||||
opcodeStr = sDataOpNames.StrGeneric;
|
||||
stropf.CharConv = CharEncoding.ConvertLowAscii; // undo DCI hack
|
||||
stropf.CharConv = CharEncoding.ConvertAscii; // undo DCI hack
|
||||
redo = true;
|
||||
}
|
||||
break;
|
||||
|
@ -387,6 +387,9 @@ namespace SourceGen.AsmGen {
|
||||
|
||||
string exprMode = settings.GetString(AppSettings.FMT_EXPRESSION_MODE, string.Empty);
|
||||
config.mExpressionMode = Formatter.FormatConfig.ParseExpressionMode(exprMode);
|
||||
|
||||
// Not doing the delimiter patterns here, because what's in the config file is
|
||||
// intended for on-screen display, and hence likely to be unsuited for an assembler.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -739,7 +739,7 @@ namespace SourceGen {
|
||||
bool isHigh = (mFileData[start] & 0x80) != 0;
|
||||
mAnattribs[start].DataDescriptor = FormatDescriptor.Create(asciiLen,
|
||||
FormatDescriptor.Type.StringGeneric, isHigh ?
|
||||
FormatDescriptor.SubType.HighAscii : FormatDescriptor.SubType.LowAscii);
|
||||
FormatDescriptor.SubType.HighAscii : FormatDescriptor.SubType.Ascii);
|
||||
start += asciiLen;
|
||||
continue;
|
||||
}
|
||||
|
@ -435,7 +435,7 @@ namespace SourceGen {
|
||||
bool isHigh = (FileData[checkOffset] & 0x80) != 0;
|
||||
newDfd = FormatDescriptor.Create(dfd.Length, dfd.FormatType,
|
||||
isHigh ? FormatDescriptor.SubType.HighAscii :
|
||||
FormatDescriptor.SubType.LowAscii);
|
||||
FormatDescriptor.SubType.Ascii);
|
||||
} else if (dfd.IsNumeric) {
|
||||
// This is a character constant in an instruction or data operand, such
|
||||
// as ".dd1 'f'" or "LDA #'f'". Could be multi-byte (even instructions
|
||||
@ -463,7 +463,7 @@ namespace SourceGen {
|
||||
bool isHigh = (FileData[checkOffset] & 0x80) != 0;
|
||||
newDfd = FormatDescriptor.Create(dfd.Length, dfd.FormatType,
|
||||
isHigh ? FormatDescriptor.SubType.HighAscii :
|
||||
FormatDescriptor.SubType.LowAscii);
|
||||
FormatDescriptor.SubType.Ascii);
|
||||
} else {
|
||||
Debug.Assert(false);
|
||||
newDfd = dfd;
|
||||
|
@ -20,17 +20,20 @@ using System.Diagnostics;
|
||||
namespace SourceGen {
|
||||
/// <summary>
|
||||
/// Format descriptor for data items and instruction operands. Instances are immutable.
|
||||
///
|
||||
///
|
||||
/// A list of these is saved as part of the project definition. Code and data that
|
||||
/// doesn't have one of these will be formatted with default behavior. For data that
|
||||
/// means a single hexadecimal byte.
|
||||
///
|
||||
///
|
||||
/// These are referenced from the project and the Anattribs array. Entries in the
|
||||
/// latter may come from the project (as specified by the user), or be auto-generated
|
||||
/// by the data analysis pass.
|
||||
///
|
||||
///
|
||||
/// There may be a large number of these, so try to keep the size down. These are usually
|
||||
/// stored in lists, not arrays, so declaring as a struct wouldn't help with that.
|
||||
///
|
||||
/// The stringified form of the enum values are currently serialized into the project
|
||||
/// file. DO NOT rename members of the enumeration without creating an upgrade path.
|
||||
/// </summary>
|
||||
public class FormatDescriptor {
|
||||
/// <summary>
|
||||
@ -76,7 +79,7 @@ namespace SourceGen {
|
||||
Symbol, // symbolic ref; replace with Expression, someday?
|
||||
|
||||
// Strings and NumericLE/BE (single character)
|
||||
LowAscii, // ASCII (high bit clear)
|
||||
Ascii, // ASCII (high bit clear)
|
||||
HighAscii, // ASCII (high bit set)
|
||||
C64Petscii, // C64 PETSCII (lower case $41-5a, upper case $c1-da)
|
||||
C64Screen, // C64 screen code
|
||||
@ -103,7 +106,7 @@ namespace SourceGen {
|
||||
private static FormatDescriptor ONE_BINARY = new FormatDescriptor(1,
|
||||
Type.NumericLE, SubType.Binary);
|
||||
private static FormatDescriptor ONE_LOW_ASCII = new FormatDescriptor(1,
|
||||
Type.NumericLE, SubType.LowAscii);
|
||||
Type.NumericLE, SubType.Ascii);
|
||||
|
||||
/// <summary>
|
||||
/// Length, in bytes, of the data to be formatted.
|
||||
@ -213,7 +216,7 @@ namespace SourceGen {
|
||||
return ONE_DECIMAL;
|
||||
case SubType.Binary:
|
||||
return ONE_BINARY;
|
||||
case SubType.LowAscii:
|
||||
case SubType.Ascii:
|
||||
return ONE_LOW_ASCII;
|
||||
}
|
||||
}
|
||||
@ -350,7 +353,7 @@ namespace SourceGen {
|
||||
if (IsString) {
|
||||
string descr;
|
||||
switch (FormatSubType) {
|
||||
case SubType.LowAscii:
|
||||
case SubType.Ascii:
|
||||
descr = "ASCII";
|
||||
break;
|
||||
case SubType.HighAscii:
|
||||
@ -417,7 +420,7 @@ namespace SourceGen {
|
||||
return "Address";
|
||||
case SubType.Symbol:
|
||||
return "Symbol \"" + SymbolRef.Label + "\"";
|
||||
case SubType.LowAscii:
|
||||
case SubType.Ascii:
|
||||
return "Numeric, ASCII";
|
||||
case SubType.HighAscii:
|
||||
return "Numeric, ASCII (high)";
|
||||
|
@ -427,7 +427,18 @@ namespace SourceGen {
|
||||
mFormatterConfig.mEndOfLineCommentDelimiter = ";";
|
||||
mFormatterConfig.mFullLineCommentDelimiterBase = ";";
|
||||
mFormatterConfig.mBoxLineCommentDelimiter = string.Empty;
|
||||
mFormatterConfig.mAllowHighAsciiCharConst = true;
|
||||
mFormatterConfig.mAsciiDelimPattern =
|
||||
AppSettings.Global.GetString(AppSettings.CHR_ASCII_DELIM_PAT,
|
||||
Res.Strings.DEFAULT_ASCII_DELIM_PAT);
|
||||
mFormatterConfig.mHighAsciiDelimPattern =
|
||||
AppSettings.Global.GetString(AppSettings.CHR_HIGH_ASCII_DELIM_PAT,
|
||||
Res.Strings.DEFAULT_HIGH_ASCII_DELIM_PAT);
|
||||
mFormatterConfig.mC64PetsciiDelimPattern =
|
||||
AppSettings.Global.GetString(AppSettings.CHR_C64_PETSCII_DELIM_PAT,
|
||||
Res.Strings.DEFAULT_C64_PETSCII_DELIM_PAT);
|
||||
mFormatterConfig.mC64ScreenCodeDelimPattern =
|
||||
AppSettings.Global.GetString(AppSettings.CHR_C64_SCREEN_CODE_DELIM_PAT,
|
||||
Res.Strings.DEFAULT_C64_SCREEN_CODE_DELIM_PAT);
|
||||
mOutputFormatter = new Formatter(mFormatterConfig);
|
||||
mOutputFormatterCpuDef = null;
|
||||
|
||||
|
@ -495,7 +495,7 @@ namespace SourceGen {
|
||||
if (!CreateSymbol(kvp.Value, report, out Symbol sym)) {
|
||||
continue;
|
||||
}
|
||||
if (!CreateFormatDescriptor(kvp.Value.DataDescriptor, report,
|
||||
if (!CreateFormatDescriptor(kvp.Value.DataDescriptor, spf._ContentVersion, report,
|
||||
out FormatDescriptor dfd)) {
|
||||
continue;
|
||||
}
|
||||
@ -618,7 +618,8 @@ namespace SourceGen {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!CreateFormatDescriptor(kvp.Value, report, out FormatDescriptor dfd)) {
|
||||
if (!CreateFormatDescriptor(kvp.Value, spf._ContentVersion, report,
|
||||
out FormatDescriptor dfd)) {
|
||||
continue;
|
||||
}
|
||||
if (intKey < 0 || intKey + dfd.Length > spf.FileDataLength) {
|
||||
@ -664,10 +665,11 @@ namespace SourceGen {
|
||||
/// Creates a FormatDescriptor from a SerFormatDescriptor.
|
||||
/// </summary>
|
||||
/// <param name="sfd">Deserialized data.</param>
|
||||
/// <param name="version">Serialization version (CONTENT_VERSION).</param>
|
||||
/// <param name="report">Error report object.</param>
|
||||
/// <param name="dfd">Created FormatDescriptor.</param>
|
||||
/// <returns>True on success.</returns>
|
||||
private static bool CreateFormatDescriptor(SerFormatDescriptor sfd,
|
||||
private static bool CreateFormatDescriptor(SerFormatDescriptor sfd, int version,
|
||||
FileLoadReport report, out FormatDescriptor dfd) {
|
||||
dfd = null;
|
||||
FormatDescriptor.Type format;
|
||||
@ -676,6 +678,7 @@ namespace SourceGen {
|
||||
if ("String".Equals(sfd.Format)) {
|
||||
// File version 1 used a different set of enumerated values for defining strings.
|
||||
// Parse it out here.
|
||||
Debug.Assert(version <= 1);
|
||||
subFormat = FormatDescriptor.SubType.ASCII_GENERIC;
|
||||
if ("None".Equals(sfd.SubFormat)) {
|
||||
format = FormatDescriptor.Type.StringGeneric;
|
||||
@ -707,10 +710,11 @@ namespace SourceGen {
|
||||
try {
|
||||
format = (FormatDescriptor.Type)Enum.Parse(
|
||||
typeof(FormatDescriptor.Type), sfd.Format);
|
||||
if ("Ascii".Equals(sfd.SubFormat)) {
|
||||
if (version <= 1 && "Ascii".Equals(sfd.SubFormat)) {
|
||||
// File version 1 used "Ascii" for all character data in numeric operands.
|
||||
// It applied to both low and high ASCII.
|
||||
subFormat = FormatDescriptor.SubType.ASCII_GENERIC;
|
||||
Debug.WriteLine("Found v1 char, fmt=" + sfd.Format + ", sub=" + sfd.SubFormat);
|
||||
} else {
|
||||
subFormat = (FormatDescriptor.SubType)Enum.Parse(
|
||||
typeof(FormatDescriptor.SubType), sfd.SubFormat);
|
||||
|
@ -492,6 +492,21 @@ namespace SourceGen {
|
||||
HasHashPrefix, // operand has a leading '#', avoiding ambiguity in some cases
|
||||
}
|
||||
|
||||
public static CharEncoding.Encoding SubTypeToEnc(FormatDescriptor.SubType subType) {
|
||||
switch (subType) {
|
||||
case FormatDescriptor.SubType.Ascii:
|
||||
return CharEncoding.Encoding.Ascii;
|
||||
case FormatDescriptor.SubType.HighAscii:
|
||||
return CharEncoding.Encoding.HighAscii;
|
||||
case FormatDescriptor.SubType.C64Petscii:
|
||||
return CharEncoding.Encoding.C64Petscii;
|
||||
case FormatDescriptor.SubType.C64Screen:
|
||||
return CharEncoding.Encoding.C64ScreenCode;
|
||||
default:
|
||||
return CharEncoding.Encoding.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Format a numeric operand value according to the specified sub-format.
|
||||
/// </summary>
|
||||
@ -520,14 +535,12 @@ namespace SourceGen {
|
||||
return formatter.FormatDecimalValue(operandValue);
|
||||
case FormatDescriptor.SubType.Binary:
|
||||
return formatter.FormatBinaryValue(operandValue, hexMinLen * 4);
|
||||
case FormatDescriptor.SubType.LowAscii:
|
||||
case FormatDescriptor.SubType.Ascii:
|
||||
case FormatDescriptor.SubType.HighAscii:
|
||||
case FormatDescriptor.SubType.C64Petscii:
|
||||
case FormatDescriptor.SubType.C64Screen:
|
||||
// TODO(petscii): convert encoding; use a helper function *not* in
|
||||
// formatter -- pass converted char value in along with operandValue
|
||||
// TODO: pass in a "make high ASCII" string, e.g. "| 0x80", that fixes char
|
||||
return formatter.FormatAsciiOrHex(operandValue);
|
||||
CharEncoding.Encoding enc = SubTypeToEnc(dfd.FormatSubType);
|
||||
return formatter.FormatCharacterValue(operandValue, enc);
|
||||
case FormatDescriptor.SubType.Symbol:
|
||||
if (symbolTable.TryGetValue(dfd.SymbolRef.Label, out Symbol sym)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -34,6 +34,10 @@ limitations under the License.
|
||||
<system:String x:Key="str_ClipformatDisassembly">Disassembly</system:String>
|
||||
<system:String x:Key="str_DefaultHeaderCommentFmt">6502bench SourceGen v{0}</system:String>
|
||||
<system:String x:Key="str_DefaultValue">Default</system:String>
|
||||
<system:String x:Key="str_DefaultAsciiDelimPat">‘#’</system:String>
|
||||
<system:String x:Key="str_DefaultHighAsciiDelimPat">“#”</system:String>
|
||||
<system:String x:Key="str_DefaultC64PetsciiDelimPat">pet:“#”</system:String>
|
||||
<system:String x:Key="str_DefaultC64ScreenCodeDelimPat">scr:“#”</system:String>
|
||||
<system:String x:Key="str_ErrBadFdFmt">Bad format descriptor at +{0:x6}.</system:String>
|
||||
<system:String x:Key="str_ErrBadFdFormat">Bad format descriptor type</system:String>
|
||||
<system:String x:Key="str_ErrBadFileLength">Bad file length</system:String>
|
||||
|
@ -45,6 +45,14 @@ namespace SourceGen.Res {
|
||||
(string)Application.Current.FindResource("str_DefaultHeaderCommentFmt");
|
||||
public static string DEFAULT_VALUE =
|
||||
(string)Application.Current.FindResource("str_DefaultValue");
|
||||
public static string DEFAULT_ASCII_DELIM_PAT =
|
||||
(string)Application.Current.FindResource("str_DefaultAsciiDelimPat");
|
||||
public static string DEFAULT_HIGH_ASCII_DELIM_PAT =
|
||||
(string)Application.Current.FindResource("str_DefaultHighAsciiDelimPat");
|
||||
public static string DEFAULT_C64_PETSCII_DELIM_PAT =
|
||||
(string)Application.Current.FindResource("str_DefaultC64PetsciiDelimPat");
|
||||
public static string DEFAULT_C64_SCREEN_CODE_DELIM_PAT =
|
||||
(string)Application.Current.FindResource("str_DefaultC64ScreenCodeDelimPat");
|
||||
public static string CLIPFORMAT_ASSEMBLER_SOURCE =
|
||||
(string)Application.Current.FindResource("str_ClipformatAssemblerSource");
|
||||
public static string CLIPFORMAT_DISASSEMBLY =
|
||||
|
@ -40,14 +40,14 @@ skipdata lda #'h'
|
||||
lda #$7f
|
||||
lda #$80
|
||||
lda #$9f
|
||||
lda #$a0
|
||||
lda #$fe
|
||||
lda #' ' | $80
|
||||
lda #'~' | $80
|
||||
lda #$ff
|
||||
rep #'0'
|
||||
.al
|
||||
.xl
|
||||
lda #'h'
|
||||
lda #$c8
|
||||
lda #'H' | $80
|
||||
lda #$6868
|
||||
rts
|
||||
|
||||
|
@ -40,14 +40,14 @@ skipdata lda #'h'
|
||||
lda #$7f
|
||||
lda #$80
|
||||
lda #$9f
|
||||
lda #$a0
|
||||
lda #$fe
|
||||
lda #' ' | $80
|
||||
lda #'~' | $80
|
||||
lda #$ff
|
||||
rep #'0'
|
||||
!al
|
||||
!rl
|
||||
lda #'h'
|
||||
lda #$c8
|
||||
lda #'H' | $80
|
||||
lda #$6868
|
||||
rts
|
||||
|
||||
|
@ -41,14 +41,14 @@ skipdata: lda #'h'
|
||||
lda #$7f
|
||||
lda #$80
|
||||
lda #$9f
|
||||
lda #$a0
|
||||
lda #$fe
|
||||
lda #' ' | $80
|
||||
lda #'~' | $80
|
||||
lda #$ff
|
||||
rep #'0'
|
||||
.a16
|
||||
.i16
|
||||
lda #'h'
|
||||
lda #$c8
|
||||
lda #'H' | $80
|
||||
lda #$6868
|
||||
rts
|
||||
|
||||
|
@ -143,7 +143,7 @@ limitations under the License.
|
||||
Margin="{StaticResource ASC}"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="0"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Margin="{StaticResource TBS}" Width="80" MaxLength="8"
|
||||
Margin="{StaticResource TBS}" Width="90" MaxLength="12"
|
||||
FontFamily="{StaticResource GeneralMonoFont}">
|
||||
<TextBox.Text>
|
||||
<Binding Path="AsciiDelimPat" UpdateSourceTrigger="PropertyChanged"
|
||||
@ -160,7 +160,7 @@ limitations under the License.
|
||||
Margin="{StaticResource ASC}"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Margin="{StaticResource TBS}" Width="80" MaxLength="8"
|
||||
Margin="{StaticResource TBS}" Width="90" MaxLength="12"
|
||||
FontFamily="{StaticResource GeneralMonoFont}">
|
||||
<TextBox.Text>
|
||||
<Binding Path="HighAsciiDelimPat" UpdateSourceTrigger="PropertyChanged"
|
||||
@ -177,11 +177,11 @@ limitations under the License.
|
||||
Margin="{StaticResource ASC}"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Margin="{StaticResource TBS}" Width="80" MaxLength="8"
|
||||
Margin="{StaticResource TBS}" Width="90" MaxLength="12"
|
||||
FontFamily="{StaticResource GeneralMonoFont}">
|
||||
<TextBox.Text>
|
||||
<Binding Path="PetsciiDelimPat" UpdateSourceTrigger="PropertyChanged"
|
||||
FallbackValue="[#]">
|
||||
FallbackValue="petscii:[#]M">
|
||||
<Binding.ValidationRules>
|
||||
<local:StringDelimiterRule ValidatesOnTargetUpdated="True"/>
|
||||
</Binding.ValidationRules>
|
||||
@ -194,7 +194,7 @@ limitations under the License.
|
||||
Margin="{StaticResource ASC}"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="3"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Center"
|
||||
Margin="{StaticResource TBS}" Width="80" MaxLength="8"
|
||||
Margin="{StaticResource TBS}" Width="90" MaxLength="12"
|
||||
FontFamily="{StaticResource GeneralMonoFont}">
|
||||
<TextBox.Text>
|
||||
<Binding Path="ScreenCodeDelimPat" UpdateSourceTrigger="PropertyChanged"
|
||||
@ -207,9 +207,20 @@ limitations under the License.
|
||||
</TextBox>
|
||||
</Grid>
|
||||
|
||||
<Button Name="defaultTextDelimitersButton" Content="Default" Margin="4,8,0,0"
|
||||
Width="70" HorizontalAlignment="Left"
|
||||
Click="DefaultTextDelimitersButton_Click"/>
|
||||
<DockPanel LastChildFill="False">
|
||||
<Button Name="defaultTextDelimitersButton" DockPanel.Dock="Left"
|
||||
Content="Default" Width="70" Margin="0,8,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Click="DefaultTextDelimitersButton_Click"/>
|
||||
|
||||
<TextBox DockPanel.Dock="Right" IsReadOnly="True"
|
||||
Text="‘’•“”↑«»❰❱"
|
||||
FontFamily="{StaticResource GeneralMonoFont}"
|
||||
FontSize="16"
|
||||
VerticalAlignment="Bottom"/>
|
||||
<TextBlock DockPanel.Dock="Right" Margin="0,0,4,3" VerticalAlignment="Bottom"
|
||||
Text="Sample:"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
|
@ -416,13 +416,10 @@ 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);
|
||||
return mSettings.GetString(AppSettings.CHR_ASCII_DELIM_PAT,
|
||||
Res.Strings.DEFAULT_ASCII_DELIM_PAT);
|
||||
}
|
||||
set {
|
||||
mSettings.SetString(AppSettings.CHR_ASCII_DELIM_PAT, value);
|
||||
@ -433,7 +430,7 @@ namespace SourceGen.WpfGui {
|
||||
public string HighAsciiDelimPat {
|
||||
get {
|
||||
return mSettings.GetString(AppSettings.CHR_HIGH_ASCII_DELIM_PAT,
|
||||
DEFAULT_HIGH_ASCII_DELIM_PAT);
|
||||
Res.Strings.DEFAULT_HIGH_ASCII_DELIM_PAT);
|
||||
}
|
||||
set {
|
||||
mSettings.SetString(AppSettings.CHR_HIGH_ASCII_DELIM_PAT, value);
|
||||
@ -444,7 +441,7 @@ namespace SourceGen.WpfGui {
|
||||
public string PetsciiDelimPat {
|
||||
get {
|
||||
return mSettings.GetString(AppSettings.CHR_C64_PETSCII_DELIM_PAT,
|
||||
DEFAULT_C64_PETSCII_DELIM_PAT);
|
||||
Res.Strings.DEFAULT_C64_PETSCII_DELIM_PAT);
|
||||
}
|
||||
set {
|
||||
mSettings.SetString(AppSettings.CHR_C64_PETSCII_DELIM_PAT, value);
|
||||
@ -455,7 +452,7 @@ namespace SourceGen.WpfGui {
|
||||
public string ScreenCodeDelimPat {
|
||||
get {
|
||||
return mSettings.GetString(AppSettings.CHR_C64_SCREEN_CODE_DELIM_PAT,
|
||||
DEFAULT_C64_SCREEN_CODE_DELIM_PAT);
|
||||
Res.Strings.DEFAULT_C64_SCREEN_CODE_DELIM_PAT);
|
||||
}
|
||||
set {
|
||||
mSettings.SetString(AppSettings.CHR_C64_SCREEN_CODE_DELIM_PAT, value);
|
||||
@ -465,10 +462,10 @@ namespace SourceGen.WpfGui {
|
||||
}
|
||||
|
||||
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;
|
||||
AsciiDelimPat = Res.Strings.DEFAULT_ASCII_DELIM_PAT;
|
||||
HighAsciiDelimPat = Res.Strings.DEFAULT_HIGH_ASCII_DELIM_PAT;
|
||||
PetsciiDelimPat = Res.Strings.DEFAULT_C64_PETSCII_DELIM_PAT;
|
||||
ScreenCodeDelimPat = Res.Strings.DEFAULT_C64_SCREEN_CODE_DELIM_PAT;
|
||||
}
|
||||
|
||||
#endregion Code View
|
||||
@ -939,6 +936,8 @@ namespace SourceGen.WpfGui {
|
||||
#endregion PseudoOp
|
||||
}
|
||||
|
||||
#region Validation rules
|
||||
|
||||
/// <summary>
|
||||
/// Text entry validation rule for assembler column widths.
|
||||
/// </summary>
|
||||
@ -981,4 +980,6 @@ namespace SourceGen.WpfGui {
|
||||
return ValidationResult.ValidResult;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Validation rules
|
||||
}
|
||||
|
@ -527,7 +527,7 @@ namespace SourceGen.WpfGui {
|
||||
case FormatDescriptor.SubType.Binary:
|
||||
radioSimpleDataBinary.IsChecked = true;
|
||||
break;
|
||||
case FormatDescriptor.SubType.LowAscii:
|
||||
case FormatDescriptor.SubType.Ascii:
|
||||
case FormatDescriptor.SubType.HighAscii:
|
||||
case FormatDescriptor.SubType.C64Petscii:
|
||||
case FormatDescriptor.SubType.C64Screen:
|
||||
@ -687,22 +687,22 @@ namespace SourceGen.WpfGui {
|
||||
// the subType and the arg to the string-creation functions, which use the
|
||||
// appropriate char encoding methods to break up the strings
|
||||
type = FormatDescriptor.Type.StringGeneric;
|
||||
subType = FormatDescriptor.SubType.LowAscii;
|
||||
subType = FormatDescriptor.SubType.Ascii;
|
||||
} else if (radioStringMixedReverse.IsChecked == true) {
|
||||
type = FormatDescriptor.Type.StringReverse;
|
||||
subType = FormatDescriptor.SubType.LowAscii;
|
||||
subType = FormatDescriptor.SubType.Ascii;
|
||||
} else if (radioStringNullTerm.IsChecked == true) {
|
||||
type = FormatDescriptor.Type.StringNullTerm;
|
||||
subType = FormatDescriptor.SubType.LowAscii;
|
||||
subType = FormatDescriptor.SubType.Ascii;
|
||||
} else if (radioStringLen8.IsChecked == true) {
|
||||
type = FormatDescriptor.Type.StringL8;
|
||||
subType = FormatDescriptor.SubType.LowAscii;
|
||||
subType = FormatDescriptor.SubType.Ascii;
|
||||
} else if (radioStringLen16.IsChecked == true) {
|
||||
type = FormatDescriptor.Type.StringL16;
|
||||
subType = FormatDescriptor.SubType.LowAscii;
|
||||
subType = FormatDescriptor.SubType.Ascii;
|
||||
} else if (radioStringDci.IsChecked == true) {
|
||||
type = FormatDescriptor.Type.StringDci;
|
||||
subType = FormatDescriptor.SubType.LowAscii;
|
||||
subType = FormatDescriptor.SubType.Ascii;
|
||||
} else {
|
||||
Debug.Assert(false);
|
||||
// default/none
|
||||
@ -780,7 +780,7 @@ namespace SourceGen.WpfGui {
|
||||
int val = RawData.GetWord(mFileData, low, dfd.Length,
|
||||
type == FormatDescriptor.Type.NumericBE);
|
||||
FormatDescriptor.SubType actualSubType = (val > 0x7f) ?
|
||||
FormatDescriptor.SubType.HighAscii : FormatDescriptor.SubType.LowAscii;
|
||||
FormatDescriptor.SubType.HighAscii : FormatDescriptor.SubType.Ascii;
|
||||
if (actualSubType != dfd.FormatSubType) {
|
||||
// replace the descriptor
|
||||
dfd = FormatDescriptor.Create(chunkLength, type, actualSubType);
|
||||
|
@ -332,10 +332,12 @@ namespace SourceGen.WpfGui {
|
||||
case FormatDescriptor.SubType.Binary:
|
||||
preview.Append(mFormatter.FormatBinaryValue(mOperandValue, 8));
|
||||
break;
|
||||
case FormatDescriptor.SubType.LowAscii:
|
||||
case FormatDescriptor.SubType.Ascii:
|
||||
case FormatDescriptor.SubType.HighAscii:
|
||||
// TODO(petscii): encoding
|
||||
preview.Append(mFormatter.FormatAsciiOrHex(mOperandValue));
|
||||
case FormatDescriptor.SubType.C64Petscii:
|
||||
case FormatDescriptor.SubType.C64Screen:
|
||||
CharEncoding.Encoding enc = PseudoOp.SubTypeToEnc(dfd.FormatSubType);
|
||||
preview.Append(mFormatter.FormatCharacterValue(mOperandValue, enc));
|
||||
break;
|
||||
case FormatDescriptor.SubType.Symbol:
|
||||
if (mProject.SymbolTable.TryGetValue(dfd.SymbolRef.Label, out Symbol sym)) {
|
||||
@ -471,7 +473,7 @@ namespace SourceGen.WpfGui {
|
||||
case FormatDescriptor.SubType.Binary:
|
||||
binaryButton.IsChecked = true;
|
||||
break;
|
||||
case FormatDescriptor.SubType.LowAscii:
|
||||
case FormatDescriptor.SubType.Ascii:
|
||||
case FormatDescriptor.SubType.HighAscii:
|
||||
// TODO(petscii): encoding
|
||||
asciiButton.IsChecked = true;
|
||||
@ -557,7 +559,7 @@ namespace SourceGen.WpfGui {
|
||||
if (mOperandValue > 0x7f) {
|
||||
subType = FormatDescriptor.SubType.HighAscii;
|
||||
} else {
|
||||
subType = FormatDescriptor.SubType.LowAscii;
|
||||
subType = FormatDescriptor.SubType.Ascii;
|
||||
}
|
||||
} else if (symbolButton.IsChecked == true) {
|
||||
subType = FormatDescriptor.SubType.Symbol;
|
||||
|
Loading…
x
Reference in New Issue
Block a user