1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-01 07:50:37 +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; charConv = CharEncoding.ConvertAscii;
break; break;
case FormatDescriptor.SubType.HighAscii: case FormatDescriptor.SubType.HighAscii:
// Can't !xor the output, because while it works for string data it opcodeStr = sDataOpNames.StrGeneric;
// also flips the high bits on unprintable bytes output as raw hex. charConv = CharEncoding.ConvertHighAscii;
OutputNoJoy(offset, dfd.Length, labelStr, commentStr); break;
return;
case FormatDescriptor.SubType.C64Petscii: case FormatDescriptor.SubType.C64Petscii:
opcodeStr = "!pet"; opcodeStr = "!pet";
charConv = CharEncoding.ConvertC64Petscii; charConv = CharEncoding.ConvertC64Petscii;
@ -595,16 +594,23 @@ namespace SourceGen.AsmGen {
stropf.FeedBytes(data, offset, dfd.Length, leadingBytes, stropf.FeedBytes(data, offset, dfd.Length, leadingBytes,
StringOpFormatter.ReverseMode.Forward); StringOpFormatter.ReverseMode.Forward);
//if (dfd.FormatSubType == FormatDescriptor.SubType.HighAscii) { if (dfd.FormatSubType == FormatDescriptor.SubType.HighAscii && stropf.HasEscapedText) {
// OutputLine(string.Empty, "!xor", "$80 {", string.Empty); // 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) { foreach (string str in stropf.Lines) {
OutputLine(labelStr, opcodeStr, str, commentStr); OutputLine(labelStr, opcodeStr, str, commentStr);
labelStr = commentStr = string.Empty; // only show on first labelStr = commentStr = string.Empty; // only show on first
} }
//if (dfd.FormatSubType == FormatDescriptor.SubType.HighAscii) { if (dfd.FormatSubType == FormatDescriptor.SubType.HighAscii) {
// OutputLine(string.Empty, "}", string.Empty, string.Empty); OutputLine(string.Empty, "}", string.Empty, string.Empty);
//} }
} }
} }

View File

@ -5,7 +5,9 @@
!text "low ASCII str" !text "low ASCII str"
!byte $80 !byte $80
!hex e8e9e7e8a0c1d3c3c9c9a0f3f4f2 !xor $80 {
!text "high ASCII str"
}
!byte $80 !byte $80
!text "'low'quoted",$22,"''text" !text "'low'quoted",$22,"''text"
!byte $80 !byte $80
@ -42,13 +44,20 @@
!text "0123456789012345678901234567890123456789012345678901678901",$22 !text "0123456789012345678901234567890123456789012345678901678901",$22
!text $22,$22 !text $22,$22
!byte $81 !byte $81
!fill 62,$aa !xor $80 {
!text "**************************************************************"
}
!byte $80 !byte $80
!fill 96,$aa !xor $80 {
!text "**************************************************************"
!text "**********************************"
}
!byte $81 !byte $81
!text "ver IICSA wol" !text "ver IICSA wol"
!byte $80 !byte $80
!hex f6e5f2a0c9c9c3d3c1a0e8e7e9e8 !xor $80 {
!text "ver IICSA hgih"
}
!byte $80 !byte $80
!text ".eeht rof sllot ti ;sllot lleb eht mohw rof wonk ot dnes reven" !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 " erofereht dna ,dniknam ni devlovni ma I esuaceb ,em sehsinimi"

View File

@ -45,7 +45,9 @@
!byte $00,$45 !byte $00,$45
!byte $80 !byte $80
!text "low ASCII str" !text "low ASCII str"
!hex e8e9e7e8a0c1d3c3c9c9a0f3f4f2 !xor $80 {
!text "high ASCII str"
}
!byte $80 !byte $80
!pet "PETSCII str" !pet "PETSCII str"
!byte $80 !byte $80

View File

@ -45,7 +45,9 @@
!byte $00,$45 !byte $00,$45
!byte $80 !byte $80
!text "low ASCII str" !text "low ASCII str"
!hex e8e9e7e8a0c1d3c3c9c9a0f3f4f2 !xor $80 {
!text "high ASCII str"
}
!byte $80 !byte $80
!pet "PETSCII str" !pet "PETSCII str"
!byte $80 !byte $80

View File

@ -45,7 +45,9 @@
!byte $00,$45 !byte $00,$45
!byte $80 !byte $80
!text "low ASCII str" !text "low ASCII str"
!hex e8e9e7e8a0c1d3c3c9c9a0f3f4f2 !xor $80 {
!text "high ASCII str"
}
!byte $80 !byte $80
!pet "PETSCII str" !pet "PETSCII str"
!byte $80 !byte $80