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

100 Commits

Author SHA1 Message Date
Andy McFadden
0860a00a54 SGEC update, part 2 (of 2)
Expand SGEC to include long comments and notes.  These are serialized
in JavaScript form.

SGEC now accepts addresses and relative position deltas.  Exported
content uses addresses, and can be configured for deltas.
2020-07-15 17:43:08 -07:00
Andy McFadden
c5d764d11f SGEC update, part 1
This is still an "experimental" feature, but it's getting expanded
a bit.  The implementation now lives in its own class.  An "export"
feature that generates SGEC data has been added.  The file extension
has been changed from ".sgec" to ".txt" to make it simpler to edit
under Windows.
2020-07-15 16:18:02 -07:00
Andy McFadden
ee58d9e803 Data Bank Register management, part 3
Added a "fake" assembler pseudo-op for DBR changes.  Display entries
in line list.

Added entry to double-click handler so that you can double-click on
a PLB instruction operand to open the data bank editor.
2020-07-09 16:52:23 -07:00
Andy McFadden
973d162edb Data Bank Register management, part 2
Changed basic data item from an "extended enum" to a class, so we can
keep track of where things come from (useful for the display list).

Finished edit dialog.  Added serialization to project file.
2020-07-09 11:14:55 -07:00
Andy McFadden
18e6951f17 Add Data Bank Register management, part 1
On the 65816, 16-bit data access instructions (e.g. LDA abs) are
expanded to 24 bits by merging in the Data Bank Register (B).  The
value of the register is difficult to determine via static analysis,
so we need a way to annotate the disassembly with the correct value.
Without this, the mapping of address to file offset will sometimes
be incorrect.

This change adds the basic data structures and "fixup" function, a
functional but incomplete editor, and source for a new test case.
2020-07-08 17:56:27 -07:00
Andy McFadden
d58b747571 Use relocation data to format instruction operands
This was a relatively lightweight change to confirm the usefulness
of relocation data.  The results were very positive.

The relatively superficial integration of the data into the data
analysis process causes some problems, e.g. the cross-reference table
entries show an offset because the code analyzer's computed operand
offset doesn't match the value of the label.  The feature should be
considered experimental

The feature can be enabled or disabled with a project property.  The
results were sufficiently useful and non-annoying to make the setting
enabled by default.
2020-07-03 17:58:41 -07:00
Andy McFadden
fdd2bcf847 Fix some 65816 code generation issues
Two basic problems:

(1) cc65, being a one-pass assembler, can't tell if a forward-referenced
label is 16-bit or 24-bit.  If the operand is potentially ambiguous,
such as "LDA label", we need to add an operand width disambiguator.
(The existing tests managed to only do backward references.)

(2) 64tass wants the labels on JMP/JSR absolute operands to have 24-bit
values that match the current program bank.  This is the opposite of
cc65, which requires 16-bit values.  We need to distinguish PBR vs.
DBR instructions (i.e. "LDA abs" vs. "JMP abs") and handle them
differently when formatting for "Common".

Merlin32 doesn't care, and ACME doesn't work at all, so neither of
those needed updating.

The 20052-branches-and-banks test was expanded to cover the problematic
cases.
2020-07-01 17:59:12 -07:00
Andy McFadden
d1526e5f25 Progress toward OMF file handling
Added generation of info/error messages to segment parser, which
are displayed in the main OMF viewer window.

Added segment viewer window, which opens when a segment entry in the
viewer list is double-clicked.  Currently shows the "raw" header
fields, with place-holder UI for additional stuff.
2020-06-26 17:04:35 -07:00
Andy McFadden
5026fd6569 First step toward Apple IIgs OMF file handling
This lays a bit of groundwork for an OMF file analyzer / viewer.
2020-06-23 17:21:18 -07:00
Andy McFadden
bb830a29db Add Navigate > Jump to Operand
If you double-click on the opcode of an instruction whose operand is
an address or equate, the selection jumps to that address.  This
feature is now available in the Navigate menu, with the keyboard
shortcut Ctrl+J.

While testing the feature I noticed that the keyboard focus wasn't
following the selection, so if you jumped to an address and then
used the up/down arrows, you jumped back to the previous location.
(This was true when double-clicking an opcode to jump; it was just
less noticeable since the next action was likely mouse-based.)  This
has been fixed by updating the ListView item focus when we jump to a
new location.

See also issue #63 and issue #72.
2020-06-07 16:37:41 -07:00
Andy McFadden
47c773dcdf Show "idx" for indexed accesses in References window
Sometimes it's useful to know whether an address referenced by a
function is a direct access, or is being used as a base address.
(I'm somewhat undecided on this one, since it clutters up the list
a bit.  Giving it a try.)
2020-05-02 14:09:53 -07:00
Andy McFadden
3820bfee8b Set initial focus to appropriate field for project properties
If you double-click a project symbol declaration, the symbol editor
opens.  I found that I was double-clicking on the comment field and
typing with the expectation that the comment would be updated, but
it was actually setting the initial focus to the label field.

With this change the symbol editor will focus the label, value, or
comment field based on which column was double-clicked.

The behavior for Actions > Edit Project Symbol and other paths to the
symbol editor are unchanged.

Also, disabled a wayward assert.
2020-04-23 11:01:07 -07:00
Andy McFadden
40b21e2ddb Fix range check in local variable table lookup
Double-clicking on the opcode of an instruction that referenced a
local variable would fail to jump if the LvTable was defined at
file offset 0.
2020-04-15 19:23:28 -07:00
Andy McFadden
6d582c80d3 Add simple SGEC reader
SourceGen Edit Commands is a feature that allows you to generate
commands into a file and have SourceGen apply them to the current
project.  I'm not expecting this to be used by anyone but me, so
for now I'm just adding an entry to the debug menu that can read
comments out of a file.

Also, fixed a bug in the re-centering min/max code that prevented
it from working on trivial shapes.

Also, renamed the atari-avg visualizer to atari-avg-bz, with the
expectation that one day somebody might want to create a variant
for newer games.
2020-04-13 17:33:34 -07:00
Andy McFadden
1da98d8628 Add a progress bar to HTML export
Generation of HTML is extremely fast, but compressing thousands
of frames for wireframe animated GIFs can take a little while.

Sharing bitmaps between threads required two changes: (1) bitmaps
need to be "frozen" after being drawn; (2) you can't use Path because
BackgroundWorker isn't a STAThread.  You can, however, use a
DrawingVisual / DrawingContext to do the rendering.  Which is really
what I should have been doing all along; I just didn't know the
approach existed until I was forced to go looking for it.

Also, we now do a "run finalizers" call before generating an animated
GIF.  Without it things explode after more than 10K GDI objects have
been allocated.
2020-03-15 14:07:05 -07:00
Andy McFadden
38ca9005c4 Progress on wireframe visualization
Added some more plumbing.  Updated visualization set edit dialog,
which now does word-wrapping correctly in the buttons.  Added Alt+V
as the hotkey for Create/Edit Visualization Set, which allows you
to double-tap it to leap into the visualization editor.

Experimented with Path drawing, which looks like it could do just
what we need.

Also, show the file size in KB in the code/data/junk breakdown at the
bottom of the window.  (Technically it's KiB, but that looked funny.)
2020-03-01 18:34:34 -08:00
Andy McFadden
0bbb307d4e Correct handling of no-op .ORG statements
These were being overlooked because they didn't actually cause
anything to happen (a no-op .ORG sets the address to what it would
already have been).  The assembly source generator works in a way
that causes them to be skipped, so everybody was happy.

This seemed like the sort of thing that was likely to cause problems
down the road, however, so we now split regions correctly when a
no-op .ORG is encountered.  This affects the uncategorized data
analyzer and selection grouping.

This changed the behavior of the 2004-numeric-types test, which was
visibly weird in the UI but generated correct output.

Added the 2024-ui-edge-cases test to provide a place to exercise
edge cases when testing the UI by hand.  It has some value for the
automated regression test, so it's included there.

Also, changed the AddressMapEntry objects to be immutable.  This
is handy when passing lists of them around.
2020-02-28 14:49:18 -08:00
Andy McFadden
d4b97007df Fix double-click jump to local var with annotation
Double-clicking the opcode of an instruction that references a
local variable (e.g. "LDA ]foo") moves the selection to the line
that declares the variable.  This wasn't working in the case where
the local var was annotated (e.g. "LDA ]foo?").
2020-01-23 11:15:14 -08:00
Andy McFadden
9c5ba9ca4b Work around the mysterious shrinking side-window problem
When a project is opened, the main window layout subtly changes.
Of particular note: the vertical splitters below the references and
symbols windows shift upward 1 pixel when a project is opened, and
back down a pixel when the project is closed.  So if you close the
app while a project is open, the settings file gets updated with the
new values for the sliders.  If you restart the app a lot the effect
becomes noticeably fairly quickly.

I'm not yet sure what's causing this.  I'm currently working around
the issue by not updating the window sizes in the settings file if
they're off by only one pixel.
2020-01-01 17:27:03 -08:00
Andy McFadden
160dfca42a Update project file formatting
No meaningful change to the format itself, just to the way it's
formatted.  Specifically, we now emit a line break after every
comma rather than only at curly braces.

The problem driving this change is that all end-of-line comments
are stored in a single dictionary, which becomes a single long line.
Most source control tools can't diff or merge that in a useful way.
Having every element on its own line makes some things harder to
read, but in the end I'm more interested in machine readability
than human readability.

(I tested this by saving all SGTestData projects and verifying that
they worked.  I didn't check the updated versions in because it's
kind of nice to have older project files around to confirm that I'm
not breaking backward compatibility.)
2019-12-31 13:59:08 -08:00
Andy McFadden
1373ffd8e3 Add file slicer tool
The tool allows you to cut a piece out of a file by specifying an
offset and a length.  A pair of hex dumps helps you verify that the
positions are correct.

Also, minor cleanups elsewhere.
2019-12-29 17:59:35 -08:00
Andy McFadden
89413d11e4 Add file concatenation tool
Select a list of files and save it.  File lengths and CRCs are
shown for reference.
2019-12-28 17:22:19 -08:00
Andy McFadden
1759317c8c Add visualization tutorial
Defined a simple monochrome bitmap format, and created some pieces
for a Tic-Tac-Toe game.  Wrote a tutorial that explains how to
visualize them.

Also, updated some comments.
2019-12-28 13:19:40 -08:00
Andy McFadden
091955b9c2 Allow setting the start/end address for a block
If you have a single line selected, Set Address adds a .ORG directive
that changes the addresses of all following data, until the next .ORG
directive is reached.  Sometimes code will relocate part of itself,
and it's useful to be able to set the address at the end of the block
to what it would have been before the .ORG change.

If you have multiple lines selected, we now add the second .ORG to
the offset that follows the last selected line.

Also, fixed a bug in the Symbol value updater that wasn't handling
non-unique labels correctly.
2019-12-25 18:17:50 -08:00
Andy McFadden
12293d3cf8 More progress on animated visualizations
Bitmap animations are composed of a sequence of other visualizations.
This is all well and good until a visualization is deleted, at which
point all animations in all sets in the entire project have to be
checked and potentially changed, and perhaps even removed (if all of
the animation's members have been removed).  This turns out to be
kind of annoying to deal with, but it's better to deal with it in
code than force the user to manually update broken animations.

This change adds thumbnails for the animations, currently generated
by offscreen composition.  This approach doesn't work quite right.
2019-12-21 18:13:36 -08:00
Andy McFadden
9f9e518afc Groundwork for animated Visualizations
This adds a new class and a rough GUI for the editor.  Animated
visualizations take a collection of bitmaps and display them in
sequence.  (This will eventually become an animated GIF.)

Fixed the issue where changes to tags in the set currently being
edited weren't visible to the tag uniqueness check when editing other
items in the same set.
2019-12-17 17:43:56 -08:00
Andy McFadden
5d9b9753e8 Add visualization sets to exported HTML
We now generate GIF images for visualizations and add inline
references to them in the HTML output.

Images are scaled using the HTML img properties.  This works well
on some browsers, but others insist on "smooth" scaling that blurs
out the pixels.  This may require a workaround.

An extra blank line is now added above visualizations.  This helps
keep the image and data visually grouped.

The Apple II bitmap test project was updated to have a visualization
set with multiple images at the top of the file.
2019-12-13 17:15:38 -08:00
Andy McFadden
0b0944e0fc Add F6 as a shortcut for the Project Symbols editor
Goes directly to the second tab of Edit Project Properties.  This is
not represented in the menu system.
2019-12-13 13:05:29 -08:00
Andy McFadden
071adb8e95 Two changes to "dense hex" bulk data formatting
(1) Added an option to limit the number of bytes per line.  This is
handy for things like bitmaps, where you might want to put (say) 3
or 8 bytes per line to reflect the structure.

(2) Added an application setting that determines whether the screen
listing shows Merlin/ACME dense hex (20edfd) or 64tass/cc65 hex bytes
($20,$ed,$fd).  Made the setting part of the assembler-driven display
definitions.  Updated 64tass+cc65 to use ".byte" as their dense hex
pseudo-op, and to use the updated formatter code.  No changes to
regression test output.

(Changes were requested in issue #42.)

Also, added a resize gripper to the bottom-right corner of the main
window.  (These seem to have generally fallen out of favor, but I
like having it there.)
2019-12-10 17:41:00 -08:00
Andy McFadden
13f7ae4b70 Minor UI tweaks
- Show the full path in the tooltip for the two "recent project"
  buttons shown on the launch panel.
- Reset the app title bar and status bar contents when the project
  is closed.
2019-12-07 13:55:11 -08:00
Andy McFadden
e82678126f Various minor tweaks
Added comments, renamed files, removed cruft.

Stop showing the visualization tag name in the code list.  It's
often redundant with the code label, and it's distracting.  (We may
want to make this an option so you can Ctrl+F to find a tag.)
2019-12-07 11:42:26 -08:00
Andy McFadden
1cdb31de32 Visualizer improvements
Various changes:
- Generally treat visualization sets like long comments and notes
  when it comes to defining data region boundaries.  (We were doing
  this for selections; now we're also doing it for format-as-word
  and in the data analyzer when scanning for strings/fill.)
- Clear the visualization cache when the address map is altered.
  This is necessary for visualizers that dereference addresses.
- Read the Apple II screen image from a series of addresses rather
  than a series of offsets.  This allows it to work when the image
  is contiguous in memory but split into chunks in the file.
- Put 1 pixel of padding around the images in the main code list,
  so they don't blend into the background.
- Remember the last visualizer used, so we can re-use it the next
  time the user selects "new".
- Move min-size hack from Loaded to ContentRendered, as it apparently
  spoils CenterOwner placement.
2019-12-06 15:05:49 -08:00
Andy McFadden
b56bdb7743 Split operand selection set at visualizations
Also, added a colStride/rowStride test to Apple II bitmap test.
Removed ClunkyColor.  Made color conversion mode selectable for
debugging.
2019-12-05 14:04:38 -08:00
Andy McFadden
2f56c56e5c Add visualization thumbnails
Thumbnails are now visible in the main list and in the visualization
set editor.  They're generated on first need, and regenerated when
the set of plugins changes.

Added a checkerboard background for the visualization editor bitmap
preview.  (It looks all official now.)
2019-12-03 16:11:21 -08:00
Andy McFadden
125080dbda Finish basic visualization editor implementation
The Visualization and Visualization Set editors are now fully
functional.  You can create, edit, and rearrange sets, and they're
now stored in the project file.
2019-12-02 16:38:32 -08:00
Andy McFadden
836626bdc3 Work in progress on visualization
Basic infrastructure for taking a list of parameters from a plugin
and turning it into a collection of UI controls, merging in values
from a Visualization object.  Doesn't yet do anything useful.

WPF makes the hard things easy and the easy things hard.  This was
a hard thing, so it was easy to do (with some helpful sample code).
Yay WPF?
2019-11-25 14:27:38 -08:00
Andy McFadden
ac30512ed3 Groundwork for visualization sets
Placeholder data structure plus menu command, undoable change, etc.
2019-11-22 20:45:57 -08:00
Andy McFadden
d8170c50d3 Show code/data/junk percentages in status bar
Not necessarily useful, but sort of interesting.
2019-11-19 18:18:41 -08:00
Andy McFadden
ff68409398 Add Apply Platform Symbols experimental feature
This turns platform symbols into address labels.  Useful for things
like system ROM images that have an established set of entry points.
2019-11-19 13:31:04 -08:00
Andy McFadden
d3670c48e8 Label rework, part 6
Correct handling of local variables.  We now correctly uniquify them
with regard to non-unique labels.  Because local vars can effectively
have global scope we mostly want to treat them as global, but they're
uniquified relative to other globals very late in the process, so we
can't just throw them in the symbol table and be done.  Fortunately
local variables exist in a separate namespace, so we just need to
uniquify the variables relative to the post-localization symbol table.
In other words, we take the symbol table, apply the label map, and
rename any variable that clashes.

This also fixes an older problem where we weren't masking the
leading '_' on variable labels when generating 64tass output.

The code list now makes non-unique labels obvious, but you can't tell
the difference between unique global and unique local.  What's more,
the default type value in Edit Label is now adjusted to Global for
unique locals that were auto-generated.  To make it a bit easier to
figure out what's what, the Info panel now has a "label type" line
that reports the type.

The 2023-non-unique-labels test had some additional tests added to
exercise conflicts with local variables.  The 2019-local-variables
test output changed slightly because the de-duplicated variable
naming convention was simplified.
2019-11-18 13:36:53 -08:00
Andy McFadden
68c324bbe8 Label rework, part 4
Update the symbol lookup in EditInstructionOperand, EditDataOperand,
and GotoBox to correctly deal with non-unique labels.

This is a little awkward because we're doing lookups by name on
a non-unique symbol, and must resolve the ambiguity.  In the case of
an instruction operand that refers to an address this is pretty
straightforward.  For partial bytes (LDA #>:foo) or data directives
(.DD1 :foo) we have to take a guess.  We can probably make a more
informed guess than we currently are, e.g. the LDA case could find
the label that minimizes the adjustment, but I don't want to sink a
lot of time into this until I'm sure it'll be useful.

Data operands with multiple regions are something of a challenge,
but I'm not sure specifying a single symbol for multiple locations
is important.

The "goto" box just finds the match that's closest to the selection.
Unlike "find", it always grabs the closest, not the next one forward.
(Not sure if this is useful or confusing.)
2019-11-16 16:44:08 -08:00
Andy McFadden
8273631917 Label rework, part 3
Added serialization of non-unique labels to project files.

The address labels are stored without the non-unique tag, because we
can get that from the file offset.  (If we stored it, we'd need to
extract the value and verify that it matches the offset.)  Operand
weak references are symbolic, and so do include the tag string.

We weren't validating symbol labels before.  Now we are.

This also adds a "NonU" filter to the Symbols window so the labels
can be shown or hidden as desired.

Also, added source for a first pass at a regression test.
2019-11-16 11:12:32 -08:00
Andy McFadden
5dd7576529 Label rework, part 2
Continue development of non-unique labels.  The actual labels are
still unique, because we append a uniquifier tag, which gets added
and removed behind the scenes.  We're currently using the six-digit
hex file offset because this is only used for internal address
symbols.

The label editor and most of the formatters have been updated.  We
can't yet assemble code that includes non-unique labels, but older
stuff hasn't been broken.

This removes the "disable label localization" property, since that's
fundamentally incompatible with what we're doing, and adds a non-
unique label prefix setting so you can put '@' or ':' in front of
your should-be-local labels.

Also, fixed a field name typo.
2019-11-12 17:44:51 -08:00
Andy McFadden
4d079c8d14 Label rework, part 1
This adds the concept of label annotations.  The primary driver of
the feature is the desire to note that sometimes you know what a
thing is, but sometimes you're just taking an educated guess.
Instead of writing "high_score_maybe", you can now write "high_score?",
which is more compact and consistent.  The annotations are stripped
off when generating source code, making them similar to Notes.

I also created a "Generated" annotation for the labels that are
synthesized by the address table formatter, but don't modify the
label for them, because there's not much need to remind the user
that "T1234" was generated by algorithm.

This also lays some of the groundwork for non-unique labels.
2019-11-08 21:02:15 -08:00
Andy McFadden
b4213de4c0 Add "Go to Last Change" feature
Jumps to the first offset associated with the change at the top of
the Undo stack.  We generally jump to the code/data offset, not the
specific line affected.  It's possible to do better (and we do, for
Notes), but probably not worthwhile.
2019-11-01 19:11:48 -07:00
Andy McFadden
14ecad0849 Improve handling of hidden LV tables
If a local variable table gets buried, it won't appear in the code
list, so most things ignore it.  Unfortunately, the code that adds
new entries and edits tables was finding them, which was causing
variable definitions to appear to fall into a black hole.

This is addressed in two ways.  First, we now add a message to the
log when a hidden table is noticed.  Second, the code that finds
the nearest prior table now keeps track of hidden vs. not hidden.
If a non-hidden table is available, that is returned.  If the only
option is a hidden table, we will return that, because the callers
have already assumed that a table exists by virtue of its presence
in the LvTable list.
2019-10-28 16:54:01 -07:00
Andy McFadden
73f04ef2d2 Update comments, remove unused var 2019-10-27 21:29:44 -07:00
Andy McFadden
c49888331a Minor tweaks
- Allow user to "unnecessarily" set an address override.  This is
  a handy thing to do when dealing with code that does a lot of
  relocations.

- Moved "save needed" text to the end of the title string.

- Updated F8-ROM syms.

- Added ProDOS 8 error code constants
2019-10-26 23:34:51 -07:00
Andy McFadden
d99eec0d4f Open damaged projects in read-only mode
If we detect a problem that requires intervention during loading,
e.g. we find unknown elements because we're loading a file created
by a newer version, default to read-only mode.

Read only mode (1) refuses to apply changes, (2) refuses to add
changes to the undo/redo list, and (3) disables Save/SaveAs.  The
mode is indicated in the title bar.

Also, flipped the order of items in the title bar so that "6502bench
SourceGen" comes last.  This allows you to read the project name in
short window title snippets.  (Visual Studio, Notepad, and others
do it this way as well.)
2019-10-26 13:20:54 -07:00
Andy McFadden
8505a5cdd4 Add an Applesoft to HTML converter
This is not an official thing, so I'm hiding it in the DEBUG menu
for now.
2019-10-23 17:49:59 -07:00