From 32d1147eecdb834a29f3d66c8dc15ce3b9e83868 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Wed, 21 Aug 2019 13:30:25 -0700 Subject: [PATCH] Improve multi-encoding output in 64tass Previously, we used the default character encoding from the project properties to determine how strings and character constants in the entire source file should be encoded. Now we switch between encodings as needed. The default character encoding is no longer relevant. High ASCII is now an actual encoding, rather than acting like ASCII that sometimes doesn't work. Because we can do high ASCII character operands with "| $80", we don't output a .enc to switch from ASCII to high ASCII unless we need to generate a string. (If we're already in high ASCII mode, the "| $80" isn't required but won't hurt anything.) We now do a scan up front to see if ASCII or high ASCII is needed, and only output the .cdefs for the encodings that are actually used. The only gap in the matrix is high ASCII DCI strings -- the ".shift" pseudo-op rejects text if the string doesn't start with the high bit clear. --- SourceGen/AsmGen/AsmAcme.cs | 3 + SourceGen/AsmGen/AsmCc65.cs | 3 + SourceGen/AsmGen/AsmMerlin32.cs | 3 + SourceGen/AsmGen/AsmTass64.cs | 198 ++++++++++++------ SourceGen/AsmGen/GenCommon.cs | 3 + SourceGen/AsmGen/IGenerator.cs | 10 + SourceGen/FormatDescriptor.cs | 18 ++ SourceGen/RuntimeData/Help/editors.html | 9 +- .../Expected/1000-allops-value-65816_64tass.S | 2 - .../Expected/1001-allops-zero-65816_64tass.S | 2 - .../1002-embedded-instructions_64tass.S | 2 - .../Expected/1003-flags-and-branches_64tass.S | 2 - .../Expected/2000-allops-value-6502_64tass.S | 2 - .../Expected/2001-allops-zero-6502_64tass.S | 2 - .../Expected/2002-allops-value-65C02_64tass.S | 2 - .../Expected/2003-allops-zero-65C02_64tass.S | 2 - .../Expected/2004-numeric-types_64tass.S | 2 - .../Expected/2005-string-types_64tass.S | 54 +++-- .../Expected/2006-operand-formats_64tass.S | 2 + .../Expected/2008-address-changes_64tass.S | 2 - .../Expected/2009-branches-and-banks_64tass.S | 2 - .../SGTestData/Expected/2011-hinting_64tass.S | 2 - .../Expected/2012-label-localizer_64tass.S | 2 - .../Expected/2013-notes-and-comments_64tass.S | 2 - .../Expected/2014-label-dp_64tass.S | 2 - .../Expected/2015-64k-nops_64tass.S | 2 - .../Expected/2016-char-encoding-a_64tass.S | 129 +++++++----- .../Expected/2017-char-encoding-p_64tass.S | 115 +++++----- .../Expected/2018-char-encoding-s_64tass.S | 128 ++++++----- 29 files changed, 424 insertions(+), 283 deletions(-) diff --git a/SourceGen/AsmGen/AsmAcme.cs b/SourceGen/AsmGen/AsmAcme.cs index ca96685..6b35050 100644 --- a/SourceGen/AsmGen/AsmAcme.cs +++ b/SourceGen/AsmGen/AsmAcme.cs @@ -318,6 +318,9 @@ namespace SourceGen.AsmGen { return string.Empty; // indicate original is fine } + // IGenerator + public void UpdateCharacterEncoding(FormatDescriptor dfd) { } + // IGenerator public void GenerateShortSequence(int offset, int length, out string opcode, out string operand) { diff --git a/SourceGen/AsmGen/AsmCc65.cs b/SourceGen/AsmGen/AsmCc65.cs index e8fe0ce..0220f7f 100644 --- a/SourceGen/AsmGen/AsmCc65.cs +++ b/SourceGen/AsmGen/AsmCc65.cs @@ -345,6 +345,9 @@ namespace SourceGen.AsmGen { } } + // IGenerator + public void UpdateCharacterEncoding(FormatDescriptor dfd) { } + // IGenerator public void GenerateShortSequence(int offset, int length, out string opcode, out string operand) { diff --git a/SourceGen/AsmGen/AsmMerlin32.cs b/SourceGen/AsmGen/AsmMerlin32.cs index d0a8300..2d0741f 100644 --- a/SourceGen/AsmGen/AsmMerlin32.cs +++ b/SourceGen/AsmGen/AsmMerlin32.cs @@ -365,6 +365,9 @@ namespace SourceGen.AsmGen { return string.Empty; } + // IGenerator + public void UpdateCharacterEncoding(FormatDescriptor dfd) { } + // IGenerator public void GenerateShortSequence(int offset, int length, out string opcode, out string operand) { diff --git a/SourceGen/AsmGen/AsmTass64.cs b/SourceGen/AsmGen/AsmTass64.cs index 38a44b0..29300cc 100644 --- a/SourceGen/AsmGen/AsmTass64.cs +++ b/SourceGen/AsmGen/AsmTass64.cs @@ -22,7 +22,6 @@ using System.Text; using Asm65; using CommonUtil; -using TextScanMode = SourceGen.ProjectProperties.AnalysisParameters.TextScanMode; namespace SourceGen.AsmGen { #region IGenerator @@ -44,6 +43,8 @@ namespace SourceGen.AsmGen { /// public class GenTass64 : IGenerator { private const string ASM_FILE_SUFFIX = "_64tass.S"; // must start with underscore + private const string ASCII_ENC_NAME = "sg_ascii"; + private const string HIGH_ASCII_ENC_NAME = "sg_hiascii"; private const int MAX_OPERAND_LEN = 64; // IGenerator @@ -101,6 +102,11 @@ namespace SourceGen.AsmGen { /// private bool mNeedHereOp; + /// + /// What encoding are we currently set up for. + /// + private CharEncoding.Encoding mCurrentEncoding; + /// /// Holds detected version of configured assembler. /// @@ -203,28 +209,16 @@ namespace SourceGen.AsmGen { GenCommon.ConfigureFormatterFromSettings(Settings, ref config); SetFormatConfigValues(ref config); - // Configure delimiters for single-character operands. The conversion mode we - // use is determined by the default text mode in the project properties. - Formatter.DelimiterSet charSet = new Formatter.DelimiterSet(); - TextScanMode textMode = Project.ProjectProps.AnalysisParams.DefaultTextScanMode; - switch (textMode) { - case TextScanMode.C64Petscii: - charSet.Set(CharEncoding.Encoding.C64Petscii, - Formatter.SINGLE_QUOTE_DELIM); - break; - case TextScanMode.C64ScreenCode: - charSet.Set(CharEncoding.Encoding.C64ScreenCode, - Formatter.SINGLE_QUOTE_DELIM); - break; - case TextScanMode.LowAscii: - case TextScanMode.LowHighAscii: - default: - charSet.Set(CharEncoding.Encoding.Ascii, Formatter.SINGLE_QUOTE_DELIM); - charSet.Set(CharEncoding.Encoding.HighAscii, - new Formatter.DelimiterDef(string.Empty, '\'', '\'', " | $80")); - break; - } - config.mCharDelimiters = charSet; + // Configure delimiters for single-character operands. + Formatter.DelimiterSet charDelimSet = new Formatter.DelimiterSet(); + charDelimSet.Set(CharEncoding.Encoding.C64Petscii, Formatter.SINGLE_QUOTE_DELIM); + charDelimSet.Set(CharEncoding.Encoding.C64ScreenCode, Formatter.SINGLE_QUOTE_DELIM); + charDelimSet.Set(CharEncoding.Encoding.Ascii, Formatter.SINGLE_QUOTE_DELIM); + charDelimSet.Set(CharEncoding.Encoding.HighAscii, + new Formatter.DelimiterDef(string.Empty, '\'', '\'', " | $80")); + + config.mCharDelimiters = charDelimSet; + SourceFormatter = new Formatter(config); string msg = string.Format(Res.Strings.PROGRESS_GENERATING_FMT, pathName); @@ -276,34 +270,58 @@ namespace SourceGen.AsmGen { OutputLine(string.Empty, SourceFormatter.FormatPseudoOp(".cpu"), '\"' + cpuStr + '\"', string.Empty); - TextScanMode textMode = Project.ProjectProps.AnalysisParams.DefaultTextScanMode; - switch (textMode) { - case TextScanMode.C64Petscii: - // With "--ascii", this is the default. - //OutputLine(string.Empty, ".enc", "sg_petscii", string.Empty); - //OutputLine(string.Empty, ".cdef", "\" @\", $20", string.Empty); - //OutputLine(string.Empty, ".cdef", "\"AZ\", $c1", string.Empty); - //OutputLine(string.Empty, ".cdef", "\"az\", $41", string.Empty); - //OutputLine(string.Empty, ".cdef", "\"[[\", $5b", string.Empty); - //OutputLine(string.Empty, ".cdef", "\"]]\", $5d", string.Empty); - break; - case TextScanMode.C64ScreenCode: - // With "--ascii", we can use the built-in screen encoding. - OutputLine(string.Empty, ".enc", "screen", string.Empty); - //OutputLine(string.Empty, ".enc", "sg_screen", string.Empty); - //OutputLine(string.Empty, ".cdef", "\" ?\", $20", string.Empty); - //OutputLine(string.Empty, ".cdef", "\"@@\", $00", string.Empty); - //OutputLine(string.Empty, ".cdef", "\"AZ\", $41", string.Empty); - //OutputLine(string.Empty, ".cdef", "\"az\", $01", string.Empty); - //OutputLine(string.Empty, ".cdef", "\"[[\", $1b", string.Empty); - //OutputLine(string.Empty, ".cdef", "\"]]\", $1d", string.Empty); - break; - case TextScanMode.LowAscii: - case TextScanMode.LowHighAscii: + // C64 PETSCII and C64 screen codes are built in. Define ASCII if we also + // need that. + mCurrentEncoding = CharEncoding.Encoding.C64Petscii; + + CheckAsciiFormats(out bool hasAscii, out bool hasHighAscii); + if (hasHighAscii) { + OutputLine(string.Empty, ".enc", HIGH_ASCII_ENC_NAME, string.Empty); + OutputLine(string.Empty, ".cdef", "$20,$7e,$a0", string.Empty); + mCurrentEncoding = CharEncoding.Encoding.HighAscii; + } + if (hasAscii) { + OutputLine(string.Empty, ".enc", ASCII_ENC_NAME, string.Empty); + OutputLine(string.Empty, ".cdef", "$20,$7e,$20", string.Empty); + mCurrentEncoding = CharEncoding.Encoding.Ascii; + } + } + + private void CheckAsciiFormats(out bool hasAscii, out bool hasHighAscii) { + int offset = 0; + hasAscii = hasHighAscii = false; + while (offset < Project.FileData.Length) { + Anattrib attr = Project.GetAnattrib(offset); + FormatDescriptor dfd = attr.DataDescriptor; + if (dfd != null) { + if (dfd.FormatSubType == FormatDescriptor.SubType.Ascii) { + Debug.Assert(dfd.IsNumeric || dfd.IsString); + hasAscii = true; + } else if (dfd.FormatSubType == FormatDescriptor.SubType.HighAscii) { + hasHighAscii = true; + } + } + if (hasAscii && hasHighAscii) { + return; + } + + offset += attr.Length; + } + } + + 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: - OutputLine(string.Empty, ".enc", "sg_ascii", string.Empty); - OutputLine(string.Empty, ".cdef", "$20,$7e,$20", string.Empty); - break; + return CharEncoding.Encoding.Unknown; } } @@ -338,6 +356,43 @@ namespace SourceGen.AsmGen { return string.Empty; // indicate original is fine } + // IGenerator + public void UpdateCharacterEncoding(FormatDescriptor dfd) { + CharEncoding.Encoding newEnc = FormatDescriptorToCharEncoding(dfd); + if (newEnc == CharEncoding.Encoding.Unknown) { + // probably not a character operand + return; + } + if (newEnc != mCurrentEncoding) { + switch (newEnc) { + case CharEncoding.Encoding.Ascii: + OutputLine(string.Empty, ".enc", ASCII_ENC_NAME, string.Empty); + break; + case CharEncoding.Encoding.HighAscii: + // If this is a numeric operand (not string), and we're currently in + // ASCII mode, the "| $80" in the delimiter will handle this without + // the need for a .enc. Much less clutter for sources that have plain + // ASCII strings but test high ASCII constants. + if (mCurrentEncoding == CharEncoding.Encoding.Ascii && !dfd.IsString) { + newEnc = mCurrentEncoding; + } else { + OutputLine(string.Empty, ".enc", HIGH_ASCII_ENC_NAME, string.Empty); + } + break; + case CharEncoding.Encoding.C64Petscii: + OutputLine(string.Empty, ".enc", "none", string.Empty); + break; + case CharEncoding.Encoding.C64ScreenCode: + OutputLine(string.Empty, ".enc", "screen", string.Empty); + break; + default: + Debug.Assert(false); + break; + } + mCurrentEncoding = newEnc; + } + } + // IGenerator public void GenerateShortSequence(int offset, int length, out string opcode, out string operand) { @@ -389,6 +444,7 @@ namespace SourceGen.AsmGen { case FormatDescriptor.Type.NumericLE: opcodeStr = sDataOpNames.GetDefineData(length); operand = RawData.GetWord(data, offset, length, false); + UpdateCharacterEncoding(dfd); operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable, mLocalizer.LabelMap, dfd, operand, length, PseudoOp.FormatNumericOpFlags.None); @@ -399,6 +455,7 @@ namespace SourceGen.AsmGen { // Nothing defined, output as comma-separated single-byte values. GenerateShortSequence(offset, length, out opcodeStr, out operandStr); } else { + UpdateCharacterEncoding(dfd); operand = RawData.GetWord(data, offset, length, true); operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable, mLocalizer.LabelMap, dfd, operand, length, @@ -587,31 +644,25 @@ namespace SourceGen.AsmGen { Debug.Assert(dfd.IsString); Debug.Assert(dfd.Length > 0); - TextScanMode textMode = Project.ProjectProps.AnalysisParams.DefaultTextScanMode; CharEncoding.Convert charConv = null; CharEncoding.Convert dciConv = null; switch (dfd.FormatSubType) { case FormatDescriptor.SubType.Ascii: - if (textMode == TextScanMode.LowAscii || - textMode == TextScanMode.LowHighAscii) { - charConv = CharEncoding.ConvertAscii; - dciConv = CharEncoding.ConvertLowAndHighAscii; - } - break; - case FormatDescriptor.SubType.C64Petscii: - if (textMode == TextScanMode.C64Petscii) { - charConv = CharEncoding.ConvertC64Petscii; - dciConv = CharEncoding.ConvertLowAndHighC64Petscii; - } - break; - case FormatDescriptor.SubType.C64Screen: - if (textMode == TextScanMode.C64ScreenCode) { - charConv = CharEncoding.ConvertC64ScreenCode; - dciConv = CharEncoding.ConvertLowAndHighC64ScreenCode; - } + charConv = CharEncoding.ConvertAscii; + dciConv = CharEncoding.ConvertLowAndHighAscii; break; case FormatDescriptor.SubType.HighAscii: - // not supported + charConv = CharEncoding.ConvertHighAscii; + dciConv = CharEncoding.ConvertLowAndHighAscii; + break; + case FormatDescriptor.SubType.C64Petscii: + charConv = CharEncoding.ConvertC64Petscii; + dciConv = CharEncoding.ConvertLowAndHighC64Petscii; + break; + case FormatDescriptor.SubType.C64Screen: + charConv = CharEncoding.ConvertC64ScreenCode; + dciConv = CharEncoding.ConvertLowAndHighC64ScreenCode; + break; default: break; } @@ -620,6 +671,9 @@ namespace SourceGen.AsmGen { return; } + // Issue a .enc, if needed. + UpdateCharacterEncoding(dfd); + Formatter formatter = SourceFormatter; byte[] data = Project.FileData; int hiddenLeadingBytes = 0; @@ -646,6 +700,12 @@ namespace SourceGen.AsmGen { break; case FormatDescriptor.Type.StringDci: opcodeStr = sDataOpNames.StrDci; + if ((Project.FileData[offset] & 0x80) != 0) { + // ".shift" directive only works for strings where the low bit starts + // clear and ends high. + OutputNoJoy(offset, dfd.Length, labelStr, commentStr); + return; + } break; default: Debug.Assert(false); diff --git a/SourceGen/AsmGen/GenCommon.cs b/SourceGen/AsmGen/GenCommon.cs index 4e46c92..5fbec47 100644 --- a/SourceGen/AsmGen/GenCommon.cs +++ b/SourceGen/AsmGen/GenCommon.cs @@ -237,6 +237,9 @@ namespace SourceGen.AsmGen { string hash = gen.Quirks.BlockMoveArgsNoHash ? "" : "#"; formattedOperand = hash + opstr1 + "," + hash + opstr2; } else { + if (attr.DataDescriptor.IsStringOrCharacter) { + gen.UpdateCharacterEncoding(attr.DataDescriptor); + } formattedOperand = PseudoOp.FormatNumericOperand(formatter, proj.SymbolTable, gen.Localizer.LabelMap, attr.DataDescriptor, operandForSymbol, operandLen, opFlags); diff --git a/SourceGen/AsmGen/IGenerator.cs b/SourceGen/AsmGen/IGenerator.cs index ff09e20..5e51952 100644 --- a/SourceGen/AsmGen/IGenerator.cs +++ b/SourceGen/AsmGen/IGenerator.cs @@ -95,6 +95,16 @@ namespace SourceGen.AsmGen { /// null if the op is unsupported or broken and should be emitted as hex. string ModifyOpcode(int offset, OpDef op); + /// + /// Allows the generator to issue character encoding update instructions for source + /// files with more than one encoding. + /// + /// + /// This may be called for non-character numeric descriptors. + /// + /// Format descriptor for character or string. + void UpdateCharacterEncoding(FormatDescriptor dfd); + /// /// Generates an opcode/operand pair for a short sequence of bytes (1-4 bytes). /// Does not produce any source output. diff --git a/SourceGen/FormatDescriptor.cs b/SourceGen/FormatDescriptor.cs index 6e9ce28..bea50db 100644 --- a/SourceGen/FormatDescriptor.cs +++ b/SourceGen/FormatDescriptor.cs @@ -295,6 +295,24 @@ namespace SourceGen { } } + /// + /// True if the FormatDescriptor is a string or character. + /// + public bool IsStringOrCharacter { + get { + switch (FormatSubType) { + case SubType.ASCII_GENERIC: + case SubType.Ascii: + case SubType.HighAscii: + case SubType.C64Petscii: + case SubType.C64Screen: + return true; + default: + return false; + } + } + } + /// /// True if the FormatDescriptor has a symbol or is Numeric/Address. /// diff --git a/SourceGen/RuntimeData/Help/editors.html b/SourceGen/RuntimeData/Help/editors.html index 0f9b239..0f3ab8b 100644 --- a/SourceGen/RuntimeData/Help/editors.html +++ b/SourceGen/RuntimeData/Help/editors.html @@ -129,7 +129,12 @@ same value.

data you have selected is in the appropriate format. For example, "Null-terminated strings" is only enabled if the data regions are composed entirely of characters followed by $00. Zero-length strings -are allowed, but only if some non-zero-length strings are present.

+are allowed, but only if some non-zero-length strings are present. +DCI (Dextral Character Inverted) strings have the high bit on the last +byte flipped; for PETSCII this will usually look like a series of +lower-case letters followed by a capital letter, but may look odd if the +last character is punctuation (e.g. '!' becomes $A1, which is a +rectangle character that SourceGen will only display as hex).

The character encoding can be selected, offering a choice between plain ASCII, low + high ASCII, C64 PETSCII, and C64 screen codes. When you change the encoding, your available options may change. The @@ -137,7 +142,7 @@ low + high ASCII setting will accept both, configuring the appropriate encoding based on the data values, but when identifying multiple strings it requires that each individual string be entirely one or the other.

Due to fundamental limitations of the character set, C64 screen code -strings cannot be null terminated.

+strings cannot be null terminated ($00 is '@').

To avoid burying a label in the middle of a data item, contiguous areas are split at labels. This can sometimes have unexpected effects. For diff --git a/SourceGen/SGTestData/Expected/1000-allops-value-65816_64tass.S b/SourceGen/SGTestData/Expected/1000-allops-value-65816_64tass.S index 753cc77..c49cedd 100644 --- a/SourceGen/SGTestData/Expected/1000-allops-value-65816_64tass.S +++ b/SourceGen/SGTestData/Expected/1000-allops-value-65816_64tass.S @@ -1,6 +1,4 @@ .cpu "65816" - .enc sg_ascii - .cdef $20,$7e,$20 * = $1000 .as .xs diff --git a/SourceGen/SGTestData/Expected/1001-allops-zero-65816_64tass.S b/SourceGen/SGTestData/Expected/1001-allops-zero-65816_64tass.S index 7fd1c66..968251d 100644 --- a/SourceGen/SGTestData/Expected/1001-allops-zero-65816_64tass.S +++ b/SourceGen/SGTestData/Expected/1001-allops-zero-65816_64tass.S @@ -1,6 +1,4 @@ .cpu "65816" - .enc sg_ascii - .cdef $20,$7e,$20 * = $1000 .as .xs diff --git a/SourceGen/SGTestData/Expected/1002-embedded-instructions_64tass.S b/SourceGen/SGTestData/Expected/1002-embedded-instructions_64tass.S index adfb9e1..89af921 100644 --- a/SourceGen/SGTestData/Expected/1002-embedded-instructions_64tass.S +++ b/SourceGen/SGTestData/Expected/1002-embedded-instructions_64tass.S @@ -1,6 +1,4 @@ .cpu "65816" - .enc sg_ascii - .cdef $20,$7e,$20 * = $1000 .as .xs diff --git a/SourceGen/SGTestData/Expected/1003-flags-and-branches_64tass.S b/SourceGen/SGTestData/Expected/1003-flags-and-branches_64tass.S index e9baca2..78d101c 100644 --- a/SourceGen/SGTestData/Expected/1003-flags-and-branches_64tass.S +++ b/SourceGen/SGTestData/Expected/1003-flags-and-branches_64tass.S @@ -1,6 +1,4 @@ .cpu "65816" - .enc sg_ascii - .cdef $20,$7e,$20 * = $1000 .as .xs diff --git a/SourceGen/SGTestData/Expected/2000-allops-value-6502_64tass.S b/SourceGen/SGTestData/Expected/2000-allops-value-6502_64tass.S index ed734a8..fb631c9 100644 --- a/SourceGen/SGTestData/Expected/2000-allops-value-6502_64tass.S +++ b/SourceGen/SGTestData/Expected/2000-allops-value-6502_64tass.S @@ -1,6 +1,4 @@ .cpu "6502i" - .enc sg_ascii - .cdef $20,$7e,$20 * = $1000 jsr L1035 jsr L1038 diff --git a/SourceGen/SGTestData/Expected/2001-allops-zero-6502_64tass.S b/SourceGen/SGTestData/Expected/2001-allops-zero-6502_64tass.S index cd4914a..20b9367 100644 --- a/SourceGen/SGTestData/Expected/2001-allops-zero-6502_64tass.S +++ b/SourceGen/SGTestData/Expected/2001-allops-zero-6502_64tass.S @@ -1,6 +1,4 @@ .cpu "6502i" - .enc sg_ascii - .cdef $20,$7e,$20 * = $1000 jsr L1035 jsr L1038 diff --git a/SourceGen/SGTestData/Expected/2002-allops-value-65C02_64tass.S b/SourceGen/SGTestData/Expected/2002-allops-value-65C02_64tass.S index 24bab97..e15b12a 100644 --- a/SourceGen/SGTestData/Expected/2002-allops-value-65C02_64tass.S +++ b/SourceGen/SGTestData/Expected/2002-allops-value-65C02_64tass.S @@ -1,6 +1,4 @@ .cpu "65c02" - .enc sg_ascii - .cdef $20,$7e,$20 * = $1000 jsr L1014 jsr L108A diff --git a/SourceGen/SGTestData/Expected/2003-allops-zero-65C02_64tass.S b/SourceGen/SGTestData/Expected/2003-allops-zero-65C02_64tass.S index 7f00a61..c3c9c95 100644 --- a/SourceGen/SGTestData/Expected/2003-allops-zero-65C02_64tass.S +++ b/SourceGen/SGTestData/Expected/2003-allops-zero-65C02_64tass.S @@ -1,6 +1,4 @@ .cpu "65c02" - .enc sg_ascii - .cdef $20,$7e,$20 * = $1000 jsr L1014 jsr L108A diff --git a/SourceGen/SGTestData/Expected/2004-numeric-types_64tass.S b/SourceGen/SGTestData/Expected/2004-numeric-types_64tass.S index e89e053..f310257 100644 --- a/SourceGen/SGTestData/Expected/2004-numeric-types_64tass.S +++ b/SourceGen/SGTestData/Expected/2004-numeric-types_64tass.S @@ -1,7 +1,5 @@ ;Project file was edited to get all big-endian data types. .cpu "6502" - .enc sg_ascii - .cdef $20,$7e,$20 * = $1000 rts diff --git a/SourceGen/SGTestData/Expected/2005-string-types_64tass.S b/SourceGen/SGTestData/Expected/2005-string-types_64tass.S index fd79a72..1f2c2f6 100644 --- a/SourceGen/SGTestData/Expected/2005-string-types_64tass.S +++ b/SourceGen/SGTestData/Expected/2005-string-types_64tass.S @@ -1,5 +1,7 @@ ;Project file was edited to get zero-length strings and reverse DCI. .cpu "6502" + .enc sg_hiascii + .cdef $20,$7e,$a0 .enc sg_ascii .cdef $20,$7e,$20 * = $1000 @@ -7,13 +9,16 @@ .text "low ASCII str" .byte $80 - .byte $e8,$e9,$e7,$e8,$a0,$c1,$d3,$c3,$c9,$c9,$a0,$f3,$f4,$f2 + .enc sg_hiascii + .text "high ASCII str" .byte $80 + .enc sg_ascii .text "'low'quoted",$22,"''text" .byte $80 - .byte $a2,$e8,$e9,$e7,$e8,$a2,$f1,$f5,$ef,$f4,$e5,$e4,$a7,$a2,$a2,$f4 - .byte $e5,$f8,$f4 + .enc sg_hiascii + .text $a2,"high",$a2,"quoted'",$a2,$a2,"text" .byte $80 + .enc sg_ascii .text "01234567890123456789012345678901234567890123456789012345678901" .text "234567890123456789" .byte $80 @@ -45,14 +50,19 @@ .text "0123456789012345678901234567890123456789012345678901678901",$22 .text $22,$22 .byte $81 - .fill 62,$aa + .enc sg_hiascii + .text "**************************************************************" .byte $80 - .fill 96,$aa + .text "**************************************************************" + .text "**********************************" .byte $81 + .enc sg_ascii .text "ver IICSA wol" .byte $80 - .byte $f6,$e5,$f2,$a0,$c9,$c9,$c3,$d3,$c1,$a0,$e8,$e7,$e9,$e8 + .enc sg_hiascii + .text "ver IICSA hgih" .byte $80 + .enc sg_ascii .text ".eeht rof sllot ti ;sllot lleb eht mohw rof wonk ot dnes reven" .text " erofereht dna ,dniknam ni devlovni ma I esuaceb ,em sehsinimi" .text "d htaed snam ynA .erew nwo eniht fo ro sdneirf yht fo ronam a" @@ -65,13 +75,16 @@ .byte $80 .null "low ASCII strz" .byte $80 - .byte $e8,$e9,$e7,$e8,$a0,$c1,$d3,$c3,$c9,$c9,$a0,$f3,$f4,$f2,$fa,$00 + .enc sg_hiascii + .null "high ASCII strz" .byte $80 + .enc sg_ascii .null "'low'quoted",$22,"''text" .byte $80 - .byte $a2,$e8,$e9,$e7,$e8,$a2,$f1,$f5,$ef,$f4,$e5,$e4,$a7,$a2,$a2,$f4 - .byte $e5,$f8,$f4,$00 + .enc sg_hiascii + .null $a2,"high",$a2,"quoted'",$a2,$a2,"text" .byte $80 + .enc sg_ascii .text "012345678901234567890123456789012345678901234567890123456789''" .text "'",$00 .byte $80 @@ -82,13 +95,16 @@ .byte $80 .ptext "low ASCII str1" .byte $80 - .byte $0f,$e8,$e9,$e7,$e8,$a0,$c1,$d3,$c3,$c9,$c9,$a0,$f3,$f4,$f2,$b1 + .enc sg_hiascii + .ptext "high ASCII str1" .byte $80 + .enc sg_ascii .ptext "'low'quoted",$22,"''text" .byte $80 - .byte $13,$a2,$e8,$e9,$e7,$e8,$a2,$f1,$f5,$ef,$f4,$e5,$e4,$a7,$a2,$a2 - .byte $f4,$e5,$f8,$f4 + .enc sg_hiascii + .ptext $a2,"high",$a2,"quoted'",$a2,$a2,"text" .byte $80 + .enc sg_ascii .text $3f,"0123456789012345678901234567890123456789012345678901234567" .text "89'''" .byte $80 @@ -99,14 +115,16 @@ .byte $80 .text $0e,$00,"low ASCII str2" .byte $80 - .byte $0f,$00,$e8,$e9,$e7,$e8,$a0,$c1,$d3,$c3,$c9,$c9,$a0,$f3,$f4,$f2 - .byte $b2 + .enc sg_hiascii + .text $0f,$00,"high ASCII str2" .byte $80 + .enc sg_ascii .text $12,$00,"'low'quoted",$22,"''text" .byte $80 - .byte $13,$00,$a2,$e8,$e9,$e7,$e8,$a2,$f1,$f5,$ef,$f4,$e5,$e4,$a7,$a2 - .byte $a2,$f4,$e5,$f8,$f4 + .enc sg_hiascii + .text $13,$00,$a2,"high",$a2,"quoted'",$a2,$a2,"text" .byte $80 + .enc sg_ascii .text $3f,$00,"012345678901234567890123456789012345678901234567890123" .text "456789'''" .byte $80 @@ -123,13 +141,17 @@ .byte $81 .shift "low ASCII dci" .byte $80 + .enc sg_hiascii .byte $e8,$e9,$e7,$e8,$a0,$c1,$d3,$c3,$c9,$c9,$a0,$e4,$e3,$69 .byte $80 + .enc sg_ascii .shift "'low'quoted",$22,"''text" .byte $80 + .enc sg_hiascii .byte $a2,$e8,$e9,$e7,$e8,$a2,$f1,$f5,$ef,$f4,$e5,$e4,$a7,$a2,$a2,$f4 .byte $e5,$f8,$74 .byte $80 + .enc sg_ascii .text "012345678901234567890123456789012345678901234567890123456789''" .text $a7 .byte $80 diff --git a/SourceGen/SGTestData/Expected/2006-operand-formats_64tass.S b/SourceGen/SGTestData/Expected/2006-operand-formats_64tass.S index 1cf0673..f192c15 100644 --- a/SourceGen/SGTestData/Expected/2006-operand-formats_64tass.S +++ b/SourceGen/SGTestData/Expected/2006-operand-formats_64tass.S @@ -1,5 +1,7 @@ ;Project file was edited for some ASCII operands. .cpu "65816" + .enc sg_hiascii + .cdef $20,$7e,$a0 .enc sg_ascii .cdef $20,$7e,$20 * = $1000 diff --git a/SourceGen/SGTestData/Expected/2008-address-changes_64tass.S b/SourceGen/SGTestData/Expected/2008-address-changes_64tass.S index 6b7d3f1..533ffb9 100644 --- a/SourceGen/SGTestData/Expected/2008-address-changes_64tass.S +++ b/SourceGen/SGTestData/Expected/2008-address-changes_64tass.S @@ -1,6 +1,4 @@ .cpu "65816" - .enc sg_ascii - .cdef $20,$7e,$20 * = $1000 .as .xs diff --git a/SourceGen/SGTestData/Expected/2009-branches-and-banks_64tass.S b/SourceGen/SGTestData/Expected/2009-branches-and-banks_64tass.S index 8d953a5..a676e7e 100644 --- a/SourceGen/SGTestData/Expected/2009-branches-and-banks_64tass.S +++ b/SourceGen/SGTestData/Expected/2009-branches-and-banks_64tass.S @@ -1,6 +1,4 @@ .cpu "65816" - .enc sg_ascii - .cdef $20,$7e,$20 longsym = $123456 * = $1000 diff --git a/SourceGen/SGTestData/Expected/2011-hinting_64tass.S b/SourceGen/SGTestData/Expected/2011-hinting_64tass.S index 2c47b83..16c6d08 100644 --- a/SourceGen/SGTestData/Expected/2011-hinting_64tass.S +++ b/SourceGen/SGTestData/Expected/2011-hinting_64tass.S @@ -1,6 +1,4 @@ .cpu "6502" - .enc sg_ascii - .cdef $20,$7e,$20 * = $1000 .byte $03 .byte $02 diff --git a/SourceGen/SGTestData/Expected/2012-label-localizer_64tass.S b/SourceGen/SGTestData/Expected/2012-label-localizer_64tass.S index 43373d6..169d0b6 100644 --- a/SourceGen/SGTestData/Expected/2012-label-localizer_64tass.S +++ b/SourceGen/SGTestData/Expected/2012-label-localizer_64tass.S @@ -1,6 +1,4 @@ .cpu "65816" - .enc sg_ascii - .cdef $20,$7e,$20 REALLYLONGLABELNAME = $8888 ;that's a long name * = $1000 diff --git a/SourceGen/SGTestData/Expected/2013-notes-and-comments_64tass.S b/SourceGen/SGTestData/Expected/2013-notes-and-comments_64tass.S index 5030bad..ab4e8ad 100644 --- a/SourceGen/SGTestData/Expected/2013-notes-and-comments_64tass.S +++ b/SourceGen/SGTestData/Expected/2013-notes-and-comments_64tass.S @@ -14,8 +14,6 @@ ;* * ;*************************************** .cpu "6502" - .enc sg_ascii - .cdef $20,$7e,$20 plataddr = $3000 ;address only in platform file ;Short, unboxed comment here!! diff --git a/SourceGen/SGTestData/Expected/2014-label-dp_64tass.S b/SourceGen/SGTestData/Expected/2014-label-dp_64tass.S index 3ffce5b..b76f1d9 100644 --- a/SourceGen/SGTestData/Expected/2014-label-dp_64tass.S +++ b/SourceGen/SGTestData/Expected/2014-label-dp_64tass.S @@ -1,7 +1,5 @@ ;6502bench SourceGen v1.1.0-dev1 .cpu "65816" - .enc sg_ascii - .cdef $20,$7e,$20 * = $1000 .as .xs diff --git a/SourceGen/SGTestData/Expected/2015-64k-nops_64tass.S b/SourceGen/SGTestData/Expected/2015-64k-nops_64tass.S index dea6275..9718d2b 100644 --- a/SourceGen/SGTestData/Expected/2015-64k-nops_64tass.S +++ b/SourceGen/SGTestData/Expected/2015-64k-nops_64tass.S @@ -1,6 +1,4 @@ .cpu "6502" - .enc sg_ascii - .cdef $20,$7e,$20 * = $0000 nop nop diff --git a/SourceGen/SGTestData/Expected/2016-char-encoding-a_64tass.S b/SourceGen/SGTestData/Expected/2016-char-encoding-a_64tass.S index c53a433..e80bfe9 100644 --- a/SourceGen/SGTestData/Expected/2016-char-encoding-a_64tass.S +++ b/SourceGen/SGTestData/Expected/2016-char-encoding-a_64tass.S @@ -1,5 +1,7 @@ ;Project edited to mark some non-ASCII operands as ASCII. .cpu "65816" + .enc sg_hiascii + .cdef $20,$7e,$a0 .enc sg_ascii .cdef $20,$7e,$20 * = $1000 @@ -10,123 +12,133 @@ sep #$30 lda #'A' lda #'A' | $80 - lda #$c1 - lda #$41 + .enc none + lda #'A' + .enc screen + lda #'A' + .enc sg_ascii ldx #'a' ldx #'a' | $80 - ldx #$41 - ldx #$01 + .enc none + ldx #'a' + .enc screen + ldx #'a' + .enc sg_ascii lda #$7f lda #$7f + .enc none lda #$7f + .enc screen lda #$7f + .enc sg_ascii lda #$0d rep #$30 .al .xl lda #'B' lda #'B' | $80 - lda #$c2 - lda #$42 + .enc none + lda #'B' + .enc screen + lda #'B' sep #$30 .as .xs rts + .enc sg_ascii .byte 'C' .byte 'C' | $80 - .byte $c3 - .byte $43 + .enc none + .byte 'C' + .enc screen + .byte 'C' + .enc sg_ascii .word 'd' .word 'd' | $80 - .word $44 - .word $04 + .enc none + .word 'd' + .enc screen + .word 'd' .byte $00,$45 .byte $00,$c5 .byte $00,$c5 .byte $00,$45 .byte $80 + .enc sg_ascii .text "low ASCII str" - .byte $e8,$e9,$e7,$e8,$a0,$c1,$d3,$c3,$c9,$c9,$a0,$f3,$f4,$f2 + .enc sg_hiascii + .text "high ASCII str" .byte $80 - .byte $d0,$c5,$d4,$d3,$c3,$c9,$c9,$20,$53,$54,$52 + .enc none + .text "PETSCII str" .byte $80 - .byte $53,$03,$12,$05,$05,$0e,$20,$43,$0f,$04,$05,$20,$13,$14,$12 + .enc screen + .text "Screen Code str" .byte $82 + .enc sg_ascii .text $07,"Low ASCII CRLF",$0d,$0a .byte $82 - .byte $87,$c8,$e9,$e7,$e8,$a0,$c1,$d3,$c3,$c9,$c9,$a0,$c3,$d2,$cc,$c6 - .byte $8d,$8a + .enc sg_hiascii + .text $87,"High ASCII CRLF",$8d,$8a .byte $82 - .byte $93,$d0,$c5,$d4,$d3,$c3,$c9,$c9,$20,$57,$49,$54,$48,$20,$96,$43 - .byte $4f,$4e,$54,$52,$4f,$4c,$05,$20,$43,$4f,$44,$45,$53,$0d + .enc none + .text $93,"PETSCII with ",$96,"control",$05," codes",$0d .byte $83 + .enc sg_ascii .text " !",$22,"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" .text "XYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~" .byte $83 - .byte $a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8,$a9,$aa,$ab,$ac,$ad,$ae,$af - .byte $b0,$b1,$b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9,$ba,$bb,$bc,$bd,$be,$bf - .byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$ca,$cb,$cc,$cd,$ce,$cf - .byte $d0,$d1,$d2,$d3,$d4,$d5,$d6,$d7,$d8,$d9,$da,$db,$dc,$dd,$de,$df - .byte $e0,$e1,$e2,$e3,$e4,$e5,$e6,$e7,$e8,$e9,$ea,$eb,$ec,$ed,$ee,$ef - .byte $f0,$f1,$f2,$f3,$f4,$f5,$f6,$f7,$f8,$f9,$fa,$fb,$fc,$fd,$fe + .enc sg_hiascii + .text " !",$a2,"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" + .text "XYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~" .byte $83 - .byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2a,$2b,$2c,$2d,$2e,$2f - .byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f - .byte $40,$c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$ca,$cb,$cc,$cd,$ce,$cf - .byte $d0,$d1,$d2,$d3,$d4,$d5,$d6,$d7,$d8,$d9,$da,$5b + .enc none + .text " !",$22,"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" + .text "XYZ[" .byte $5c - .byte $5d + .byte ']' .byte $5e .byte $5f .byte $60 - .byte $41,$42,$43,$44,$45,$46,$47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f,$50 - .byte $51,$52,$53,$54,$55,$56,$57,$58,$59,$5a + .text "abcdefghijklmnopqrstuvwxyz" + .enc sg_ascii .text "{|}~" .byte $83 - .byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2a,$2b,$2c,$2d,$2e,$2f - .byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f - .byte $00,$41,$42,$43,$44,$45,$46,$47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f - .byte $50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5a,$1b + .enc screen + .text " !",$22,"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" + .text "XYZ[" .byte $1c - .byte $1d + .byte ']' .byte $1e .byte $1f .byte $40 - .byte $01,$02,$03,$04,$05,$06,$07,$08,$09,$0a,$0b,$0c,$0d,$0e,$0f,$10 - .byte $11,$12,$13,$14,$15,$16,$17,$18,$19,$1a + .text "abcdefghijklmnopqrstuvwxyz" + .enc sg_ascii .text "{|}~" .byte $84 - .byte $c9,$c9,$c3,$d3,$d4,$c5,$d0,$20,$45,$53,$52,$45,$56,$45,$52 + .enc none + .text "IICSTEP esrever" .byte $84 - .byte $4e,$55,$4c,$4c,$20,$54,$45,$52,$4d,$20,$d0,$c5,$d4,$d3,$c3,$c9 - .byte $c9,$00 + .null "null term PETSCII" .byte $84 - .byte $d4,$48,$49,$53,$20,$4e,$55,$4c,$4c,$2d,$54,$45,$52,$4d,$49,$4e - .byte $41,$54,$45,$44,$20,$53,$54,$52,$49,$4e,$47,$20,$49,$53,$20,$54 - .byte $4f,$4f,$20,$4c,$4f,$4e,$47,$20,$54,$4f,$20,$46,$49,$54,$20,$4f - .byte $4e,$20,$41,$20,$53,$49,$4e,$47,$4c,$45,$20,$4c,$49,$4e,$45,$2c - .byte $20,$41,$4e,$44,$20,$57,$49,$4c,$4c,$20,$42,$45,$20,$53,$50,$4c - .byte $49,$54,$2e,$00 + .text "This null-terminated string is too long to fit on a single lin" + .text "e, and will be split.",$00 .byte $84 - .byte $13,$d0,$c5,$d4,$d3,$c3,$c9,$c9,$20,$57,$49,$54,$48,$20,$4c,$45 - .byte $4e,$47,$54,$48 + .ptext "PETSCII with length" .byte $84 - .byte $14,$00,$d0,$c5,$d4,$d3,$c3,$c9,$c9,$20,$57,$49,$54,$48,$20,$4c - .byte $45,$4e,$47,$54,$48,$32 + .text $14,$00,"PETSCII with length2" .byte $84 - .byte $50,$45,$54,$20,$44,$43,$c9 + .shift "pet dci" .byte $84 - .byte $05,$04,$0f,$43,$20,$0e,$05,$05,$12,$03,$53,$20,$05,$13,$12,$05 - .byte $16,$05,$12 + .enc screen + .text "edoC neercS esrever" .byte $84 - .byte $17,$53,$03,$12,$05,$05,$0e,$20,$43,$0f,$04,$05,$20,$17,$09,$14 - .byte $08,$20,$0c,$05,$0e,$07,$14,$08 + .ptext "Screen Code with length" .byte $84 - .byte $18,$00,$53,$03,$12,$05,$05,$0e,$20,$43,$0f,$04,$05,$20,$17,$09 - .byte $14,$08,$20,$0c,$05,$0e,$07,$14,$08,$32 + .text $18,$00,"Screen Code with length2" .byte $84 - .byte $53,$03,$12,$05,$05,$0e,$20,$43,$0f,$04,$05,$20,$44,$43,$c9 + .shift "Screen Code DCI" .byte $84 .byte $85 ;$00-ff block @@ -162,6 +174,7 @@ .byte $1d .byte $1e .byte $1f + .enc sg_ascii .text " !",$22,"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" .text "XYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~" .byte $7f diff --git a/SourceGen/SGTestData/Expected/2017-char-encoding-p_64tass.S b/SourceGen/SGTestData/Expected/2017-char-encoding-p_64tass.S index 25ac70b..fd0b87d 100644 --- a/SourceGen/SGTestData/Expected/2017-char-encoding-p_64tass.S +++ b/SourceGen/SGTestData/Expected/2017-char-encoding-p_64tass.S @@ -1,78 +1,99 @@ ;Project edited to mark some non-ASCII operands as ASCII. .cpu "65816" + .enc sg_hiascii + .cdef $20,$7e,$a0 + .enc sg_ascii + .cdef $20,$7e,$20 * = $1000 .as .xs clc xce sep #$30 - lda #$41 - lda #$c1 lda #'A' - lda #$41 - ldx #$61 - ldx #$e1 + lda #'A' | $80 + .enc none + lda #'A' + .enc screen + lda #'A' + .enc sg_ascii ldx #'a' - ldx #$01 + ldx #'a' | $80 + .enc none + ldx #'a' + .enc screen + ldx #'a' + .enc sg_ascii lda #$7f lda #$7f + .enc none lda #$7f + .enc screen lda #$7f + .enc sg_ascii lda #$0d rep #$30 .al .xl - lda #$42 - lda #$c2 lda #'B' - lda #$42 + lda #'B' | $80 + .enc none + lda #'B' + .enc screen + lda #'B' sep #$30 .as .xs rts - .byte $43 - .byte $c3 + .enc sg_ascii .byte 'C' - .byte $43 - .word $64 - .word $e4 + .byte 'C' | $80 + .enc none + .byte 'C' + .enc screen + .byte 'C' + .enc sg_ascii + .word 'd' + .word 'd' | $80 + .enc none + .word 'd' + .enc screen .word 'd' - .word $04 .byte $00,$45 .byte $00,$c5 .byte $00,$c5 .byte $00,$45 .byte $80 - .byte $6c,$6f,$77,$20,$41,$53,$43,$49,$49,$20,$73,$74,$72 - .byte $e8,$e9,$e7,$e8,$a0,$c1,$d3,$c3,$c9,$c9,$a0,$f3,$f4,$f2 + .enc sg_ascii + .text "low ASCII str" + .enc sg_hiascii + .text "high ASCII str" .byte $80 + .enc none .text "PETSCII str" .byte $80 - .byte $53,$03,$12,$05,$05,$0e,$20,$43,$0f,$04,$05,$20,$13,$14,$12 + .enc screen + .text "Screen Code str" .byte $82 - .byte $07,$4c,$6f,$77,$20,$41,$53,$43,$49,$49,$20,$43,$52,$4c,$46,$0d - .byte $0a + .enc sg_ascii + .text $07,"Low ASCII CRLF",$0d,$0a .byte $82 - .byte $87,$c8,$e9,$e7,$e8,$a0,$c1,$d3,$c3,$c9,$c9,$a0,$c3,$d2,$cc,$c6 - .byte $8d,$8a + .enc sg_hiascii + .text $87,"High ASCII CRLF",$8d,$8a .byte $82 + .enc none .text $93,"PETSCII with ",$96,"control",$05," codes",$0d .byte $83 - .byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2a,$2b,$2c,$2d,$2e,$2f - .byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f - .byte $40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f - .byte $50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5a,$5b,$5c,$5d,$5e,$5f - .byte $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6a,$6b,$6c,$6d,$6e,$6f - .byte $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e + .enc sg_ascii + .text " !",$22,"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" + .text "XYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~" .byte $83 - .byte $a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8,$a9,$aa,$ab,$ac,$ad,$ae,$af - .byte $b0,$b1,$b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9,$ba,$bb,$bc,$bd,$be,$bf - .byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$ca,$cb,$cc,$cd,$ce,$cf - .byte $d0,$d1,$d2,$d3,$d4,$d5,$d6,$d7,$d8,$d9,$da,$db,$dc,$dd,$de,$df - .byte $e0,$e1,$e2,$e3,$e4,$e5,$e6,$e7,$e8,$e9,$ea,$eb,$ec,$ed,$ee,$ef - .byte $f0,$f1,$f2,$f3,$f4,$f5,$f6,$f7,$f8,$f9,$fa,$fb,$fc,$fd,$fe + .enc sg_hiascii + .text " !",$a2,"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" + .text "XYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~" .byte $83 + .enc none .text " !",$22,"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" .text "XYZ[" .byte $5c @@ -86,22 +107,21 @@ .byte $7d .byte $7e .byte $83 - .byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2a,$2b,$2c,$2d,$2e,$2f - .byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f - .byte $00,$41,$42,$43,$44,$45,$46,$47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f - .byte $50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5a,$1b + .enc screen + .text " !",$22,"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" + .text "XYZ[" .byte $1c - .byte $1d + .byte ']' .byte $1e .byte $1f .byte $40 - .byte $01,$02,$03,$04,$05,$06,$07,$08,$09,$0a,$0b,$0c,$0d,$0e,$0f,$10 - .byte $11,$12,$13,$14,$15,$16,$17,$18,$19,$1a + .text "abcdefghijklmnopqrstuvwxyz" .byte $7b .byte $7c .byte $7d .byte $7e .byte $84 + .enc none .text "IICSTEP esrever" .byte $84 .null "null term PETSCII" @@ -115,16 +135,14 @@ .byte $84 .shift "pet dci" .byte $84 - .byte $05,$04,$0f,$43,$20,$0e,$05,$05,$12,$03,$53,$20,$05,$13,$12,$05 - .byte $16,$05,$12 + .enc screen + .text "edoC neercS esrever" .byte $84 - .byte $17,$53,$03,$12,$05,$05,$0e,$20,$43,$0f,$04,$05,$20,$17,$09,$14 - .byte $08,$20,$0c,$05,$0e,$07,$14,$08 + .ptext "Screen Code with length" .byte $84 - .byte $18,$00,$53,$03,$12,$05,$05,$0e,$20,$43,$0f,$04,$05,$20,$17,$09 - .byte $14,$08,$20,$0c,$05,$0e,$07,$14,$08,$32 + .text $18,$00,"Screen Code with length2" .byte $84 - .byte $53,$03,$12,$05,$05,$0e,$20,$43,$0f,$04,$05,$20,$44,$43,$c9 + .shift "Screen Code DCI" .byte $84 .byte $85 ;$00-ff block @@ -158,6 +176,7 @@ .byte $1b .byte $1c .byte $1d + .enc none .text $1e,$1f," !",$22,"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmno" .text "pqrstuvwxyz[" .byte $5c diff --git a/SourceGen/SGTestData/Expected/2018-char-encoding-s_64tass.S b/SourceGen/SGTestData/Expected/2018-char-encoding-s_64tass.S index 6894a54..3a51414 100644 --- a/SourceGen/SGTestData/Expected/2018-char-encoding-s_64tass.S +++ b/SourceGen/SGTestData/Expected/2018-char-encoding-s_64tass.S @@ -1,96 +1,113 @@ ;Project edited to mark some non-ASCII operands as ASCII. .cpu "65816" - .enc screen + .enc sg_hiascii + .cdef $20,$7e,$a0 + .enc sg_ascii + .cdef $20,$7e,$20 * = $1000 .as .xs clc xce sep #$30 - lda #$41 - lda #$c1 - lda #$c1 lda #'A' - ldx #$61 - ldx #$e1 - ldx #$41 + lda #'A' | $80 + .enc none + lda #'A' + .enc screen + lda #'A' + .enc sg_ascii ldx #'a' + ldx #'a' | $80 + .enc none + ldx #'a' + .enc screen + ldx #'a' + .enc sg_ascii lda #$7f lda #$7f + .enc none lda #$7f + .enc screen lda #$7f + .enc sg_ascii lda #$0d rep #$30 .al .xl - lda #$42 - lda #$c2 - lda #$c2 + lda #'B' + lda #'B' | $80 + .enc none + lda #'B' + .enc screen lda #'B' sep #$30 .as .xs rts - .byte $43 - .byte $c3 - .byte $c3 + .enc sg_ascii .byte 'C' - .word $64 - .word $e4 - .word $44 + .byte 'C' | $80 + .enc none + .byte 'C' + .enc screen + .byte 'C' + .enc sg_ascii + .word 'd' + .word 'd' | $80 + .enc none + .word 'd' + .enc screen .word 'd' .byte $00,$45 .byte $00,$c5 .byte $00,$c5 .byte $00,$45 .byte $80 - .byte $6c,$6f,$77,$20,$41,$53,$43,$49,$49,$20,$73,$74,$72 - .byte $e8,$e9,$e7,$e8,$a0,$c1,$d3,$c3,$c9,$c9,$a0,$f3,$f4,$f2 + .enc sg_ascii + .text "low ASCII str" + .enc sg_hiascii + .text "high ASCII str" .byte $80 - .byte $d0,$c5,$d4,$d3,$c3,$c9,$c9,$20,$53,$54,$52 + .enc none + .text "PETSCII str" .byte $80 + .enc screen .text "Screen Code str" .byte $82 - .byte $07,$4c,$6f,$77,$20,$41,$53,$43,$49,$49,$20,$43,$52,$4c,$46,$0d - .byte $0a + .enc sg_ascii + .text $07,"Low ASCII CRLF",$0d,$0a .byte $82 - .byte $87,$c8,$e9,$e7,$e8,$a0,$c1,$d3,$c3,$c9,$c9,$a0,$c3,$d2,$cc,$c6 - .byte $8d,$8a + .enc sg_hiascii + .text $87,"High ASCII CRLF",$8d,$8a .byte $82 - .byte $93,$d0,$c5,$d4,$d3,$c3,$c9,$c9,$20,$57,$49,$54,$48,$20,$96,$43 - .byte $4f,$4e,$54,$52,$4f,$4c,$05,$20,$43,$4f,$44,$45,$53,$0d + .enc none + .text $93,"PETSCII with ",$96,"control",$05," codes",$0d .byte $83 - .byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2a,$2b,$2c,$2d,$2e,$2f - .byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f - .byte $40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f - .byte $50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5a,$5b,$5c,$5d,$5e,$5f - .byte $60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6a,$6b,$6c,$6d,$6e,$6f - .byte $70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$7a,$7b,$7c,$7d,$7e + .enc sg_ascii + .text " !",$22,"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" + .text "XYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~" .byte $83 - .byte $a0,$a1,$a2,$a3,$a4,$a5,$a6,$a7,$a8,$a9,$aa,$ab,$ac,$ad,$ae,$af - .byte $b0,$b1,$b2,$b3,$b4,$b5,$b6,$b7,$b8,$b9,$ba,$bb,$bc,$bd,$be,$bf - .byte $c0,$c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$ca,$cb,$cc,$cd,$ce,$cf - .byte $d0,$d1,$d2,$d3,$d4,$d5,$d6,$d7,$d8,$d9,$da,$db,$dc,$dd,$de,$df - .byte $e0,$e1,$e2,$e3,$e4,$e5,$e6,$e7,$e8,$e9,$ea,$eb,$ec,$ed,$ee,$ef - .byte $f0,$f1,$f2,$f3,$f4,$f5,$f6,$f7,$f8,$f9,$fa,$fb,$fc,$fd,$fe + .enc sg_hiascii + .text " !",$a2,"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" + .text "XYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~" .byte $83 - .byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2a,$2b,$2c,$2d,$2e,$2f - .byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$3f - .byte $40,$c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$ca,$cb,$cc,$cd,$ce,$cf - .byte $d0,$d1,$d2,$d3,$d4,$d5,$d6,$d7,$d8,$d9,$da,$5b + .enc none + .text " !",$22,"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" + .text "XYZ[" .byte $5c - .byte $5d + .byte ']' .byte $5e .byte $5f .byte $60 - .byte $41,$42,$43,$44,$45,$46,$47,$48,$49,$4a,$4b,$4c,$4d,$4e,$4f,$50 - .byte $51,$52,$53,$54,$55,$56,$57,$58,$59,$5a + .text "abcdefghijklmnopqrstuvwxyz" .byte $7b .byte $7c .byte $7d .byte $7e .byte $83 + .enc screen .text " !",$22,"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" .text "XYZ[" .byte $1c @@ -104,26 +121,21 @@ .byte $7d .byte $7e .byte $84 - .byte $c9,$c9,$c3,$d3,$d4,$c5,$d0,$20,$45,$53,$52,$45,$56,$45,$52 + .enc none + .text "IICSTEP esrever" .byte $84 - .byte $4e,$55,$4c,$4c,$20,$54,$45,$52,$4d,$20,$d0,$c5,$d4,$d3,$c3,$c9 - .byte $c9,$00 + .null "null term PETSCII" .byte $84 - .byte $d4,$48,$49,$53,$20,$4e,$55,$4c,$4c,$2d,$54,$45,$52,$4d,$49,$4e - .byte $41,$54,$45,$44,$20,$53,$54,$52,$49,$4e,$47,$20,$49,$53,$20,$54 - .byte $4f,$4f,$20,$4c,$4f,$4e,$47,$20,$54,$4f,$20,$46,$49,$54,$20,$4f - .byte $4e,$20,$41,$20,$53,$49,$4e,$47,$4c,$45,$20,$4c,$49,$4e,$45,$2c - .byte $20,$41,$4e,$44,$20,$57,$49,$4c,$4c,$20,$42,$45,$20,$53,$50,$4c - .byte $49,$54,$2e,$00 + .text "This null-terminated string is too long to fit on a single lin" + .text "e, and will be split.",$00 .byte $84 - .byte $13,$d0,$c5,$d4,$d3,$c3,$c9,$c9,$20,$57,$49,$54,$48,$20,$4c,$45 - .byte $4e,$47,$54,$48 + .ptext "PETSCII with length" .byte $84 - .byte $14,$00,$d0,$c5,$d4,$d3,$c3,$c9,$c9,$20,$57,$49,$54,$48,$20,$4c - .byte $45,$4e,$47,$54,$48,$32 + .text $14,$00,"PETSCII with length2" .byte $84 - .byte $50,$45,$54,$20,$44,$43,$c9 + .shift "pet dci" .byte $84 + .enc screen .text "edoC neercS esrever" .byte $84 .ptext "Screen Code with length"