diff --git a/SourceGen/SGTestData/20180-extension-scripts b/SourceGen/SGTestData/20180-extension-scripts new file mode 100644 index 0000000..47f1e73 Binary files /dev/null and b/SourceGen/SGTestData/20180-extension-scripts differ diff --git a/SourceGen/SGTestData/20180-extension-scripts-a.cs b/SourceGen/SGTestData/20180-extension-scripts-a.cs index d7d0c5c..5558a56 100644 --- a/SourceGen/SGTestData/20180-extension-scripts-a.cs +++ b/SourceGen/SGTestData/20180-extension-scripts-a.cs @@ -6,8 +6,9 @@ using System.Collections.Generic; using PluginCommon; -namespace RuntimeData.Test2022 { - public class Test2022A : MarshalByRefObject, IPlugin, IPlugin_SymbolList, +// JSR/JSL handler +namespace RuntimeData.Test20180 { + public class Test20180A : MarshalByRefObject, IPlugin, IPlugin_SymbolList, IPlugin_InlineJsr, IPlugin_InlineJsl { private IApplication mAppRef; private byte[] mFileData; @@ -23,7 +24,7 @@ namespace RuntimeData.Test2022 { public string Identifier { get { - return "Test 2022-extension-scripts A"; + return "Test 20180-extension-scripts A"; } } @@ -31,7 +32,7 @@ namespace RuntimeData.Test2022 { mAppRef = appRef; mFileData = fileData; - mAppRef.DebugLog("Test2022-A(id=" + AppDomain.CurrentDomain.Id + "): prepare()"); + mAppRef.DebugLog("Test20180-A(id=" + AppDomain.CurrentDomain.Id + "): prepare()"); } public void Unprepare() { diff --git a/SourceGen/SGTestData/20180-extension-scripts-b.cs b/SourceGen/SGTestData/20180-extension-scripts-b.cs index 4933764..812a040 100644 --- a/SourceGen/SGTestData/20180-extension-scripts-b.cs +++ b/SourceGen/SGTestData/20180-extension-scripts-b.cs @@ -6,15 +6,16 @@ using System.Collections.Generic; using PluginCommon; -namespace RuntimeData.Test2022 { - public class Test2022B : MarshalByRefObject, IPlugin, IPlugin_InlineBrk { +// BRK handler +namespace RuntimeData.Test20180 { + public class Test20180B : MarshalByRefObject, IPlugin, IPlugin_InlineBrk { private IApplication mAppRef; private byte[] mFileData; private AddressTranslate mAddrTrans; public string Identifier { get { - return "Test 2022-extension-scripts B"; + return "Test 20180-extension-scripts B"; } } @@ -23,7 +24,7 @@ namespace RuntimeData.Test2022 { mFileData = fileData; mAddrTrans = addrTrans; - mAppRef.DebugLog("Test2022-B(id=" + AppDomain.CurrentDomain.Id + "): prepare()"); + mAppRef.DebugLog("Test20180-B(id=" + AppDomain.CurrentDomain.Id + "): prepare()"); } public void Unprepare() { diff --git a/SourceGen/SGTestData/20180-extension-scripts.dis65 b/SourceGen/SGTestData/20180-extension-scripts.dis65 new file mode 100644 index 0000000..942ea8a --- /dev/null +++ b/SourceGen/SGTestData/20180-extension-scripts.dis65 @@ -0,0 +1,149 @@ +### 6502bench SourceGen dis65 v1.0 ### +{ +"_ContentVersion":7, +"FileDataLength":543, +"FileDataCrc32":321667593, +"ProjectProps":{ +"CpuName":"6502", +"IncludeUndocumentedInstr":true, +"TwoByteBrk":true, +"EntryFlags":32702671, +"AutoLabelStyle":"Simple", +"AnalysisParams":{ +"AnalyzeUncategorizedData":true, +"DefaultTextScanMode":"LowHighAscii", +"MinCharsForString":4, +"SeekNearbyTargets":false, +"UseRelocData":false, +"SmartPlpHandling":false, +"SmartPlbHandling":true}, + +"PlatformSymbolFileIdentifiers":[], +"ExtensionScriptFileIdentifiers":["PROJ:20180-extension-scripts-a.cs", +"PROJ:20180-extension-scripts-b.cs"], +"ProjectSyms":{ +}}, + +"AddressMap":[{ +"Offset":0, +"Addr":4096, +"Length":512, +"PreLabel":"", +"DisallowInward":false, +"DisallowOutward":false, +"IsRelative":false}, + +{ +"Offset":512, +"Addr":6144, +"Length":11, +"PreLabel":"", +"DisallowInward":false, +"DisallowOutward":false, +"IsRelative":false}, + +{ +"Offset":523, +"Addr":6208, +"Length":20, +"PreLabel":"", +"DisallowInward":false, +"DisallowOutward":false, +"IsRelative":false}], +"TypeHints":[{ +"Low":0, +"High":0, +"Hint":"Code"}], +"StatusFlagOverrides":{ +}, + +"MiscFlags":{ +}, + +"Comments":{ +}, + +"LongComments":{ +}, + +"Notes":{ +}, + +"UserLabels":{ +"72":{ +"Label":"PrintInline8String", +"Value":4168, +"Source":"User", +"Type":"GlobalAddr", +"LabelAnno":"None"}, + +"73":{ +"Label":"PrintInlineRev8String", +"Value":4169, +"Source":"User", +"Type":"GlobalAddr", +"LabelAnno":"None"}, + +"74":{ +"Label":"PrintInlineNullString", +"Value":4170, +"Source":"User", +"Type":"GlobalAddr", +"LabelAnno":"None"}, + +"75":{ +"Label":"data01", +"Value":4171, +"Source":"User", +"Type":"LocalOrGlobalAddr", +"LabelAnno":"None"}, + +"127":{ +"Label":"Next1", +"Value":4223, +"Source":"User", +"Type":"GlobalAddr", +"LabelAnno":"None"}, + +"103":{ +"Label":"data02", +"Value":4199, +"Source":"User", +"Type":"LocalOrGlobalAddr", +"LabelAnno":"None"}, + +"106":{ +"Label":"data03", +"Value":4202, +"Source":"User", +"Type":"LocalOrGlobalAddr", +"LabelAnno":"None"}, + +"114":{ +"Label":"NoCont", +"Value":4210, +"Source":"User", +"Type":"GlobalAddr", +"LabelAnno":"None"}}, + +"OperandFormats":{ +"100":{ +"Length":2, +"Format":"NumericLE", +"SubFormat":"Address", +"SymbolRef":null, +"Extra":null}}, + +"LvTables":{ +}, + +"Visualizations":[], +"VisualizationAnimations":[], +"VisualizationSets":{ +}, + +"RelocList":{ +}, + +"DbrValues":{ +}} diff --git a/SourceGen/SGTestData/20182-extension-scripts b/SourceGen/SGTestData/20182-extension-scripts index 6475220..fe0819c 100644 Binary files a/SourceGen/SGTestData/20182-extension-scripts and b/SourceGen/SGTestData/20182-extension-scripts differ diff --git a/SourceGen/SGTestData/20182-extension-scripts.dis65 b/SourceGen/SGTestData/20182-extension-scripts.dis65 index 55716f3..2c88148 100644 --- a/SourceGen/SGTestData/20182-extension-scripts.dis65 +++ b/SourceGen/SGTestData/20182-extension-scripts.dis65 @@ -1,8 +1,8 @@ ### 6502bench SourceGen dis65 v1.0 ### { -"_ContentVersion":3, +"_ContentVersion":7, "FileDataLength":544, -"FileDataCrc32":787264196, +"FileDataCrc32":1948144462, "ProjectProps":{ "CpuName":"65816", "IncludeUndocumentedInstr":false, @@ -13,10 +13,12 @@ "AnalyzeUncategorizedData":true, "DefaultTextScanMode":"LowHighAscii", "MinCharsForString":4, -"SeekNearbyTargets":true, -"SmartPlpHandling":true}, +"SeekNearbyTargets":false, +"UseRelocData":false, +"SmartPlpHandling":false, +"SmartPlbHandling":true}, -"PlatformSymbolFileIdentifiers":["PROJ:20180-extension-scripts.sym65"], +"PlatformSymbolFileIdentifiers":["PROJ:20182-extension-scripts.sym65"], "ExtensionScriptFileIdentifiers":["PROJ:20180-extension-scripts-a.cs", "PROJ:20180-extension-scripts-b.cs"], "ProjectSyms":{ @@ -25,7 +27,8 @@ "Length":1, "Format":"NumericLE", "SubFormat":"Hex", -"SymbolRef":null}, +"SymbolRef":null, +"Extra":null}, "Comment":"", "HasWidth":false, @@ -39,15 +42,30 @@ "AddressMap":[{ "Offset":0, -"Addr":4096}, +"Addr":4096, +"Length":512, +"PreLabel":"", +"DisallowInward":false, +"DisallowOutward":false, +"IsRelative":false}, { "Offset":512, -"Addr":6144}, +"Addr":6144, +"Length":11, +"PreLabel":"", +"DisallowInward":false, +"DisallowOutward":false, +"IsRelative":false}, { "Offset":523, -"Addr":6208}], +"Addr":6208, +"Length":21, +"PreLabel":"", +"DisallowInward":false, +"DisallowOutward":false, +"IsRelative":false}], "TypeHints":[{ "Low":0, "High":0, @@ -55,8 +73,11 @@ "StatusFlagOverrides":{ }, +"MiscFlags":{ +}, + "Comments":{ -"183":"split across address change"}, +}, "LongComments":{ }, @@ -65,58 +86,51 @@ }, "UserLabels":{ -"141":{ +"131":{ "Label":"PrintInline8String", -"Value":4237, -"Source":"User", -"Type":"LocalOrGlobalAddr", -"LabelAnno":"None"}, - -"142":{ -"Label":"PrintInlineRev8String", -"Value":4238, -"Source":"User", -"Type":"LocalOrGlobalAddr", -"LabelAnno":"None"}, - -"143":{ -"Label":"PrintInlineNullString", -"Value":4239, -"Source":"User", -"Type":"LocalOrGlobalAddr", -"LabelAnno":"None"}, - -"172":{ -"Label":"data02", -"Value":4268, -"Source":"User", -"Type":"LocalOrGlobalAddr", -"LabelAnno":"None"}, - -"175":{ -"Label":"data03", -"Value":4271, -"Source":"User", -"Type":"LocalOrGlobalAddr", -"LabelAnno":"None"}, - -"144":{ -"Label":"data01", -"Value":4240, -"Source":"User", -"Type":"LocalOrGlobalAddr", -"LabelAnno":"None"}, - -"196":{ -"Label":"Next1", -"Value":4292, +"Value":4227, "Source":"User", "Type":"GlobalAddr", "LabelAnno":"None"}, -"183":{ -"Label":"NoCont", -"Value":4279, +"132":{ +"Label":"PrintInlineRev8String", +"Value":4228, +"Source":"User", +"Type":"GlobalAddr", +"LabelAnno":"None"}, + +"133":{ +"Label":"PrintInlineNullString", +"Value":4229, +"Source":"User", +"Type":"GlobalAddr", +"LabelAnno":"None"}, + +"134":{ +"Label":"data01", +"Value":4230, +"Source":"User", +"Type":"LocalOrGlobalAddr", +"LabelAnno":"None"}, + +"162":{ +"Label":"data02", +"Value":4258, +"Source":"User", +"Type":"LocalOrGlobalAddr", +"LabelAnno":"None"}, + +"165":{ +"Label":"data03", +"Value":4261, +"Source":"User", +"Type":"LocalOrGlobalAddr", +"LabelAnno":"None"}, + +"173":{ +"Label":"Next", +"Value":4269, "Source":"User", "Type":"GlobalAddr", "LabelAnno":"None"}}, @@ -130,4 +144,10 @@ "Visualizations":[], "VisualizationAnimations":[], "VisualizationSets":{ +}, + +"RelocList":{ +}, + +"DbrValues":{ }} diff --git a/SourceGen/SGTestData/20180-extension-scripts.sym65 b/SourceGen/SGTestData/20182-extension-scripts.sym65 similarity index 80% rename from SourceGen/SGTestData/20180-extension-scripts.sym65 rename to SourceGen/SGTestData/20182-extension-scripts.sym65 index ec014d1..3f0f963 100644 --- a/SourceGen/SGTestData/20180-extension-scripts.sym65 +++ b/SourceGen/SGTestData/20182-extension-scripts.sym65 @@ -1,7 +1,7 @@ ; Copyright 2019 faddenSoft. All Rights Reserved. ; See the LICENSE.txt file for distribution terms (Apache 2.0). -*SYNOPSIS Symbols test 2022-extension-scripts +*SYNOPSIS Symbols test 20182-extension-scripts PrintInlineL1String @ $011000 PrintInlineL2String @ $012000 diff --git a/SourceGen/SGTestData/Expected/20180-extension-scripts_64tass.S b/SourceGen/SGTestData/Expected/20180-extension-scripts_64tass.S new file mode 100644 index 0000000..749ec2b --- /dev/null +++ b/SourceGen/SGTestData/Expected/20180-extension-scripts_64tass.S @@ -0,0 +1,115 @@ + .cpu "6502i" + .enc "sg_hiascii" + .cdef $20,$7e,$a0 + .enc "sg_ascii" + .cdef $20,$7e,$20 +bword .macro + .byte (\1)>>8,(\1)&$ff + .endmacro +* = $1000 + jsr PrintInline8String + .text "01234567" + jsr PrintInlineRev8String + .text "76543210" + jsr PrintInlineNullString + .null "null-term string" + jsr L1800 + jsr L184E + jsr L1848 + brk #$01 + .word data01 + brk #$02 + .word data02 + nop + jsr L1040 + .byte $24 +L1040 .byte $a9 + .byte $00 + sta $ff + .byte $ea + jmp Next1 + +PrintInline8String rts + +PrintInlineRev8String rts + +PrintInlineNullString rts + +data01 .word 4386 + bword $3344 + .dword $88776655 + .byte $99,$88,$77,$66 + .byte 'f' + .byte 'F' | $80 + .byte $40 + .byte $c1 + .byte $42 + .byte $c3 + .byte $44 + .byte $c5 + .byte $46 + .byte $c7 + .long $012000 + .word data02 + .byte $80 +data02 .word _data03 + .byte $80 + .enc "sg_hiascii" +_data03 .text "AllEight" + +NoCont pla + pla + rts + +L1075 jsr NoCont + + .byte $00 + .byte $80 + +L107A jsr NoCont + + .byte $00 + .byte $80 + +Next1 jsr L1075 + jsr _L108A + clc + jsr L107A + rts + +_L108A sec + jsr L107A + clc + brk #$02 + .word data02 + bcc _L1099 + bcs _L1099 + + .byte $00 + .byte $80 + +_L1099 rts + + .fill 358,$00 + + .logical $1800 +L1800 jsr PrintInlineNullString + .byte $62 + + .enc "sg_ascii" + .text "roken " + .byte $01 + .here + .logical $1840 + .text "string" + .byte $00 + .byte $60 + +L1848 jsr PrintInlineNullString + .null $0a + rts + +L184E jsr PrintInlineNullString + adc $6e + .byte $64 + .here diff --git a/SourceGen/SGTestData/Expected/20180-extension-scripts_acme.S b/SourceGen/SGTestData/Expected/20180-extension-scripts_acme.S new file mode 100644 index 0000000..6d93467 --- /dev/null +++ b/SourceGen/SGTestData/Expected/20180-extension-scripts_acme.S @@ -0,0 +1,108 @@ + !cpu 6510 +* = $1000 + jsr PrintInline8String + !text "01234567" + jsr PrintInlineRev8String + !text "76543210" + jsr PrintInlineNullString + !text "null-term string",$00 + jsr L1800 + jsr L184E + jsr L1848 + !byte $00,$01 + !word data01 + !byte $00,$02 + !word data02 + nop + jsr L1040 + !byte $24 +L1040 !byte $a9 + !byte $00 + sta $ff + !byte $ea + jmp Next1 + +PrintInline8String rts + +PrintInlineRev8String rts + +PrintInlineNullString rts + +data01 !word 4386 + !byte $33,$44 + !32 $88776655 + !byte $99,$88,$77,$66 + !byte 'f' + !byte 'F' | $80 + !byte $40 + !byte $c1 + !byte $42 + !byte $c3 + !byte $44 + !byte $c5 + !byte $46 + !byte $c7 + !24 $012000 + !word data02 + !byte $80 +data02 !word @data03 + !byte $80 + !xor $80 { +@data03 !text "AllEight" + } + +NoCont pla + pla + rts + +L1075 jsr NoCont + + !byte $00 + !byte $80 + +L107A jsr NoCont + + !byte $00 + !byte $80 + +Next1 jsr L1075 + jsr @L108A + clc + jsr L107A + rts + +@L108A sec + jsr L107A + clc + !byte $00,$02 + !word data02 + bcc @L1099 + bcs @L1099 + + !byte $00 + !byte $80 + +@L1099 rts + + !fill 358,$00 + + !pseudopc $1800 { +L1800 jsr PrintInlineNullString + !byte $62 + + !text "roken " + !byte $01 + } + !pseudopc $1840 { + !text "string" + !byte $00 + !byte $60 + +L1848 jsr PrintInlineNullString + !text $0a,$00 + rts + +L184E jsr PrintInlineNullString + adc $6e + !byte $64 + } diff --git a/SourceGen/SGTestData/Expected/20180-extension-scripts_cc65.S b/SourceGen/SGTestData/Expected/20180-extension-scripts_cc65.S new file mode 100644 index 0000000..7cf8ef0 --- /dev/null +++ b/SourceGen/SGTestData/Expected/20180-extension-scripts_cc65.S @@ -0,0 +1,109 @@ + .setcpu "6502X" + .org $1000 + jsr PrintInline8String + .byte "01234567" + jsr PrintInlineRev8String + .byte "76543210" + jsr PrintInlineNullString + .asciiz "null-term string" + jsr L1800 + jsr L184E + jsr L1848 + .byte $00,$01 + .word data01 + .byte $00,$02 + .word data02 + nop + jsr L1040 + .byte $24 +L1040: .byte $a9 + .byte $00 + sta $ff + .byte $ea + jmp Next1 + +PrintInline8String: rts + +PrintInlineRev8String: rts + +PrintInlineNullString: rts + +data01: .word 4386 + .dbyt $3344 + .dword $88776655 + .byte $99,$88,$77,$66 + .byte 'f' + .byte 'F' | $80 + .byte $40 + .byte $c1 + .byte $42 + .byte $c3 + .byte $44 + .byte $c5 + .byte $46 + .byte $c7 + .faraddr $012000 + .word data02 + .byte $80 +data02: .word @data03 + .byte $80 +.macro HiAscii Arg + .repeat .strlen(Arg), I + .byte .strat(Arg, I) | $80 + .endrep +.endmacro +@data03: HiAscii "AllEight" + +NoCont: pla + pla + rts + +L1075: jsr NoCont + + .byte $00 + .byte $80 + +L107A: jsr NoCont + + .byte $00 + .byte $80 + +Next1: jsr L1075 + jsr @L108A + clc + jsr L107A + rts + +@L108A: sec + jsr L107A + clc + .byte $00,$02 + .word data02 + bcc @L1099 + bcs @L1099 + + .byte $00 + .byte $80 + +@L1099: rts + + .res 358,$00 + + .org $1800 +L1800: jsr PrintInlineNullString + .byte $62 + + .byte "roken " + .byte $01 + .org $1840 + .byte "string" + .byte $00 + .byte $60 + +L1848: jsr PrintInlineNullString + .byte $0a,$00 + rts + +L184E: jsr PrintInlineNullString + adc $6e + .byte $64 diff --git a/SourceGen/SGTestData/Expected/20180-extension-scripts_cc65.cfg b/SourceGen/SGTestData/Expected/20180-extension-scripts_cc65.cfg new file mode 100644 index 0000000..a31ad62 --- /dev/null +++ b/SourceGen/SGTestData/Expected/20180-extension-scripts_cc65.cfg @@ -0,0 +1,9 @@ +# 6502bench SourceGen generated linker script for 20180-extension-scripts +MEMORY { + MAIN: file=%O, start=%S, size=65536; +} +SEGMENTS { + CODE: load=MAIN, type=rw; +} +FEATURES {} +SYMBOLS {} diff --git a/SourceGen/SGTestData/Expected/20180-extension-scripts_merlin32.S b/SourceGen/SGTestData/Expected/20180-extension-scripts_merlin32.S new file mode 100644 index 0000000..9ad3b76 --- /dev/null +++ b/SourceGen/SGTestData/Expected/20180-extension-scripts_merlin32.S @@ -0,0 +1,103 @@ + org $1000 + jsr PrintInline8String + asc '01234567' + jsr PrintInlineRev8String + rev '01234567' + jsr PrintInlineNullString + asc 'null-term string',00 + jsr L1800 + jsr L184E + jsr L1848 + brk $01 + dw data01 + brk $02 + dw data02 + nop + jsr L1040 + dfb $24 +L1040 dfb $a9 + dfb $00 + sta $ff + dfb $ea + jmp Next1 + +PrintInline8String rts + +PrintInlineRev8String rts + +PrintInlineNullString rts + +data01 dw 4386 + ddb $3344 + adrl $88776655 + dfb $99,$88,$77,$66 + dfb 'f' + dfb "F" + dfb $40 + dfb $c1 + dfb $42 + dfb $c3 + dfb $44 + dfb $c5 + dfb $46 + dfb $c7 + adr $012000 + dw data02 + dfb $80 +data02 dw :data03 + dfb $80 +:data03 asc "AllEight" + +NoCont pla + pla + rts + +L1075 jsr NoCont + + dfb $00 + dfb $80 + +L107A jsr NoCont + + dfb $00 + dfb $80 + +Next1 jsr L1075 + jsr :L108A + clc + jsr L107A + rts + +:L108A sec + jsr L107A + clc + brk $02 + dw data02 + bcc :L1099 + bcs :L1099 + + dfb $00 + dfb $80 + +:L1099 rts + + ds 358 + + org $1800 +L1800 jsr PrintInlineNullString + dfb $62 + + asc 'roken ' + dfb $01 + org $1840 + asc 'string' + dfb $00 + dfb $60 + +L1848 jsr PrintInlineNullString + asc 0a00 + rts + +L184E jsr PrintInlineNullString + adc $6e + dfb $64 diff --git a/SourceGen/SGTestData/Expected/20182-extension-scripts_64tass.S b/SourceGen/SGTestData/Expected/20182-extension-scripts_64tass.S index 76ad260..6ae242b 100644 --- a/SourceGen/SGTestData/Expected/20182-extension-scripts_64tass.S +++ b/SourceGen/SGTestData/Expected/20182-extension-scripts_64tass.S @@ -35,14 +35,7 @@ PrintInlineDciString = $013000 .word data01 brk #$02 .word data02 - nop - jsr L1085 - .byte $24 -L1085 .byte $a9 - .byte $00 - sta $ff - .byte $ea - jmp Next1 + jmp Next PrintInline8String rts @@ -72,40 +65,18 @@ data02 .word _data03 .enc "sg_hiascii" _data03 .text "AllEight" -NoCont pla ;split across address change - pla - rts - -L10BA jsr NoCont - - .byte $00 - .byte $80 - -L10BF jsr NoCont - - .byte $00 - .byte $80 - -Next1 jsr L10BA - jsr _L10CF - clc - jsr L10BF - rts - -_L10CF sec - jsr L10BF - clc +Next clc brk #$02 .word data02 - bcc _L10DE - bcs _L10DE + bcc _L10B8 + bcs _L10B8 .byte $00 .byte $80 -_L10DE rts +_L10B8 rts - .fill 289,$00 + .fill 327,$00 .logical $1800 L1800 jsr PrintInlineNullString diff --git a/SourceGen/SGTestData/Expected/20182-extension-scripts_acme.S b/SourceGen/SGTestData/Expected/20182-extension-scripts_acme.S index 396872f..566b02b 100644 --- a/SourceGen/SGTestData/Expected/20182-extension-scripts_acme.S +++ b/SourceGen/SGTestData/Expected/20182-extension-scripts_acme.S @@ -28,14 +28,7 @@ PrintInlineDciString = $013000 !word data01 !byte $00,$02 !word data02 - nop - jsr L1085 - !byte $24 -L1085 !byte $a9 - !byte $00 - sta $ff - !byte $ea - jmp Next1 + jmp Next PrintInline8String rts @@ -66,40 +59,18 @@ data02 !word @data03 @data03 !text "AllEight" } -NoCont pla ;split across address change - pla - rts - -L10BA jsr NoCont - - !byte $00 - !byte $80 - -L10BF jsr NoCont - - !byte $00 - !byte $80 - -Next1 jsr L10BA - jsr @L10CF - clc - jsr L10BF - rts - -@L10CF sec - jsr L10BF - clc +Next clc !byte $00,$02 !word data02 - bcc @L10DE - bcs @L10DE + bcc @L10B8 + bcs @L10B8 !byte $00 !byte $80 -@L10DE rts +@L10B8 rts - !fill 289,$00 + !fill 327,$00 !pseudopc $1800 { L1800 jsr PrintInlineNullString diff --git a/SourceGen/SGTestData/Expected/20182-extension-scripts_cc65.S b/SourceGen/SGTestData/Expected/20182-extension-scripts_cc65.S index dd81e5b..7251bef 100644 --- a/SourceGen/SGTestData/Expected/20182-extension-scripts_cc65.S +++ b/SourceGen/SGTestData/Expected/20182-extension-scripts_cc65.S @@ -28,14 +28,7 @@ PrintInlineDciString = $013000 .word data01 brk $02 .word data02 - nop - jsr L1085 - .byte $24 -L1085: .byte $a9 - .byte $00 - sta $ff - .byte $ea - jmp Next1 + jmp Next PrintInline8String: rts @@ -69,40 +62,18 @@ data02: .word @data03 .endmacro @data03: HiAscii "AllEight" -NoCont: pla ;split across address change - pla - rts - -L10BA: jsr NoCont - - .byte $00 - .byte $80 - -L10BF: jsr NoCont - - .byte $00 - .byte $80 - -Next1: jsr L10BA - jsr @L10CF - clc - jsr L10BF - rts - -@L10CF: sec - jsr L10BF - clc +Next: clc brk $02 .word data02 - bcc @L10DE - bcs @L10DE + bcc @L10B8 + bcs @L10B8 .byte $00 .byte $80 -@L10DE: rts +@L10B8: rts - .res 289,$00 + .res 327,$00 .org $1800 L1800: jsr PrintInlineNullString diff --git a/SourceGen/SGTestData/Expected/20182-extension-scripts_merlin32.S b/SourceGen/SGTestData/Expected/20182-extension-scripts_merlin32.S index 217dd3f..de1601d 100644 --- a/SourceGen/SGTestData/Expected/20182-extension-scripts_merlin32.S +++ b/SourceGen/SGTestData/Expected/20182-extension-scripts_merlin32.S @@ -25,14 +25,7 @@ PrintInlineDciString equ $013000 dw data01 brk $02 dw data02 - nop - jsr L1085 - dfb $24 -L1085 dfb $a9 - dfb $00 - sta $ff - dfb $ea - jmp Next1 + jmp Next PrintInline8String rts @@ -61,40 +54,18 @@ data02 dw :data03 dfb $80 :data03 asc "AllEight" -NoCont pla ;split across address change - pla - rts - -L10BA jsr NoCont - - dfb $00 - dfb $80 - -L10BF jsr NoCont - - dfb $00 - dfb $80 - -Next1 jsr L10BA - jsr :L10CF - clc - jsr L10BF - rts - -:L10CF sec - jsr L10BF - clc +Next clc brk $02 dw data02 - bcc :L10DE - bcs :L10DE + bcc :L10B8 + bcs :L10B8 dfb $00 dfb $80 -:L10DE rts +:L10B8 rts - ds 289 + ds 327 org $1800 L1800 jsr PrintInlineNullString diff --git a/SourceGen/SGTestData/Source/20180-extension-scripts.S b/SourceGen/SGTestData/Source/20180-extension-scripts.S new file mode 100644 index 0000000..d8e7d94 --- /dev/null +++ b/SourceGen/SGTestData/Source/20180-extension-scripts.S @@ -0,0 +1,148 @@ +; Copyright 2019 faddenSoft. All Rights Reserved. +; See the LICENSE.txt file for distribution terms (Apache 2.0). +; +; Assembler: Merlin 32 + +; EDIT: the project must include the extension scripts +; EDIT: set "treat BRK as two-byte instruction" + + org $1000 + +; check basics + jsr PrintInline8String + asc '01234567' + jsr PrintInlineRev8String + asc '76543210' + jsr PrintInlineNullString + asc 'null-term string',00 + +; check errors + jsr broken + jsr off_end + jsr too_long + +; check block formatting + brk $01 + dw data01 + + brk $02 + dw data02 + +; Handle an edge case where the inline formatting gets thrown out. +; Two paths: BIT $A9 / BRK $85 / inline $FF/EA goes first, then +; LDA $00 / STA $FF / NOP goes. When we get to the STA we notice +; that it's marked as inline data, so we remove it from $85 $ff +; but not from $ea. +; +; If we try to walk through the file, advancing offset by the anattrib +; length, we will traverse the first path, which (with 2-byte BRKs) +; runs into the $FF, which is marked as an instruction but not an +; instruction start. +; +; Switching to 1-byte BRKs makes the $85 an inline data item rather +; than an instruction. When we come back through, we LDA $00 and +; then skip over the next 3 bytes. No conflict. + nop + jsr edge1 ;alt path, evaluated later + dfb $24 ;1: BIT dp +edge1 dfb $a9 ;2: LDA imm + brk ;1: BRK + dfb $85 ;2: STA imm + dfb $ff ;1: address $eaff + nop ;2: + + jmp Next1 + +PrintInline8String rts ;EDIT: set label +PrintInlineRev8String rts ;EDIT: set label +PrintInlineNullString rts ;EDIT: set label + +data01 ;EDIT: set label (unique local) + dw $1122 ;should be little-endian + dw $4433 ;should be big-endian + hex 55667788 ;32-bit + hex 99887766 ;32-bit big-endian + dfb 'f' ;ASCII + dfb "F" ;high ASCII + hex 40C142C344C546C7 ;bad DCI string + hex 002001 ;24-bit addr + dw data02 ;by symbol + + dfb $80 + +data02 ;EDIT: set label, must be "data02" (unique local) + dw data03 + dfb $80 + +data03 ;EDIT: set label (unique local) + asc "AllEight" + + +; +; The analyzer is trying to avoid calling the inline JSR check on code it +; has previously visited. There was a bug that caused us to lose the +; no-continue value if code was revisited. +; +; To ensure we revisit the function, we need to call it, then call +; something else that calls it, changing up the flags. +; + +NoCont pla + pla + rts + +TestNC1 jsr NoCont + dfb $00,$80 +TestNC2 jsr NoCont + dfb $00,$80 + +Next1 jsr TestNC1 + + jsr PushThing + clc + jsr TestNC2 + rts + +PushThing + sec + jsr TestNC2 + + +; Make sure flags get marked as indeterminate across inline BRK. +; Also exercises formatting the same block twice. + clc + brk $02 + dw data02 + bcc :BrkNext + bcs :BrkNext + brk $80 +:BrkNext + + rts + + +; Failed call tests. Some of these need to be at the end of the file. +; We use an align directive to ensure their offsets don't change as we +; update stuff earlier in the file. + ds \ + ds 256 + + + org $1800 + +; check address split across string +broken jsr PrintInlineNullString + asc 'broken ',01 + org $1840 ;EDIT: split address + asc 'string',00 + rts + +too_long jsr PrintInlineNullString + dw END-*+1 ;should be 1 byte over; want it to be rejected by + rts ; function in .cs (otherwise code overlap race) + +; MUST be last +off_end jsr PrintInlineNullString +nonterm asc 'end' + +END equ * diff --git a/SourceGen/SGTestData/Source/20182-extension-scripts.S b/SourceGen/SGTestData/Source/20182-extension-scripts.S index bd2a887..809d3a3 100644 --- a/SourceGen/SGTestData/Source/20182-extension-scripts.S +++ b/SourceGen/SGTestData/Source/20182-extension-scripts.S @@ -3,7 +3,7 @@ ; ; Assembler: Merlin 32 -; EDIT: the project must include the platform symbol file and extension script +; EDIT: the project must include the platform symbol file and extension scripts PrintInlineL1String equ $011000 PrintInlineL2String equ $012000 @@ -43,36 +43,13 @@ PrintInlineDciString equ $013000 ;EDIT: add to project symbols brk $02 dw data02 -; Handle an edge case where the inline formatting gets thrown out. -; Two paths: BIT $A9 / BRK $85 / inline $FF/EA goes first, then -; LDA $00 / STA $FF / NOP goes. When we get to the STA we notice -; that it's marked as inline data, so we remove it from $85 $ff -; but not from $ea. -; -; If we try to walk through the file, advancing offset by the anattrib -; length, we will traverse the first path, which (with 2-byte BRKs) -; runs into the $FF, which is marked as an instruction but not an -; instruction start. -; -; Switching to 1-byte BRKs makes the $85 an inline data item rather -; than an instruction. When we come back through, we LDA $00 and -; then skip over the next 3 bytes. No conflict. - nop - jsr edge1 ;alt path, evaluated later - dfb $24 ;1: BIT dp -edge1 dfb $a9 ;2: LDA imm - brk ;1: BRK - dfb $85 ;2: STA imm - dfb $ff ;1: address $eaff - nop ;2: - - jmp Next1 + jmp Next PrintInline8String rts ;EDIT: set label PrintInlineRev8String rts ;EDIT: set label PrintInlineNullString rts ;EDIT: set label -data01 ;EDIT: set label +data01 ;EDIT: set label (unique local) dw $1122 ;should be little-endian dw $4433 ;should be big-endian hex 55667788 ;32-bit @@ -85,43 +62,14 @@ data01 ;EDIT: set label dfb $80 -data02 ;EDIT: set label, must be "data02" +data02 ;EDIT: set label, must be "data02" (unique local) dw data03 dfb $80 -data03 ;EDIT: set label +data03 ;EDIT: set label (unique local) asc "AllEight" - -; -; The analyzer is trying to avoid calling the inline JSR check on code it -; has previously visited. There was a bug that caused us to lose the -; no-continue value if code was revisited. -; -; To ensure we revisit the function, we need to call it, then call -; something else that calls it, changing up the flags. -; - -NoCont pla - pla - rts - -TestNC1 jsr NoCont - dfb $00,$80 -TestNC2 jsr NoCont - dfb $00,$80 - -Next1 jsr TestNC1 - - jsr PushThing - clc - jsr TestNC2 - rts - -PushThing - sec - jsr TestNC2 - +Next ; Make sure flags get marked as indeterminate across inline BRK. ; Also exercises formatting the same block twice.