From b5d1881cf05ece82e6be997bbf56c77a755c1e19 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Tue, 8 Oct 2019 10:44:49 -0700 Subject: [PATCH] Add inline string script sample Also, updated LZ4FH sample, which needed to have explicit widths on a couple of zero-page pointers. Also, updated Zippy sample, which had a ton of unnecessary format entries for a couple of pointers. --- .../Examples/A2-Zippy/ZIPPY#ff2000.dis65 | 216 ++++++------------ .../Examples/A2-lz4fh/LZ4FH6502#060300.dis65 | 42 ++-- .../Examples/A2-lz4fh/LZ4FH65816#060300.dis65 | 32 +-- SourceGen/Examples/README.md | 3 +- SourceGen/Examples/Scripts/InlineNullTerm.cs | 69 ++++++ SourceGen/Examples/Scripts/Sample | Bin 0 -> 13 bytes SourceGen/Examples/Scripts/Sample.S | 8 + SourceGen/Examples/Scripts/Sample.dis65 | 24 ++ 8 files changed, 213 insertions(+), 181 deletions(-) create mode 100644 SourceGen/Examples/Scripts/InlineNullTerm.cs create mode 100644 SourceGen/Examples/Scripts/Sample create mode 100644 SourceGen/Examples/Scripts/Sample.S create mode 100644 SourceGen/Examples/Scripts/Sample.dis65 diff --git a/SourceGen/Examples/A2-Zippy/ZIPPY#ff2000.dis65 b/SourceGen/Examples/A2-Zippy/ZIPPY#ff2000.dis65 index e7daa1a..6167ec0 100644 --- a/SourceGen/Examples/A2-Zippy/ZIPPY#ff2000.dis65 +++ b/SourceGen/Examples/A2-Zippy/ZIPPY#ff2000.dis65 @@ -1,81 +1,81 @@ ### 6502bench SourceGen dis65 v1.0 ### { -"_ContentVersion":1,"FileDataLength":2087,"FileDataCrc32":315385475,"ProjectProps":{ -"CpuName":"65816","IncludeUndocumentedInstr":false,"EntryFlags":32702671,"AnalysisParams":{ -"AnalyzeUncategorizedData":true,"MinCharsForString":4,"SeekNearbyTargets":true}, +"_ContentVersion":2,"FileDataLength":2087,"FileDataCrc32":315385475,"ProjectProps":{ +"CpuName":"65816","IncludeUndocumentedInstr":false,"EntryFlags":32702671,"AutoLabelStyle":"Simple","AnalysisParams":{ +"AnalyzeUncategorizedData":true,"DefaultTextScanMode":"LowHighAscii","MinCharsForString":4,"SeekNearbyTargets":true,"SmartPlpHandling":true}, "PlatformSymbolFileIdentifiers":["RT:Apple/F8-ROM.sym65","RT:Apple/Cxxx-IO.sym65","RT:Apple/ProDOS8.sym65","RT:Apple/IIgs-ROM.sym65"],"ExtensionScriptFileIdentifiers":["RT:Apple/ProDOS8.cs","RT:Apple/IIgs-Toolbox.cs"],"ProjectSyms":{ "DR_ENAB":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"DR_ENAB","Value":1690,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"","HasWidth":false,"Label":"DR_ENAB","Value":1690,"Source":"Project","Type":"ExternalAddr"}, "DR_OPTA":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"DR_OPTA","Value":1739,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"","HasWidth":false,"Label":"DR_OPTA","Value":1739,"Source":"Project","Type":"ExternalAddr"}, "DR_OPTB":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"DR_OPTB","Value":1599,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"","HasWidth":false,"Label":"DR_OPTB","Value":1599,"Source":"Project","Type":"ExternalAddr"}, "DR_OPTC":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"DR_OPTC","Value":1847,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"","HasWidth":false,"Label":"DR_OPTC","Value":1847,"Source":"Project","Type":"ExternalAddr"}, "DR_OPTF":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"DR_OPTF","Value":1867,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"","HasWidth":false,"Label":"DR_OPTF","Value":1867,"Source":"Project","Type":"ExternalAddr"}, "DR_OPTP":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"DR_OPTP","Value":1719,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"","HasWidth":false,"Label":"DR_OPTP","Value":1719,"Source":"Project","Type":"ExternalAddr"}, "DR_SPDBAR":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"DR_SPDBAR","Value":1236,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"","HasWidth":false,"Label":"DR_SPDBAR","Value":1236,"Source":"Project","Type":"ExternalAddr"}, "ENABLE":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"Zip: R=bit options, W=enable card","Label":"ENABLE","Value":49243,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"Zip: R=bit options, W=enable card","HasWidth":false,"Label":"ENABLE","Value":49243,"Source":"Project","Type":"ExternalAddr"}, "LOCK":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"Zip: R=get speed, W=lock/unlock","Label":"LOCK","Value":49242,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"Zip: R=get speed, W=lock/unlock","HasWidth":false,"Label":"LOCK","Value":49242,"Source":"Project","Type":"ExternalAddr"}, "OPTIONS":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"Zip: R/W=bit options","Label":"OPTIONS","Value":49241,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"Zip: R/W=bit options","HasWidth":false,"Label":"OPTIONS","Value":49241,"Source":"Project","Type":"ExternalAddr"}, "PTR":{ "DataDescriptor":{ -"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"PTR","Value":2,"Source":"Project","Type":"ExternalAddr"}, +"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Comment":"","HasWidth":true,"Label":"PTR","Value":2,"Source":"Project","Type":"ExternalAddr"}, "PTR2":{ "DataDescriptor":{ -"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"PTR2","Value":4,"Source":"Project","Type":"ExternalAddr"}, +"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Comment":"","HasWidth":true,"Label":"PTR2","Value":4,"Source":"Project","Type":"ExternalAddr"}, "RESET":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"Zip: R=nop, W=force reset","Label":"RESET","Value":49240,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"Zip: R=nop, W=force reset","HasWidth":false,"Label":"RESET","Value":49240,"Source":"Project","Type":"ExternalAddr"}, "SLOTENAB":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"Zip: R/W=slot/speaker enable","Label":"SLOTENAB","Value":49244,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"Zip: R/W=slot/speaker enable","HasWidth":false,"Label":"SLOTENAB","Value":49244,"Source":"Project","Type":"ExternalAddr"}, "SPEED":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"Zip: R=bank, W=set speed","Label":"SPEED","Value":49245,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"Zip: R=bank, W=set speed","HasWidth":false,"Label":"SPEED","Value":49245,"Source":"Project","Type":"ExternalAddr"}, "TAG1":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"Zip","Label":"TAG1","Value":49246,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"Zip","HasWidth":false,"Label":"TAG1","Value":49246,"Source":"Project","Type":"ExternalAddr"}, "TAG2":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"Zip","Label":"TAG2","Value":49247,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"Zip","HasWidth":false,"Label":"TAG2","Value":49247,"Source":"Project","Type":"ExternalAddr"}, "TMP":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"TMP","Value":0,"Source":"Project","Type":"ExternalAddr"}}}, +"Comment":"","HasWidth":false,"Label":"TMP","Value":0,"Source":"Project","Type":"ExternalAddr"}}}, "AddressMap":[{ "Offset":0,"Addr":8192}],"TypeHints":[{ "Low":0,"High":0,"Hint":"Code"}],"StatusFlagOverrides":{ @@ -363,45 +363,38 @@ "2041":{ "Label":"color_loop","Value":10233,"Source":"User","Type":"LocalOrGlobalAddr"}, "2053":{ -"Label":"wait_loop","Value":10245,"Source":"User","Type":"LocalOrGlobalAddr"}}, +"Label":"wait_loop","Value":10245,"Source":"User","Type":"LocalOrGlobalAddr"}, +"133":{ +"Label":"noten","Value":8325,"Source":"User","Type":"LocalOrGlobalAddr"}}, "OperandFormats":{ "123":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, -"125":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"noten","Part":"Low"}}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "133":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "228":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "246":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "260":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "320":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "337":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "355":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "373":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "391":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "409":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "427":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "431":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, -"433":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"notnum","Part":"Low"}}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "436":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, -"445":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"TMP","Part":"Low"}}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "591":{ "Length":3,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"statline","Part":"Low"}}, @@ -411,159 +404,123 @@ "601":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"screen_data","Part":"Low"}}, -"603":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}, "605":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"screen_data","Part":"High"}}, -"607":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}, -"611":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR2","Part":"Low"}}, -"617":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR2","Part":"Low"}}, -"628":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}, -"632":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}, -"651":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}, -"655":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}, "668":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "670":{ -"Length":39,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":39,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "709":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "711":{ -"Length":26,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":26,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "737":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "739":{ -"Length":8,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":8,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "747":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "749":{ -"Length":8,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":8,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "757":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "759":{ -"Length":8,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":8,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "767":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "769":{ -"Length":8,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":8,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "777":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "779":{ -"Length":8,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":8,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "787":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "789":{ -"Length":8,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":8,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "797":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "799":{ -"Length":8,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":8,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "807":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "809":{ -"Length":8,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":8,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "817":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "819":{ -"Length":22,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":22,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "841":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "843":{ -"Length":14,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":14,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "857":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "859":{ -"Length":14,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":14,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "873":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "875":{ -"Length":14,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":14,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "889":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "891":{ -"Length":14,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":14,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "905":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "907":{ -"Length":35,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":35,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "942":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "944":{ -"Length":41,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":41,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "985":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "987":{ -"Length":34,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":34,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "1021":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "1023":{ -"Length":34,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":34,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "1057":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "1059":{ -"Length":39,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":39,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "1098":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "1112":{ "Length":3,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"speed","Part":"Low"}}, "1177":{ -"Length":3,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":3,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "1188":{ "Length":3,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"speed","Part":"Low"}}, -"1211":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}, -"1236":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}, "1253":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "1255":{ "Length":3,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"speed","Part":"Low"}}, "1262":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "1264":{ "Length":3,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"speed","Part":"Low"}}, "1438":{ -"Length":33,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":33,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "1478":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"disabled_txt","Part":"Low"}}, "1482":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"enabled_txt","Part":"High"}}, -"1484":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}, "1488":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"enabled_txt","Part":"Low"}}, "1492":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"enabled_txt","Part":"High"}}, -"1494":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}, "1502":{ "Length":3,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"DR_ENAB","Part":"Low"}}, @@ -573,85 +530,55 @@ "1512":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"DR_OPTB","Part":"High"}}, -"1514":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR2","Part":"Low"}}, "1521":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"DR_OPTP","Part":"Low"}}, "1525":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"DR_OPTP","Part":"High"}}, -"1527":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR2","Part":"Low"}}, "1534":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"DR_OPTA","Part":"Low"}}, "1538":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"DR_OPTA","Part":"High"}}, -"1540":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR2","Part":"Low"}}, "1547":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"DR_OPTC","Part":"Low"}}, "1551":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"DR_OPTC","Part":"High"}}, -"1553":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR2","Part":"Low"}}, "1560":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"DR_OPTF","Part":"Low"}}, "1564":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"DR_OPTF","Part":"High"}}, -"1566":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR2","Part":"Low"}}, "1573":{ -"Length":10,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":10,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "1583":{ -"Length":10,"Format":"String","SubFormat":"CString","SymbolRef":null}, +"Length":10,"Format":"StringNullTerm","SubFormat":"HighAscii","SymbolRef":null}, "1602":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"disb_txt","Part":"Low"}}, -"1608":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}, "1612":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"enab_txt","Part":"Low"}}, "1616":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"enab_txt","Part":"High"}}, -"1618":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}, -"1652":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}, "1661":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"slow_txt","Part":"Low"}}, "1665":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"slow_txt","Part":"High"}}, -"1667":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR2","Part":"Low"}}, "1671":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"fast_txt","Part":"Low"}}, "1675":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Label":"fast_txt","Part":"High"}}, -"1677":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR2","Part":"Low"}}, "1704":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "1706":{ @@ -681,9 +608,9 @@ "1813":{ "Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "1829":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "1847":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2,"Format":"NumericLE","SubFormat":"HighAscii","SymbolRef":null}, "2000":{ "Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "2003":{ @@ -693,7 +620,6 @@ "Label":"color_data","Part":"Low"}}, "2017":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"color_data","Part":"High"}}, -"2019":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"PTR","Part":"Low"}}}} +"Label":"color_data","Part":"High"}}}, +"LvTables":{ +}} diff --git a/SourceGen/Examples/A2-lz4fh/LZ4FH6502#060300.dis65 b/SourceGen/Examples/A2-lz4fh/LZ4FH6502#060300.dis65 index 8aea974..85e7124 100644 --- a/SourceGen/Examples/A2-lz4fh/LZ4FH6502#060300.dis65 +++ b/SourceGen/Examples/A2-lz4fh/LZ4FH6502#060300.dis65 @@ -1,53 +1,53 @@ ### 6502bench SourceGen dis65 v1.0 ### { -"_ContentVersion":1,"FileDataLength":194,"FileDataCrc32":177347202,"ProjectProps":{ -"CpuName":"6502","IncludeUndocumentedInstr":false,"EntryFlags":32702671,"AnalysisParams":{ -"AnalyzeUncategorizedData":true,"MinCharsForString":4,"SeekNearbyTargets":true}, +"_ContentVersion":2,"FileDataLength":194,"FileDataCrc32":177347202,"ProjectProps":{ +"CpuName":"6502","IncludeUndocumentedInstr":false,"EntryFlags":32702671,"AutoLabelStyle":"Simple","AnalysisParams":{ +"AnalyzeUncategorizedData":true,"DefaultTextScanMode":"LowHighAscii","MinCharsForString":4,"SeekNearbyTargets":true,"SmartPlpHandling":true}, "PlatformSymbolFileIdentifiers":["RT:Apple/F8-ROM.sym65"],"ExtensionScriptFileIdentifiers":[],"ProjectSyms":{ "A1H":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"hide platform def","Label":"A1H","Value":-1,"Source":"Project","Type":"Constant"}, +"Comment":"hide platform def","HasWidth":false,"Label":"A1H","Value":-1,"Source":"Project","Type":"Constant"}, "copyptr":{ "DataDescriptor":{ -"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"2b","Label":"copyptr","Value":0,"Source":"Project","Type":"ExternalAddr"}, +"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Comment":"2b","HasWidth":true,"Label":"copyptr","Value":0,"Source":"Project","Type":"ExternalAddr"}, "dstptr":{ "DataDescriptor":{ -"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"2b A1H","Label":"dstptr","Value":62,"Source":"Project","Type":"ExternalAddr"}, +"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Comment":"2b A2L","HasWidth":true,"Label":"dstptr","Value":62,"Source":"Project","Type":"ExternalAddr"}, "in_dst":{ "DataDescriptor":{ -"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"in_dst","Value":766,"Source":"Project","Type":"ExternalAddr"}, +"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Comment":"","HasWidth":true,"Label":"in_dst","Value":766,"Source":"Project","Type":"ExternalAddr"}, "in_src":{ "DataDescriptor":{ -"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"in_src","Value":764,"Source":"Project","Type":"ExternalAddr"}, +"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Comment":"","HasWidth":true,"Label":"in_src","Value":764,"Source":"Project","Type":"ExternalAddr"}, "lz4fh_magic":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"ascii \u0027f\u0027","Label":"lz4fh_magic","Value":102,"Source":"Project","Type":"Constant"}, +"Comment":"ascii \u0027f\u0027","HasWidth":false,"Label":"lz4fh_magic","Value":102,"Source":"Project","Type":"Constant"}, "savlen":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"1b","Label":"savlen","Value":3,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"1b","HasWidth":false,"Label":"savlen","Value":3,"Source":"Project","Type":"ExternalAddr"}, "savmix":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"1b","Label":"savmix","Value":2,"Source":"Project","Type":"ExternalAddr"}, +"Comment":"1b","HasWidth":false,"Label":"savmix","Value":2,"Source":"Project","Type":"ExternalAddr"}, "srcptr":{ "DataDescriptor":{ -"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"2b A1L","Label":"srcptr","Value":60,"Source":"Project","Type":"ExternalAddr"}, +"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Comment":"2b A1L","HasWidth":true,"Label":"srcptr","Value":60,"Source":"Project","Type":"ExternalAddr"}, "tok_empty":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, -"Comment":"","Label":"tok_empty","Value":253,"Source":"Project","Type":"Constant"}, +"Comment":"","HasWidth":false,"Label":"tok_empty","Value":253,"Source":"Project","Type":"Constant"}, "tok_eod":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, -"Comment":"","Label":"tok_eod","Value":254,"Source":"Project","Type":"Constant"}}}, +"Comment":"","HasWidth":false,"Label":"tok_eod","Value":254,"Source":"Project","Type":"Constant"}}}, "AddressMap":[{ "Offset":0,"Addr":768}],"TypeHints":[{ "Low":0,"High":0,"Hint":"Code"}],"StatusFlagOverrides":{ @@ -163,4 +163,6 @@ "Label":"copyptr","Part":"Low"}}, "190":{ "Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"dstptr","Part":"Low"}}}} +"Label":"dstptr","Part":"Low"}}}, +"LvTables":{ +}} diff --git a/SourceGen/Examples/A2-lz4fh/LZ4FH65816#060300.dis65 b/SourceGen/Examples/A2-lz4fh/LZ4FH65816#060300.dis65 index 296924f..484c984 100644 --- a/SourceGen/Examples/A2-lz4fh/LZ4FH65816#060300.dis65 +++ b/SourceGen/Examples/A2-lz4fh/LZ4FH65816#060300.dis65 @@ -1,37 +1,37 @@ ### 6502bench SourceGen dis65 v1.0 ### { -"_ContentVersion":1,"FileDataLength":121,"FileDataCrc32":657890661,"ProjectProps":{ -"CpuName":"65816","IncludeUndocumentedInstr":false,"EntryFlags":32702671,"AnalysisParams":{ -"AnalyzeUncategorizedData":true,"MinCharsForString":4,"SeekNearbyTargets":true}, +"_ContentVersion":2,"FileDataLength":121,"FileDataCrc32":657890661,"ProjectProps":{ +"CpuName":"65816","IncludeUndocumentedInstr":false,"EntryFlags":32702671,"AutoLabelStyle":"Simple","AnalysisParams":{ +"AnalyzeUncategorizedData":true,"DefaultTextScanMode":"LowHighAscii","MinCharsForString":4,"SeekNearbyTargets":true,"SmartPlpHandling":true}, "PlatformSymbolFileIdentifiers":["RT:Apple/F8-ROM.sym65"],"ExtensionScriptFileIdentifiers":[],"ProjectSyms":{ "in_dst":{ "DataDescriptor":{ -"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"in_dst","Value":766,"Source":"Project","Type":"ExternalAddr"}, +"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Comment":"","HasWidth":true,"Label":"in_dst","Value":766,"Source":"Project","Type":"ExternalAddr"}, "in_src":{ "DataDescriptor":{ -"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"","Label":"in_src","Value":764,"Source":"Project","Type":"ExternalAddr"}, +"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Comment":"","HasWidth":true,"Label":"in_src","Value":764,"Source":"Project","Type":"ExternalAddr"}, "lz4fh_magic":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"ascii \u0027f\u0027","Label":"lz4fh_magic","Value":102,"Source":"Project","Type":"Constant"}, +"Comment":"ascii \u0027f\u0027","HasWidth":false,"Label":"lz4fh_magic","Value":102,"Source":"Project","Type":"Constant"}, "savlen":{ "DataDescriptor":{ -"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"2b","Label":"savlen","Value":2,"Source":"Project","Type":"ExternalAddr"}, +"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Comment":"2b","HasWidth":true,"Label":"savlen","Value":2,"Source":"Project","Type":"ExternalAddr"}, "savmix":{ "DataDescriptor":{ -"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, -"Comment":"2b","Label":"savmix","Value":0,"Source":"Project","Type":"ExternalAddr"}, +"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Comment":"2b","HasWidth":true,"Label":"savmix","Value":0,"Source":"Project","Type":"ExternalAddr"}, "tok_empty":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, -"Comment":"","Label":"tok_empty","Value":253,"Source":"Project","Type":"Constant"}, +"Comment":"","HasWidth":false,"Label":"tok_empty","Value":253,"Source":"Project","Type":"Constant"}, "tok_eod":{ "DataDescriptor":{ "Length":1,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, -"Comment":"","Label":"tok_eod","Value":254,"Source":"Project","Type":"Constant"}}}, +"Comment":"","HasWidth":false,"Label":"tok_eod","Value":254,"Source":"Project","Type":"Constant"}}}, "AddressMap":[{ "Offset":0,"Addr":768}],"TypeHints":[{ "Low":0,"High":0,"Hint":"Code"}],"StatusFlagOverrides":{ @@ -95,4 +95,6 @@ "99":{ "Length":3,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, "104":{ -"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}}} +"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}}, +"LvTables":{ +}} diff --git a/SourceGen/Examples/README.md b/SourceGen/Examples/README.md index 9d40e2e..5601a44 100644 --- a/SourceGen/Examples/README.md +++ b/SourceGen/Examples/README.md @@ -4,8 +4,9 @@ These are some sample projects you can play with. The binaries are accompanied by the original source code, so you can compare the SourceGen project to the original. - * Tutorial: a simple project, intended for use with the tutorial in + * Tutorial: simples project, intended for use with the tutorial in the manual. + * Scripts: extension script samples. * A2-lz4fh: two functions for unpacking a simplified form of LZ4 compression. One is 6502, the other is 65816. This is pretty straightforward. [(Full project)](https://github.com/fadden/fhpack) diff --git a/SourceGen/Examples/Scripts/InlineNullTerm.cs b/SourceGen/Examples/Scripts/InlineNullTerm.cs new file mode 100644 index 0000000..30431ba --- /dev/null +++ b/SourceGen/Examples/Scripts/InlineNullTerm.cs @@ -0,0 +1,69 @@ +// Copyright 2019 faddenSoft. All Rights Reserved. +// See the LICENSE.txt file for distribution terms (Apache 2.0). + +using System; +using System.Collections.Generic; + +using PluginCommon; + +namespace ExtensionScriptSample { + /// + /// Sample class for handling a JSR followed by an inline null-terminated string. + /// + public class InlineNullStringHandler : MarshalByRefObject, IPlugin, IPlugin_InlineJsr { + private IApplication mAppRef; + private byte[] mFileData; + + private int mInlineNullStringAddr; // jsr + + public string Identifier { + get { + return "Inline null-terminated ASCII string handler"; + } + } + + public void Prepare(IApplication appRef, byte[] fileData, AddressTranslate addrTrans, + List plSyms) { + mAppRef = appRef; + mFileData = fileData; + + mAppRef.DebugLog("InlineNullStringHandler(id=" + + AppDomain.CurrentDomain.Id + "): prepare()"); + + // reset this every time, in case they remove the label + mInlineNullStringAddr = -1; + foreach (PlSymbol sym in plSyms) { + if (sym.Label == "PrintInlineZString") { + mInlineNullStringAddr = sym.Value; + break; + } + } + mAppRef.DebugLog("PrintInlineZString @ $" + mInlineNullStringAddr.ToString("x6")); + } + + public void CheckJsr(int offset, out bool noContinue) { + noContinue = false; + int target = Util.GetWord(mFileData, offset + 1, 2, false); + if (target == mInlineNullStringAddr) { + // search for the terminating null byte + int nullOff = offset + 3; + while (nullOff < mFileData.Length) { + if (mFileData[nullOff] == 0) { + break; + } + nullOff++; + } + if (nullOff == mFileData.Length) { + mAppRef.DebugLog("Unable to find end of null-terminated string at +" + + (offset+3).ToString("x6")); + return; + } + + // Assuming ASCII. This can be hard-coded, use auto-detection, or look + // up a value in a project constant. + mAppRef.SetInlineDataFormat(offset + 3, nullOff - (offset + 3) + 1, + DataType.StringNullTerm, DataSubType.Ascii, null); + } + } + } +} diff --git a/SourceGen/Examples/Scripts/Sample b/SourceGen/Examples/Scripts/Sample new file mode 100644 index 0000000000000000000000000000000000000000..4f43070bad8012717e520994b1f158bff085575d GIT binary patch literal 13 UcmY%35eP{wF3HSGXGll@02kf^+W-In literal 0 HcmV?d00001 diff --git a/SourceGen/Examples/Scripts/Sample.S b/SourceGen/Examples/Scripts/Sample.S new file mode 100644 index 0000000..9ddddb2 --- /dev/null +++ b/SourceGen/Examples/Scripts/Sample.S @@ -0,0 +1,8 @@ + org $1000 + + jsr PrintInlineZString + asc 'Testing',00 + rts + +PrintInlineZString + rts diff --git a/SourceGen/Examples/Scripts/Sample.dis65 b/SourceGen/Examples/Scripts/Sample.dis65 new file mode 100644 index 0000000..e63fc3e --- /dev/null +++ b/SourceGen/Examples/Scripts/Sample.dis65 @@ -0,0 +1,24 @@ +### 6502bench SourceGen dis65 v1.0 ### +{ +"_ContentVersion":2,"FileDataLength":13,"FileDataCrc32":205674068,"ProjectProps":{ +"CpuName":"65816","IncludeUndocumentedInstr":false,"EntryFlags":32702671,"AutoLabelStyle":"Simple","AnalysisParams":{ +"AnalyzeUncategorizedData":true,"DefaultTextScanMode":"LowHighAscii","MinCharsForString":4,"SeekNearbyTargets":true,"SmartPlpHandling":true}, +"PlatformSymbolFileIdentifiers":[],"ExtensionScriptFileIdentifiers":["PROJ:InlineNullTerm.cs"],"ProjectSyms":{ +}}, +"AddressMap":[{ +"Offset":0,"Addr":4096}],"TypeHints":[{ +"Low":0,"High":0,"Hint":"Code"}],"StatusFlagOverrides":{ +}, +"Comments":{ +}, +"LongComments":{ +}, +"Notes":{ +}, +"UserLabels":{ +"12":{ +"Label":"PrintInlineZString","Value":4108,"Source":"User","Type":"LocalOrGlobalAddr"}}, +"OperandFormats":{ +}, +"LvTables":{ +}}