1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-26 06:49:19 +00:00

Work around Merlin assembler bug

The assembler can't handle "DFB '{'" or "DFB '}'", so just output
those as hex.

Tests added to 2006-operand-formats.
This commit is contained in:
Andy McFadden 2020-03-18 17:45:06 -07:00
parent 5d852e3ea6
commit 547cbb7811
9 changed files with 450 additions and 71 deletions

View File

@ -246,9 +246,15 @@ namespace SourceGen.AsmGen {
case FormatDescriptor.Type.NumericLE: case FormatDescriptor.Type.NumericLE:
opcodeStr = sDataOpNames.GetDefineData(length); opcodeStr = sDataOpNames.GetDefineData(length);
operand = RawData.GetWord(data, offset, length, false); operand = RawData.GetWord(data, offset, length, false);
operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable, if (length == 1 && dfd.IsStringOrCharacter &&
mLocalizer.LabelMap, dfd, operand, length, (operand & 0x7f) == '{' || (operand & 0x7f) == '}') {
PseudoOp.FormatNumericOpFlags.OmitLabelPrefixSuffix); // 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; break;
case FormatDescriptor.Type.NumericBE: case FormatDescriptor.Type.NumericBE:
opcodeStr = sDataOpNames.GetDefineBigData(length); opcodeStr = sDataOpNames.GetDefineBigData(length);

View File

@ -1,135 +1,457 @@
### 6502bench SourceGen dis65 v1.0 ### ### 6502bench SourceGen dis65 v1.0 ###
{ {
"_ContentVersion":1,"FileDataLength":133,"FileDataCrc32":-811370049,"ProjectProps":{ "_ContentVersion":3,
"CpuName":"65816","IncludeUndocumentedInstr":false,"EntryFlags":33489103,"AnalysisParams":{ "FileDataLength":143,
"AnalyzeUncategorizedData":true,"MinCharsForString":4,"SeekNearbyTargets":true}, "FileDataCrc32":-2044577818,
"PlatformSymbolFileIdentifiers":[],"ExtensionScriptFileIdentifiers":[],"ProjectSyms":{ "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":[{ "AddressMap":[{
"Offset":0,"Addr":4096}],"TypeHints":[{ "Offset":0,
"Low":0,"High":0,"Hint":"Code"}],"StatusFlagOverrides":{ "Addr":4096}],
"TypeHints":[{
"Low":0,
"High":0,
"Hint":"Code"}],
"StatusFlagOverrides":{
}, },
"Comments":{ "Comments":{
}, },
"LongComments":{ "LongComments":{
"-2147483647":{ "-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":{ "Notes":{
}, },
"UserLabels":{ "UserLabels":{
"63":{ "63":{
"Label":"skipdata","Value":4159,"Source":"User","Type":"LocalOrGlobalAddr"}, "Label":"skipdata",
"Value":4159,
"Source":"User",
"Type":"LocalOrGlobalAddr",
"LabelAnno":"None"},
"112":{ "112":{
"Label":"more_ascii","Value":4208,"Source":"User","Type":"LocalOrGlobalAddr"}}, "Label":"more_ascii",
"Value":4208,
"Source":"User",
"Type":"LocalOrGlobalAddr",
"LabelAnno":"None"}},
"OperandFormats":{ "OperandFormats":{
"4":{ "4":{
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"6":{ "6":{
"Length":3,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "Length":3,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"9":{ "9":{
"Length":4,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "Length":4,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"13":{ "13":{
"Length":2,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"15":{ "15":{
"Length":3,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, "Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"18":{ "18":{
"Length":4,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, "Length":4,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"22":{ "22":{
"Length":2,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"24":{ "24":{
"Length":3,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, "Length":3,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"27":{ "27":{
"Length":4,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, "Length":4,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"33":{ "33":{
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"34":{ "34":{
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"36":{ "36":{
"Length":3,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "Length":3,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"39":{ "39":{
"Length":4,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null}, "Length":4,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"43":{ "43":{
"Length":1,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, "Length":1,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"44":{ "44":{
"Length":2,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"46":{ "46":{
"Length":3,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, "Length":3,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"49":{ "49":{
"Length":4,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}, "Length":4,
"Format":"NumericLE",
"SubFormat":"Decimal",
"SymbolRef":null},
"53":{ "53":{
"Length":1,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, "Length":1,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"54":{ "54":{
"Length":2,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"56":{ "56":{
"Length":3,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, "Length":3,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"59":{ "59":{
"Length":4,"Format":"NumericLE","SubFormat":"Binary","SymbolRef":null}, "Length":4,
"Format":"NumericLE",
"SubFormat":"Binary",
"SymbolRef":null},
"63":{ "63":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"65":{ "65":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"67":{ "67":{
"Length":3,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":3,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"70":{ "70":{
"Length":4,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":4,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"74":{ "74":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"76":{ "76":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"78":{ "78":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"80":{ "80":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"82":{ "82":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"84":{ "84":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"86":{ "86":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"88":{ "88":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"90":{ "90":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"92":{ "92":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"94":{ "94":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"96":{ "96":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"98":{ "98":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"100":{ "100":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"102":{ "102":{
"Length":3,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":3,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"105":{ "105":{
"Length":3,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":3,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"108":{ "108":{
"Length":3,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":3,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"112":{ "112":{
"Length":1,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":1,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"113":{ "113":{
"Length":1,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":1,
"Format":"NumericLE",
"SubFormat":"HighAscii",
"SymbolRef":null},
"114":{ "114":{
"Length":2,"Format":"NumericLE","SubFormat":"Ascii","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Ascii",
"SymbolRef":null},
"117":{ "117":{
"Length":2,"Format":"NumericLE","SubFormat":"Address","SymbolRef":null}, "Length":2,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"119":{ "119":{
"Length":3,"Format":"NumericLE","SubFormat":"Address","SymbolRef":null}, "Length":3,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"122":{ "122":{
"Length":2,"Format":"NumericBE","SubFormat":"Address","SymbolRef":null}, "Length":2,
"Format":"NumericBE",
"SubFormat":"Address",
"SymbolRef":null},
"124":{ "124":{
"Length":1,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Length":1,
"Label":"more_ascii","Part":"Low"}}, "Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"more_ascii",
"Part":"Low"}},
"125":{ "125":{
"Length":1,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Length":1,
"Label":"more_ascii","Part":"High"}}, "Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"more_ascii",
"Part":"High"}},
"126":{ "126":{
"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Length":2,
"Label":"more_ascii","Part":"Low"}}, "Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"more_ascii",
"Part":"Low"}},
"128":{ "128":{
"Length":3,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ "Length":3,
"Label":"more_ascii","Part":"Low"}}, "Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"more_ascii",
"Part":"Low"}},
"131":{ "131":{
"Length":2,"Format":"NumericBE","SubFormat":"Symbol","SymbolRef":{ "Length":2,
"Label":"more_ascii","Part":"Low"}}}} "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":{
}}

View File

@ -71,3 +71,13 @@ _more_ascii .byte 'h'
.word _more_ascii .word _more_ascii
.long _more_ascii .long _more_ascii
.byte $10,$70 .byte $10,$70
.byte '['
.byte '{'
.byte '|'
.byte '}'
.byte ','
.byte '[' | $80
.byte '{' | $80
.byte '|' | $80
.byte '}' | $80
.byte ',' | $80

View File

@ -63,3 +63,13 @@ skipdata lda #'h'
dw :more_ascii dw :more_ascii
adr :more_ascii adr :more_ascii
ddb :more_ascii ddb :more_ascii
dfb '['
dfb $7b
dfb '|'
dfb $7d
dfb ','
dfb "["
dfb $fb
dfb "|"
dfb $fd
dfb ","

View File

@ -67,3 +67,13 @@ skipdata lda #'h'
!word @more_ascii !word @more_ascii
!24 @more_ascii !24 @more_ascii
!byte $10,$70 !byte $10,$70
!byte '['
!byte '{'
!byte '|'
!byte '}'
!byte ','
!byte '[' | $80
!byte '{' | $80
!byte '|' | $80
!byte '}' | $80
!byte ',' | $80

View File

@ -68,3 +68,13 @@ skipdata: lda #'h'
.word @more_ascii .word @more_ascii
.faraddr @more_ascii .faraddr @more_ascii
.dbyt @more_ascii .dbyt @more_ascii
.byte '['
.byte '{'
.byte '|'
.byte '}'
.byte ','
.byte '[' | $80
.byte '{' | $80
.byte '|' | $80
.byte '}' | $80
.byte ',' | $80

View File

@ -1,7 +1,7 @@
# 6502bench SourceGen generated linker script for 2006-operand-formats # 6502bench SourceGen generated linker script for 2006-operand-formats
MEMORY { MEMORY {
MAIN: file=%O, start=%S, size=65536; MAIN: file=%O, start=%S, size=65536;
# MEM000: file=%O, start=$1000, size=133; # MEM000: file=%O, start=$1000, size=143;
} }
SEGMENTS { SEGMENTS {
CODE: load=MAIN, type=rw; CODE: load=MAIN, type=rw;

View File

@ -84,3 +84,14 @@
adr :ascii adr :ascii
dfb >:ascii,:ascii ;format as big-endian symbol 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 ","