1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-12 23:29:32 +00:00

Refactor 2006x-target-adjustment

Split into 6502/65816 portions.  The 6502 version is the original
with a few in-place substitutions (e.g. JMP for BRL).  The 65816
version is only needed to exercise special handling of PEA/PER.
This commit is contained in:
Andy McFadden 2020-10-19 15:46:05 -07:00
parent 8109396c48
commit b7d3e3cfdf
16 changed files with 760 additions and 466 deletions

Binary file not shown.

View File

@ -0,0 +1,198 @@
### 6502bench SourceGen dis65 v1.0 ###
{
"_ContentVersion":4,
"FileDataLength":191,
"FileDataCrc32":-1208181819,
"ProjectProps":{
"CpuName":"6502",
"IncludeUndocumentedInstr":false,
"TwoByteBrk":false,
"EntryFlags":33489103,
"AutoLabelStyle":"Simple",
"AnalysisParams":{
"AnalyzeUncategorizedData":true,
"DefaultTextScanMode":"LowHighAscii",
"MinCharsForString":4,
"SeekNearbyTargets":true,
"UseRelocData":false,
"SmartPlpHandling":true,
"SmartPlbHandling":true},
"PlatformSymbolFileIdentifiers":[],
"ExtensionScriptFileIdentifiers":[],
"ProjectSyms":{
}},
"AddressMap":[{
"Offset":0,
"Addr":4096},
{
"Offset":133,
"Addr":8192}],
"TypeHints":[{
"Low":0,
"High":0,
"Hint":"Code"}],
"StatusFlagOverrides":{
},
"Comments":{
"125":"self-ref; operand format refs nonexistent symbol"},
"LongComments":{
},
"Notes":{
},
"UserLabels":{
"0":{
"Label":"load11",
"Value":4096,
"Source":"User",
"Type":"LocalOrGlobalAddr",
"LabelAnno":"None"},
"4":{
"Label":"load33",
"Value":4100,
"Source":"User",
"Type":"LocalOrGlobalAddr",
"LabelAnno":"None"},
"8":{
"Label":"predat",
"Value":4104,
"Source":"User",
"Type":"LocalOrGlobalAddr",
"LabelAnno":"None"},
"12":{
"Label":"dat1",
"Value":4108,
"Source":"User",
"Type":"LocalOrGlobalAddr",
"LabelAnno":"None"},
"49":{
"Label":"fill0",
"Value":4145,
"Source":"User",
"Type":"LocalOrGlobalAddr",
"LabelAnno":"None"},
"132":{
"Label":"dat81",
"Value":4228,
"Source":"User",
"Type":"LocalOrGlobalAddr",
"LabelAnno":"None"},
"150":{
"Label":"nearby",
"Value":8209,
"Source":"User",
"Type":"LocalOrGlobalAddr",
"LabelAnno":"None"}},
"OperandFormats":{
"10":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"12":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"14":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"16":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"18":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"20":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"43":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"45":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"47":{
"Length":2,
"Format":"NumericLE",
"SubFormat":"Address",
"SymbolRef":null},
"90":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"fill0",
"Part":"Low"}},
"93":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"fill0",
"Part":"Low"}},
"96":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"fill0",
"Part":"Low"}},
"125":{
"Length":3,
"Format":"NumericLE",
"SubFormat":"Symbol",
"SymbolRef":{
"Label":"nonexistent",
"Part":"Low"}}},
"LvTables":{
},
"Visualizations":[],
"VisualizationAnimations":[],
"VisualizationSets":{
},
"RelocList":{
},
"DbrValues":{
}}

View File

@ -1,67 +1,72 @@
### 6502bench SourceGen dis65 v1.0 ###
{
"_ContentVersion":2,"FileDataLength":191,"FileDataCrc32":1554487300,"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":{
"_ContentVersion":4,
"FileDataLength":23,
"FileDataCrc32":-1829154192,
"ProjectProps":{
"CpuName":"65816",
"IncludeUndocumentedInstr":false,
"TwoByteBrk":false,
"EntryFlags":32702671,
"AutoLabelStyle":"Simple",
"AnalysisParams":{
"AnalyzeUncategorizedData":true,
"DefaultTextScanMode":"LowHighAscii",
"MinCharsForString":4,
"SeekNearbyTargets":true,
"UseRelocData":false,
"SmartPlpHandling":false,
"SmartPlbHandling":true},
"PlatformSymbolFileIdentifiers":[],
"ExtensionScriptFileIdentifiers":[],
"ProjectSyms":{
}},
"AddressMap":[{
"Offset":0,"Addr":4096},
{
"Offset":133,"Addr":8192}],"TypeHints":[{
"Low":0,"High":0,"Hint":"Code"}],"StatusFlagOverrides":{
"Offset":0,
"Addr":4096}],
"TypeHints":[{
"Low":0,
"High":0,
"Hint":"Code"}],
"StatusFlagOverrides":{
},
"Comments":{
"125":"self-ref; operand format refs nonexistent symbol"},
"LongComments":{
},
"LongComments":{
"-2147483647":{
"Text":"6502bench SourceGen v1.7.3-dev2",
"BoxMode":false,
"MaxWidth":80,
"BackgroundColor":0}},
"Notes":{
},
"UserLabels":{
"0":{
"Label":"load11","Value":4096,"Source":"User","Type":"LocalOrGlobalAddr"},
"4":{
"Label":"load33","Value":4100,"Source":"User","Type":"LocalOrGlobalAddr"},
"8":{
"Label":"predat","Value":4104,"Source":"User","Type":"LocalOrGlobalAddr"},
"12":{
"Label":"dat1","Value":4108,"Source":"User","Type":"LocalOrGlobalAddr"},
"49":{
"Label":"fill0","Value":4145,"Source":"User","Type":"LocalOrGlobalAddr"},
"132":{
"Label":"dat81","Value":4228,"Source":"User","Type":"LocalOrGlobalAddr"},
"150":{
"Label":"nearby","Value":8209,"Source":"User","Type":"LocalOrGlobalAddr"}},
"Label":"caddr",
"Value":4100,
"Source":"User",
"Type":"GlobalAddr",
"LabelAnno":"None"}},
"OperandFormats":{
"10":{
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
"12":{
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
"14":{
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
"16":{
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
"18":{
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
"20":{
"Length":2,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
"43":{
"Length":2,"Format":"NumericLE","SubFormat":"Address","SymbolRef":null},
"45":{
"Length":2,"Format":"NumericLE","SubFormat":"Address","SymbolRef":null},
"47":{
"Length":2,"Format":"NumericLE","SubFormat":"Address","SymbolRef":null},
"90":{
"Length":3,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{
"Label":"fill0","Part":"Low"}},
"93":{
"Length":3,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{
"Label":"fill0","Part":"Low"}},
"96":{
"Length":3,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{
"Label":"fill0","Part":"Low"}},
"125":{
"Length":3,"Format":"NumericLE","SubFormat":"Symbol","SymbolRef":{
"Label":"nonexistent","Part":"Low"}}},
},
"LvTables":{
},
"Visualizations":[],
"VisualizationAnimations":[],
"VisualizationSets":{
},
"RelocList":{
},
"DbrValues":{
}}

View File

@ -0,0 +1,86 @@
.cpu "6502"
.enc "sg_ascii"
.cdef $20,$7e,$20
* = $1000
load11 lda #$11
_L1002 ldx #$22
_load33 ldy #$33
_L1006 lda #$44
_predat bne _L1042
.word $0123
_dat1 .word $4567
.word $89ab
_L1010 .word $cdef
_L1012 .word $0011
_L1014 .word $2233
.byte $80
.text "The quick brown fox"
.byte $80
.word _L1042
.word _L1041
.word _L1042+1
_fill0 .fill 16,$00
_L1041 .byte $80
_L1042 lda _predat+2
lda _L1041
asl _dat1
rol _dat1+2
ror _L1010
and _L1012
ora _L1014
lda _fill0
sta _fill0+4
lda _fill0+8
sta _fill0+12
jsr _L1002
_L1066 lda _L1006
_L1069 bit _L1066+2
ora _L1066+2
lda _L1069+1
lda _L1069+2
lda #$ea
_L1077 sta _L1077
_L107A sta _L107A+1
sta $107f ;self-ref; operand format refs nonexistent symbol
jmp _L2002
.byte $80
_dat81 .byte $81
.logical $2000
_L2000 .byte $82
.byte $83
_L2002 nop
nop
lda _dat81
lda _L2000
jmp _L2018
_L200D .byte $7c
_L200E .byte $7d
_L200F .byte $7e
.byte $7f
_nearby .byte $80
.byte $81
.byte $82
.byte $83
_L2015 .byte $84
_L2016 .byte $85
_L2017 .byte $86
_L2018 lda _L200D
lda _L200E
lda _L200F
lda _nearby-1
lda _nearby
lda _nearby+1
lda _nearby+2
lda _nearby+3
lda _L2015
lda _L2016
lda _L2017
rts
.here

View File

@ -0,0 +1,86 @@
!cpu 6502
* = $0000
!pseudopc $1000 {
load11 lda #$11
@L1002 ldx #$22
@load33 ldy #$33
@L1006 lda #$44
@predat bne @L1042
!word $0123
@dat1 !word $4567
!word $89ab
@L1010 !word $cdef
@L1012 !word $0011
@L1014 !word $2233
!byte $80
!text "The quick brown fox"
!byte $80
!word @L1042
!word @L1041
!word @L1042+1
@fill0 !fill 16,$00
@L1041 !byte $80
@L1042 lda @predat+2
lda @L1041
asl @dat1
rol @dat1+2
ror @L1010
and @L1012
ora @L1014
lda @fill0
sta @fill0+4
lda @fill0+8
sta @fill0+12
jsr @L1002
@L1066 lda @L1006
@L1069 bit @L1066+2
ora @L1066+2
lda @L1069+1
lda @L1069+2
lda #$ea
@L1077 sta @L1077
@L107A sta @L107A+1
sta $107f ;self-ref; operand format refs nonexistent symbol
jmp @L2002
!byte $80
@dat81 !byte $81
} ;!pseudopc
!pseudopc $2000 {
@L2000 !byte $82
!byte $83
@L2002 nop
nop
lda @dat81
lda @L2000
jmp @L2018
@L200D !byte $7c
@L200E !byte $7d
@L200F !byte $7e
!byte $7f
@nearby !byte $80
!byte $81
!byte $82
!byte $83
@L2015 !byte $84
@L2016 !byte $85
@L2017 !byte $86
@L2018 lda @L200D
lda @L200E
lda @L200F
lda @nearby-1
lda @nearby
lda @nearby+1
lda @nearby+2
lda @nearby+3
lda @L2015
lda @L2016
lda @L2017
rts
} ;!pseudopc

View File

@ -0,0 +1,85 @@
.setcpu "6502"
; .segment "SEG000"
.org $1000
load11: lda #$11
@L1002: ldx #$22
@load33: ldy #$33
@L1006: lda #$44
@predat: bne @L1042
.word $0123
@dat1: .word $4567
.word $89ab
@L1010: .word $cdef
@L1012: .word $0011
@L1014: .word $2233
.byte $80
.byte "The quick brown fox"
.byte $80
.word @L1042
.word @L1041
.word @L1042+1
@fill0: .res 16,$00
@L1041: .byte $80
@L1042: lda @predat+2
lda @L1041
asl @dat1
rol @dat1+2
ror @L1010
and @L1012
ora @L1014
lda @fill0
sta @fill0+4
lda @fill0+8
sta @fill0+12
jsr @L1002
@L1066: lda @L1006
@L1069: bit @L1066+2
ora @L1066+2
lda @L1069+1
lda @L1069+2
lda #$ea
@L1077: sta @L1077
@L107A: sta @L107A+1
sta $107f ;self-ref; operand format refs nonexistent symbol
jmp @L2002
.byte $80
@dat81: .byte $81
; .segment "SEG001"
.org $2000
@L2000: .byte $82
.byte $83
@L2002: nop
nop
lda @dat81
lda @L2000
jmp @L2018
@L200D: .byte $7c
@L200E: .byte $7d
@L200F: .byte $7e
.byte $7f
@nearby: .byte $80
.byte $81
.byte $82
.byte $83
@L2015: .byte $84
@L2016: .byte $85
@L2017: .byte $86
@L2018: lda @L200D
lda @L200E
lda @L200F
lda @nearby-1
lda @nearby
lda @nearby+1
lda @nearby+2
lda @nearby+3
lda @L2015
lda @L2016
lda @L2017
rts

View File

@ -0,0 +1,13 @@
# 6502bench SourceGen generated linker script for 20060-target-adjustment
MEMORY {
MAIN: file=%O, start=%S, size=65536;
# MEM000: file=%O, start=$1000, size=133;
# MEM001: file=%O, start=$2000, size=58;
}
SEGMENTS {
CODE: load=MAIN, type=rw;
# SEG000: load=MEM000, type=rw;
# SEG001: load=MEM001, type=rw;
}
FEATURES {}
SYMBOLS {}

View File

@ -0,0 +1,82 @@
org $1000
load11 lda #$11
:L1002 ldx #$22
:load33 ldy #$33
:L1006 lda #$44
:predat bne :L1042
dw $0123
:dat1 dw $4567
dw $89ab
:L1010 dw $cdef
:L1012 dw $0011
:L1014 dw $2233
dfb $80
asc 'The quick brown fox'
dfb $80
dw :L1042
dw :L1041
dw :L1042+1
:fill0 ds 16
:L1041 dfb $80
:L1042 lda :predat+2
lda :L1041
asl :dat1
rol :dat1+2
ror :L1010
and :L1012
ora :L1014
lda :fill0
sta :fill0+4
lda :fill0+8
sta :fill0+12
jsr :L1002
:L1066 lda :L1006
:L1069 bit :L1066+2
ora :L1066+2
lda :L1069+1
lda :L1069+2
lda #$ea
:L1077 sta :L1077
:L107A sta :L107A+1
sta $107f ;self-ref; operand format refs nonexistent symbol
jmp :L2002
dfb $80
:dat81 dfb $81
org $2000
:L2000 dfb $82
dfb $83
:L2002 nop
nop
lda :dat81
lda :L2000
jmp :L2018
:L200D dfb $7c
:L200E dfb $7d
:L200F dfb $7e
dfb $7f
:nearby dfb $80
dfb $81
dfb $82
dfb $83
:L2015 dfb $84
:L2016 dfb $85
:L2017 dfb $86
:L2018 lda :L200D
lda :L200E
lda :L200F
lda :nearby-1
lda :nearby
lda :nearby+1
lda :nearby+2
lda :nearby+3
lda :L2015
lda :L2016
lda :L2017
rts

View File

@ -1,87 +1,15 @@
;6502bench SourceGen v1.7.3-dev2
.cpu "65816"
.enc "sg_ascii"
.cdef $20,$7e,$20
* = $1000
.as
.xs
load11 lda #$11
_L1002 ldx #$22
_load33 ldy #$33
_L1006 lda #$44
_predat bra _L1042
.word $0123
_dat1 .word $4567
.word $89ab
_L1010 .word $cdef
_L1012 .word $0011
_L1014 .word $2233
.byte $80
.text "The quick brown fox"
.byte $80
.word _L1042
.word _L1041
.word _L1042+1
_fill0 .fill 16,$00
_L1041 .byte $80
_L1042 lda _predat+2
lda _L1041
asl _dat1
rol _dat1+2
ror _L1010
and _L1012
ora _L1014
lda _fill0
sta _fill0+4
lda _fill0+8
sta _fill0+12
jsr _L1002
lda _L1006
_L1069 pea _L1069-1
per _L1069-1
lda _L1069+1
lda _L1069+2
lda #$ea
_L1077 sta _L1077
_L107A sta _L107A+1
sta $107f ;self-ref; operand format refs nonexistent symbol
brl _L2002
.byte $80
_dat81 .byte $81
.logical $2000
_L2000 .byte $82
.byte $83
_L2002 bit _L2002
lda _dat81
lda _L2000
bra _L2018
_L200D .byte $7c
_L200E .byte $7d
_L200F .byte $7e
.byte $7f
_nearby .byte $80
.byte $81
.byte $82
.byte $83
_L2015 .byte $84
_L2016 .byte $85
_L2017 .byte $86
_L2018 lda _L200D
lda _L200E
lda _L200F
lda _nearby-1
lda _nearby
lda _nearby+1
lda _nearby+2
lda _nearby+3
lda _L2015
lda _L2016
lda _L2017
nop
L1001 bit L1001
caddr pea caddr-1
per caddr-1
lda L1001+2
lda caddr
lda caddr+1
lda caddr+2
rts
.here

View File

@ -1,87 +1,15 @@
;6502bench SourceGen v1.7.3-dev2
!cpu 65816
* = $0000
!pseudopc $1000 {
* = $1000
!as
!rs
load11 lda #$11
@L1002 ldx #$22
@load33 ldy #$33
@L1006 lda #$44
@predat bra @L1042
!word $0123
@dat1 !word $4567
!word $89ab
@L1010 !word $cdef
@L1012 !word $0011
@L1014 !word $2233
!byte $80
!text "The quick brown fox"
!byte $80
!word @L1042
!word @L1041
!word @L1042+1
@fill0 !fill 16,$00
@L1041 !byte $80
@L1042 lda @predat+2
lda @L1041
asl @dat1
rol @dat1+2
ror @L1010
and @L1012
ora @L1014
lda @fill0
sta @fill0+4
lda @fill0+8
sta @fill0+12
jsr @L1002
lda @L1006
@L1069 pea @L1069-1
per @L1069-1
lda @L1069+1
lda @L1069+2
lda #$ea
@L1077 sta @L1077
@L107A sta @L107A+1
sta $107f ;self-ref; operand format refs nonexistent symbol
brl @L2002
!byte $80
@dat81 !byte $81
} ;!pseudopc
!pseudopc $2000 {
@L2000 !byte $82
!byte $83
@L2002 bit @L2002
lda @dat81
lda @L2000
bra @L2018
@L200D !byte $7c
@L200E !byte $7d
@L200F !byte $7e
!byte $7f
@nearby !byte $80
!byte $81
!byte $82
!byte $83
@L2015 !byte $84
@L2016 !byte $85
@L2017 !byte $86
@L2018 lda @L200D
lda @L200E
lda @L200F
lda @nearby-1
lda @nearby
lda @nearby+1
lda @nearby+2
lda @nearby+3
lda @L2015
lda @L2016
lda @L2017
nop
L1001 bit L1001
caddr pea caddr-1
per caddr-1
lda L1001+2
lda caddr
lda caddr+1
lda caddr+2
rts
} ;!pseudopc

View File

@ -1,86 +1,16 @@
;6502bench SourceGen v1.7.3-dev2
.setcpu "65816"
; .segment "SEG000"
.org $1000
.a8
.i8
load11: lda #$11
@L1002: ldx #$22
@load33: ldy #$33
@L1006: lda #$44
@predat: bra @L1042
.word $0123
@dat1: .word $4567
.word $89ab
@L1010: .word $cdef
@L1012: .word $0011
@L1014: .word $2233
.byte $80
.byte "The quick brown fox"
.byte $80
.word @L1042
.word @L1041
.word @L1042+1
@fill0: .res 16,$00
@L1041: .byte $80
@L1042: lda @predat+2
lda @L1041
asl @dat1
rol @dat1+2
ror @L1010
and @L1012
ora @L1014
lda @fill0
sta @fill0+4
lda @fill0+8
sta @fill0+12
jsr @L1002
lda @L1006
@L1069: pea @L1069-1
per @L1069-1
lda @L1069+1
lda @L1069+2
lda #$ea
@L1077: sta @L1077
@L107A: sta @L107A+1
sta $107f ;self-ref; operand format refs nonexistent symbol
brl @L2002
.byte $80
@dat81: .byte $81
; .segment "SEG001"
.org $2000
@L2000: .byte $82
.byte $83
@L2002: bit @L2002
lda @dat81
lda @L2000
bra @L2018
@L200D: .byte $7c
@L200E: .byte $7d
@L200F: .byte $7e
.byte $7f
@nearby: .byte $80
.byte $81
.byte $82
.byte $83
@L2015: .byte $84
@L2016: .byte $85
@L2017: .byte $86
@L2018: lda @L200D
lda @L200E
lda @L200F
lda @nearby-1
lda @nearby
lda @nearby+1
lda @nearby+2
lda @nearby+3
lda @L2015
lda @L2016
lda @L2017
nop
L1001: bit L1001
caddr: pea caddr-1
per caddr-1
lda L1001+2
lda caddr
lda caddr+1
lda caddr+2
rts

View File

@ -1,13 +1,11 @@
# 6502bench SourceGen generated linker script for 20062-target-adjustment
MEMORY {
MAIN: file=%O, start=%S, size=65536;
# MEM000: file=%O, start=$1000, size=133;
# MEM001: file=%O, start=$2000, size=58;
# MEM000: file=%O, start=$1000, size=23;
}
SEGMENTS {
CODE: load=MAIN, type=rw;
# SEG000: load=MEM000, type=rw;
# SEG001: load=MEM001, type=rw;
}
FEATURES {}
SYMBOLS {}

View File

@ -1,81 +1,12 @@
;6502bench SourceGen v1.7.3-dev2
org $1000
load11 lda #$11
:L1002 ldx #$22
:load33 ldy #$33
:L1006 lda #$44
:predat bra :L1042
dw $0123
:dat1 dw $4567
dw $89ab
:L1010 dw $cdef
:L1012 dw $0011
:L1014 dw $2233
dfb $80
asc 'The quick brown fox'
dfb $80
dw :L1042
dw :L1041
dw :L1042+1
:fill0 ds 16
:L1041 dfb $80
:L1042 lda :predat+2
lda :L1041
asl :dat1
rol :dat1+2
ror :L1010
and :L1012
ora :L1014
lda :fill0
sta :fill0+4
lda :fill0+8
sta :fill0+12
jsr :L1002
lda :L1006
:L1069 pea :L1069-1
per :L1069-1
lda :L1069+1
lda :L1069+2
lda #$ea
:L1077 sta :L1077
:L107A sta :L107A+1
sta $107f ;self-ref; operand format refs nonexistent symbol
brl :L2002
dfb $80
:dat81 dfb $81
org $2000
:L2000 dfb $82
dfb $83
:L2002 bit :L2002
lda :dat81
lda :L2000
bra :L2018
:L200D dfb $7c
:L200E dfb $7d
:L200F dfb $7e
dfb $7f
:nearby dfb $80
dfb $81
dfb $82
dfb $83
:L2015 dfb $84
:L2016 dfb $85
:L2017 dfb $86
:L2018 lda :L200D
lda :L200E
lda :L200F
lda :nearby-1
lda :nearby
lda :nearby+1
lda :nearby+2
lda :nearby+3
lda :L2015
lda :L2016
lda :L2017
nop
L1001 bit L1001
caddr pea caddr-1
per caddr-1
lda L1001+2
lda caddr
lda caddr+1
lda caddr+2
rts

View File

@ -0,0 +1,107 @@
; Copyright 2018 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0).
;
; Assembler: Merlin 32
org $1000
load11 lda #$11 ;EDIT: set label=load11
load22 ldx #$22
load33 ldy #$33 ;EDIT: set label=load33
load44 lda #$44
predat bne skipdat ;EDIT: set label=predat
dat0 dw $0123
dat1 dw $4567 ;EDIT: set label=dat1
dat2 dw $89ab
dat3 dw $cdef
dat4 dw $0011
dat5 dw $2233
dfb $80
asc 'The quick brown fox'
dfb $80
dw skipdat ;EDIT: format these as addresses
dw skipdat-1
dw skipdat+1
fill0 ds 4 ;EDIT: set label=fill0
fill1 ds 4
fill2 ds 4
fill3 ds 4
postfill dfb $80
skipdat ;EDIT: set label=skipdat
lda dat0 ;this should get mapped to predat+2
lda postfill
asl dat1 ;these should coalesce to dat1
rol dat2
ror dat3 ;these should be auto-labeled
and dat4
ora dat5
lda fill0 ;EDIT: set all labels to fill0
sta fill1 ; and confirm that auto-labels vanish
lda fill2 ; and we get a single 16-byte .fill
sta fill3
jsr load22 ;should get auto label
lda load44 ;should get auto label
; PEA/PER may want to push addr-1; make sure that works
; (note: 65816-specific code replaced, PEA/PER now BIT/ORA)
caddr
bit caddr-1 ;should base off caddr
ora caddr-1 ;should base off caddr
lda caddr+1 ;should base off caddr
lda caddr+2 ;should base off caddr
; self-referential, self-modifying code (edge case for xrefs)
lda #$ea
srop1 sta srop1
srop2 sta srop2+1
srop3 sta srop3+2 ;EDIT: set operand to non-existent symbol
jmp skipdat1
dfb $80
dat81 dfb $81 ;EDIT: set label dat81
org $2000
dat82 dfb $82
dfb $83
skipdat1
nop
nop
lda dat81
lda dat82 ;this should NOT use dat81
;
; Test the precise extent to which we associate a label with nearby elements.
;
jmp skipmore
dfb $7c
dfb $7d
dfb $7e
dfb $7f
nearby dfb $80 ;EDIT: label this
dfb $81
dfb $82
dfb $83
dfb $84
dfb $85
dfb $86
skipmore
lda nearby-4
lda nearby-3
lda nearby-2
lda nearby-1
lda nearby
lda nearby+1
lda nearby+2
lda nearby+3
lda nearby+4
lda nearby+5
lda nearby+6
rts

View File

@ -5,101 +5,18 @@
org $1000
load11 lda #$11 ;EDIT: set label=load11
load22 ldx #$22
load33 ldy #$33 ;EDIT: set label=load33
load44 lda #$44
predat bra skipdat ;EDIT: set label=predat
start nop
dat0 dw $0123
dat1 dw $4567 ;EDIT: set label=dat1
dat2 dw $89ab
dat3 dw $cdef
dat4 dw $0011
dat5 dw $2233
dfb $80
asc 'The quick brown fox'
dfb $80
dw skipdat ;EDIT: format these as addresses
dw skipdat-1
dw skipdat+1
fill0 ds 4 ;EDIT: set label=fill0
fill1 ds 4
fill2 ds 4
fill3 ds 4
postfill dfb $80
skipdat ;EDIT: set label=skipdat
lda dat0 ;this should get mapped to predat+2
lda postfill
asl dat1 ;these should coalesce to dat1
rol dat2
ror dat3 ;these should be auto-labeled
and dat4
ora dat5
lda fill0 ;EDIT: set all labels to fill0
sta fill1 ; and confirm that auto-labels vanish
lda fill2 ; and we get a single 16-byte .fill
sta fill3
jsr load22 ;should get auto label
lda load44 ;should get auto label
; PEA/PER may want to push addr-1; make sure that works
; PEA/PER may want to push code addr-1; make sure that works. This
; is different from the way LDA works on the same address.
pre_addr
bit pre_addr
caddr
pea caddr-1 ;should base off caddr
per caddr-1 ;should base off caddr
lda caddr-1 ;should base off pre_addr
lda caddr ;should base off caddr
lda caddr+1 ;should base off caddr
lda caddr+2 ;should base off caddr
; self-referential, self-modifying code (edge case for xrefs)
lda #$ea
srop1 sta srop1
srop2 sta srop2+1
srop3 sta srop3+2 ;EDIT: set operand to non-existent symbol
brl skipdat1
dfb $80
dat81 dfb $81 ;EDIT: set label dat81
org $2000
dat82 dfb $82
dfb $83
skipdat1
bit skipdat1
lda dat81
lda dat82 ;this should NOT use dat81
;
; Test the precise extent to which we associate a label with nearby elements.
;
bra skipmore
dfb $7c
dfb $7d
dfb $7e
dfb $7f
nearby dfb $80 ;EDIT: label this
dfb $81
dfb $82
dfb $83
dfb $84
dfb $85
dfb $86
skipmore
lda nearby-4
lda nearby-3
lda nearby-2
lda nearby-1
lda nearby
lda nearby+1
lda nearby+2
lda nearby+3
lda nearby+4
lda nearby+5
lda nearby+6
rts