1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-26 06:49:19 +00:00
6502bench/SourceGen/SGTestData/2021-external-symbols-1.sym65
Andy McFadden c535201884 Prefer narrower project/platform symbols
We want to be able to declare a symbol for a struct or buffer that
spans the entire width, and then declare more-specific items within
it that take precedence.  This worked for everything but the very
first byte, because on an exact match we were resolving the conflict
alphabetically.

Now, if one is wider than the other, we use the narrower definition.

Updated 2021-external-symbols with some additional test cases.
2020-01-23 10:49:22 -08:00

123 lines
3.6 KiB
Plaintext

; Copyright 2019 faddenSoft. All Rights Reserved.
; See the LICENSE.txt file for distribution terms (Apache 2.0).
*SYNOPSIS Symbol set 1 for test 2021-external-symbols
; Platform symbols aren't applied to file data.
CodeWrap @ $0f00 $1000 ;encases program
; SameName2 and SameName3 are replaced by later file
SameName1 @ $2000
SameName2 @ $2010
SameName3 @ $2020
; Symbols with the same values but different names are defined
; in later files. Names are chosen to not provide a strict
; alphabetical progression.
;
; These do not have widths, so we can check N+1 to confirm that it does
; not resolve to a symbol.
SameValA_C @ $2100
SameValB_B @ $2110
SameValC_A @ $2120
; Test overlap with project symbol. Declare at $2202(4b), and $220a(1b).
ChkProj1 @ $2200 4
ChkProj2 @ $2204 4
; Overlapping regions, defined within a single platform file. We
; should prefer matches by proximity and width. When all else is
; equal, choose alphabetically.
Over1 @ $3000 16 ;$3000-300f, inclusive
Over2 @ $3002 8 ;$3002-3009
Over3 @ $3006 7 ;$3006-300c
Over2a @ $3006 1 ;$3006
; Expected result:
; $3000-3001: Over1
; $3002-3005: Over2
; $3006 : Over4
; $3007-300c: Over3
; $300d-300f: Over1
; Overlapping regions defined in multiple files. The later definition
; takes priority. So while SepOver1 would normally end at $3102,
; instead it steps on the first two bytes of SepOver2.
SepOver2 @ $3102 4 ;$3102-3105, inclusive
; Test overlap with local variable. Declare at $41(2b).
OverVar @ $40 4
; Test bank wrap.
BankWrap @ $fff0 $20
; Width specifiers on constants should be ignored.
FatConst = $4000 8
; Overlapping multi-byte items with exact and inexact matches.
OverA_0 @ $6000 8 ;should win, alphabetically
OverB_0 @ $6000 8
OverB_1 @ $6100 8 ;(file order reversed)
OverA_1 @ $6100 8 ;should win, alphabetically
OverA_2 @ $6200 8
OverB_2 @ $6200 ;should win because narrower
OverA_3 @ $6300 8 ;(ref OverA_3+4)
OverB_3 @ $6300 7 ;should win because narrower
OverA_4 @ $6401 8 ;(ref OverA_4+2)
OverB_4 @ $6402 8 ;should win because closer
OverC_4 @ $6403 8
; I/O direction test
ReadOnly < $5000 2 ;R
WriteOnly > $5001 2 ;W
;
; MULTI_MASK tests.
;
; The behavior of overlapping masks is not currently defined, so we don't test
; that scenario.
;
; overlaps with multi range in second symbol file
AlsoMoreMultiZero @ $c110 ;winner
*MULTI_MASK $ff00 $c000 $000f ;$c000-c00f, repeats $c010-c01f, etc. to $c0ff
MultiZero @ $c000
AlsoMultiZero @ $c010 ;wins (alphabetically)
MultiOne @ $c021
; Test: C000, C010, C020, C0F0
; Test: C001, C011, C021
; Test: C002, C012, C022
MultiRead < $c004 3 ;$c004/5/6, read-only
MultiWrite > $c005 3 ;$c005/6/7, write-only
; Test: read C003 C004 C005 C006 C007
; Test: write C004 C005 C006 C007 C008
; try a non-matching constant; should be accepted without complaint
MultiConst = $4567
;
; Invalid values. These cause a warning at load time, and the symbol will
; be ignored.
;
; Not in range.
MultiInvalid @ $1234
; Not all covered addresses are inside the masked range.
TooLong @ $c0f8 $a
;
; Badly-formed MULTI_MASK entries. These cause a warning at load time, and
; the directive will be ignored.
;
*MULTI_MASK $fffff $ffff $ffff ;range
*MULTI_MASK $ffff $fffff $ffff ;range
*MULTI_MASK $ffff $ffff $fffff ;range
*MULTI_MASK