1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-29 10:50:28 +00:00

Improve ACME high ASCII handling

We can !xor a high ASCII string so long as it doesn't include any
escaped characters.
This commit is contained in:
Andy McFadden 2019-08-17 17:35:01 -07:00
parent 6251edb5ed
commit 037b590967
5 changed files with 38 additions and 17 deletions

View File

@ -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);
}
}
}

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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