diff --git a/SourceGen/AsmGen/GenCommon.cs b/SourceGen/AsmGen/GenCommon.cs index 0b7e509..c3e6c51 100644 --- a/SourceGen/AsmGen/GenCommon.cs +++ b/SourceGen/AsmGen/GenCommon.cs @@ -148,12 +148,19 @@ namespace SourceGen.AsmGen { gen.OutputAsmConfig(); // Format symbols. + bool prevConst = false; foreach (DefSymbol defSym in proj.ActiveDefSymbolList) { + if (prevConst && !defSym.IsConstant) { + // Output a blank line between the constants and the address equates. + gen.OutputLine(string.Empty); + } // Use an operand length of 1 so values are shown as concisely as possible. string valueStr = PseudoOp.FormatNumericOperand(formatter, proj.SymbolTable, gen.Localizer.LabelMap, defSym.DataDescriptor, defSym.Value, 1, PseudoOp.FormatNumericOpFlags.None); gen.OutputEquDirective(defSym.Label, valueStr, defSym.Comment); + + prevConst = defSym.IsConstant; } // If there was at least one symbol, output a blank line. diff --git a/SourceGen/SGTestData/2009-branches-and-banks b/SourceGen/SGTestData/2009-branches-and-banks index 3ebc932..7950dc9 100644 Binary files a/SourceGen/SGTestData/2009-branches-and-banks and b/SourceGen/SGTestData/2009-branches-and-banks differ diff --git a/SourceGen/SGTestData/2009-branches-and-banks.dis65 b/SourceGen/SGTestData/2009-branches-and-banks.dis65 index 47d8953..d0ee23b 100644 --- a/SourceGen/SGTestData/2009-branches-and-banks.dis65 +++ b/SourceGen/SGTestData/2009-branches-and-banks.dis65 @@ -1,8 +1,8 @@ ### 6502bench SourceGen dis65 v1.0 ### { -"_ContentVersion":1,"FileDataLength":119,"FileDataCrc32":934960724,"ProjectProps":{ -"CpuName":"65816","IncludeUndocumentedInstr":false,"EntryFlags":33489103,"AnalysisParams":{ -"AnalyzeUncategorizedData":true,"MinCharsForString":4,"SeekNearbyTargets":true}, +"_ContentVersion":2,"FileDataLength":119,"FileDataCrc32":-1095650494,"ProjectProps":{ +"CpuName":"65816","IncludeUndocumentedInstr":false,"TwoByteBrk":false,"EntryFlags":33489103,"AutoLabelStyle":"Simple","AnalysisParams":{ +"AnalyzeUncategorizedData":true,"DefaultTextScanMode":"LowHighAscii","MinCharsForString":4,"SeekNearbyTargets":true,"SmartPlpHandling":true}, "PlatformSymbolFileIdentifiers":["PROJ:2009-branches-and-banks.sym65"],"ExtensionScriptFileIdentifiers":[],"ProjectSyms":{ }}, "AddressMap":[{ @@ -54,4 +54,6 @@ "Label":"j2","Part":"Low"}}, "111":{ "Length":3,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{ -"Label":"j2","Part":"Low"}}}} +"Label":"j2","Part":"Low"}}}, +"LvTables":{ +}} diff --git a/SourceGen/SGTestData/Expected/2007-labels-and-symbols_64tass.S b/SourceGen/SGTestData/Expected/2007-labels-and-symbols_64tass.S index 0eab1e1..e047c49 100644 --- a/SourceGen/SGTestData/Expected/2007-labels-and-symbols_64tass.S +++ b/SourceGen/SGTestData/Expected/2007-labels-and-symbols_64tass.S @@ -8,6 +8,7 @@ absl = $1029 absh = $feed biggie = $123456 thirty2 = $12345678 ;32-bit constant test + plataddr = $3000 ;address only in platform file projalsa = $3200 ;same val as projalso diff --git a/SourceGen/SGTestData/Expected/2007-labels-and-symbols_Merlin32.S b/SourceGen/SGTestData/Expected/2007-labels-and-symbols_Merlin32.S index 5fe1fca..cc086b4 100644 --- a/SourceGen/SGTestData/Expected/2007-labels-and-symbols_Merlin32.S +++ b/SourceGen/SGTestData/Expected/2007-labels-and-symbols_Merlin32.S @@ -5,6 +5,7 @@ absl equ $1029 absh equ $feed biggie equ $123456 thirty2 equ $12345678 ;32-bit constant test + plataddr equ $3000 ;address only in platform file projalsa equ $3200 ;same val as projalso diff --git a/SourceGen/SGTestData/Expected/2007-labels-and-symbols_cc65.S b/SourceGen/SGTestData/Expected/2007-labels-and-symbols_cc65.S index ec78cfa..30e531b 100644 --- a/SourceGen/SGTestData/Expected/2007-labels-and-symbols_cc65.S +++ b/SourceGen/SGTestData/Expected/2007-labels-and-symbols_cc65.S @@ -6,6 +6,7 @@ absl = $1029 absh = $feed biggie = $123456 thirty2 = $12345678 ;32-bit constant test + plataddr = $3000 ;address only in platform file projalsa = $3200 ;same val as projalso diff --git a/SourceGen/SGTestData/Expected/2009-branches-and-banks_64tass.S b/SourceGen/SGTestData/Expected/2009-branches-and-banks_64tass.S index a676e7e..c272794 100644 --- a/SourceGen/SGTestData/Expected/2009-branches-and-banks_64tass.S +++ b/SourceGen/SGTestData/Expected/2009-branches-and-banks_64tass.S @@ -16,7 +16,7 @@ L0003 lda L0000 bne LFFC3 bmi $ffc3 per LFFC3 - bcc L0016 + bvs L0016 brl L0080 lodat .byte $00 diff --git a/SourceGen/SGTestData/Expected/2009-branches-and-banks_Merlin32.S b/SourceGen/SGTestData/Expected/2009-branches-and-banks_Merlin32.S index c77330f..12d082f 100644 --- a/SourceGen/SGTestData/Expected/2009-branches-and-banks_Merlin32.S +++ b/SourceGen/SGTestData/Expected/2009-branches-and-banks_Merlin32.S @@ -13,7 +13,7 @@ L0003 lda L0000 dfb $d0,$ba dfb $30,$b8 dfb $62,$b5,$ff - bcc L0016 + bvs L0016 brl L0080 lodat dfb $00 diff --git a/SourceGen/SGTestData/Expected/2009-branches-and-banks_acme.S b/SourceGen/SGTestData/Expected/2009-branches-and-banks_acme.S index 448ce21..dd06c38 100644 --- a/SourceGen/SGTestData/Expected/2009-branches-and-banks_acme.S +++ b/SourceGen/SGTestData/Expected/2009-branches-and-banks_acme.S @@ -1,6 +1,6 @@ ;ACME can't handle 65816 code that lives outside bank zero * = $1000 - !hex 18fbe2304c00002c0000a500a503d0ba30b862b5ff9006826d00000102a51482 + !hex 18fbe2304c00002c0000a500a503d0ba30b862b5ff7006826d00000102a51482 !hex a5ff2c80005c0000442cc0ff823d00cf000044af000044ad0000a50030f562b2 !hex ffd0b082a9ff1700170044cfc0ff44f005303c8239005c0020002c0020f41700 !hex f44400d003dc1300ea201220201520200f202256341260 diff --git a/SourceGen/SGTestData/Expected/2009-branches-and-banks_cc65.S b/SourceGen/SGTestData/Expected/2009-branches-and-banks_cc65.S index 6dc231d..29b8ead 100644 --- a/SourceGen/SGTestData/Expected/2009-branches-and-banks_cc65.S +++ b/SourceGen/SGTestData/Expected/2009-branches-and-banks_cc65.S @@ -18,7 +18,7 @@ L0003: lda L0000 .byte $d0,$ba .byte $30,$b8 .byte $62,$b5,$ff - bcc L0016 + bvs L0016 brl L0080 lodat: .byte $00 diff --git a/SourceGen/SGTestData/Expected/2019-local-variables_64tass.S b/SourceGen/SGTestData/Expected/2019-local-variables_64tass.S index 7aabe71..8f593fc 100644 --- a/SourceGen/SGTestData/Expected/2019-local-variables_64tass.S +++ b/SourceGen/SGTestData/Expected/2019-local-variables_64tass.S @@ -3,6 +3,7 @@ .enc sg_ascii .cdef $20,$7e,$20 CONST_ZERO = $f0 ;project const + PROJ_ZERO = $00 ;project addr PROJ_ONE = $01 ;project addr diff --git a/SourceGen/SGTestData/Expected/2019-local-variables_Merlin32.S b/SourceGen/SGTestData/Expected/2019-local-variables_Merlin32.S index ba5b202..ba48085 100644 --- a/SourceGen/SGTestData/Expected/2019-local-variables_Merlin32.S +++ b/SourceGen/SGTestData/Expected/2019-local-variables_Merlin32.S @@ -1,5 +1,6 @@ ;Edited to have duplicate labels (PROJ_ZERO, DPCODE). CONST_ZERO equ $f0 ;project const + PROJ_ZERO equ $00 ;project addr PROJ_ONE equ $01 ;project addr diff --git a/SourceGen/SGTestData/Expected/2019-local-variables_acme.S b/SourceGen/SGTestData/Expected/2019-local-variables_acme.S index 1e1dc97..f755693 100644 --- a/SourceGen/SGTestData/Expected/2019-local-variables_acme.S +++ b/SourceGen/SGTestData/Expected/2019-local-variables_acme.S @@ -1,6 +1,7 @@ ;Edited to have duplicate labels (PROJ_ZERO, DPCODE). !cpu 65816 CONST_ZERO = $f0 ;project const + PROJ_ZERO = $00 ;project addr PROJ_ONE = $01 ;project addr diff --git a/SourceGen/SGTestData/Expected/2019-local-variables_cc65.S b/SourceGen/SGTestData/Expected/2019-local-variables_cc65.S index 51893af..157f2fe 100644 --- a/SourceGen/SGTestData/Expected/2019-local-variables_cc65.S +++ b/SourceGen/SGTestData/Expected/2019-local-variables_cc65.S @@ -1,6 +1,7 @@ ;Edited to have duplicate labels (PROJ_ZERO, DPCODE). .setcpu "65816" CONST_ZERO = $f0 ;project const + PROJ_ZERO = $00 ;project addr PROJ_ONE = $01 ;project addr diff --git a/SourceGen/SGTestData/Expected/2021-external-symbols_64tass.S b/SourceGen/SGTestData/Expected/2021-external-symbols_64tass.S index 6832803..4c646e1 100644 --- a/SourceGen/SGTestData/Expected/2021-external-symbols_64tass.S +++ b/SourceGen/SGTestData/Expected/2021-external-symbols_64tass.S @@ -1,5 +1,6 @@ .cpu "6502" FatConst = $4000 + OverVar = $40 CodeWrap = $0f00 ;encases program SameName1 = $2000 diff --git a/SourceGen/SGTestData/Expected/2021-external-symbols_Merlin32.S b/SourceGen/SGTestData/Expected/2021-external-symbols_Merlin32.S index d5b63e8..9311a56 100644 --- a/SourceGen/SGTestData/Expected/2021-external-symbols_Merlin32.S +++ b/SourceGen/SGTestData/Expected/2021-external-symbols_Merlin32.S @@ -1,4 +1,5 @@ FatConst equ $4000 + OverVar equ $40 CodeWrap equ $0f00 ;encases program SameName1 equ $2000 diff --git a/SourceGen/SGTestData/Expected/2021-external-symbols_acme.S b/SourceGen/SGTestData/Expected/2021-external-symbols_acme.S index 75b190f..339c06e 100644 --- a/SourceGen/SGTestData/Expected/2021-external-symbols_acme.S +++ b/SourceGen/SGTestData/Expected/2021-external-symbols_acme.S @@ -1,5 +1,6 @@ !cpu 6502 FatConst = $4000 + OverVar = $40 CodeWrap = $0f00 ;encases program SameName1 = $2000 diff --git a/SourceGen/SGTestData/Expected/2021-external-symbols_cc65.S b/SourceGen/SGTestData/Expected/2021-external-symbols_cc65.S index 8bc9670..fbd5a85 100644 --- a/SourceGen/SGTestData/Expected/2021-external-symbols_cc65.S +++ b/SourceGen/SGTestData/Expected/2021-external-symbols_cc65.S @@ -1,5 +1,6 @@ .setcpu "6502" FatConst = $4000 + OverVar = $40 CodeWrap = $0f00 ;encases program SameName1 = $2000 diff --git a/SourceGen/SGTestData/Source/2009-branches-and-banks.S b/SourceGen/SGTestData/Source/2009-branches-and-banks.S index 7e7fdef..a67d610 100644 --- a/SourceGen/SGTestData/Source/2009-branches-and-banks.S +++ b/SourceGen/SGTestData/Source/2009-branches-and-banks.S @@ -28,7 +28,7 @@ low: lda zero bne low-$40 ;reference symbol bmi low-$40 ;EDIT: format as hex per low-$40 - bcc more + bvs more brl more1 lodat: .byte $00,$01,$02 ;EDIT: set label more: lda more-2 diff --git a/SourceGen/SGTestData/Source/2009-branches-and-banks.cfg b/SourceGen/SGTestData/Source/2009-branches-and-banks.cfg new file mode 100644 index 0000000..8db331e --- /dev/null +++ b/SourceGen/SGTestData/Source/2009-branches-and-banks.cfg @@ -0,0 +1,8 @@ +MEMORY { + MAIN: file=%O, start=%S, size=65536; +} +SEGMENTS { + CODE: load=MAIN, type=rw; +} +FEATURES {} +SYMBOLS {}