1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-06 16:29:03 +00:00
Commit Graph

324 Commits

Author SHA1 Message Date
Andy McFadden
88e72d1eb8 Rename regression test 2020 to reflect the CPU configuration
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.
2019-09-15 17:02:21 -07:00
Andy McFadden
2828cc8ca7 Apply project/platform symbols to Numeric/Address data operands
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.
2019-09-15 14:38:12 -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
9fc61507ca Split-address table formatter now handles non-split 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.
2019-09-15 13:16:38 -07:00
Andy McFadden
42e6e6df1e Add 2020-cycle-counts
A quick test to confirm that the cycle counting mechanism is
generating the correct results.
2019-09-14 18:51:03 -07:00
Andy McFadden
44c140a8d0 Add "Copy to Operand" button to instruction operand editor
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.
2019-09-14 17:57:46 -07:00
Andy McFadden
62b7655a1c Fix handling of data formatting that overlaps with code
If you play games with code hints you can create a data operand that
overlaps with code.  This causes problems (see issue #45).  We now
check for that situation and ignore overlapping data descriptors.

Added a regression test to 2011-hinting.
2019-09-14 11:44:17 -07:00
Andy McFadden
e7d693bae2 Version 1.3.0-dev6 2019-09-13 20:19:13 -07:00
Andy McFadden
be2b1e7bba Add Export feature to documentation
Also, removed "include symbol table" from export dialog.  You can
exclude the table by removing it from the template, which right
now  you'd need to do anyway to get rid of the H2 header and other
framing.  To make this work correctly as an option we'd need to
parse the "div" in the template file and strip the whole section,
or split the template into multiple parts that get included as
needed.  Not worth doing the work until we're sure it matters.
2019-09-13 18:22:34 -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
2d5bdd27a8 Version 1.3.0-dev5 2019-09-09 10:58:35 -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
a3b968f025 Fix up the manual a bit 2019-09-06 15:38:49 -07:00
Andy McFadden
8727d49f43 Minor tweaks 2019-09-06 13:47:23 -07:00
Andy McFadden
ee6e5d7fb6 Fix a couple of obscure bugs
The code that checked to see if a data target was inside a data
operand wasn't going all the way back to the start of the file.
It was also failing to stop when it should, wasting time.

The anattrib validation method has code that avoids a false-positive
on certain complex embedded instruction arrangements.  This was also
preventing it from seeing a transition from a data area to the
middle of an instruction (caused by issue #45).
2019-09-04 17:48:55 -07:00
Andy McFadden
431ad94d95 Make "smart" PLP handling optional
We try to be clever with PHP/PLP, but sometimes we get it wrong.  If
we get it wrong a lot, we want to turn it off.  Now we can.
2019-09-02 15:57:59 -07:00
Andy McFadden
54e7f68490 Make modified flags stand out
This changes the color of the status flags on lines where the flags
have been overridden.
2019-09-02 15:18:55 -07:00
Andy McFadden
9a8df9c498 Add local variable tables to documentation 2019-09-01 18:14:59 -07:00
Andy McFadden
14b215b76d Implement local variables for cc65
I'd apparently overlooked the ".set" directive, which seems to do
exactly what we need.
2019-09-01 18:14:39 -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
d542a809f8 Implement local variables for ACME
Unlike 64tass and Merlin, which allow you to redefine symbols, ACME
uses "zones" that provide scope for local variables.  This means
that, at the point of a local variable table definition, we have to
start a new zone and output the full set of active symbols, not just
the newly-defined ones.  (If you set the "clear previous" flag in
the LvTable there's no difference.)

We could do a bit better by only outputting the symbols that are
actually used within the zone, similar to what we do for global
project/platform symbols, but that's a bunch of work for questionable
benefit.
2019-09-01 10:55:19 -07:00
Andy McFadden
c698048001 Handle variable labels that are duplicates of non-variables
After thrashing around a bit, I had to choose between making the
uniquifier more complicated, or making de-duplication a separate
step.  Since I don't really expect duplicates to be a thing, I went
with the latter.

Updated the regression test.
2019-08-31 21:54:20 -07:00
Andy McFadden
963b351a52 Add 2019-local-variables test
This hits most of the edge cases, but doesn't exercise the two
duplicate name situations (var name same as user label, var name
same as project/platform symbol).

Also, fixed a bug in the EditDefSymbol uniqueness check where it
was comparing a symbol to itself.
2019-08-31 20:40:38 -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
02c79db749 Add local variable uniquification
For ACME and cc65, enable uniqification.  This works with my basic
tests, but there are a lot of potential edge cases.
2019-08-31 14:19:50 -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
9e4949ab21 Tweak var table sort order
Still primarily ascending numeric order, but now we use the symbol
type as the secondary sort instead of the label.

Also, fix References crash on first line of empty var table.
2019-08-29 15:20:38 -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
e82339573f Add VarDirective to PseudoOpNames
Also, rearranged the pseudo-op app settings XAML to be a bit easier
to maintain.
2019-08-29 12:14:47 -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
5dcdbe3f3a Various tweaks
Fixed a minor bug in GenerateLineList that would cause a blank line
to disappear under certain circumstances.  Harmless, but odd.

Added a width property to DefSymbol.

Updated comments.
2019-08-24 17:35:26 -07:00
Andy McFadden
2fa5fdc237 Eliminate duplicate function 2019-08-21 15:29:00 -07:00
Andy McFadden
32d1147eec Improve multi-encoding output in 64tass
Previously, we used the default character encoding from the project
properties to determine how strings and character constants in the
entire source file should be encoded.  Now we switch between
encodings as needed.  The default character encoding is no longer
relevant.

High ASCII is now an actual encoding, rather than acting like ASCII
that sometimes doesn't work.  Because we can do high ASCII character
operands with "| $80", we don't output a .enc to switch from ASCII
to high ASCII unless we need to generate a string.  (If we're
already in high ASCII mode, the "| $80" isn't required but won't
hurt anything.)

We now do a scan up front to see if ASCII or high ASCII is needed,
and only output the .cdefs for the encodings that are actually used.

The only gap in the matrix is high ASCII DCI strings -- the ".shift"
pseudo-op rejects text if the string doesn't start with the high
bit clear.
2019-08-21 13:46:05 -07:00
Andy McFadden
38d3adbb08 PETSCII does DCI
I didn't think it made sense, but I found something that used it,
so apparently it's a thing.  This updates the operand editor to
let you choose PETSCII+DCI, and updates the assemblers to handle
it correctly (really just 64tass, since the others either don't
have a DCI directive or don't deal with PETSCII at all).

Changed the char-encoding sample from "bad dcI" to "pet dcI", and
updated the documentation.
2019-08-20 17:55:12 -07:00
Andy McFadden
57deccca27 Version 1.3.0-dev4 2019-08-20 11:26:56 -07:00
Andy McFadden
149e763821 Change the way ASCII is handled for 64tass
The documentation for 64tass says you're required to pass "--ascii"
when the source file is ASCII (as opposed to PETSCII).  We were
ignoring this, but it turns out that everything works a bit better
if we don't.

So we now pass "--ascii" on the command line, and add a two-line
character encoding definition to every file that is generated with
ASCII as the default encoding.  The sg_petscii and sg_screen
encodings go away, as PETSCII is now the default, and we can use the
built-in "screen" encoding.
2019-08-20 11:21:30 -07:00
Andy McFadden
0abea2beac Update 64tass handling of StackInt ops
The operands for BRK and COP must be expressed as immediate mode
constants, with a leading '#'.
2019-08-19 16:09:11 -07:00
Andy McFadden
434f0506d5 Version 1.3.0-dev3 2019-08-19 14:23:00 -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
62c15031fd Update documentation
PETSCII, ACME, and other improvements.
2019-08-18 17:16:44 -07:00