1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-05-31 22:41:37 +00:00

Ignore project/platform symbols in StdInline

External symbols don't have a file offset, so a JSR to an external
address can't reliably be matched to a label.
This commit is contained in:
Andy McFadden 2021-10-27 20:23:34 -07:00
parent fa04c98dac
commit 07f5396eee
8 changed files with 85 additions and 14 deletions

View File

@ -112,6 +112,13 @@ namespace RuntimeData.Common {
//mAppRef.DebugLog("Ignoring non-addr label '" + sym.Label + "'");
continue;
}
if (sym.Offset < 0) {
// Ignore project/platform symbols. External symbols are tricky, because
// there can be multiple symbols for a given address. We'd need to know
// which specific symbol was referenced by the JSR, and we don't have that
// information.
continue;
}
foreach (NameMap map in sMap) {
if (sym.Label.StartsWith(map.Prefix)) {
// Offsets will be unique.
@ -142,10 +149,10 @@ namespace RuntimeData.Common {
public void CheckJsr(int offset, int operand, out bool noContinue) {
noContinue = false;
// Do a quick test on the address.
// Do a quick test on the target address.
int unused;
if (!mInlineAddrs.TryGetValue(operand, out unused)) {
// JSR destination address not recognized.
// JSR destination address not special.
return;
}

View File

@ -1,8 +1,8 @@
### 6502bench SourceGen dis65 v1.0 ###
{
"_ContentVersion":5,
"FileDataLength":251,
"FileDataCrc32":-1864354559,
"FileDataLength":260,
"FileDataCrc32":66352775,
"ProjectProps":{
"CpuName":"6502",
"IncludeUndocumentedInstr":false,
@ -21,7 +21,22 @@
"PlatformSymbolFileIdentifiers":[],
"ExtensionScriptFileIdentifiers":["RT:Common/StdInline.cs"],
"ProjectSyms":{
}},
"InW_project":{
"DataDescriptor":{
"Length":1,
"Format":"NumericLE",
"SubFormat":"Hex",
"SymbolRef":null},
"Comment":"",
"HasWidth":false,
"Direction":"ReadWrite",
"MultiMask":null,
"Label":"InW_project",
"Value":57344,
"Source":"Project",
"Type":"ExternalAddr",
"LabelAnno":"None"}}},
"AddressMap":[{
"Offset":0,
@ -60,6 +75,13 @@
{
"Offset":215,
"Addr":16384,
"Length":-1024,
"PreLabel":"",
"IsRelative":false},
{
"Offset":224,
"Addr":61440,
"Length":-1024,
"PreLabel":"",

View File

@ -3,6 +3,8 @@
.cdef $20,$7e,$a0
.enc "sg_ascii"
.cdef $20,$7e,$20
InW_project = $e000
* = $1000
jmp L1040
@ -53,7 +55,7 @@ _L10AD nop
jsr InW_test1
.word $1100
nop
jmp LF000
jmp L4000
.byte $80
@ -92,8 +94,14 @@ InW_na_test .byte $ea
.byte $81
.here
.logical $4000
L4000 bit L4000
jsr InW_project
jmp _LF000
.here
.logical $f000
LF000 jsr _LF008
_LF000 jsr _LF008
jsr _LF015
nop
rts

View File

@ -1,4 +1,6 @@
!cpu 6502
InW_project = $e000
* = $1000
jmp L1040
@ -45,7 +47,7 @@ L1040 nop
jsr InW_test1
!word $1100
nop
jmp LF000
jmp L4000
!byte $80
@ -84,8 +86,14 @@ InW_na_test !byte $ea
!byte $81
}
!pseudopc $4000 {
L4000 bit L4000
jsr InW_project
jmp @LF000
}
!pseudopc $f000 {
LF000 jsr @LF008
@LF000 jsr @LF008
jsr @LF015
nop
rts

View File

@ -1,4 +1,6 @@
.setcpu "6502"
InW_project = $e000
.org $1000
jmp L1040
@ -45,7 +47,7 @@ L1040: nop
jsr InW_test1
.word $1100
nop
jmp LF000
jmp L4000
.byte $80
@ -80,8 +82,13 @@ InW_na_test: .byte $ea
.byte $60
.byte $81
.org $4000
L4000: bit L4000
jsr InW_project
jmp @LF000
.org $f000
LF000: jsr @LF008
@LF000: jsr @LF008
jsr @LF015
nop
rts

View File

@ -1,3 +1,5 @@
InW_project equ $e000
org $1000
jmp L1040
@ -44,7 +46,7 @@ L1040 nop
jsr InW_test1
dw $1100
nop
jmp LF000
jmp L4000
dfb $80
@ -79,8 +81,13 @@ InW_na_test dfb $ea
dfb $60
dfb $81
org $4000
L4000 bit L4000
jsr InW_project
jmp :LF000
org $f000
LF000 jsr :LF008
:LF000 jsr :LF008
jsr :LF015
nop
rts

View File

@ -8,6 +8,7 @@
!cpu 6502
* = $1000
f_W_ext = $e000 ;EDIT: add project symbol
jmp calls
; EDIT: put appropriate labels on these
@ -64,7 +65,7 @@ cont nop
!word $1100
nop
jmp end_stuff
jmp test_ext
!byte $80
@ -109,6 +110,17 @@ f_W_na nop
!byte $81
; Test a call to a project symbol with a matching name. These don't
; have offsets, so the question of whether or not to handle the JSR
; hinges on the specific symbol used in the source.
!pseudopc $4000 {
test_ext bit test_ext
jsr f_W_ext
jmp end_stuff
}
!pseudopc $f000 {
; end-of-file error cases
end_stuff