diff --git a/SourceGen/AsmGen/AsmMerlin32.cs b/SourceGen/AsmGen/AsmMerlin32.cs index f8c98fc..372b79e 100644 --- a/SourceGen/AsmGen/AsmMerlin32.cs +++ b/SourceGen/AsmGen/AsmMerlin32.cs @@ -246,9 +246,15 @@ namespace SourceGen.AsmGen { case FormatDescriptor.Type.NumericLE: opcodeStr = sDataOpNames.GetDefineData(length); operand = RawData.GetWord(data, offset, length, false); - operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable, - mLocalizer.LabelMap, dfd, operand, length, - PseudoOp.FormatNumericOpFlags.OmitLabelPrefixSuffix); + if (length == 1 && dfd.IsStringOrCharacter && + (operand & 0x7f) == '{' || (operand & 0x7f) == '}') { + // Merlin32 can't handle "DFB '{'", so just output hex. + operandStr = formatter.FormatHexValue(operand, length * 2); + } else { + operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable, + mLocalizer.LabelMap, dfd, operand, length, + PseudoOp.FormatNumericOpFlags.OmitLabelPrefixSuffix); + } break; case FormatDescriptor.Type.NumericBE: opcodeStr = sDataOpNames.GetDefineBigData(length); diff --git a/SourceGen/SGTestData/2006-operand-formats b/SourceGen/SGTestData/2006-operand-formats index ff2319e..3dbfc61 100644 Binary files a/SourceGen/SGTestData/2006-operand-formats and b/SourceGen/SGTestData/2006-operand-formats differ diff --git a/SourceGen/SGTestData/2006-operand-formats.dis65 b/SourceGen/SGTestData/2006-operand-formats.dis65 index 144d3d3..e23d6c5 100644 --- a/SourceGen/SGTestData/2006-operand-formats.dis65 +++ b/SourceGen/SGTestData/2006-operand-formats.dis65 @@ -1,135 +1,457 @@ ### 6502bench SourceGen dis65 v1.0 ### { -"_ContentVersion":1,"FileDataLength":133,"FileDataCrc32":-811370049,"ProjectProps":{ -"CpuName":"65816","IncludeUndocumentedInstr":false,"EntryFlags":33489103,"AnalysisParams":{ -"AnalyzeUncategorizedData":true,"MinCharsForString":4,"SeekNearbyTargets":true}, -"PlatformSymbolFileIdentifiers":[],"ExtensionScriptFileIdentifiers":[],"ProjectSyms":{ +"_ContentVersion":3, +"FileDataLength":143, +"FileDataCrc32":-2044577818, +"ProjectProps":{ +"CpuName":"65816", +"IncludeUndocumentedInstr":false, +"TwoByteBrk":false, +"EntryFlags":33489103, +"AutoLabelStyle":"Simple", +"AnalysisParams":{ +"AnalyzeUncategorizedData":true, +"DefaultTextScanMode":"LowHighAscii", +"MinCharsForString":4, +"SeekNearbyTargets":true, +"SmartPlpHandling":true}, + +"PlatformSymbolFileIdentifiers":[], +"ExtensionScriptFileIdentifiers":[], +"ProjectSyms":{ }}, + "AddressMap":[{ -"Offset":0,"Addr":4096}],"TypeHints":[{ -"Low":0,"High":0,"Hint":"Code"}],"StatusFlagOverrides":{ +"Offset":0, +"Addr":4096}], +"TypeHints":[{ +"Low":0, +"High":0, +"Hint":"Code"}], +"StatusFlagOverrides":{ }, + "Comments":{ }, + "LongComments":{ "-2147483647":{ -"Text":"Project file was edited for some ASCII operands.","BoxMode":false,"MaxWidth":80}}, +"Text":"Project file was edited for some ASCII operands.", +"BoxMode":false, +"MaxWidth":80, +"BackgroundColor":0}}, + "Notes":{ }, + "UserLabels":{ "63":{ -"Label":"skipdata","Value":4159,"Source":"User","Type":"LocalOrGlobalAddr"}, +"Label":"skipdata", +"Value":4159, +"Source":"User", +"Type":"LocalOrGlobalAddr", +"LabelAnno":"None"}, + "112":{ -"Label":"more_ascii","Value":4208,"Source":"User","Type":"LocalOrGlobalAddr"}}, +"Label":"more_ascii", +"Value":4208, +"Source":"User", +"Type":"LocalOrGlobalAddr", +"LabelAnno":"None"}}, + "OperandFormats":{ "4":{ -"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Hex", +"SymbolRef":null}, + "6":{ -"Length":3,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Length":3, +"Format":"NumericLE", +"SubFormat":"Hex", +"SymbolRef":null}, + "9":{ -"Length":4,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Length":4, +"Format":"NumericLE", +"SubFormat":"Hex", +"SymbolRef":null}, + "13":{ -"Length":2,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Decimal", +"SymbolRef":null}, + "15":{ -"Length":3,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, +"Length":3, +"Format":"NumericLE", +"SubFormat":"Decimal", +"SymbolRef":null}, + "18":{ -"Length":4,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, +"Length":4, +"Format":"NumericLE", +"SubFormat":"Decimal", +"SymbolRef":null}, + "22":{ -"Length":2,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Binary", +"SymbolRef":null}, + "24":{ -"Length":3,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, +"Length":3, +"Format":"NumericLE", +"SubFormat":"Binary", +"SymbolRef":null}, + "27":{ -"Length":4,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, +"Length":4, +"Format":"NumericLE", +"SubFormat":"Binary", +"SymbolRef":null}, + "33":{ -"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Length":1, +"Format":"NumericLE", +"SubFormat":"Hex", +"SymbolRef":null}, + "34":{ -"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Hex", +"SymbolRef":null}, + "36":{ -"Length":3,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Length":3, +"Format":"NumericLE", +"SubFormat":"Hex", +"SymbolRef":null}, + "39":{ -"Length":4,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, +"Length":4, +"Format":"NumericLE", +"SubFormat":"Hex", +"SymbolRef":null}, + "43":{ -"Length":1,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, +"Length":1, +"Format":"NumericLE", +"SubFormat":"Decimal", +"SymbolRef":null}, + "44":{ -"Length":2,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Decimal", +"SymbolRef":null}, + "46":{ -"Length":3,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, +"Length":3, +"Format":"NumericLE", +"SubFormat":"Decimal", +"SymbolRef":null}, + "49":{ -"Length":4,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, +"Length":4, +"Format":"NumericLE", +"SubFormat":"Decimal", +"SymbolRef":null}, + "53":{ -"Length":1,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, +"Length":1, +"Format":"NumericLE", +"SubFormat":"Binary", +"SymbolRef":null}, + "54":{ -"Length":2,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Binary", +"SymbolRef":null}, + "56":{ -"Length":3,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, +"Length":3, +"Format":"NumericLE", +"SubFormat":"Binary", +"SymbolRef":null}, + "59":{ -"Length":4,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, +"Length":4, +"Format":"NumericLE", +"SubFormat":"Binary", +"SymbolRef":null}, + "63":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "65":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "67":{ -"Length":3,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":3, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "70":{ -"Length":4,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":4, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "74":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "76":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "78":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "80":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "82":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "84":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "86":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}, + "88":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}, + "90":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}, + "92":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}, + "94":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}, + "96":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}, + "98":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}, + "100":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "102":{ -"Length":3,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":3, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "105":{ -"Length":3,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":3, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}, + "108":{ -"Length":3,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":3, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "112":{ -"Length":1,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":1, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "113":{ -"Length":1,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":1, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}, + "114":{ -"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + "117":{ -"Length":2,"Format":"NumericLE","SubFormat":"Address","SymbolRef":null}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Address", +"SymbolRef":null}, + "119":{ -"Length":3,"Format":"NumericLE","SubFormat":"Address","SymbolRef":null}, +"Length":3, +"Format":"NumericLE", +"SubFormat":"Address", +"SymbolRef":null}, + "122":{ -"Length":2,"Format":"NumericBE","SubFormat":"Address","SymbolRef":null}, +"Length":2, +"Format":"NumericBE", +"SubFormat":"Address", +"SymbolRef":null}, + "124":{ -"Length":1,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"more_ascii","Part":"Low"}}, +"Length":1, +"Format":"NumericLE", +"SubFormat":"Symbol", +"SymbolRef":{ +"Label":"more_ascii", +"Part":"Low"}}, + "125":{ -"Length":1,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"more_ascii","Part":"High"}}, +"Length":1, +"Format":"NumericLE", +"SubFormat":"Symbol", +"SymbolRef":{ +"Label":"more_ascii", +"Part":"High"}}, + "126":{ -"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"more_ascii","Part":"Low"}}, +"Length":2, +"Format":"NumericLE", +"SubFormat":"Symbol", +"SymbolRef":{ +"Label":"more_ascii", +"Part":"Low"}}, + "128":{ -"Length":3,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"more_ascii","Part":"Low"}}, +"Length":3, +"Format":"NumericLE", +"SubFormat":"Symbol", +"SymbolRef":{ +"Label":"more_ascii", +"Part":"Low"}}, + "131":{ -"Length":2,"Format":"NumericBE","SubFormat":"Symbol","SymbolRef":{ -"Label":"more_ascii","Part":"Low"}}}} +"Length":2, +"Format":"NumericBE", +"SubFormat":"Symbol", +"SymbolRef":{ +"Label":"more_ascii", +"Part":"Low"}}, + +"133":{ +"Length":1, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + +"134":{ +"Length":1, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + +"135":{ +"Length":1, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + +"136":{ +"Length":1, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + +"137":{ +"Length":1, +"Format":"NumericLE", +"SubFormat":"Ascii", +"SymbolRef":null}, + +"138":{ +"Length":1, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}, + +"139":{ +"Length":1, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}, + +"140":{ +"Length":1, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}, + +"141":{ +"Length":1, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}, + +"142":{ +"Length":1, +"Format":"NumericLE", +"SubFormat":"HighAscii", +"SymbolRef":null}}, + +"LvTables":{ +}, + +"Visualizations":[], +"VisualizationAnimations":[], +"VisualizationSets":{ +}} diff --git a/SourceGen/SGTestData/Expected/2006-operand-formats_64tass.S b/SourceGen/SGTestData/Expected/2006-operand-formats_64tass.S index 12dfb8e..59e464a 100644 --- a/SourceGen/SGTestData/Expected/2006-operand-formats_64tass.S +++ b/SourceGen/SGTestData/Expected/2006-operand-formats_64tass.S @@ -71,3 +71,13 @@ _more_ascii .byte 'h' .word _more_ascii .long _more_ascii .byte $10,$70 + .byte '[' + .byte '{' + .byte '|' + .byte '}' + .byte ',' + .byte '[' | $80 + .byte '{' | $80 + .byte '|' | $80 + .byte '}' | $80 + .byte ',' | $80 diff --git a/SourceGen/SGTestData/Expected/2006-operand-formats_Merlin32.S b/SourceGen/SGTestData/Expected/2006-operand-formats_Merlin32.S index b773d48..3727e6a 100644 --- a/SourceGen/SGTestData/Expected/2006-operand-formats_Merlin32.S +++ b/SourceGen/SGTestData/Expected/2006-operand-formats_Merlin32.S @@ -63,3 +63,13 @@ skipdata lda #'h' dw :more_ascii adr :more_ascii ddb :more_ascii + dfb '[' + dfb $7b + dfb '|' + dfb $7d + dfb ',' + dfb "[" + dfb $fb + dfb "|" + dfb $fd + dfb "," diff --git a/SourceGen/SGTestData/Expected/2006-operand-formats_acme.S b/SourceGen/SGTestData/Expected/2006-operand-formats_acme.S index ca14901..331a3db 100644 --- a/SourceGen/SGTestData/Expected/2006-operand-formats_acme.S +++ b/SourceGen/SGTestData/Expected/2006-operand-formats_acme.S @@ -67,3 +67,13 @@ skipdata lda #'h' !word @more_ascii !24 @more_ascii !byte $10,$70 + !byte '[' + !byte '{' + !byte '|' + !byte '}' + !byte ',' + !byte '[' | $80 + !byte '{' | $80 + !byte '|' | $80 + !byte '}' | $80 + !byte ',' | $80 diff --git a/SourceGen/SGTestData/Expected/2006-operand-formats_cc65.S b/SourceGen/SGTestData/Expected/2006-operand-formats_cc65.S index 8928d4a..8eef614 100644 --- a/SourceGen/SGTestData/Expected/2006-operand-formats_cc65.S +++ b/SourceGen/SGTestData/Expected/2006-operand-formats_cc65.S @@ -68,3 +68,13 @@ skipdata: lda #'h' .word @more_ascii .faraddr @more_ascii .dbyt @more_ascii + .byte '[' + .byte '{' + .byte '|' + .byte '}' + .byte ',' + .byte '[' | $80 + .byte '{' | $80 + .byte '|' | $80 + .byte '}' | $80 + .byte ',' | $80 diff --git a/SourceGen/SGTestData/Expected/2006-operand-formats_cc65.cfg b/SourceGen/SGTestData/Expected/2006-operand-formats_cc65.cfg index b689faf..f5aa693 100644 --- a/SourceGen/SGTestData/Expected/2006-operand-formats_cc65.cfg +++ b/SourceGen/SGTestData/Expected/2006-operand-formats_cc65.cfg @@ -1,7 +1,7 @@ # 6502bench SourceGen generated linker script for 2006-operand-formats MEMORY { MAIN: file=%O, start=%S, size=65536; -# MEM000: file=%O, start=$1000, size=133; +# MEM000: file=%O, start=$1000, size=143; } SEGMENTS { CODE: load=MAIN, type=rw; diff --git a/SourceGen/SGTestData/Source/2006-operand-formats.S b/SourceGen/SGTestData/Source/2006-operand-formats.S index 9a027bd..c8eba10 100644 --- a/SourceGen/SGTestData/Source/2006-operand-formats.S +++ b/SourceGen/SGTestData/Source/2006-operand-formats.S @@ -84,3 +84,14 @@ adr :ascii dfb >:ascii,:ascii ;format as big-endian symbol +; Merlin 1.0 has trouble with "DFB '{'". + dfb '[' + dfb $7b + dfb $7c + dfb $7d + dfb ',' + dfb "[" + dfb $fb + dfb $fc + dfb $fd + dfb ","