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 23:26:05 +00:00
|
|
|
; 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.
|
2019-10-03 17:32:54 +00:00
|
|
|
CodeWrap @ $0f00 $1000 ;encases program
|
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 23:26:05 +00:00
|
|
|
|
|
|
|
; 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.
|
2019-10-03 17:32:54 +00:00
|
|
|
;
|
|
|
|
; These do not have widths, so we can check N+1 to confirm that it does
|
|
|
|
; not resolve to a symbol.
|
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 23:26:05 +00:00
|
|
|
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 always use the most-recently-defined symbol. When all
|
|
|
|
; else is equal, alphabetical.
|
|
|
|
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
|
|
|
|
|
2019-10-03 17:32:54 +00:00
|
|
|
; Test bank wrap.
|
|
|
|
BankWrap @ $fff0 $20
|
|
|
|
|
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 23:26:05 +00:00
|
|
|
; Width specifiers on constants should be ignored.
|
|
|
|
FatConst = $4000 8
|
2019-10-17 00:32:30 +00:00
|
|
|
|
|
|
|
; 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
|
|
|
|
|
2019-10-18 23:19:42 +00:00
|
|
|
; try a non-matching constant; should be accepted without complaint
|
|
|
|
MultiConst = $4567
|
|
|
|
|
2019-10-17 00:32:30 +00:00
|
|
|
|
|
|
|
;
|
|
|
|
; 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
|