mirror of
https://github.com/fadden/6502bench.git
synced 2025-01-19 23:31:01 +00:00
Add 2019-local-variables test
This hits most of the edge cases, but doesn't exercise the two duplicate name situations (var name same as user label, var name same as project/platform symbol). Also, fixed a bug in the EditDefSymbol uniqueness check where it was comparing a symbol to itself.
This commit is contained in:
parent
b65f75437d
commit
963b351a52
@ -932,7 +932,7 @@ namespace SourceGen {
|
||||
} else if (!sym.IsVariable) {
|
||||
// Somehow we have a variable and a non-variable with the same
|
||||
// name. Platform/project symbols haven't been processed yet, so
|
||||
// this must be a clash with a user label. This will likely cause
|
||||
// this must be a clash with a user label. This could cause
|
||||
// assembly source gen to fail later on. It's possible to do this
|
||||
// by "hiding" a table and then adding a user label, so we can't just
|
||||
// fix it at project load time. The full fix is to permanently
|
||||
@ -940,7 +940,6 @@ namespace SourceGen {
|
||||
// hate trashing user data.
|
||||
Debug.WriteLine("Found non-variable with var name in symbol table: "
|
||||
+ sym);
|
||||
Debug.Assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ namespace SourceGen {
|
||||
mRecentSymbols.Add(defSym);
|
||||
}
|
||||
|
||||
mCurrentTable.DebugDump(mNextLvtOffset);
|
||||
//mCurrentTable.DebugDump(mNextLvtOffset);
|
||||
}
|
||||
|
||||
// Update state to look for next table.
|
||||
|
BIN
SourceGen/SGTestData/2019-local-variables
Normal file
BIN
SourceGen/SGTestData/2019-local-variables
Normal file
Binary file not shown.
182
SourceGen/SGTestData/2019-local-variables.dis65
Normal file
182
SourceGen/SGTestData/2019-local-variables.dis65
Normal file
@ -0,0 +1,182 @@
|
||||
### 6502bench SourceGen dis65 v1.0 ###
|
||||
{
|
||||
"_ContentVersion":2,"FileDataLength":137,"FileDataCrc32":708791740,"ProjectProps":{
|
||||
"CpuName":"65816","IncludeUndocumentedInstr":false,"EntryFlags":32702671,"AutoLabelStyle":"Simple","AnalysisParams":{
|
||||
"AnalyzeUncategorizedData":true,"DefaultTextScanMode":"LowHighAscii","MinCharsForString":4,"SeekNearbyTargets":true},
|
||||
"PlatformSymbolFileIdentifiers":[],"ExtensionScriptFileIdentifiers":[],"ProjectSyms":{
|
||||
"CONST_ONE":{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"project const","Label":"CONST_ONE","Value":241,"Source":"Project","Type":"Constant"},
|
||||
"CONST_ZERO":{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"project const","Label":"CONST_ZERO","Value":240,"Source":"Project","Type":"Constant"},
|
||||
"PROJ_ONE":{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"project addr","Label":"PROJ_ONE","Value":1,"Source":"Project","Type":"ExternalAddr"},
|
||||
"PROJ_ZERO":{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"project addr","Label":"PROJ_ZERO","Value":0,"Source":"Project","Type":"ExternalAddr"},
|
||||
"PTR_2":{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"project addr, should clash","Label":"PTR_2","Value":248,"Source":"Project","Type":"ExternalAddr"}}},
|
||||
"AddressMap":[{
|
||||
"Offset":0,"Addr":4096},
|
||||
{
|
||||
"Offset":126,"Addr":128}],"TypeHints":[{
|
||||
"Low":0,"High":0,"Hint":"Code"}],"StatusFlagOverrides":{
|
||||
},
|
||||
"Comments":{
|
||||
},
|
||||
"LongComments":{
|
||||
"-2147483647":{
|
||||
"Text":"Would need to be edited to test duplicate labels. Those currently cause assembly to fail (see the X_* vars).","BoxMode":false,"MaxWidth":80,"BackgroundColor":0},
|
||||
"81":{
|
||||
"Text":"Test name redefinition. This is mostly of interest for assemblers without redefinable variables, but also of interest to the cross-reference window.","BoxMode":false,"MaxWidth":80,"BackgroundColor":0}},
|
||||
"Notes":{
|
||||
},
|
||||
"UserLabels":{
|
||||
"87":{
|
||||
"Label":"PTR_1","Value":4183,"Source":"User","Type":"LocalOrGlobalAddr"},
|
||||
"126":{
|
||||
"Label":"DPCODE","Value":128,"Source":"User","Type":"LocalOrGlobalAddr"}},
|
||||
"OperandFormats":{
|
||||
"8":{
|
||||
"Length":2,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{
|
||||
"Label":"CONST_ZERO","Part":"Low"}},
|
||||
"24":{
|
||||
"Length":2,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null},
|
||||
"26":{
|
||||
"Length":2,"Format":"NumericLE","SubFormat":"Decimal","SymbolRef":null}},
|
||||
"LvTables":{
|
||||
"12":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"VAR_ZERO","Value":0,"Source":"Variable","Type":"ExternalAddr"},
|
||||
{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"VAR_TWO","Value":2,"Source":"Variable","Type":"ExternalAddr"},
|
||||
{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"VAR_THREE","Value":3,"Source":"Variable","Type":"ExternalAddr"},
|
||||
{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"CONST_ZERO_VAR","Value":240,"Source":"Variable","Type":"Constant"}],"ClearPrevious":false},
|
||||
"28":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"clash with project symbol","Label":"X_PROJ_ZERO","Value":16,"Source":"Variable","Type":"ExternalAddr"},
|
||||
{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"clash with user label","Label":"X_DPCODE","Value":128,"Source":"Variable","Type":"ExternalAddr"}],"ClearPrevious":false},
|
||||
"34":{
|
||||
"Variables":[],"ClearPrevious":false},
|
||||
"44":{
|
||||
"Variables":[],"ClearPrevious":true},
|
||||
"51":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"hidden table","Label":"HIDDEN0","Value":0,"Source":"Variable","Type":"ExternalAddr"},
|
||||
{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"hidden table","Label":"HIDDEN1","Value":1,"Source":"Variable","Type":"ExternalAddr"}],"ClearPrevious":false},
|
||||
"60":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"not hidden","Label":"NH0","Value":0,"Source":"Variable","Type":"ExternalAddr"},
|
||||
{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"not hidden","Label":"NH1","Value":1,"Source":"Variable","Type":"ExternalAddr"}],"ClearPrevious":false},
|
||||
"71":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"PTR0","Value":16,"Source":"Variable","Type":"ExternalAddr"},
|
||||
{
|
||||
"DataDescriptor":{
|
||||
"Length":4,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"CONST0","Value":16,"Source":"Variable","Type":"Constant"}],"ClearPrevious":false},
|
||||
"81":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"#1","Label":"PTR","Value":32,"Source":"Variable","Type":"ExternalAddr"}],"ClearPrevious":false},
|
||||
"83":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"#2","Label":"PTR","Value":34,"Source":"Variable","Type":"ExternalAddr"}],"ClearPrevious":false},
|
||||
"85":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"#3","Label":"PTR","Value":36,"Source":"Variable","Type":"ExternalAddr"}],"ClearPrevious":false},
|
||||
"88":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"PTR_A","Value":32,"Source":"Variable","Type":"ExternalAddr"}],"ClearPrevious":false},
|
||||
"90":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"PTR_B","Value":31,"Source":"Variable","Type":"ExternalAddr"}],"ClearPrevious":false},
|
||||
"92":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":4,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"PTR_C","Value":29,"Source":"Variable","Type":"ExternalAddr"}],"ClearPrevious":false},
|
||||
"94":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"PTR_D","Value":33,"Source":"Variable","Type":"ExternalAddr"}],"ClearPrevious":false},
|
||||
"96":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"VAL0","Value":48,"Source":"Variable","Type":"ExternalAddr"},
|
||||
{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"VAL1","Value":49,"Source":"Variable","Type":"ExternalAddr"},
|
||||
{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"VAL2","Value":50,"Source":"Variable","Type":"ExternalAddr"},
|
||||
{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"VAL3","Value":51,"Source":"Variable","Type":"ExternalAddr"},
|
||||
{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"VAL4","Value":52,"Source":"Variable","Type":"ExternalAddr"},
|
||||
{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"VAL5","Value":53,"Source":"Variable","Type":"ExternalAddr"}],"ClearPrevious":false},
|
||||
"108":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":4,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","Label":"VAL14","Value":49,"Source":"Variable","Type":"ExternalAddr"}],"ClearPrevious":false},
|
||||
"120":{
|
||||
"Variables":[{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"same as org","Label":"DPNOP","Value":128,"Source":"Variable","Type":"ExternalAddr"}],"ClearPrevious":false}}}
|
110
SourceGen/SGTestData/Expected/2019-local-variables_64tass.S
Normal file
110
SourceGen/SGTestData/Expected/2019-local-variables_64tass.S
Normal file
@ -0,0 +1,110 @@
|
||||
;Would need to be edited to test duplicate labels. Those currently cause
|
||||
;assembly to fail (see the X_* vars).
|
||||
.cpu "65816"
|
||||
PROJ_ZERO = $00 ;project addr
|
||||
PROJ_ONE = $01 ;project addr
|
||||
CONST_ZERO = $f0 ;project const
|
||||
|
||||
* = $1000
|
||||
.as
|
||||
.xs
|
||||
ldy PROJ_ZERO
|
||||
lda (PROJ_ONE),y
|
||||
sta $03
|
||||
ldx $04
|
||||
lda CONST_ZERO,s
|
||||
sta $f1,s
|
||||
VAR_ZERO .var $00
|
||||
VAR_TWO .var $02
|
||||
VAR_THREE .var $03
|
||||
CONST_ZERO_VAR .var $f0
|
||||
ldy VAR_ZERO
|
||||
lda (VAR_ZERO+1),y
|
||||
sta VAR_THREE
|
||||
ldx $04
|
||||
lda CONST_ZERO_VAR,s
|
||||
sta $f1,s
|
||||
eor 0
|
||||
ora 240,s
|
||||
X_PROJ_ZERO .var $10 ;clash with project symbol
|
||||
X_DPCODE .var $80 ;clash with user label
|
||||
lda VAR_ZERO
|
||||
lda VAR_ZERO+1
|
||||
lda VAR_TWO
|
||||
lda VAR_THREE
|
||||
lda $04
|
||||
lda X_PROJ_ZERO
|
||||
lda $11
|
||||
lda DPCODE
|
||||
ldx PROJ_ZERO
|
||||
ldx PROJ_ONE
|
||||
ldx $02
|
||||
bit $ffa9
|
||||
ldy PROJ_ZERO
|
||||
ldy PROJ_ONE
|
||||
ldy $02
|
||||
.byte $2c
|
||||
NH0 .var $00 ;not hidden
|
||||
NH1 .var $01 ;not hidden
|
||||
L103C lda #$fe
|
||||
beq L103C
|
||||
ldy NH0
|
||||
ldy NH1
|
||||
ldy $02
|
||||
nop
|
||||
PTR0 .var $10
|
||||
CONST0 .var $10
|
||||
lda PTR0
|
||||
ldx PTR0+1
|
||||
ldy $12
|
||||
lda (CONST0,s),y
|
||||
sta (CONST0+3,s),y
|
||||
;Test name redefinition. This is mostly of interest for assemblers without
|
||||
;redefinable variables, but also of interest to the cross-reference window.
|
||||
PTR .var $20 ;#1
|
||||
ldx PTR
|
||||
PTR .var $22 ;#2
|
||||
ldx PTR
|
||||
PTR .var $24 ;#3
|
||||
ldx PTR
|
||||
PTR_1 nop
|
||||
PTR_A .var $20
|
||||
ldy PTR_A
|
||||
PTR_B .var $1f
|
||||
ldy PTR_B+1
|
||||
PTR_C .var $1d
|
||||
ldy PTR_C+3
|
||||
PTR_D .var $21
|
||||
ldy PTR_C+3
|
||||
VAL0 .var $30
|
||||
VAL1 .var $31
|
||||
VAL2 .var $32
|
||||
VAL3 .var $33
|
||||
VAL4 .var $34
|
||||
VAL5 .var $35
|
||||
and VAL0
|
||||
and VAL1
|
||||
and VAL2
|
||||
and VAL3
|
||||
and VAL4
|
||||
and VAL5
|
||||
VAL14 .var $31
|
||||
and VAL0
|
||||
and VAL14
|
||||
and VAL14+1
|
||||
and VAL14+2
|
||||
and VAL14+3
|
||||
and VAL5
|
||||
DPNOP .var $80 ;same as org
|
||||
lda DPCODE
|
||||
jsr DPCODE
|
||||
rts
|
||||
|
||||
.logical $0080
|
||||
DPCODE nop
|
||||
lda DPCODE
|
||||
lda @wDPCODE
|
||||
lda @lDPCODE
|
||||
rts
|
||||
|
||||
.here
|
106
SourceGen/SGTestData/Expected/2019-local-variables_Merlin32.S
Normal file
106
SourceGen/SGTestData/Expected/2019-local-variables_Merlin32.S
Normal file
@ -0,0 +1,106 @@
|
||||
;Would need to be edited to test duplicate labels. Those currently cause
|
||||
;assembly to fail (see the X_* vars).
|
||||
PROJ_ZERO equ $00 ;project addr
|
||||
PROJ_ONE equ $01 ;project addr
|
||||
CONST_ZERO equ $f0 ;project const
|
||||
|
||||
org $1000
|
||||
ldy PROJ_ZERO
|
||||
lda (PROJ_ONE),y
|
||||
sta $03
|
||||
ldx $04
|
||||
lda CONST_ZERO,S
|
||||
sta $f1,S
|
||||
]VAR_ZERO equ $00
|
||||
]VAR_TWO equ $02
|
||||
]VAR_THREE equ $03
|
||||
]CONST_ZERO_VAR equ $f0
|
||||
ldy ]VAR_ZERO
|
||||
lda (]VAR_ZERO+1),y
|
||||
sta ]VAR_THREE
|
||||
ldx $04
|
||||
lda ]CONST_ZERO_VAR,S
|
||||
sta $f1,S
|
||||
eor 0
|
||||
ora 240,S
|
||||
]X_PROJ_ZERO equ $10 ;clash with project symbol
|
||||
]X_DPCODE equ $80 ;clash with user label
|
||||
lda ]VAR_ZERO
|
||||
lda ]VAR_ZERO+1
|
||||
lda ]VAR_TWO
|
||||
lda ]VAR_THREE
|
||||
lda $04
|
||||
lda ]X_PROJ_ZERO
|
||||
lda $11
|
||||
lda DPCODE
|
||||
ldx PROJ_ZERO
|
||||
ldx PROJ_ONE
|
||||
ldx $02
|
||||
bit $ffa9
|
||||
ldy PROJ_ZERO
|
||||
ldy PROJ_ONE
|
||||
ldy $02
|
||||
dfb $2c
|
||||
]NH0 equ $00 ;not hidden
|
||||
]NH1 equ $01 ;not hidden
|
||||
L103C lda #$fe
|
||||
beq L103C
|
||||
ldy ]NH0
|
||||
ldy ]NH1
|
||||
ldy $02
|
||||
nop
|
||||
]PTR0 equ $10
|
||||
]CONST0 equ $10
|
||||
lda ]PTR0
|
||||
ldx ]PTR0+1
|
||||
ldy $12
|
||||
lda (]CONST0,S),y
|
||||
sta (]CONST0+3,S),y
|
||||
;Test name redefinition. This is mostly of interest for assemblers without
|
||||
;redefinable variables, but also of interest to the cross-reference window.
|
||||
]PTR equ $20 ;#1
|
||||
ldx ]PTR
|
||||
]PTR equ $22 ;#2
|
||||
ldx ]PTR
|
||||
]PTR equ $24 ;#3
|
||||
ldx ]PTR
|
||||
PTR_1 nop
|
||||
]PTR_A equ $20
|
||||
ldy ]PTR_A
|
||||
]PTR_B equ $1f
|
||||
ldy ]PTR_B+1
|
||||
]PTR_C equ $1d
|
||||
ldy ]PTR_C+3
|
||||
]PTR_D equ $21
|
||||
ldy ]PTR_C+3
|
||||
]VAL0 equ $30
|
||||
]VAL1 equ $31
|
||||
]VAL2 equ $32
|
||||
]VAL3 equ $33
|
||||
]VAL4 equ $34
|
||||
]VAL5 equ $35
|
||||
and ]VAL0
|
||||
and ]VAL1
|
||||
and ]VAL2
|
||||
and ]VAL3
|
||||
and ]VAL4
|
||||
and ]VAL5
|
||||
]VAL14 equ $31
|
||||
and ]VAL0
|
||||
and ]VAL14
|
||||
and ]VAL14+1
|
||||
and ]VAL14+2
|
||||
and ]VAL14+3
|
||||
and ]VAL5
|
||||
]DPNOP equ $80 ;same as org
|
||||
lda DPCODE
|
||||
jsr DPCODE
|
||||
rts
|
||||
|
||||
org $0080
|
||||
DPCODE nop
|
||||
lda DPCODE
|
||||
lda: DPCODE
|
||||
ldal DPCODE
|
||||
rts
|
||||
|
110
SourceGen/SGTestData/Expected/2019-local-variables_acme.S
Normal file
110
SourceGen/SGTestData/Expected/2019-local-variables_acme.S
Normal file
@ -0,0 +1,110 @@
|
||||
;Would need to be edited to test duplicate labels. Those currently cause
|
||||
;assembly to fail (see the X_* vars).
|
||||
!cpu 65816
|
||||
PROJ_ZERO = $00 ;project addr
|
||||
PROJ_ONE = $01 ;project addr
|
||||
CONST_ZERO = $f0 ;project const
|
||||
|
||||
* = $1000
|
||||
!as
|
||||
!rs
|
||||
ldy PROJ_ZERO
|
||||
lda (PROJ_ONE),y
|
||||
sta $03
|
||||
ldx $04
|
||||
lda CONST_ZERO,S
|
||||
sta $f1,S
|
||||
VAR_ZERO = $00
|
||||
VAR_TWO = $02
|
||||
VAR_THREE = $03
|
||||
CONST_ZERO_VAR = $f0
|
||||
ldy VAR_ZERO
|
||||
lda (VAR_ZERO+1),y
|
||||
sta VAR_THREE
|
||||
ldx $04
|
||||
lda CONST_ZERO_VAR,S
|
||||
sta $f1,S
|
||||
eor 0
|
||||
ora 240,S
|
||||
X_PROJ_ZERO = $10 ;clash with project symbol
|
||||
X_DPCODE = $80 ;clash with user label
|
||||
lda VAR_ZERO
|
||||
lda VAR_ZERO+1
|
||||
lda VAR_TWO
|
||||
lda VAR_THREE
|
||||
lda $04
|
||||
lda X_PROJ_ZERO
|
||||
lda $11
|
||||
lda+1 DPCODE
|
||||
ldx PROJ_ZERO
|
||||
ldx PROJ_ONE
|
||||
ldx $02
|
||||
bit $ffa9
|
||||
ldy PROJ_ZERO
|
||||
ldy PROJ_ONE
|
||||
ldy $02
|
||||
!byte $2c
|
||||
NH0 = $00 ;not hidden
|
||||
NH1 = $01 ;not hidden
|
||||
L103C lda #$fe
|
||||
beq L103C
|
||||
ldy NH0
|
||||
ldy NH1
|
||||
ldy $02
|
||||
nop
|
||||
PTR0 = $10
|
||||
CONST0 = $10
|
||||
lda PTR0
|
||||
ldx PTR0+1
|
||||
ldy $12
|
||||
lda (CONST0,S),y
|
||||
sta (CONST0+3,S),y
|
||||
;Test name redefinition. This is mostly of interest for assemblers without
|
||||
;redefinable variables, but also of interest to the cross-reference window.
|
||||
PTR = $20 ;#1
|
||||
ldx PTR
|
||||
PTR_3 = $22 ;#2
|
||||
ldx PTR_3
|
||||
PTR_4 = $24 ;#3
|
||||
ldx PTR_4
|
||||
PTR_1 nop
|
||||
PTR_A = $20
|
||||
ldy PTR_A
|
||||
PTR_B = $1f
|
||||
ldy PTR_B+1
|
||||
PTR_C = $1d
|
||||
ldy PTR_C+3
|
||||
PTR_D = $21
|
||||
ldy PTR_C+3
|
||||
VAL0 = $30
|
||||
VAL1 = $31
|
||||
VAL2 = $32
|
||||
VAL3 = $33
|
||||
VAL4 = $34
|
||||
VAL5 = $35
|
||||
and VAL0
|
||||
and VAL1
|
||||
and VAL2
|
||||
and VAL3
|
||||
and VAL4
|
||||
and VAL5
|
||||
VAL14 = $31
|
||||
and VAL0
|
||||
and VAL14
|
||||
and VAL14+1
|
||||
and VAL14+2
|
||||
and VAL14+3
|
||||
and VAL5
|
||||
DPNOP = $80 ;same as org
|
||||
lda+1 DPCODE
|
||||
jsr DPCODE
|
||||
rts
|
||||
|
||||
!pseudopc $0080 {
|
||||
DPCODE nop
|
||||
lda+1 DPCODE
|
||||
lda+2 DPCODE
|
||||
lda+3 DPCODE
|
||||
rts
|
||||
|
||||
} ;!pseudopc
|
111
SourceGen/SGTestData/Expected/2019-local-variables_cc65.S
Normal file
111
SourceGen/SGTestData/Expected/2019-local-variables_cc65.S
Normal file
@ -0,0 +1,111 @@
|
||||
;Would need to be edited to test duplicate labels. Those currently cause
|
||||
;assembly to fail (see the X_* vars).
|
||||
.setcpu "65816"
|
||||
PROJ_ZERO = $00 ;project addr
|
||||
PROJ_ONE = $01 ;project addr
|
||||
CONST_ZERO = $f0 ;project const
|
||||
|
||||
; .segment "SEG000"
|
||||
.org $1000
|
||||
.a8
|
||||
.i8
|
||||
ldy PROJ_ZERO
|
||||
lda (PROJ_ONE),y
|
||||
sta $03
|
||||
ldx $04
|
||||
lda CONST_ZERO,S
|
||||
sta $f1,S
|
||||
VAR_ZERO = $00
|
||||
VAR_TWO = $02
|
||||
VAR_THREE = $03
|
||||
CONST_ZERO_VAR = $f0
|
||||
ldy VAR_ZERO
|
||||
lda (VAR_ZERO+1),y
|
||||
sta VAR_THREE
|
||||
ldx $04
|
||||
lda CONST_ZERO_VAR,S
|
||||
sta $f1,S
|
||||
eor 0
|
||||
ora 240,S
|
||||
X_PROJ_ZERO = $10 ;clash with project symbol
|
||||
X_DPCODE = $80 ;clash with user label
|
||||
lda VAR_ZERO
|
||||
lda VAR_ZERO+1
|
||||
lda VAR_TWO
|
||||
lda VAR_THREE
|
||||
lda $04
|
||||
lda X_PROJ_ZERO
|
||||
lda $11
|
||||
lda z:DPCODE
|
||||
ldx PROJ_ZERO
|
||||
ldx PROJ_ONE
|
||||
ldx $02
|
||||
bit $ffa9
|
||||
ldy PROJ_ZERO
|
||||
ldy PROJ_ONE
|
||||
ldy $02
|
||||
.byte $2c
|
||||
NH0 = $00 ;not hidden
|
||||
NH1 = $01 ;not hidden
|
||||
L103C: lda #$fe
|
||||
beq L103C
|
||||
ldy NH0
|
||||
ldy NH1
|
||||
ldy $02
|
||||
nop
|
||||
PTR0 = $10
|
||||
CONST0 = $10
|
||||
lda PTR0
|
||||
ldx PTR0+1
|
||||
ldy $12
|
||||
lda (CONST0,S),y
|
||||
sta (CONST0+3,S),y
|
||||
;Test name redefinition. This is mostly of interest for assemblers without
|
||||
;redefinable variables, but also of interest to the cross-reference window.
|
||||
PTR = $20 ;#1
|
||||
ldx PTR
|
||||
PTR_3 = $22 ;#2
|
||||
ldx PTR_3
|
||||
PTR_4 = $24 ;#3
|
||||
ldx PTR_4
|
||||
PTR_1: nop
|
||||
PTR_A = $20
|
||||
ldy PTR_A
|
||||
PTR_B = $1f
|
||||
ldy PTR_B+1
|
||||
PTR_C = $1d
|
||||
ldy PTR_C+3
|
||||
PTR_D = $21
|
||||
ldy PTR_C+3
|
||||
VAL0 = $30
|
||||
VAL1 = $31
|
||||
VAL2 = $32
|
||||
VAL3 = $33
|
||||
VAL4 = $34
|
||||
VAL5 = $35
|
||||
and VAL0
|
||||
and VAL1
|
||||
and VAL2
|
||||
and VAL3
|
||||
and VAL4
|
||||
and VAL5
|
||||
VAL14 = $31
|
||||
and VAL0
|
||||
and VAL14
|
||||
and VAL14+1
|
||||
and VAL14+2
|
||||
and VAL14+3
|
||||
and VAL5
|
||||
DPNOP = $80 ;same as org
|
||||
lda z:DPCODE
|
||||
jsr DPCODE
|
||||
rts
|
||||
|
||||
; .segment "SEG001"
|
||||
.org $0080
|
||||
DPCODE: nop
|
||||
lda DPCODE
|
||||
lda a:DPCODE
|
||||
lda f:DPCODE
|
||||
rts
|
||||
|
13
SourceGen/SGTestData/Expected/2019-local-variables_cc65.cfg
Normal file
13
SourceGen/SGTestData/Expected/2019-local-variables_cc65.cfg
Normal file
@ -0,0 +1,13 @@
|
||||
# 6502bench SourceGen generated linker script for 2019-local-variables
|
||||
MEMORY {
|
||||
MAIN: file=%O, start=%S, size=65536;
|
||||
# MEM000: file=%O, start=$1000, size=126;
|
||||
# MEM001: file=%O, start=$0080, size=11;
|
||||
}
|
||||
SEGMENTS {
|
||||
CODE: load=MAIN, type=rw;
|
||||
# SEG000: load=MEM000, type=rw;
|
||||
# SEG001: load=MEM001, type=rw;
|
||||
}
|
||||
FEATURES {}
|
||||
SYMBOLS {}
|
148
SourceGen/SGTestData/Source/2019-local-variables.S
Normal file
148
SourceGen/SGTestData/Source/2019-local-variables.S
Normal file
@ -0,0 +1,148 @@
|
||||
; Copyright 2019 faddenSoft. All Rights Reserved.
|
||||
; See the LICENSE.txt file for distribution terms (Apache 2.0).
|
||||
;
|
||||
; Assembler: Merlin 32
|
||||
|
||||
org $1000
|
||||
|
||||
; Define these as project symbols.
|
||||
PROJ_ZERO equ $00
|
||||
PROJ_ONE equ $01
|
||||
CONST_ZERO equ $f0
|
||||
CONST_ONE equ $f1
|
||||
PTR_2 equ $f8 ;used to test uniqifier later on
|
||||
|
||||
ldy PROJ_ZERO
|
||||
lda (PROJ_ONE),y
|
||||
sta $03 ;undefined yet
|
||||
ldx $04 ;undefined yet
|
||||
lda CONST_ZERO,S ;explicitly set symbol
|
||||
sta CONST_ONE,S ;leave as default (hex)
|
||||
|
||||
; TABLE - test redefinition of project symbol values
|
||||
]VAR_ZERO equ $00 ;2b
|
||||
]VAR_TWO equ $02 ;1b
|
||||
]VAR_THREE equ $03 ;1b
|
||||
]CONST_ZERO equ $f0 ;1b const
|
||||
|
||||
ldy PROJ_ZERO ;should become ]VAR_ZERO
|
||||
lda (PROJ_ONE),y ;should become ]VAR_ZERO+1
|
||||
sta $03 ;should become ]VAR_THREE
|
||||
ldx $04 ;undefined yet
|
||||
lda CONST_ZERO,S ;should become ]CONST_ZERO
|
||||
sta CONST_ONE,S ;leave as default (hex)
|
||||
|
||||
eor $00 ;explicitly format as decimal
|
||||
ora $f0,S ;explicitly format as decimal
|
||||
|
||||
; TABLE - test redefinition of symbol labels
|
||||
]PROJ_ZERO equ $10 ;EDIT: rename to PROJ_ZERO
|
||||
]DPCODE equ $80 ;EDIT: rename to DPCODE
|
||||
|
||||
lda $00
|
||||
lda $01
|
||||
lda $02
|
||||
lda $03
|
||||
lda $04
|
||||
lda $10
|
||||
lda $11
|
||||
lda $80
|
||||
|
||||
; TABLE/CLEAR - empty table
|
||||
ldx $00
|
||||
ldx $01
|
||||
ldx $02
|
||||
|
||||
; confirm that hidden tables are skipped over
|
||||
dfb $2c
|
||||
; TABLE (hidden)
|
||||
]HIDDEN0 equ $00
|
||||
]HIDDEN1 equ $01
|
||||
lda #$ff
|
||||
ldy $00
|
||||
ldy $01
|
||||
ldy $02
|
||||
|
||||
dfb $2c
|
||||
; TABLE (not hidden)
|
||||
]NH0 equ $00
|
||||
]NH1 equ $01
|
||||
:label lda #$fe
|
||||
beq :label
|
||||
ldy $00
|
||||
ldy $01
|
||||
ldy $02
|
||||
|
||||
nop
|
||||
|
||||
; TABLE
|
||||
]PTR0 equ $10 ;2b
|
||||
]CONST0 equ $10 ;4b
|
||||
lda ]PTR0
|
||||
ldx ]PTR0+1
|
||||
ldy ]PTR0+2 ;should be hex
|
||||
lda (]CONST0,S),y
|
||||
sta (]CONST0+3,S),y
|
||||
|
||||
; test redefinition of name
|
||||
|
||||
; TABLE
|
||||
]PTR equ $20 ;2b
|
||||
ldx ]PTR
|
||||
; TABLE
|
||||
]PTR equ $22 ;2b
|
||||
ldx ]PTR
|
||||
; TABLE
|
||||
]PTR equ $24 ;2b
|
||||
ldx ]PTR
|
||||
|
||||
; define user label to try to trip up the uniqifier
|
||||
PTR_1 nop
|
||||
|
||||
|
||||
; test redefinition of value
|
||||
; TABLE/CLEAR
|
||||
]PTR_A equ $20 ;2b
|
||||
ldy ]PTR_A ;PTR_A
|
||||
]PTR_B equ $1f ;2b
|
||||
ldy ]PTR_A ;PTR_B+1
|
||||
]PTR_C equ $1d ;4b
|
||||
ldy ]PTR_A ;PTR_C+3
|
||||
]PTR_D equ $21 ;1b
|
||||
ldy ]PTR_A ;should come up as hex
|
||||
|
||||
; TABLE
|
||||
]VAL0 equ $30 ;1b
|
||||
]VAL1 equ $31 ;1b
|
||||
]VAL2 equ $32 ;1b
|
||||
]VAL3 equ $33 ;1b
|
||||
]VAL4 equ $34 ;1b
|
||||
]VAL5 equ $35 ;1b
|
||||
and ]VAL0
|
||||
and ]VAL1
|
||||
and ]VAL2
|
||||
and ]VAL3
|
||||
and ]VAL4
|
||||
and ]VAL5
|
||||
; TABLE
|
||||
]VAL14 equ $31 ;4b
|
||||
and ]VAL0
|
||||
and ]VAL1 ;these four become ]VAL14
|
||||
and ]VAL2
|
||||
and ]VAL3
|
||||
and ]VAL4
|
||||
and ]VAL5
|
||||
|
||||
|
||||
; TABLE - test direct page label vs. variable
|
||||
]DPNOP equ $80
|
||||
lda ]DPNOP
|
||||
jsr DPCODE
|
||||
rts
|
||||
|
||||
org $0080
|
||||
DPCODE nop
|
||||
lda DPCODE ;should be DPNOP
|
||||
lda |DPCODE ;should be DPCODE
|
||||
lda >DPCODE ;should be DPCODE
|
||||
rts
|
@ -226,7 +226,8 @@ namespace SourceGen.WpfGui {
|
||||
bool valueUniqueValid = true;
|
||||
if (mIsVariable && valueValid && widthValid) {
|
||||
foreach (KeyValuePair<string, DefSymbol> kvp in mDefSymbolList) {
|
||||
if (DefSymbol.CheckOverlap(kvp.Value, thisValue, thisWidth, symbolType)) {
|
||||
if (kvp.Value != mOldSym &&
|
||||
DefSymbol.CheckOverlap(kvp.Value, thisValue, thisWidth, symbolType)) {
|
||||
valueUniqueValid = false;
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user