1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-12 08:29:29 +00:00
6502bench/SourceGen/SGTestData/Source/2021-external-symbols.S
Andy McFadden 0d9814d993 Allow explicit widths in project/platform symbols, part 3
Implement multi-byte project/platform symbols by filling out a table
of addresses.  Each symbol is "painted" into the table, replacing
an existing entry if the new entry has higher priority.  This allows
us to handle overlapping entries, giving boosted priority to platform
symbols that are defined in .sym65 files loaded later.

The bounds on project/platform symbols are now rigidly defined.  If
the "nearby" feature is enabled, references to SYM-1 will be picked
up, but we won't go hunting for SYM+1 unless the symbol is at least
two bytes wide.

The cost of adding a symbol to the symbol table is about the same,
but we don't have a quick way to remove a symbol.

Previously, if two platform symbols had the same value, the symbol
with the alphabetically lowest label would win.  Now, the symbol
defined in the most-recently-loaded file wins.  (If you define two
symbols with the same value in the same file, it's still resolved
alphabetically.)  This allows the user to pick the winner by
arranging the load order of the platform symbol files.

Platform symbols now keep a reference to the file ident of the
symbol file that defined them, so we can show the symbols's source
in the Info panel.

These changes altered the behavior of test 2008-address-changes,
which includes some tests on external addresses that are close to
labeled internal addresses.  The previous behavior essentially
treated user labels as being 3 bytes wide and extending outside the
file bounds, which was mildly convenient on occasion but felt a
little skanky.  (We could do with a way to define external symbols
relative to internal symbols, for things like the source address of
code that gets relocated.)

Also, re-enabled some unit tests.

Also, added a bit of identifying stuff to CrashLog.txt.
2019-10-02 16:50:15 -07:00

113 lines
3.7 KiB
ArmAsm

; 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 three platform symbol files.
org $1000
; make sure platform symbols don't get set for file data
; DO NOT set a user label here
Start lda Start-1 ;PlatStart-1
ldx Start ;auto
ldy Start+1 ;auto+1
nop
; test overlapping labels (multiple sym files)
lda $1ffe ;should have no symbol
lda $1fff ;should be SameName1-1
lda $2000 ;should be SameName1
lda $200f ;should have no symbol
lda $2010 ;should be SameName2-1
lda $2011 ;should be SameName2
lda $201f ;should have no symbol
lda $2020 ;should have no symbol
lda $2021 ;should be sym-1
lda $2022 ;should be SameName3
nop
; test overlapping values (multiple sym files)
lda $2100 ;should be SameValA_A
lda $2110 ;should be SameValB_A
lda $2120 ;should be SameValC_C
nop
; test overlap with project symbol
; EDIT: define project symbols ProjSym1 at $2202(4b) and ProjSim2 at $220a(1b)
lda $21fe ;should have no symbol
lda $21ff ;SYM-1
lda $2200 ;ChkProj1
lda $2201 ;ChkProj1+1
lda $2202 ;ProjSym
lda $2203 ;ProjSym1+1
lda $2204 ;ProjSym1+2
lda $2205 ;ProjSym1+3
lda $2206 ;ChkProj2+2
lda $2207 ;ChkProj2+3
lda $2208 ;should have no symbol
lda $2209 ;ProjSym2-1
lda $220a ;ProjSym2
lda $220b ;should have no symbol
nop
; test overlapping regions, single file
lda $2ffe ;should have no symbol
lda $2fff ;Over1-1
lda $3000 ;Over1
lda $3001 ;Over1+1
lda $3002 ;Over2
lda $3003 ;Over2+1
lda $3004 ;Over2+2
lda $3005 ;Over2+3
lda $3006 ;Over2a
lda $3007 ;Over3+1
lda $3008 ;Over3+2
lda $3009 ;Over3+3
lda $300a ;Over3+4
lda $300b ;Over3+5
lda $300c ;Over3+6
lda $300d ;Over1+13
lda $300e ;Over1+14
lda $300f ;Over1+15
lda $3010 ;should have no symbol
nop
; test overlapping regions, multiple platform files
lda $30fe ;should have no symbol
lda $30ff ;SepOver1-1
lda $3100 ;SepOver1
lda $3101 ;SepOver1+1
lda $3102 ;SepOver1+2
lda $3103 ;SepOver1+3
lda $3104 ;SepOver2+2
lda $3105 ;SepOver2+3
lda $3106 ;should have no symbol
nop
; test overlap with local variable
; EDIT: create variable LocalVar at $41(2b)
ldx $3e ;should have no symbol
ldx $3f ;should be OverVar-1
ldx $40 ;should be OverVar
ldx $41 ;should be LocalVar
ldx $42 ;should be LocalVar+1
ldx $43 ;should be OverVar+3
ldx $44 ;should have no symbol
nop
lda $3fff ;EDIT: change to "FatConst"
lda $4000 ;should have no symbol
lda $4001 ;should have no symbol
rts