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

288 Commits

Author SHA1 Message Date
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
Andy McFadden
037b590967 Improve ACME high ASCII handling
We can !xor a high ASCII string so long as it doesn't include any
escaped characters.
2019-08-17 17:35:01 -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
268ad18067 Add C64 character conversions to hex dump viewer
The conversion mode enum was replaced, so we will lose the previous
combo box setting after an upgrade.
2019-08-16 15:45:42 -07:00
Andy McFadden
479be1a58e Add 2016-char-encoding-a and variations
All tests use the same data file and nearly the same project file.
The only difference is the default text encoding property setting.
For "-a" it's ASCII, for "-p" it's PETSCII, for "-s" it's C64 screen
code.  Right now this only affects the code generated for 64tass.

The test itself is a collection of strings and characters in the
supported character encodings.  How these are handled varies
significantly between assemblers.
2019-08-16 15:01:11 -07:00
Andy McFadden
81029afae5 Generate C64 encodings in 64tass output
The 64tass generator now uses the "default text encoding" project
property to determine how readable text should be encoded.  For
example, if the property is set to PETSCII, an ASCII-to-PETSCII
encoding table is generated at the top of the output file.
2019-08-16 14:46:17 -07:00
Andy McFadden
84d3146903 Update source generators to recognize C64 strings
For the most part this means explicitly dumping them as hex, though
ACME gets to exercise its !pet and !scr operators.
2019-08-15 21:33:10 -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
176e1ad6af Add default text encoding mode to system definition
This allows C64/C128/Pet projects to start out with PETSCII set as
the default text encoding mode.
2019-08-14 18:03:40 -07:00
Andy McFadden
8fd469b81f Correctly handle delimiters in character operands
We weren't checking to see if character operands matched their
delimiters, so bad code like "LDA #'''" was being generated.

There wasn't a test for this in 2006-operand-formats, so the test
has been updated with single and double quotes in low and high ASCII.
2019-08-14 17:31:15 -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
f3c28406a5 Add multiple encoding support to uncategorized data analyzer
The code that searches for character strings in uncategorized data
now recognizes the C64 encodings when selected in the project
properties.

The new code avoids some redundant comparisons when runs of
printable characters are found.  I suspect the new implementation
loses on overall performance because we're now calling through
delegates instead of testing characters directly, but I haven't
tested for that.
2019-08-13 14:08:27 -07:00
Andy McFadden
d5b53a0795 Add combo box for default text scan mode
It's not quite the same as the character encoding -- sometimes we
want a mix of things -- so it gets its own enum.  The value is
saved to the project file, but not actually used yet.

Also, moved some combo box strings into XAML resources.
2019-08-12 18:01:29 -07:00
Andy McFadden
9a6d8d2e28 Minor cleanup
Remove left/right arrow PNGs.  Remove duplicate copies of icon.
Tweak some comments.  Set application icon.  Adjust padding on
group boxes in first tab of app settings.
2019-08-12 14:13:27 -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
068b3a44c7 Remove "high" versions of string pseudo-ops
High ASCII and other encodings will be noted in the operand field,
not the opcode, so we no longer need these.

This removes the six input fields from the Pseudo-Op tab of app
settings.  Values were stored as a serialized class in settings,
which generally works correctly as far as forward/backward
compatibility goes, so no worries there.

This also adds four "delimiter pattern" fields to the Code View tab,
allowing the user to customize how encoded strings are marked up
for the code list.  The values aren't actually used yet.

Also, fixed an issue where changes to text fields on the Pseudo-Op
tab weren't raising the dirty flag.
2019-08-11 16:44:22 -07:00
Andy McFadden
bc633288ad Prep work for multi-encoding support
Wrote down research into C64 encodings.

Added source for a first cut at 2016-char-encoding test.
2019-08-11 11:27:09 -07:00
Andy McFadden
15d26c9ebd Don't do plugin interface checks during code analysis
The plugin objects are MarshalByRefObject stubs, which means they
don't actually implement the interfaces we're checking for.  There's
some additional overhead to do the interface check.  We can avoid
it by doing the interface queries during initialization, and just
checking some bit flags later on.

Also, in the extension script info window, show a list of
implemented interfaces.
2019-08-10 17:16:39 -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
a4f5d19295 Improve 64tass output
DCI is handled with the ".shift" pseudo-op.  The .null, .ptext,
and .shift operators all work correctly with escaped characters,
so we no longer redo those.
2019-08-09 19:13:58 -07:00
Andy McFadden
dae76d9b45 Rework string operand formatting
This generalizes the string pseudo-operand formatter, moving it into
the Asm65 library.  The assembly source generators have been updated
to use it.  This makes the individual generators simpler, and by
virtue of avoiding "test runs" should make them slightly faster.

This also introduces byte-to-character converters, though we're
currently still only supporting low/high ASCII.

Regression test output is unchanged.
2019-08-09 17:46:33 -07:00
Andy McFadden
7a40d7f9bf Update expected output for test 2005-string-types
This was the result of the earlier change to eliminate "reverse DCI"
strings.  On further examination, it doesn't seem like we can do
much better than a hex dump without more work than the situation
merits.  So hex dump it is.
2019-08-09 16:41:05 -07:00
Andy McFadden
835c1c7fe2 Reverse position on '#' in block move operands
During a discussion with the cc65 developers, I became convinced that
generating "MVN $01,$02" is wrong, and "MVN #$01,#$02" is correct.
64tass, cc65, and Merlin 32 all accept this syntax; only ACME does
not.  Operands without a leading '#' should be treated as 24-bit
values, and have the bank byte extracted.

This change updates the on-screen display and assembled output to
include the '#'.  The ACME generator uses a Quirk to suppress the
hash mark.  (It doesn't currently accept values larger than 8 bits,
so there's no ambiguity.)
2019-08-08 13:02:01 -07:00
Andy McFadden
0d0854bda7 Change the way string formats are defined
We used to use type="String", with the sub-type indicating whether
the string was null-terminated, prefixed with a length, or whatever.
This didn't leave much room for specifying a character encoding,
which is orthogonal to the sub-type.

What we actually want is to have the type specify the string type,
and then have the sub-type determine the character encoding.  These
sub-types can also be used with the Numeric type to specify the
encoding of character operands.

This change updates the enum definitions and the various bits of
code that use them, but does not add any code for working with
non-ASCII character encodings.

The project file version number was incremented to 2, since the new
FormatDescriptor serialization is mildly incompatible with the old.
(Won't explode, but it'll post a complaint and ignore the stuff
it doesn't recognize.)

While I was at it, I finished removing DciReverse.  It's still part
of the 2005-string-types regression test, which currently fails
because the generated source doesn't match.
2019-08-07 16:19:13 -07:00
Andy McFadden
89288c4d8c Updated assembler bugs & quirks
Notably, updated remarks regarding cc65's handling of block move
operands, which are apparently "broken as intended".
2019-08-06 08:52:59 -07:00
Andy McFadden
a4e90bffd1 Add 2015-64k-nops test
The test file is just 65536 NOPs.
2019-08-04 16:54:01 -07:00
Andy McFadden
212c20e02c Version 1.3.0-dev2 2019-08-04 15:00:36 -07:00
Andy McFadden
d80132e941 Finish ACME v0.96.4 support
There's no easy way to make non-zero-bank 65816 code work, so I'm
punting and just generating a whole-file hex dump for those.  This
renders tests 2007 and 2009 useless, so I'm hesitant to claim that
ACME support is fully functional.
2019-08-04 14:48:42 -07:00
Andy McFadden
71badf2359 Update for cc65 v2.18
WDM <arg> now works.  MVN/MVP are still broken.  Correct code is
generated for whichever version of the assembler is configured.
Regression tests updated for new version.

Also, fixed a UI bug where manual edits to the assembler path were
being ignored.
2019-08-04 13:38:25 -07:00
Andy McFadden
1ad9caa783 First pass at ACME support
I managed to work around most of the quirks, but there's still an
issue with 65816 code.

Also, enabled word wrapping in the AsmGen text boxes.
2019-08-03 20:54:07 -07:00
Andy McFadden
d97d715ae3 Version 1.3.0-dev1 2019-08-02 17:25:55 -07:00
Andy McFadden
98914e9f80 Treat BRK as a 1-byte instruction
The 65816 definition makes it a two-byte instruction, like COP.  On
the 6502 it acted like a two-byte instruction, but in practice very
few assemblers treat it that way.  Very few humans, for that matter.
So it's now treated as a single byte instruction, with the following
byte encoded as a data value.
2019-08-02 17:21:50 -07:00
Andy McFadden
0616e4e4a4 Define interfaces for inline call handlers and BRK
Instead of providing no-op CheckJsr/CheckJsl, plugins now declare
which calls they support by defining interfaces on the plugin class.

I added a CheckBrk call for code like Apple /// SOS calls, which
use BRK as an OS call mechanism.  The formatting doesn't work quite
right yet because I've been treating BRK as a two-byte instruction.
Hardly anything else does, and I think it's time I stopped (but not
in this commit).

Note: THIS BREAKS ALL PLUGINS that use the inline JSR/JSL feature,
which is pretty much all of them.
2019-08-02 16:06:27 -07:00
Andy McFadden
d41266442d Make the "continue" button actually do something 2019-08-02 16:00:58 -07:00