diff --git a/SourceGen/RuntimeData/Common/StdInline.cs b/SourceGen/RuntimeData/Common/StdInline.cs index b81e364..4877ddf 100644 --- a/SourceGen/RuntimeData/Common/StdInline.cs +++ b/SourceGen/RuntimeData/Common/StdInline.cs @@ -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; } diff --git a/SourceGen/SGTestData/20270-std-inline b/SourceGen/SGTestData/20270-std-inline index 60f0f61..18a3dc6 100644 Binary files a/SourceGen/SGTestData/20270-std-inline and b/SourceGen/SGTestData/20270-std-inline differ diff --git a/SourceGen/SGTestData/20270-std-inline.dis65 b/SourceGen/SGTestData/20270-std-inline.dis65 index f4faf28..d667d3b 100644 --- a/SourceGen/SGTestData/20270-std-inline.dis65 +++ b/SourceGen/SGTestData/20270-std-inline.dis65 @@ -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":"", diff --git a/SourceGen/SGTestData/Expected/20270-std-inline_64tass.S b/SourceGen/SGTestData/Expected/20270-std-inline_64tass.S index b7f86b4..769d2d5 100644 --- a/SourceGen/SGTestData/Expected/20270-std-inline_64tass.S +++ b/SourceGen/SGTestData/Expected/20270-std-inline_64tass.S @@ -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 diff --git a/SourceGen/SGTestData/Expected/20270-std-inline_acme.S b/SourceGen/SGTestData/Expected/20270-std-inline_acme.S index ded3ffd..7bd1e65 100644 --- a/SourceGen/SGTestData/Expected/20270-std-inline_acme.S +++ b/SourceGen/SGTestData/Expected/20270-std-inline_acme.S @@ -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 diff --git a/SourceGen/SGTestData/Expected/20270-std-inline_cc65.S b/SourceGen/SGTestData/Expected/20270-std-inline_cc65.S index e0ad475..567b700 100644 --- a/SourceGen/SGTestData/Expected/20270-std-inline_cc65.S +++ b/SourceGen/SGTestData/Expected/20270-std-inline_cc65.S @@ -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 diff --git a/SourceGen/SGTestData/Expected/20270-std-inline_merlin32.S b/SourceGen/SGTestData/Expected/20270-std-inline_merlin32.S index 9de7742..d50ef92 100644 --- a/SourceGen/SGTestData/Expected/20270-std-inline_merlin32.S +++ b/SourceGen/SGTestData/Expected/20270-std-inline_merlin32.S @@ -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 diff --git a/SourceGen/SGTestData/Source/20270-std-inline.S b/SourceGen/SGTestData/Source/20270-std-inline.S index ea6f0d1..0df7cfb 100644 --- a/SourceGen/SGTestData/Source/20270-std-inline.S +++ b/SourceGen/SGTestData/Source/20270-std-inline.S @@ -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