1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-01-14 07:29:44 +00:00

Eliminate duplicate function

This commit is contained in:
Andy McFadden 2019-08-21 15:29:00 -07:00
parent 32d1147eec
commit 2fa5fdc237
2 changed files with 7 additions and 17 deletions

View File

@ -309,22 +309,6 @@ namespace SourceGen.AsmGen {
}
}
private CharEncoding.Encoding FormatDescriptorToCharEncoding(FormatDescriptor dfd) {
switch (dfd.FormatSubType) {
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;
case FormatDescriptor.SubType.ASCII_GENERIC:
default:
return CharEncoding.Encoding.Unknown;
}
}
// IGenerator
public string ModifyOpcode(int offset, OpDef op) {
if (op.IsUndocumented) {
@ -358,7 +342,7 @@ namespace SourceGen.AsmGen {
// IGenerator
public void UpdateCharacterEncoding(FormatDescriptor dfd) {
CharEncoding.Encoding newEnc = FormatDescriptorToCharEncoding(dfd);
CharEncoding.Encoding newEnc = PseudoOp.SubTypeToEnc(dfd.FormatSubType);
if (newEnc == CharEncoding.Encoding.Unknown) {
// probably not a character operand
return;

View File

@ -499,6 +499,12 @@ namespace SourceGen {
HasHashPrefix, // operand has a leading '#', avoiding ambiguity in some cases
}
/// <summary>
/// Converts a FormatDescriptor SubType to a CharEncoding.Encoding value.
/// </summary>
/// <param name="subType">FormatDescriptor sub-type.</param>
/// <returns>The corresponding CharEncoding.Encoding value, or Encoding.Unknown
/// if the sub-type isn't a character encoding.</returns>
public static CharEncoding.Encoding SubTypeToEnc(FormatDescriptor.SubType subType) {
switch (subType) {
case FormatDescriptor.SubType.Ascii: