Also exercise various formatting options.
Also, fix a bug where the code that applies project/platform symbols
to numeric references was ignoring inline data items.
The current AddressMap is now passed into the plugin manager, which
wraps it in an AddressTranslate object and passes that to the
plugins at Prepare() time. This allows plugins to convert addresses
to offsets, making it possible to format complex structures.
This breaks existing plugins.
If we have a bug, or somebody edits the project file manually, we
can end up with a very wrong string, such as a null-terminated
string that isn't, or a DCI string that has a mix of high and low
ASCII from start to finish. We now check all incoming strings for
validity, and discard any that fail the test. The verification
code is shared with the extension script inline data formatter.
Also, added a comment to an F8-ROM symbol I stumbled over.
Extension scripts (a/k/a "plugins") can now apply any data format
supported by FormatDescriptor to inline data. In particular, it can
now handle variable-length inline strings. The code analyzer
verifies the string structure (e.g. null-terminated strings have
exactly one null byte, at the very end).
Added PluginException to carry an exception back to the plugin code,
for occasions when they're doing something so wrong that we just
want to smack them.
Added test 2022-extension-scripts to exercise the feature.
We were providing platform symbols to plugins through the PlatSym
list, which allowed them to find constants and well-known addresses.
We now pass all project symbols and user labels in as well. The
name "PlatSym" is no longer accurate, so the class has been renamed.
Also, added a bunch of things to the problem list viewer, and
added some more info to the Info panel.
Also, added a minor test to 2011-hinting that does not affect the
output (which is the point).
Handle situation where a symbol wraps around a bank. Updated
2021-external-symbols for that, and to test the behavior when file
data and an external symbol overlap.
The bank-wrap test turned up a bug in Merlin 32. A workaround has
been added.
Updated documentation to explain widths.
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.
If you open the Actions menu when nothing is selected, the "can I
create a local variable table here" method crashes with a bad index
reference.
Issue #48.
If you open the Actions menu when nothing is selected, the "can I
create a local variable table here" method crashes with a bad index
reference.
Issue #48.
Added a Width column to the list in the project symbol editor.
Changed the local variable table editor and the project symbol editor
to use DataGrid instead of ListView. This gets us easy sorting on
arbitrary columns. The previous code was reloading the display list
after every change; now we just add/edit/remove individual items,
which helps keep the list position and selection stable.
The ability to give explicit widths to local variables worked out
pretty well, so we're going to try adding the same thing to project
and platform symbols.
The first step is to allow widths to be specified in platform files,
and set with the project symbol editor. The DefSymbol editor is
also used for local variables, so a bit of dancing is required.
For platform/project symbols the width is optional, and is totally
ignored for constants. (For variables, constants are used for the
StackRel args, so the width is meaningful and required.)
We also now show the symbol's type (address or constant) and width
in the listing. This gets really distracting when overused, so we
only show it when the width is explicitly set. The default width
is 1, which most things will be, so users can make an aesthetic
choice there. (The place where widths make very little sense is when
the symbol represents a code entry point, rather than a data item.)
The maximum width of a local variable is now 256, but it's not
allowed to overlap with other variables or run of the end of the
direct page. The maximum width of a platform/project symbol is
65536, with bank-wrap behavior TBD.
The local variable table editor now refers to stack-relative
constants as such, rather than simply "constant", to make it clear
that it's not just defining an 8-bit constant.
Widths have been added to a handful of Apple II platform defs.
Change + save + undo + change was being treated as non-dirty.
Added link to "export" feature to documentation TOC.
Added keyboard shortcut for high part in data operand editor.
Corrected various things in the tutorial.
Added a blank line after local variable tables. Otherwise they
just sort of blend in with the stuff around them.
Put prefixes before the DOS 3.3 platform symbols.
Added a BAS_HBASH entry. We were getting BAS_HBASL and MON_GBASH
paired up, which looks weird.
Apply a very light tint to the preview section of the Edit Long
Comment dialog, to hint that the window is read-only.
Having underlined blue text everywhere was too noisy. This changes
the CSS style for internal links to be plain black text that gets
blue and underliney when you hover the mouse over it.
Also, added the current date and time to the set of template
substitutions.
HTML output should have had double quotes around internal anchors.
(Chrome and Edge didn't complain, but the w3c validator wasn't
happy.)
Made the text areas in the load-time problem report dialogs
scrollable.
Updated the manual.
The analyzer sometimes runs into things that don't seem right, like
hidden labels or references to non-existent symbols, but has no way
to report them. This adds a problem viewer.
I'm not quite ready to turn this into a real feature, so for now it's
a free-floating window accessed from the debug menu.
Also, updated some documentation.
In a recent survey, three out of four cross assemblers surveyed
recommended not using opcode mnemonics to their patients who use
labels. We now remap labels like "AND" and "jmp", using the label
map that's part of the label localizer.
We skip the step for Merlin 32, which is perfectly happy to assemble
"JMP JMP JMP".
Also, fixed a bug in MaskLeadingUnderscores that could hang the
source generator thread.
Most assemblers end local label scope when a global label is
encountered. cc65 takes this one step further by ending local label
scope when constants or variables are defined. So, if we have a
variable table with a nonzero number of entries, we want to create
a fake global label at that point to end the scope.
Merlin 32 won't let you write " LDA #',' ". For some reason the
comma causes an error. IGenerator now has a "tweak operand format"
interface that lets us fix that.
Split "edit local variable table" into "create" and "edit prior".
The motivation is to allow the user to make changes to the most
recently defined table without having to go search for it. Having
table creation be an explicit action, rather than something that
just happens if you edit a table that isn't there, feels reasonable.
Show table offset in LV table edit dialog, so if you really want
to go find it there's a (clumsy) way to do so.
Increased the maximum width of a variable from 4 to 8. (This is
entirely arbitrary.)
Typing a long comment in the project symbol editor caused the
window to expand, which wasn't intended. Use the mono font in
the comment editor. Set the focus to the OK button after creating
or editing a project property. Show constant vs. address in the
info panel when an EQU directive is selected.
Changing an ASCII character operand back to default was going
through a path that tried to resolve low vs. high ASCII, which
isn't useful when you're removing the item. The root of the problem
was that the "default" button wasn't properly resetting the UI.
Also, updated keyboard shortcuts to be in sync with the instruction
operand editor.
It felt a little weird tying it to the asm generation setting,
so now it's just another checkbox in the export options.
Implemented the feature for plain text output. Did some rearranging
in the code. Fixed suppression of Notes in text and CSV.
The functions started by trying to pad a column out to a width,
then changed to pad things to a certain length. What they really
should be doing is padding the start of an entry to a specified
column. This is much more natural and avoids a trim operation.
The only change to the output is to ORG statements from the HTML
exporter, which are now formatted correctly.
We weren't escaping '<', '>', and '&', which caused browsers to get
very confused. Browsers seem to prefer <PRE> to <CODE> for long
blocks of text, so switch to that.
Also, added support for putting long labels on their own lines in
the HTML output.
Also, fixed some unescaped angle brackets in the manual.
Also, tweaked the edit instruction operand a bit more.
If you set things up just right, it's possible for flag status
changes to fail to get merged.
Added a regression test to 1003-flags-and-branches.
Also, tweaked the instruction operand editor to be a bit smoother
from the keyboard: added alt-key shortcuts, and put the focus on the
OK button after creating/editing a label so you can just hit the
return key twice.
I was using the plain names, but when you've got symbols like
READ and WAIT it's too easy to have a conflict and it's not plainly
obvious where something came from. Now all monitor symbols begin
with MON_, and Applesoft symbols begin with BAS_.
The Amper-fdraw example ended up with a few broken symbol refs,
because it was created before project/platform symbols followed the
"nearby" rules, and was explicitly naming LINNUM and AMPERV. I
switched the operands to default, and they now auto-format correctly.
I added a few more entries to Applesoft while I was at it.
If a line has a comment with a cycle count and nothing else, it was
getting an extra space or two on the end.
Also, added a few end-of-line comments to the 2020 test to show how
they interact with the cycle counts.
Cycle counting is CPU-specific. The 2020 test exercises the
65816, but there are things unique to 6502 and 65C02 that should
also be checked if we want to be thorough.
No changes to the test itself.
A ".dd2 <address>" item would get linked to an internal label, but
references to external addresses weren't doing the appropriate
search through the platform/project symbol list.
This change altered the output of the 2019-local-variables test.
The previous behavior was restored by disabling "nearby" symbol
matching in the project properties.
Updated the "lookup symbol by address" function to ignore local
variables.
Also, minor updates to Applesoft and F8-ROM symbol tables.
I ran into a non-split table of 16-bit addresses, each of which
was (address-1) for a code location. I wanted to create a label,
add a code hint, and set the operand for each one, but there's no
easy way to do that.
It turns out the split-address table formatter can be made to work
for non-split tables with just a few minor changes.
It's possible to define multiple project symbols with the same
address. The way to resolve the ambiguity is to explicitly
reference the desired symbol from the operand. This was the
default behavior of the "create project symbol" shortcut in the
previous version.
It's rarely necessary, and it can get ugly if you rename a project
symbol, because we don't refactor operands in that case.