1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-04 01:29:34 +00:00
Commit Graph

117 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
716dce5f28 Pass operand to extension script JSR/JSL handlers
Sort of silly to have every handler immediately pull the operand out
of the file data.  (This is arguably less efficient, since we now
have to serialize the argument across the AppDomain boundary, but
we should be okay spending a few extra nanoseconds here.)
2019-10-17 13:15:25 -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
4d8ee3fd07 External symbol I/O direction and address mask, part 2
First cut at lookup-by-address implementation.  Seems to work, but
needs full tests.
2019-10-16 14:55:10 -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
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
547ecd2173 Update comments 2019-10-12 17:18:04 -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
98ebf449ef Tweak comments
Useful comments need to be on each line, so that they appear in the
disassembly listing.
2019-10-08 17:46:00 -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
57d8514faa Format ProDOS 8 parameter blocks
If it's a known function, apply basic numeric formatting to the
various fields.  Primarily of value for the pathname and buffer
parameters, which are formatted as addresses.

Also, enable horizontal scrolling in the generic show-text dialog.
2019-10-07 15:42:40 -07:00
Andy McFadden
245e0bd9f3 Make address translation available to extension scripts
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.
2019-10-06 18:13:39 -07:00
Andy McFadden
8c87ce3004 Check formatted string structure at load time
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.
2019-10-06 17:07: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
9a11ffea49 Missed a spot 2019-10-04 17:55:48 -07:00
Andy McFadden
3c3209b67f Expand set of symbols available to plugins
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).
2019-10-04 16:57:57 -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
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
2a41d70e04 Allow explicit widths in project/platform symbols, part 1
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.
2019-10-01 16:00:08 -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
7739f640f5 Minor tweaks
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.
2019-09-26 13:00:14 -07:00
Andy McFadden
0877857e7e Make links less distracting in HTML output
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.
2019-09-22 16:45:08 -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
c05c42bf21 Add a few things to Apple II platform symbol lists 2019-09-20 19:04:10 -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
ab755f1bc1 Tweak HTML output
Changed the HTML template to make the SourceGen version visible,
and added the expression style.
2019-09-17 22:14:10 -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
c1056839b1 Changed naming convention in Applesoft/F8-ROM symbol files
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.
2019-09-16 16:58:32 -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
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
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
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