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

79 Commits

Author SHA1 Message Date
Andy McFadden
3cc6f32c6f Put some stuff in a "Navigate" menu
Created a Navigate menu, and put the menu items for Find and Go To
in it.  Added menu items for nav-forward and nav-backward, which
until now were only available as toolbar buttons.
2019-10-19 17:46:40 -07:00
Andy McFadden
cd23580cc5 Add junk/align directives
Sometimes there's a bunch of junk in the binary that isn't used for
anything.  Often it's there to make things line up at the start of
a page boundary.

This adds a ".junk" directive that tells the disassembler that it
can safely disregard the contents of a region.  If the region ends
on a power-of-two boundary, an alignment value can be specified.

The assembly source generators will output an alignment directive
when possible, a .fill directive when appropriate, and a .dense
directive when all else fails.  Because we're required to regenerate
the original data file, it's not always possible to avoid generating
a hex dump.
2019-10-18 21:00:28 -07:00
Andy McFadden
f31b7f5822 Fix constants declared with MULTI_MASK
The masks should only be applied to address symbols.  We were
rejecting constants that didn't match the pattern.
2019-10-18 16:19:42 -07:00
Andy McFadden
bd11aea4a4 External symbol I/O direction and address mask, part 3 (of 3)
Added regression tests.  Improved error messages.  Updated
documentation.
2019-10-16 17:32:30 -07:00
Andy McFadden
fac2d6a51f Invoke extension scripts when labels they care about change
We were failing to update properly when a label changed if the label
was one that a plugin cared about.  The problem is that a label
add/remove operation skips the code analysis, and a label edit skips
everything but the display update.  Plugins only run during the code
analysis pass, so changes weren't being reflected in the display
list until something caused it to refresh.

The solution is to ask the plugin if the label being changed is one
that it cares about.  This allows the plugin to use the same
wildcard-match logic that it uses elsewhere.

For efficiency, and to reduce clutter in plugins that don't care
about symbols, a new interface class has been created to handle the
"here are the symbols" call and the "do you care about this label"
call.

The program in Examples/Scripts has been updated to show a very
simple single-call plugin and a slightly more complex multi-call
plugin.
2019-10-13 18:32:53 -07:00
Andy McFadden
76efbcfcbe Rename button text 2019-10-13 15:21:05 -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
d8604294bb Change how the "quick set" settings work
The last two tabs in the Edit App Settings dialog have "quick set"
buttons configure all fields for a particular assembler, or reset
them to default values.  The previous UI was a little annoying,
because you had to pick something from the combo box and then hit
"set" to push the change.  It was also confusing, because if you
came back later the combo box was just set to the first entry, not
the thing you picked last.

Now, picking an entry from the combo box immediately updates all
fields.  The combo box selection is set to reflect the actual
contents (so if you set everything just right, the combo box will
change to a specific assembler).  If nothing matches, a special
entry labeled "Custom" is selected.

Also, rearranged the tutorial sections in the manual so the
address table formatting comes last, and appears in the local TOC.
2019-10-11 17:39:52 -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
dfd5bcab1b Optionally treat BRKs as two-byte instructions
Early data sheets listed BRK as one byte, but RTI after a BRK skips
the following byte, effectively making BRK a 2-byte instruction.
Sometimes, such as when diassembling Apple /// SOS code, it's handy
to treat it that way explicitly.

This change makes two-byte BRKs optional, controlled by a checkbox
in the project settings.  In the system definitions it defaults to
true for Apple ///, false for all others.

ACME doesn't allow BRK to have an arg, and cc65 only allows it for
65816 code (?), so it's emitted as a hex blob for those assemblers.
Anyone wishing to target those assemblers should stick to 1-byte mode.

Extension scripts have to switch between formatting one byte of
inline data and formatting an instruction with a one-byte operand.
A helper function has been added to the plugin Util class.

To get some regression test coverage, 2022-extension-scripts has
been configured to use two-byte BRK.

Also, added/corrected some SOS constants.

See also issue #44.
2019-10-09 14:55:56 -07:00
Andy McFadden
b8e11215fa Add separate button for adding symbols+scripts from project
The "add platform symbol file" and "add extension script" buttons
create a file dialog with the initial directory set to the
RuntimeData directory inside the SourceGen installation directory.
This is great if you're trying to add a file from the platform
definitions, but annoying if you're trying to add it from the
project directory.

It's really convenient to not have to hunt around though, so now
there are two buttons: one for platform, one for project.  The
latter is disabled if the project is new and hasn't been saved yet.
2019-10-09 13:24:09 -07:00
Andy McFadden
86c4331cce Add issues & limitations for scripts to manual
Also, note in the code where we're discarding the compiler error
messages.
2019-10-07 17:56:35 -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
9a11ffea49 Missed a spot 2019-10-04 17:55:48 -07:00
Andy McFadden
b1d11480f3 Fix errors in manual 2019-10-03 10:53:56 -07:00
Andy McFadden
37855c8f8e Allow explicit widths in project/platform symbols, part 4 (of 4)
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.
2019-10-03 10:32:54 -07:00
Andy McFadden
e898ef9568 Minor fixes
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.
2019-09-27 13:43:58 -07:00
Andy McFadden
488df3e68e Minor fixes
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.
2019-09-21 18:49:03 -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
b74630dd5b Work around two assembler issues
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.
2019-09-20 14:05:17 -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
d01c61fbc1 Fix HTML output
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.
2019-09-17 19:13:28 -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
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
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
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
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
a3b968f025 Fix up the manual a bit 2019-09-06 15:38:49 -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
9a8df9c498 Add local variable tables to documentation 2019-09-01 18:14:59 -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
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
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
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
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
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
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
4aee3af089 Various doc fixes 2019-07-29 13:20:03 -07:00
Andy McFadden
4f74430757 Minor fixes
- Updated the tutorial to track changes to WPF, and to clarify
  existing content.
- Fixed Ctrl+H Ctrl+C, which was getting masked by the Copy command
  handler.
- Fixed initial selection of address in Set Address.
2019-07-21 15:24:39 -07:00
Andy McFadden
02f6e884d7 Fix startup issues
- MakeDist now copies CommonWPF.dll.
- Spent a bunch of time tracking down a null-pointer deref that only
  happened when you didn't start with a config file.  Fixed.
- The NPE was causing the program to exit without any sort of useful
  diagnostic, so I added an uncaught exception handler that writes
  the crash to a text file in the current directory.
- Added a trace listener definition to App.config that writes log
  messages to a file, but it can't generally be enabled at runtime
  because you can't write files from inside the sandbox.  So it's
  there but commented out.
- Made the initial size of the main window a little wider.
2019-07-20 17:36:12 -07:00
Andy McFadden
e49ee6f20b Finish split-address table formatter
A lot of things react to other things in this dialog.  I think I
got everything behaving correctly.
2019-07-13 15:55:32 -07:00
Andy McFadden
9aa8b5c9a7 Minor documentation updates
Also, placate consistency hobgoblins.
2019-07-06 10:58:24 -07:00
Andy McFadden
6998eb4021 Minor doc edits
Added Ctrl+W to the tutorial.  Named the 64tass executable.
Performed various acts of word-smithing.
2019-04-19 14:10:48 -07:00
Andy McFadden
8d0ce87ec7 Experiment on uncategorized data analysis
Tried something to speed it up.  Didn't help.  Cleaned up the code
a bit though.
2019-04-18 15:58:43 -07:00
Andy McFadden
61d6cd597a Document the auto-label style setting 2019-04-15 16:04:11 -07:00
Andy McFadden
97a372a884 Add selectable auto-label styles
SourceGen creates "auto" labels when it finds a reference to an
address that doesn't have a label associated with it.  The label for
address $1234 would be "L1234".  This change allows the project to
specify alternative label naming conventions, annotating them with
information from the cross-reference data.  For example, a subroutine
entry point (i.e. the target of a JSR) would be "S_1234".  (The
underscore was added to avoid confusion when an annotation letter
is the same as a hex digit.)

Also, tweaked the way the preferred clipboard line format is stored
in the settings file (was an integer, now an enumeration string).
2019-04-15 15:14:04 -07:00