1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-25 20:29:31 +00:00
Commit Graph

143 Commits

Author SHA1 Message Date
Andy McFadden
c8dfa94ce2 Change find-previous hotkey to Shift+F3
The range-select behavior that was giving us problems can be worked
around by switching the control to single-select mode when changing
the selection.
2019-10-17 12:51:45 -07:00
Andy McFadden
9c3422623d External symbol I/O direction and address mask, part 1
Memory-mapped I/O locations can have different behavior when read
vs. written.  This is part 1 of a change to allow two different
symbols to represent the same address, based on I/O direction.

This also adds a set of address masks for systems like the Atari
2600 that map hardware addresses to multiple locations.

This change updates the data structures, .sym65 file reader,
project serialization, and DefSymbol editor.
2019-10-15 19:12:57 -07:00
Andy McFadden
df2f3803f4 SourceGen After Dark
Most of SourceGen uses standard WPF controls, which get their default
style from the system theme.  The main disassembly list uses a
custom style, and always looks like the Windows default theme.

Some people greatly prefer white text on a black background, so we
now provide a way to get that.  This also requires muting the colors
used for Notes, since those were chosen to contrast with black text.

This does not affect anything other than the ListView used for
code, because everything else can be set through the Windows
"personalization" interface.  We might want to change the way the
Notes window looks though, to avoid having glowing bookmarks on
the side.
2019-10-12 17:23:32 -07:00
Andy McFadden
6d886ecc3a Change some EQU handling
Changed the sort order on EQU lines so that constants come before
address definitions.  This caused trivial changes to three of the
regression tests.

Added the ability to jump directly to an EQU line when an opcode
is double-clicked on.
2019-10-10 13:49:21 -07:00
Andy McFadden
475c31b886 Tweak navigation
If you select a local variable, double-click on a reference entry,
and then hit "back", you aren't taken back to the correct place in
the local variable table.  This is annoying if you're trying to
explore how a local variable is used.

The NavStack Location object now has a "line delta" that can be
applied to position the selection correctly.  This isn't stable
across undo/redo, but it solves the common cases.

This makes LineListGen's "Top" class redundant, so uses of that have
been replaced with Location.
2019-10-10 11:57:36 -07:00
Andy McFadden
3a67c14247 Add "find previous"
The Find box now has forward/backward radio buttons.  Find Next
searches forward, and Find Previous searches backward, regardless
of the direction of the initial search.

The standard key sequence for "find previous" is Shift+F3.  The WPF
ListView has some weird logic that does something like: if you hit
a key, and the selection changes, and the shift key was held down,
then you must have meant to select a range.  So Shift+F3 often (but
not always) selects a range.  I think this might be fixable if I can
figure out how ListView keeps track of the current keyboard
navigation position (which is not the same as the selection).  For
now I'm working around the problem by using Ctrl+F3 to search.
Yay WPF.
2019-10-09 17:47:07 -07:00
Andy McFadden
28eafef27c Expand the set of things SetInlineDataFormat accepts
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.
2019-10-05 19:51:34 -07:00
Andy McFadden
3172ea0b70 Update Apple II data files
Added symbols for the ProDOS 8 global page, as well as some notes
about screen holes.

Also, if a platform symbol has a tag, show it in the Info panel.
2019-10-03 15:18:59 -07:00
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
Andy McFadden
e2b5b12e13 Fix Actions menu crash
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.
2019-10-01 19:13:15 -07:00
Andy McFadden
41cd30a8c6 Add Problem List Viewer to debug menu
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.
2019-09-21 13:43:01 -07:00
Andy McFadden
6df874c559 Minor changes to local variable tables
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.)
2019-09-19 16:37:59 -07:00
Andy McFadden
6bc491885a Minor UI tweaks
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.
2019-09-18 18:11:48 -07:00
Andy McFadden
5dacbcd9b5 Make "long labels on new line" configurable in export dialog
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.
2019-09-18 11:14:20 -07:00
Andy McFadden
6f81d748ee Rename FormatSplitAddress to FormatAddressTable
Updated menus and docs to match.
2019-09-15 13:37:38 -07:00
Andy McFadden
d3ff1f6eff Implement HTML export
Pretty straightforward formatted-text dump, with links for internal
labels, and a table of exported symbols at the end.
2019-09-13 17:18:33 -07:00
Andy McFadden
1631cd77f6 Check both directions for project/platform "nearby" matches
If a symbol is defined at <addr>, and we counter STA <addr>-1,Y,
we want to use the symbol in the operand.  This worked for labels
but not project/platform symbols.

Also, fixed a crash that happened if you tried to delete an auto
label.
2019-09-12 14:24:09 -07:00
Andy McFadden
81157b6b47 Implement text export
This feature "exports" the source code in the same format it appears
in on screen.  The five columns on the left are optional, the four
on the right can be resized.  Exported text can span the entire file
or just the current selection.  Output can be plain text or CSV.
(I still haven't figured out a good use for CSV.)

The old copy-to-clipboard function is now implemented via the export
mechanism.

This adds a new clipboard mode that includes all columns.  Potentially
useful for filing bug reports against SourceGen.
2019-09-12 13:57:52 -07:00
Andy McFadden
e5104dc2e7 Add first pass at source export dialog
Ported the column width stuff from EditAppSettings, which it turns
out can be simplified slightly.

Moved the clipboard copy code out into its own class.

Disabled "File > Print", which has never done anything and isn't
likely to do anything in the near future.

Also, added a note to 2019-local-variables about a test case it
should probably have.
2019-09-10 17:43:31 -07:00
Andy McFadden
bb23bf82d1 Instruction operand editor rework, part 4 (of 4)
Updated the manual, and changed tutorial #2 to use local variables
for pointers.

If the symbol text box isn't empty, use the string as the initial
value for the Label when creating a new project property.

Fixed a crash when editing a project property.
2019-09-08 21:56:47 -07:00
Andy McFadden
4d9d5e2ecf Instruction operand editor rework, part 3
Implemented editing of labels and project symbols.

Also, cleaned up the local variable edit code.
2019-09-08 16:41:54 -07:00
Andy McFadden
e8ae534879 Instruction operand editor rework, part 2
Implemented local variable editing.  Operands that have a local
variable reference, or are eligible to have one, can now be edited
directly from the instruction operand edit dialog.

Also, updated the code list double-click handler so that, if you
double-click on the opcode of an instruction that uses a local
variable reference, the selection and view will jump to the place
where that variable was defined.

Also, tweaked the way the References window refers to references
to an address that didn't use a symbol at that address.  Updated
the explanation in the manual, which was a bit confusing.

Also, fixed some odds and ends in the manual.

Also, fixed a nasty infinite recursion bug (issue #47).
2019-09-07 20:56:43 -07:00
Andy McFadden
2633720c82 Instruction operand editor rework, part 1
Rearrange the UI elements, and convert the code-behind to a more
XAML-style form.  The basic stuff works, but the old "shortcut"
system is still in the process of being replaced.
2019-09-07 13:39:22 -07:00
Andy McFadden
8727d49f43 Minor tweaks 2019-09-06 13:47:23 -07:00
Andy McFadden
9a61a852ad Add a "move table" button
A simple if slightly awkward way to reposition a local variable
table.
2019-09-01 16:40:54 -07:00
Andy McFadden
b65f75437d Make local variable prefix configurable for display
It's kind of handy to have variable labels tagged.  This makes it
configurable.  The quick-set for Merlin sets it to "]", all others
leave it blank.
2019-08-31 15:00:45 -07:00
Andy McFadden
6a2532588b Local variables mostly work
Variables are now handled properly end-to-end, except for label
uniquification.  So cc65 and ACME can't yet handle a file that
redefines a local variable.

This required a bunch of plumbing, but I think it came out okay.
2019-08-30 18:39:29 -07:00
Andy McFadden
4a02cb9846 Wire up variable xrefs
Also, update the EditDefSymbol value range check to take the width
into account.
2019-08-29 13:37:24 -07:00
Andy McFadden
0ed1547e79 Set Anattrib DataDescriptor for local variable references
We now generate FormatDescriptors with WeakSymbolRefs for direct
page references that match variable table entries.

LocalVariableTable got a rewrite.  We need to be unique in both
name and address, but for the address we have to take the width into
account as well.  We also want to sort the display by address
rather than name.  (Some people might want it sorted by name, but
we can worry about that some other time.)

Updated the DefSymbol editor to require value uniqueness.  Note
addresses and constants exist in separate namespaces.

The various symbols are added to the SymbolTable so that uniqueness
checks work correctly.  This also allows the operand generation to
appear to work, but it doesn't yet handle redefinition of symbols.
2019-08-28 18:01:38 -07:00
Andy McFadden
c4c67757c0 Show variable tables in line list
Multi-line item, with one .eq line per variable definition.  Add
one header line if "clear previous" is set.

Also, limit variable values to 0-255 in the editor.  This is
somewhat arbitrary, but I think a focus on DP is useful.
2019-08-27 16:45:37 -07:00
Andy McFadden
0eeb36f59a Add LocalVariableTable list to project
This involved adding a list to the DisasmProject, creating a new
UndoableChange type, and writing the project file serialization
code.  While doing the latter I realized that the new Width field
was redundant with the FormatDescriptor Length field, and removed it.

I added a placeholder line type, but we're not yet showing the
table in the display list.  (To edit the tables you just have to
know where they are.)
2019-08-26 16:58:53 -07:00
Andy McFadden
1cc9d2bd70 Update editors to work with local variables
The table editor is now editing the table, and the DefSymbol editor
now asks for the Width data when editing a local var.

This also moves EditDefSymbol closer to proper WPF style, with
bound properties for the input fields.

No changes yet to serialization or analysis.
2019-08-25 17:25:15 -07:00
Andy McFadden
5fe032c93a Rough layout of local variable tables
Create the XAML and some skeletal classes.
2019-08-25 14:14:44 -07:00
Andy McFadden
354d106665 Documentation update
Also, make "spaces between numbers in bytes column" default to
enabled.
2019-08-19 14:16:35 -07:00
Andy McFadden
6251edb5ed Fix PseudoOp Merge
Missed this in the immutability change.  Instead of merging new
strings in, we create a new instance with the merged data.
2019-08-17 17:22:14 -07:00
Andy McFadden
f87ac20f32 Add a string operand cache
String operands used to be simple -- each line had 62 characters
plus two hard-coded non-ASCII delimiters -- but now we're mixing
character and hex data, so we can't use simple math to tell where
the lines will break.  We want to render them and keep the result
around until some dependency changes, e.g. different delimiters
or a change to the pseudo-op table.

Also, cleaned up LineListGen a little.  It had some methods that
were declared static because they were expected to be shared, but
that never happened.

Also, fixed a bug in GatherEntityCounts where multi-line items were
being scanned multiple times.
2019-08-17 17:03:06 -07:00
Andy McFadden
4902b89cf8 Various improvements
The PseudoOpNames class is increasingly being used in situations
where mutability is undesirable.  This change makes instances
immutable, eliminating the Copy() method and adding a constructor
that takes a Dictionary.  The serialization code now operates on a
Dictionary instead of the class properties, but the JSON encoding is
identical, so this doesn't invalidate app settings file data.

Added an equality test to PseudoOpNames.  In LineListGen, don't
reset the line list if the names haven't actually changed.

Use a table lookup for C64 character conversions.  I figure that
should be faster than multiple conditionals on a modern x64 system.

Fixed a 64tass generator issue where we tried to query project
properties in a call that might not have a project available
(specifically, getting FormatConfig values out of the generator for
use in the "quick set" buttons for Display Format).

Fixed a regression test harness issue where, if the assembler reported
success but didn't actually generate output, an exception would be
thrown that halted the tests.

Increased the width of text entry fields on the Pseudo-Op tab of app
settings.  The previous 8-character limit wasn't wide enough to hold
ACME's "!pseudopc".  Also, use TrimEnd() to remove trailing spaces
(leading spaces are still allowed).

In the last couple of months, Win10 started stalling for a fraction
of a second when executing assemblers.  It doesn't do this every
time; mostly it happens if it has been a while since the assembler
was run.  My guess is this has to do with changes to the built-in
malware scanner.  Whatever the case, we now change the mouse pointer
to a wait cursor while updating the assembler version cache.
2019-08-17 11:30:42 -07:00
Andy McFadden
7bbe5692bd Add C64 encodings to instruction and data operand editors
Both dialogs got a couple extra radio buttons for selection of
single character operands.  The data operand editor got a combo box
that lets you specify how it scans for viable strings.

Various string scanning methods were made more generic.  This got a
little strange with auto-detection of low/high ASCII, but that was
mostly a matter of keeping the previous code around as a special
case.

Made C64 Screen Code DCI strings a thing that works.
2019-08-15 17:53:12 -07:00
Andy McFadden
beb1024550 Define and use "delimiter sets"
A delimiter definition is four strings (prefix, open, close, suffix)
that are concatenated with the character or string data to form an
operand.  A delimiter set is a collection of delimiter definitions,
with separate entries for each character encoding.

This is a convenient way to configure Formatter objects, import and
export data from the app settings file, and manage the UI needed to
allow the user to customize how things look.

The full set of options didn't fit on the first app settings tab, so
there's now a separate tab just for specifying character and string
delimiters.  (This might be overkill, but there are various plausible
scenarios that make use of it.)

The delimiters for on-screen display of strings can now be
configured.
2019-08-14 16:10:04 -07:00
Andy McFadden
5889f45737 Replace on-screen string operand formatting
The previous functions just grabbed 62 characters and slapped quotes
on the ends, but that doesn't work if we want to show strings with
embedded control characters.  This change replaces the simple
formatter with the one used to generate assembly source code.  This
increases the cost of refreshing the display list, so a cache will
need to be added in a future change.

Converters for C64 PETSCII and C64 Screen Code have been defined.
The results of changing the auto-scan encoding can now be viewed.

The string operand formatter was using a single delimiter, but for
the on-screen version we want open-quote and close-quote, and might
want to identify some encodings with a prefix.  The formatter now
takes a class that defines the various parts.  (It might be worth
replacing the delimiter patterns recently added for single-character
operands with this, so we don't have two mechanisms for very nearly
the same thing.)

While working on this change I remembered why there were two kinds
of "reverse" in the old Merlin 32 string operand generator: what you
want for assembly code is different from what you want on screen.
The ReverseMode enum has been resurrected.
2019-08-13 17:52:58 -07:00
Andy McFadden
f33cd7d8a6 Replace character operand output method
The previous code output a character in single-quotes if it was
standard ASCII, double-quotes if high ASCII, or hex if it was neither
of those.  If a flag was set, high ASCII would also be output as
hex.

The new system takes the character value and an encoding identifier.
The identifier selects the character converter and delimiter
pattern, and puts the two together to generate the operand.

While doing this I realized that I could trivially support high
ASCII character arguments in all assemblers by setting the delimiter
pattern to "'#' | $80".

In FormatDescriptor, I had previously renamed the "Ascii" sub-type
"LowAscii" so it wouldn't be confused, but I dislike filling the
project file with "LowAscii" when "Ascii" is more accurate and less
confusing.  So I switched it back, and we now check the project
file version number when deciding what to do with an ASCII item.
The CharEncoding tests/converters were also renamed.

Moved the default delimiter patterns to the string table.

Widened the delimiter pattern input fields slightly.  Added a read-
only TextBox with assorted non-typewriter quotes and things so
people have something to copy text from.
2019-08-11 22:11:00 -07:00
Andy McFadden
975b62db6b Treat low and high ASCII as two distinct formats
We've been treating ASCII strings and instruction/data operands as
ambiguous, resolving low vs. high when generating output for the
display or assembler.  This change splits it into two separate
formats, simplifying output generation.

The UI will continue to treat low/high ASCII as as single thing,
selecting the format appropriately based on the data.  There's no
reason to have two radio buttons that are never both enabled.

The data operand string functions need some additional work, but
that overlaps substantially with the upcoming PETSCII changes, so
for now all strings set by the data operand editor are low ASCII.

The file format has changed again, but since there hasn't been a
release since the previous change, I'm leaving the file format
at v2.  Code has been added to resolve the ASCII mode when loading
a v1 project file.

This removes some complexity from the assembly code generators.
2019-08-10 14:59:24 -07:00
Andy McFadden
c64f72d147 Move WPF code from SourceGenWPF to SourceGen 2019-07-20 13:28:37 -07:00