diff --git a/SourceGen/AsmGen/AsmAcme.cs b/SourceGen/AsmGen/AsmAcme.cs index 393fb3b..705e73c 100644 --- a/SourceGen/AsmGen/AsmAcme.cs +++ b/SourceGen/AsmGen/AsmAcme.cs @@ -549,10 +549,9 @@ namespace SourceGen.AsmGen { charConv = CharEncoding.ConvertAscii; break; case FormatDescriptor.SubType.HighAscii: - // Can't !xor the output, because while it works for string data it - // also flips the high bits on unprintable bytes output as raw hex. - OutputNoJoy(offset, dfd.Length, labelStr, commentStr); - return; + opcodeStr = sDataOpNames.StrGeneric; + charConv = CharEncoding.ConvertHighAscii; + break; case FormatDescriptor.SubType.C64Petscii: opcodeStr = "!pet"; charConv = CharEncoding.ConvertC64Petscii; @@ -595,16 +594,23 @@ namespace SourceGen.AsmGen { stropf.FeedBytes(data, offset, dfd.Length, leadingBytes, StringOpFormatter.ReverseMode.Forward); - //if (dfd.FormatSubType == FormatDescriptor.SubType.HighAscii) { - // OutputLine(string.Empty, "!xor", "$80 {", string.Empty); - //} + if (dfd.FormatSubType == FormatDescriptor.SubType.HighAscii && stropf.HasEscapedText) { + // Can't !xor the output, because while it works for string data it + // also flips the high bits on the unprintable bytes we output as raw hex. + OutputNoJoy(offset, dfd.Length, labelStr, commentStr); + return; + } + + if (dfd.FormatSubType == FormatDescriptor.SubType.HighAscii) { + OutputLine(string.Empty, "!xor", "$80 {", string.Empty); + } foreach (string str in stropf.Lines) { OutputLine(labelStr, opcodeStr, str, commentStr); labelStr = commentStr = string.Empty; // only show on first } - //if (dfd.FormatSubType == FormatDescriptor.SubType.HighAscii) { - // OutputLine(string.Empty, "}", string.Empty, string.Empty); - //} + if (dfd.FormatSubType == FormatDescriptor.SubType.HighAscii) { + OutputLine(string.Empty, "}", string.Empty, string.Empty); + } } } diff --git a/SourceGen/SGTestData/Expected/2005-string-types_acme.S b/SourceGen/SGTestData/Expected/2005-string-types_acme.S index 8e82a71..836a08b 100644 --- a/SourceGen/SGTestData/Expected/2005-string-types_acme.S +++ b/SourceGen/SGTestData/Expected/2005-string-types_acme.S @@ -5,7 +5,9 @@ !text "low ASCII str" !byte $80 - !hex e8e9e7e8a0c1d3c3c9c9a0f3f4f2 + !xor $80 { + !text "high ASCII str" + } !byte $80 !text "'low'quoted",$22,"''text" !byte $80 @@ -42,13 +44,20 @@ !text "0123456789012345678901234567890123456789012345678901678901",$22 !text $22,$22 !byte $81 - !fill 62,$aa + !xor $80 { + !text "**************************************************************" + } !byte $80 - !fill 96,$aa + !xor $80 { + !text "**************************************************************" + !text "**********************************" + } !byte $81 !text "ver IICSA wol" !byte $80 - !hex f6e5f2a0c9c9c3d3c1a0e8e7e9e8 + !xor $80 { + !text "ver IICSA hgih" + } !byte $80 !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" diff --git a/SourceGen/SGTestData/Expected/2016-char-encoding-a_acme.S b/SourceGen/SGTestData/Expected/2016-char-encoding-a_acme.S index a182155..4258744 100644 --- a/SourceGen/SGTestData/Expected/2016-char-encoding-a_acme.S +++ b/SourceGen/SGTestData/Expected/2016-char-encoding-a_acme.S @@ -45,7 +45,9 @@ !byte $00,$45 !byte $80 !text "low ASCII str" - !hex e8e9e7e8a0c1d3c3c9c9a0f3f4f2 + !xor $80 { + !text "high ASCII str" + } !byte $80 !pet "PETSCII str" !byte $80 diff --git a/SourceGen/SGTestData/Expected/2017-char-encoding-p_acme.S b/SourceGen/SGTestData/Expected/2017-char-encoding-p_acme.S index 3540bec..9b237ff 100644 --- a/SourceGen/SGTestData/Expected/2017-char-encoding-p_acme.S +++ b/SourceGen/SGTestData/Expected/2017-char-encoding-p_acme.S @@ -45,7 +45,9 @@ !byte $00,$45 !byte $80 !text "low ASCII str" - !hex e8e9e7e8a0c1d3c3c9c9a0f3f4f2 + !xor $80 { + !text "high ASCII str" + } !byte $80 !pet "PETSCII str" !byte $80 diff --git a/SourceGen/SGTestData/Expected/2018-char-encoding-s_acme.S b/SourceGen/SGTestData/Expected/2018-char-encoding-s_acme.S index 350728b..27dec34 100644 --- a/SourceGen/SGTestData/Expected/2018-char-encoding-s_acme.S +++ b/SourceGen/SGTestData/Expected/2018-char-encoding-s_acme.S @@ -45,7 +45,9 @@ !byte $00,$45 !byte $80 !text "low ASCII str" - !hex e8e9e7e8a0c1d3c3c9c9a0f3f4f2 + !xor $80 { + !text "high ASCII str" + } !byte $80 !pet "PETSCII str" !byte $80