1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-07 07:28:57 +00:00
Commit Graph

685 Commits

Author SHA1 Message Date
Andy McFadden
1e56490b6b Another update to project/platform cross-references
Don't show adjustments for operands that aren't full addresses.  For
example, "LDA BLAH" shows an adjustment, but "LDA #>BLAH" does not.
This matches the behavior for internal addresses.
2020-03-23 15:16:30 -07:00
Andy McFadden
76784848d0 Change Apple Disk ][ I/O defs to constants
The $C0En approach wasn't really working well.  This changes the
addresses to $C08x, and makes them constants so they don't clash
with the LC defs.
2020-03-22 13:18:01 -07:00
Andy McFadden
456f2c8afb Trim annotations off of labels in HTML names
When generating the HTML anchor name element we need to remove the
trailing '?' from the label.  It wasn't present in the hrefs, so all
links to annotated labels were broken.
2020-03-18 17:57:07 -07:00
Andy McFadden
547cbb7811 Work around Merlin assembler bug
The assembler can't handle "DFB '{'" or "DFB '}'", so just output
those as hex.

Tests added to 2006-operand-formats.
2020-03-18 17:45:06 -07:00
Andy McFadden
5d852e3ea6 Don't show adjustment in constant cross-references
The change to properly display adjustments to project/platform
symbol cross-references also added them to constants, but based on
the reference address rather than the operand value.  We could
generate an adjustment from the value, but I'm not sure if that's
actually useful.
2020-03-18 08:04:13 -07:00
Andy McFadden
63b84dcece Fix display of project/platform cross-ref adjustments
We were trying to use the in-file calculation for an external
address, so the adjustment was always zero.

Also, don't pass a fill brush for wireframe rendering.  (No change
in behavior.)
2020-03-17 13:49:14 -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
b3dacc2613 Switch to left-handed coordinate system
There's no "standard" coordinate system, so the choice is arbitrary.
However, an examination of the Transporter mesh in Elite revealed
that the mesh was designed for a left-handed coordinate system.  We
can compensate for that trivially in the Elite visualizer, but we
might as well match what they're doing.  (The only change required
in the code is a couple of sign changes on the Z coordinate, and an
update to the rotation matrix.)

This also downsizes Matrix44 to Matrix33, exposes the rotation mode
enum, and adds a left-handed ZYX rotation mode.

This does mean that meshes that put the front at +Z will show their
backsides initially, since we're now oriented as if we're flying
the ships rather than facing them.  I considered adding a 180-degree
Y rotation (with a tweak to the rotation matrix handedness to correct
the first rotation axis) to have them facing by default, but figured
that might be confusing since +Z is supposed to be away.

Anybody who really wants it to be the other way can trivially flip
the coordinates in their visualizer (negate xc/zc).

The Z coordinates in the visualization test project were flipped so
that the design is still facing the viewer at rotation (0,0,0).
2020-03-14 13:59:08 -07:00
Andy McFadden
c0de0a8844 Allow custom colors in Notes
The data structure and project file have always supported arbitrary
ARGB colors.  Now the editor does as well.
2020-03-13 13:58:52 -07:00
Andy McFadden
a0bf8b808c Add edge/vertex exclusion for LOD
Elite has a level-of-detail cutoff in the mesh data.  This change
provides a way for the visualization generator to exclude vertices
and edges that should not be rendered based on the desired LOD.
2020-03-13 10:53:53 -07:00
Andy McFadden
c9d519e7f8 Version 1.6.0-dev1 2020-03-12 10:08:26 -07:00
Andy McFadden
58ba6008a5 Bump a couple of copyright dates
Not really necessary, but they were on the same screen and didn't
agree with each other, which felt weird.
2020-03-11 17:02:37 -07:00
Andy McFadden
4221602e12 Minor tweaks to wireframe viewer
Experimented with different orders of rotation for wireframe viewer.
Made perspective projection the default behavior.  Removed animation
parameters from the stored Visualization when it's not animated.
2020-03-11 16:23:52 -07:00
Andy McFadden
ecb22ef9a4 Use previous edit values as default
The visualization editor uses the parameters from the most recent
edit as the defaults when creating a new visualization.  This change
extends the behavior to the view controls for wireframes.
2020-03-11 10:12:39 -07:00
Andy McFadden
31d2462628 Tweak Vector3 and VisWireframe
Made vectors immutable.  Added calls to support rewriting of surface
normals.
2020-03-10 20:59:45 -07:00
Andy McFadden
01d64f79b7 Relocate Matrix/Vector code to lib where plugins can use it
Also, tweak the perspective projection scaling to fill out the area
a bit more, and change the visualization editor to use the grid's
size when setting the path dimensions.

Also, note gimbal lock.
2020-03-10 17:20:54 -07:00
Andy McFadden
971301d5b8 Fix object timeout
Remember how object references from plugins are proxy objects that
time out if you don't access them for a while?  I didn't either.

This reshuffles the code to keep WireframeObject references rather
than IVisualizationWireframe.
2020-03-10 11:23:18 -07:00
Andy McFadden
6da3e73e63 Document wireframe visualizations 2020-03-09 14:12:54 -07:00
Andy McFadden
8c01f383e5 Implement wireframe animation
You can view the animated wireframe with the "test" button in the
visualization editor, and export it as an animated GIF.
2020-03-09 13:56:20 -07:00
Andy McFadden
b68e39ab6b Progress toward wireframe animations
Handle the remaining visualization editor UI controls, except for
the "test" button.  Save/restore wireframe animations in the
project file.  Changed the preview from a 1-pixel-wide line drawn
by a path half the window size to a 2-pixel-wide line drawn by a
path the exact window size.
2020-03-08 17:05:08 -07:00
Andy McFadden
7e92a86ffa Progress toward wireframe animations
Moved X/Y/Z rotation out of the plugin, since it has nothing to do
with the plugin at all.  (Backface removal and perspective projection
are somewhat based on the data contents, as is the choice for
whether or not they should be options.)

Added sliders for X/Y/Z rotation.  Much more fun that way.

Renamed VisualizationAnimation to VisBitmapAnimation, as we're not
going to use it for wireframe animation.  Created a new class to
hold wireframe animation data, which is really just a reference to
the IVisualizationWireframe so we can generate an animated GIF
without having to pry open the plugin again.

Renamed the "frame-delay-msec" parameter, which should start with
an underscore to ensure it doesn't clash with plugin parameters.
If we don't find it with an underscore we check again without for
backward compatibility.
2020-03-07 17:05:08 -08:00
Andy McFadden
b686d2d208 Add rotation and backface culling
Also, correctly update the thumbnail when leaving the visualization
editor.
2020-03-06 16:51:47 -08:00
Andy McFadden
eec847d5f1 Implement basic wireframe rendering
We extract the data from the wireframe visualization, perform a
trivial transform, and display it.  The perspective vs.
orthographic flag in the parameters is respected.  (No rotation or
backface removal yet.)

Also, increased the thumbnail sizes in the visualization set editor
list from 48x48 to 64x64, because the nearest-pixel-scaled 48x48
looks nasty when used for wireframes.
2020-03-03 19:37:51 -08:00
Andy McFadden
bd0b20dc2f Add wireframe thumbnail generation
I did a bunch of experiments to characterize line drawing.  Long
story short: end points are inclusive, and coordinates should be
offset by +0.5 to avoid anti-aliasing effects.
2020-03-03 16:20:55 -08: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
e8870c30e8 Checkpoint work on wireframe visualization
Defined interfaces and added a test case.
2020-02-29 18:30:19 -08:00
Andy McFadden
4155d254c2 Add note about label-edit weirdness 2020-02-28 16:11:35 -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
07d477fc70 Improve Apple II hi-res visualizer
Added a new category "sprite sheet", which is essentially a more
generalized version of the bitmap font renderer.  It has the full
set of options for col/row/cell stride and colors.  (Issue #74,
issue #75)

Added a flag that flips the high bits on bitmaps.  Sometimes data
is stored with the high bit clear, but the high bit is set as it's
rendered.  (Issue #76)

Also, fixed the keyboard shortcuts in the Edit Visualization Set
window, which were 'N' for both "New ___" items.  (Issue #57)
2020-02-18 16:42:46 -08:00
Andy McFadden
b0278c9c51 Improve data operand editor
Added accelerator keys to Mixed and Null strings.  (Issue #67)

Added units to string counts.  (Issue #68)  Added proper handling
for plural/singular for bytes and strings.  Changed N/A indicator
from "xx" to "--".
2020-02-18 13:57:35 -08:00
Andy McFadden
0ab76ea1f7 Improve CPU instruction chart
Added "show undocumented opcodes" checkbox, so you can choose
whether or not to see them at all.  (Issue #60)

Added formatter call for the instruction mnemonics so they get
capitalized when the app is configured for upper-case opcodes.
(Issue #59)

Fix a bug where the instruction chart and ASCII chart were writing
their modes to the same setting, stomping each other.

Also, pluralized a button in the file concatenator.
2020-02-18 13:25:20 -08:00
Andy McFadden
ecbb01db1f Add Disk ][ I/O locations
Not perfect, but I'm not sure how to do better.
2020-02-18 13:11:13 -08:00
Andy McFadden
d7593181f5 Allow multiple files to be added at once in file concatenator
Also, show the current number of elements.
2020-02-04 14:11:04 -08:00
Andy McFadden
5b75ae35fc Fix ANDImm flag updater
For nonzero values we were leaving Z=prev, which is wrong when Z=0
because the AND result might be zero.  Now if Z=1 we leave it alone,
but if Z=0 we now set it to Z=?.

Test 1003-flags-and-branches was testing for the (incorrect)
behavior, so we're now running into a BRK.  This is fine.
2020-02-01 16:41:44 -08:00
Andy McFadden
717e32d881 Version 1.5.0 2020-01-27 13:35:57 -08:00
Andy McFadden
f51b583d3b Fix tutorial
The scripts for tutorial #4 were suffering from bit rot.

Did some word-smithing on the tutorials.
2020-01-27 13:23:05 -08:00
Andy McFadden
589ff9bb36 Don't create bad DefSymbol
When editing an instruction operand, if you click "edit project
symbol", we need an initial value for the label.  If you started
typing something in the instruction operand symbol field, we use
that.  Unfortunately we were trying to use that even when it was
invalid, which caused an assertion to go off in the DefSymbol
constructor.
2020-01-25 18:23:27 -08:00
Andy McFadden
44568f71ef Add Apple II shape table visualizer 2020-01-24 15:46:45 -08:00
Andy McFadden
6ff349c2f6 Fix crashing bug in Goto
The application would crash if an invalid file offset was entered
(with "+xxxx").  This bug has been present since v1.0.
2020-01-24 15:25:01 -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
c535201884 Prefer narrower project/platform symbols
We want to be able to declare a symbol for a struct or buffer that
spans the entire width, and then declare more-specific items within
it that take precedence.  This worked for everything but the very
first byte, because on an exact match we were resolving the conflict
alphabetically.

Now, if one is wider than the other, we use the narrower definition.

Updated 2021-external-symbols with some additional test cases.
2020-01-23 10:49:22 -08:00
Andy McFadden
14ce56ec9a Add more symbols for Applesoft and DOS 3.3 2020-01-21 22:15:36 -08:00
Andy McFadden
a0735826fb Add VisParamDescr default value type check
The VisParamDescrs specify a type and a default value.  If the value
has the wrong type, things would blow up in the editor.  We now
check the type at plugin load time, and refuse to load the plugin at
all if an entry has a bad type.
2020-01-21 11:02:36 -08:00
Andy McFadden
b5deea713f Fix adding header comment to project without header lines
The DisplayList update function was mis-handling the case where
there were no previous lines.  This caused assertions to fire for
the case where you add a header comment to a project with no
existing header comment or EQUs.
2020-01-21 10:29:58 -08:00
Andy McFadden
5deba9a898 Add a few Apple II symbols
Added monitor BASL/BASH, and DOS $03ea (for which I can't find an
official name).  Fixed a typo.
2020-01-19 16:49:02 -08:00
Andy McFadden
da5833caef Rename project/platform symbols that clash with opcode mnemonics
We're doing this for user labels but not for project/platform
symbols.  So if you have a constant named "BCC" you can't assemble
your code with certain assemblers.  Now we rename it automatically.

Added a quick test to 2007-labels-and-symbols.  (No change to ACME,
which barfs on the test.)
2020-01-17 18:29:20 -08:00
Andy McFadden
ea94839bf6 Fix alignment check
The "is the .junk alignment directive correct" was returning true
for subtype=None (not aligned), which caused execution to go down
the wrong path and irritate an assert.
2020-01-17 17:26:31 -08:00
Andy McFadden
e2996d9b38 Don't output HTML anchors for non-unique labels
We're generating names that nothing links to.  The names aren't
guaranteed unique, so they're of dubious value anyway.

Also, fixed the Atari 2600 visualizer script filename in sys defs.
2020-01-16 21:37:49 -08:00
Andy McFadden
963e64e190 Version 1.5.0-alpha1 2020-01-14 20:36:03 -08:00
Andy McFadden
0013718d59 Clear Lv xrefs at start of xref gen
Local variable cross-references were accumulating without bound on
every refresh.
2020-01-14 17:56:55 -08:00
Andy McFadden
b387298685 Fix various local variable de-duplication bugs
In 1.5.0-dev1, as part of changes to the way label localization
works, the local variable de-duplicator started checking against a
filtered copy of the symbol table.  Unfortunately it never
re-generated the table, so a long-lived LocalVariableLookup (like
the one used by LineListGen) would set up the dup map wrong and
be inconsistent with other parts of the program.

We now regenerate the table on every Reset().

The de-duplication stuff also had problems when opcodes and
operands were double-clicked on.  When the opcode is clicked, the
selection should jump to the appropriate variable declaration, but
it wasn't being found because the label generated in the list was
in its original form.  Fixed.

When an instruction operand is double-clicked, the instruction operand
editor opens with an "edit variable" shortcut.  This was showing
the de-duplicated name, which isn't necessarily a bad thing, but it
was passing that value on to the DefSymbol editor, which thought it
was being asked to create a new entry.  Fixed.  (Entering the editor
through the LvTable editor works correctly, with nary a de-duplicated
name in sight.  You'll be forced to rename it because it'll fail the
uniqueness test.)

References to de-duplicated local variables were getting lost when
the symbol's label was replaced (due largely to a convenient but
flawed shortcut: xrefs are attached to DefSymbol objects).  Fixed by
linking the XrefSets.

Given the many issues and their relative subtlety, I decided to make
the modified names more obvious, and went back to the "_DUPn" naming
strategy.  (I'm also considering just making it an error and
discarding conflicting entries during analysis... this is much more
complicated than I expected it to be.)

Quick tests can be performed in 2019-local-variables:
 - go to +000026, double-click on the opcode, confirm sel change
 - go to +000026, double-click on the operand, confirm orig name
   shown in shortcut and that shortcut opens editor with orig name
 - go to +00001a, down a line, click on PROJ_ZERO_DUP1 and confirm
   that it has a single reference (from +000026)
 - double-click on var table and confirm editing entry
2020-01-13 18:32:56 -08:00
Andy McFadden
422af1193c Tweak def symbol sort order
The list of EQUs at the top of the file is sorted, by type, then
value, then name.  This adds width as an additional check, so that
if you have overlapping items the widest comes first.

This is nice when you have a general entry for a block of data, and
then specific entries for some locations within the block.
2020-01-04 16:56:31 -08:00
Andy McFadden
5548469ba1 Show large adjustments in hex
We emit address adjustments like "LDA thing+1", which are usually
small values.  Sometimes they're large, e.g. "LDA thing-61440",
which is harder to understand than "LDA thing-$F000".  So now we
show small adjustments in decimal, and large adjustments in hex.

The current definition of "small" is abs(adjust) < 256.
2020-01-02 13:09:18 -08:00
Andy McFadden
6c27b032bc
Updated the RuntimeData README 2020-01-01 18:06:59 -08:00
Andy McFadden
32d6d849ea Tweak Merlin DS output
The default fill value is $00.  Don't specify it explicitly when we
don't have to.
2020-01-01 17:45:32 -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
02fb5c50ea Minor tweaks
- Break up long sequences of visualization images in exported HTML
  to avoid horizontal scrolling.  Lines don't fold in "pre" mode,
  and switching out of "pre" is ugly, so we just break at an
  arbitrary point.
- Use a slightly different filename for animated GIFs.
- When moving items up/down in the visualization set editor or
  bitmap animation editor, scroll the datagrid to keep the selected
  item in view.
- Fix a wayward assert.
2020-01-01 17:26:53 -08:00
Andy McFadden
8aa4b7736e Visualization editor UX enhancements
Remember the most recent set of parameters, and use them as defaults
when creating a new visualization.  This is very helpful when
creating visualizations for multiple frames of an animation.

After exiting an editor, focus on the "OK" button in the visualization
set editor.  This allows a quick double-Enter after an edit.
2019-12-31 20:39:51 -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
f157fbbfd3 Add regression test for data analysis bug
The uncategorized data scanner isn't supposed to create strings or
".fill" directives that straddle labels, long comments, notes,
visualizations, or ORG directives.  The test for crossing an ORG
directive is incomplete, and doesn't correctly handle no-op ORGs
(where the new address is the same as the old address).

The code generator doesn't output ORGs that are hidden inside other
things, so we're not generating bad code, but it looks funny on
screen and may cause problems later on.  The 2004-numeric-types test
has the basic .align/.fill/.bulk directive tests, and now has an
extended set of tests for uncategorized data region splitting.
2019-12-30 14:09:18 -08:00
Andy McFadden
676ab2554d Fix Atari 2600 sprite visualizer
Should be solid/transparent not white/black.  Added a blue color
to the palette to use for sprites, as white + transparent disappears
completely on web pages with a white background.

Black + white + grey seems fine for playfields.
2019-12-29 18:15:40 -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
7c2fbec773 Fix proxy object timeout in visualization editor
The visualization editor was retaining an IPlugin reference for the
visualization generator selection combo box.  After 5 minutes the
proxy object timed out, so if you left the editor open and inactive
for that long you'd start getting weird errors.

We now keep the script identifier string and use that to get a
fresh IPlugin proxy object.
2019-12-28 14:00:48 -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
e00c07901a Version 1.5.0-dev3 2019-12-26 11:09:28 -08:00
Andy McFadden
a9913b8b69 Fix symbol entry bug in operand editors
The un-trimmed symbol was being used, so labels entered with
annotation characters (e.g. "FOO?") were failing to be found.
2019-12-26 11:04:37 -08:00
Andy McFadden
9a6e87f496 Minor wordsmithing 2019-12-25 19:00:57 -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
3acf83ead3 Check for hidden visualizations
As always, we try to prevent this from happening, but a determined
user can accomplish anything.
2019-12-25 11:15:22 -08:00
Andy McFadden
f11ef0dce4 Output human-readable generation parameters to HTML
Makes it easier to regenerate a file when you can see what the
column widths are supposed to be.
2019-12-25 10:59:40 -08:00
Andy McFadden
5a88a805d0 Fix proportions for animated GIFs
As with still images, animations are rendered at original size and
then scaled with HTML properties.

Also, fixed the blurry scaling on animation thumbnails.  I couldn't
find a way to do nearest-neighbor scaling in the code-behind without
resorting to System.Drawing (WinForms), so I added an overlay image
to the various grids.
2019-12-25 10:28:40 -08:00
Andy McFadden
6913558f4a Add animated GIF generation to HTML export
Visualization animations are now exported as animated GIFs.  The
Windows stuff is a bit lame so I threw together some code that
stitches a bunch of GIFs together.

The GIF doesn't quite match the preview, because the preview scales
the individual frames, while the animated GIF uses the largest frame
as the size and is then scaled based on that.  Animating frames of
differing sizes together is bound to be trouble anyway, so I'm not
sure how much to fret over this.
2019-12-24 18:15:03 -08:00
Andy McFadden
226ba7c9a3 Serialize animations to project file
We now store Visualizations, VisualizationAnimations, and
VisualizationSets as three separate lists linked by tag strings.

WARNING: this breaks existing projects with visualizations.  The
test projects have been updated.
2019-12-22 16:56:57 -08:00
Andy McFadden
4b19a029a9 Allow visualizations to be repeated in an animation
The UI was moving items from the source list to the animation list,
but there's no reason why the same thing can't appear more than once.

You can no longer hit "Add" repeatedly to add multiple consecutive
items, but you can now multi-select in the source list to add several
things at once.
2019-12-22 14:43:07 -08:00
Andy McFadden
4e645d911c Render the animation overlay image instead of loading from a file
Mostly because I'm a lousy artist, and if I do it in code it's easy
to make it symmetric and tweak the colors.
2019-12-22 14:02:39 -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
fef7668b63 Progress on animated visualizations
Visualization editor dialog is fully functional.  Add/remove,
up/down, tag/interval timer editing, and animated preview are now
working.
2019-12-20 15:09:57 -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
8b20021c4d Show visualization bitmap dimensions
The preview window scales freely, so it's hard to know how big the
actual pixels are.
2019-12-11 22:12:20 -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
b8e092cede Version 1.5.0-dev2 2019-12-07 13:08:00 -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
ed66e129cd Add C64 sprite visualization generator
Handles high-resolution and multi-color sprites.  The visualization
can be doubled in height and/or width.

I created some test sprites with SpritePad.
2019-12-06 21:25:31 -08:00
Andy McFadden
3c541089a7 Tweak Atari 2600 visualizer
Changed "row duplication" to a straight "row thickness".  Feels more
intuitive.
2019-12-06 17:54:18 -08:00
Andy McFadden
5635a1e33a Add Atari 2600 sprite/playfield visualizer
First swing at a visualizer for Atari 2600 sprites and playfields.
Won't necessarily present an accurate view of what is displayed on
screen, but should provide a reasonable shape for data stored in
the obvious way.

The Adventure playfields looked squashed, so I added a simple row
duplication value.

Also, minor improvements to visualizers generally:
- Throw an exception, rather than an Assert, in VisBitmap8 when the
  arguments are bad.
- Show the exception in the Visualization Edit dialog.
- If generation fails and we don't have an error message, show a
  generic "stuff be broke" string.
- Set focus on OK button in Visualization Set Edit after editing,
  so you can hit Enter twice after renaming a tag.
2019-12-06 17:33:29 -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
af4ec49c9b Document visualizations 2019-12-06 13:41:17 -08:00
Andy McFadden
4696132dfa Make visualization edit window resizable
The preview window changes size to match, providing an easy way to
get a "zoomed in" view of the image.
2019-12-05 21:52:50 -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
4bf1ab2799 Tweak visualizer interface
Report visualization generation errors through an explicit
IApplication interface, instead of pulling messages out of the
DebugLog stream.

Declare that GetVisGenDescrs() is only called when the plugin is in
the "prepared" state, so that plugins can taylor the set based on
the contents of the file.  (This could be used to set min/max on
the "offset" entries, but I want special handling for offsets, so
we might as well set it later.)
2019-12-05 10:29:00 -08:00
Andy McFadden
4ef1d7e7c7 Implement Apple II hi-res bitmap font and screen image visualizers
Bitmap fonts are a series of (usually) 1x8 bitmaps, which we arrange
into a grid of cells.

Screen images are useful for embedded screens, or for people who want
to display stand-alone image files as disassembly projects.
2019-12-04 18:05:17 -08:00
Andy McFadden
df04de61e6 Improve visualization
Various improvements:
- Switched to ReadOnlyDictionary in Visualization to make it clear
  that the parameter dictionary should not be modified.
- Added a warning to the Visualization Set editor that appears when
  there are no plugins that implement a visualizer.
- Make sure an item is selected in the set editor after edit/remove.
- Replaced the checkerboard background with one that's a little bit
  more grey, so it's more distinct from white pixel data.
- Added a new Apple II hi-res color converter whose output more
  closely matches KEGS and AppleWin RGB.
- Added VisHiRes.cs to some Apple II system definitions.
- Added some test bitmaps for Apple II hi-res to the test directory.
  (These are not part of an automated test.)
2019-12-04 15:59:37 -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
365864ccdf More progress on visualization
Implemented Apple II hi-res bitmap conversion.  Supports B&W and
color.  Uses essentially the same algorithm as CiderPress.

Experimented with displaying non-text items in ListView.  I assumed
it would work, since it's the sort of thing WPF is designed to do,
but it's always wise to approach with caution.  Visualization Sets
now show a 64x64 button as a placeholder for the eventual thumbnail.

Some things were being flaky, which turned out to be because I
wasn't Prepare()ing the plugins before using them from Edit
Visualization.  To make this a deterministic failure I added an
Unprepare() call that tells the plugin that we're all done.

NOTE: this breaks all existing plugins.
2019-11-30 18:02:03 -08:00
Andy McFadden
9244ceda7c More progress on visualization
Added some rudimentary bitmap creation code.  Got a test pattern
generated by the plugin to display in the app.  (Most of the time
required for this was spent figuring out how bitmaps are handled
in WPF.)
2019-11-27 17:17:30 -08:00
Andy McFadden
e7fccfda03 More progress on visualization
Got parameter in/out working in EditVisualization dialog.  Did some
rearranging in PluginCommon interfaces and data structures.  Still
doesn't do anything useful.
2019-11-26 18:54:42 -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
bef664ae7e Don't do nearby SYM-1 for zero-page values
It's pretty common for code to access BUFFER-1,X, but it's rare for
the buffer to live on zero page memory.  More often than not we're
auto-formatting zero-page operands with a nearby symbol when they're
just simple variables.  It's more confusing than useful, so we don't
do that anymore.
2019-11-23 16:27:06 -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
e43b7233d9 Version 1.5.0-dev1 2019-11-19 14:03:16 -08:00
Andy McFadden
ade3403b9f Tweak documentation 2019-11-19 13:43:42 -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
97a5623599 Label rework, part 7 (of 7)
Updated documentation for non-unique label changes.  Added a new
section to tutorial #1.

Updated examples to use non-unique labels and variable tables.

Tweaked the EditLabel radio button names.
2019-11-18 17:45:41 -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
88c56616f7 Label rework, part 5
Implemented assembly source generation of non-unique local labels.
The new 2023-non-unique-labels test exercises various edge cases
(though we're still missing local variable interaction).

The format of uniquified labels changed slightly, so the expected
output of 2012-label-localizer needed to be updated.

This changes the "no opcode mnemonics" and "mask leading underscores"
functions into integrated parts of the label localization process.
2019-11-17 16:05:51 -08:00
Andy McFadden
4e08810278 Finish removal of "disable label localizer" feature
The label localizer is now always on.  The regression tests turned
it off by default, but that's no longer allowed, so the generated
output has changed for many of them.  The tests themselves were not
altered.
2019-11-16 17:15:03 -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
be65f280a3 Minor tweaks
- Renamed "strip label prefix/suffix" to "omit label prefix/suffix".

- Changed a Merlin operand workaround so it doesn't apply to code
  that is explicitly not in bank zero.

- Changed {addr}/{const} annotations on project/platform symbol
  equates so they line up a little better on screen and in exported
  sources.
2019-11-15 16:24:07 -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
b4519b2aa2 Update NES symbols
The PPU registers are mirrored from $2000-3FFF.
2019-11-08 07:53:28 -08:00
Andy McFadden
ceb07c809e Check for bank overrun
If an address map entry wraps around the end of a bank, add a note
to the message log.  This is Error level, since some assemblers
will refuse to handle it.
2019-11-05 13:29:51 -08:00
Andy McFadden
6a8d6950e5 Add change discard confirmation to project properties editor
It's too easy to hit Escape after making a bunch of changes, so
now we ask for confirmation.

(Might make sense to make this strictly an Esc guard, and not
pester the user if they actually hit the Cancel button or close
box.  I'm not convinced though; Esc+Enter isn't terrible.)
2019-11-04 17:41:33 -08:00
Andy McFadden
6411df7ff9 Add toolbar button for "Go to Last Change"
Also, updated a couple of comments.
2019-11-04 15:22:56 -08:00
Andy McFadden
0a0208409a Tweak line folding code
Some style guides say you should only put one space between
sentences, but I and many others still put two.  The line-folding
code was only eating one of them when they straddled the end of the
line, which looked a little funny because the following line was
indented by one space.

This tweaks the code to eat both spaces.  Regression test updated.

Also, nudge some UI elements so they line up.
2019-11-01 19:47:56 -07: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
2ddd3b400d Workaround for GridSplitter lockup
As noted in issue #52, the side panels can't be resized once the
ListView gets focus.  The root of the problem is a workaround for a
selection problem that involves catching the Item Container
Generator's Status Changed event, and setting an item's focus.  It
appears that changing the size of the ListView causes the
StatusChanged event to fire, which cause the handler to grab the
focus, which causes the splitters to stop moving after one step.

This change adds a workaround that prevents the original workaround
from doing anything while a splitter is in the process of being
dragged.  It doesn't solve all problems -- you can't move the
splitters more than one step with the keyboard -- but it allows them
to be dragged around with the mouse.

There's got to be a better way to deal with this.
2019-11-01 11:14:49 -07:00
Andy McFadden
0c02b3ebe3 Version 1.4.0 2019-10-30 15:50:09 -07:00
Andy McFadden
1136759c98 Tweak the tutorial 2019-10-30 15:40:03 -07:00
Andy McFadden
f61f1022e1 Collapse the "offset" line in the info window for non-DEBUG 2019-10-30 14:30:03 -07:00
Andy McFadden
4b46b78e34 Rearrange the tutorial files
Copied the extension script tutorial files out of the Scripts
directory and into the Tutorial directory.  This makes more sense,
and makes it possible to expand the script sample without altering
the tutorial.

Reverted the Scripts sample to be an actual sample, rather than a
tutorial.

Renumbered the last two tutorials and added them to the ToC.  This
gives them actual numbers rather than treating them as add-ons to
the advanced tutorial.

Moved the source files for the tutorial binaries into a subdirectory
to reduce clutter.

This does mean we have two separate copies of the inline string
sample plugins, but that's an artifact of our attempts at security.
2019-10-30 09:49:11 -07:00
Andy McFadden
51081c5db0 Tweak "nearby" label finder
The code that found a nearby data target for an instruction operand
was searching backward but not forward.  We now take one step
forward, so that "LDA TABLE-1,Y" fills in automatically.

This altered 2008-address-changes, which had just this situation.
It didn't alter 2010-target-adjustment, but the existing tests were
insufficient and have been improved.
2019-10-29 18:12:22 -07:00
Andy McFadden
7000a5094e Fix crashing bug in selection management
The fix for Shift+F3 required briefly switching the code list view
to single-select mode.  Unfortunately, while in that mode the
control throws an exception if you touch SelectedItems (plural)
rather than SelectedItem (singular), and in an unusual case the
selection-changed event handler was doing just that.
2019-10-29 18:09:01 -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
b508fa6b4a Version 1.4.0-beta1 2019-10-27 21:17:54 -07:00
Andy McFadden
99d088e800 Mention the message log in the tutorial 2019-10-27 21:17:28 -07:00
Andy McFadden
70353c82e1 Limit value range of project address symbols
Project symbol address values are now limited to positive 24-bit
integers, just as they are for platform symbols.  Constants may
still be 32-bit values.
2019-10-27 15:36:47 -07:00
Andy McFadden
819a363178 Move SPEEDZ from F8-ROM to Applesoft
It's an Applesoft thing.
2019-10-27 11:12:22 -07:00
Andy McFadden
0fc121c9cb Add ability to "erase" previously-defined platform symbols
While disassembling some code I found that I wanted the ROM entry
points, but the zero page usage was significantly different and the
ROM labels were distracting.  Splitting the symbol file in two was
a possibility, but I'm afraid this will lead to a very large
collection of very small files, and we'll lose any sense of relation
between the ROM entry points and the ZP addresses used to pass
arguments.

Platform symbols have the lowest priority when resolving by address,
but using that to hide the unwanted labels requires creating project
symbols or local variables for things that you might not know what
they do yet.  It's possible to hide a platform symbol by adding
another symbol with the same label and an invalid value.

This change formalizes and extends the "hiding" of platform symbols
to full erasure, so that they don't clutter up the symbol table.
This also tightens up the platform symbol parser to only accept
values in the range 0 <= value <= 0x00ffffff (24-bit positive
integers).

An "F8-ROM-nozp" symbol file is now part of the standard set.  A
project can include that to erase the zero-page definitions.

(I'm not entirely convinced this is the right approach, so I'm not
doing this treatment on other symbol files... consider this an
experiment.  Another approach would be some sort of conditional
inclusion, or perhaps erase-by-tag, but that requires some UI work
in the app to define what you want included or excluded.)
2019-10-27 11:09:16 -07:00
Andy McFadden
0709ff94de Fix visibility binding 2019-10-27 10:38:29 -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
6344ea59bb Add Apple-1 symbols
From a post on comp.sys.apple2:
https://groups.google.com/d/msg/comp.sys.apple2/SBBdH1ChMwQ/mnygA3WVEAAJ
2019-10-26 08:28:49 -07:00
Andy McFadden
2466090efe Version 1.4.0-alpha1 2019-10-25 18:17:25 -07:00
Andy McFadden
00612097f6 Minor updates
Add a link to the web site in the About box.

Add an up-link to the HTML export template.

Escape '<', '>', and '&' in the Applesoft to HTML converter.
2019-10-25 18:16:09 -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
Andy McFadden
eb99a716f1 Add scripts and inline data to tutorials
Added an inline data formatting section to Tutorial2.

Added a new section on extension scripts, using Scripts/Sample as
the code.
2019-10-23 14:52:52 -07:00
Andy McFadden
1844fcb8b7 Fix junk alignment check
While adding a message log entry for failing alignment directives,
I noticed that the assembler source generator's test for valid
alignment was allowing some bad alignment values through.

I'm holding off on reporting the message to the log because not all
format changes cause a data-reanalysis, which means the log entry
doesn't always appear and disappear when it should.  If we decide
this is an important message we can add a scan for "softer" errors.
2019-10-23 13:25:50 -07:00
Andy McFadden
4ed2558f9f Experiment with showing character value next to default data
Doesn't seem useful in practice.  If I find a good use case it might
be worth making it an option.
2019-10-23 13:02:31 -07:00
Andy McFadden
9d5f8f8049 Add a blank line between constants and addresses
In the assembler output, add a blank line between the constants
and addresses in the long list of equates.

The earlier change that corrected the BIT instruction caused test
2009-branches-and-banks to fail, because it was relying on the idea
that BIT made the carry flag indeterminate.  Changing a BCC to a
BVS restored the desired behavior.
2019-10-22 22:45:13 -07:00
Andy McFadden
4c43b4063a Tweaks 2019-10-22 22:23:22 -07:00
Andy McFadden
630f7f0f87 Improve the "info" panel
Not a huge improvement, but things are slightly more organized, and
there's a splash of color in the form of a border around the text
describing the format of code and data lines.

Added an "IsConstant" property to Symbol.
2019-10-22 21:27:49 -07:00
Andy McFadden
463fbff368 Show load address in Edit Address dialog
Sometimes code relocates a few bits of itself but not others.  We
don't currently have a way to say, "go back to where we would have
been".  As a cheap alternative, we now show the "load address", i.e.
where we'd be if there were no address map entries after the first.
2019-10-22 13:58:32 -07:00
Andy McFadden
1b0ee7de21 Fix display of instruction attributes
The "affected flags" constants were incorrect for BIT, BRK, COP,
RTI, XCE, and the undocmented instructions ANE, DCP, and SAX.  The
constants are used for the changed-flag summary shown in the info
window and the instruction chart.

Of greater import: the status flag updater for BIT was incorrectly
marking N/V/C as indeterminate instead of N/V/Z.  The undocmented
instructions ANE, DCP, and SAX were also incorrect.

The cycle counts shown in line comments are computed correctly, but
the counts shown in the info window and instruction chart were
displaying the full set of modifiers, ignoring the CPU type.  That's
okay for the info window, which spells the modifiers out, though
it'd be better if the bits were explicitly marked as being applicable
to the current CPU or a different one.
2019-10-22 10:48:02 -07:00
Andy McFadden
7bbccaf71f Minor tweaks
Mark the "info" window as read-only.

When the project closes, clear the contents of the Symbols and
Notes windows.

Clarify some Apple II I/O definitions.
2019-10-21 17:43:40 -07:00
Andy McFadden
bcac8bc6a0 Add instruction chart
This adds a window that displays all of the instructions for a
given CPU in a summary grid.  Undocumented instructions are
included, but shown in grey italics.

Also, tweaked AppSettings to not mark itself as dirty if a "set"
operation doesn't actually change anything.
2019-10-21 15:15:09 -07:00
Andy McFadden
a4f1de1238 Add message list, part 2 (of 2)
Implemented show/hide mechanic, using a button on the right side of
the status bar to show status and to trigger un-hide.

Also, show I/O direction in project symbols editor list.
2019-10-20 18:02:23 -07:00
Andy McFadden
81dbab04ba Add message list, part 1
This converts the "problem list viewer" tool to a grid that appears
below the code list view when non-empty.  Not all messages are
problems, so it's being renamed to "message list".
2019-10-20 14:40:32 -07:00
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
b6e571afc2 Correctly handle embedded instruction edge case
This began with a change to support "BRK <operand>" in cc65.  The
assembler only supports this for 65816 projects, so we detect that
and enable it when available.

While fiddling with some test code an assertion fired.  This
revealed a minor issue in the code analyzer: when overwriting inline
data with instructions, we weren't resetting the format descriptor.

The code that exercises it, which requires two-byte BRKs and an
inline BRK handler in an extension script, has been added to test
2022-extension-scripts.

The new regression test revealed a flaw in the 64tass code
generator's character encoding scanner that caused it to hang.
Fixed.
2019-10-19 17:28:45 -07:00
Andy McFadden
e5da5ced95 Version 1.4.0-dev2 2019-10-19 11:17:09 -07:00
Andy McFadden
a902f69aea Update A2-Zippy example
The ZipChip GS register definitions can take advantage of the new
I/O direction feature.  Pulling them out into a .sym65 makes sense.
2019-10-19 10:16:02 -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
c8dfa94ce2 Change find-previous hotkey to Shift+F3
The range-select behavior that was giving us problems can be worked
around by switching the control to single-select mode when changing
the selection.
2019-10-17 12:51:45 -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
3702448780 Correctly handle a label update edge case
Test case:
 1. create a label FOO
   (can be referenced or unreferenced)
 2. add a platform symbol file that also defines FOO
   (the platform symbol will be masked by the user label)
 3. rename FOO to BAR
   (platform symbol should appear)
 4. hit "undo"
   (platform symbol should disappear)
 5. delete label FOO
   (platform symbol should appear)
 6. hit "undo"
   (platform symbol should disappear)

This will fail to update the display list properly, and/or crash
when we try to add FOO to a symbol table that already has a
symbol with that label.

The problem is the optimization that tries to avoid running the
data analysis pass if we're just renaming a user label.  We need to
check to see if the rename overlaps with project/platform symbols,
because we need to update the active def symbol set in that case.

To avoid the crash, we just need to use table[key]=value syntax
instead of table.Add(key,value).
2019-10-13 15:53:46 -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
94a7f2e8fb Replace '#' with '_' in .html filename
If you link to the file without escaping the '#', the browser will
think it's an anchor inside the page.  Easier on everyone to just
alter the filename.
2019-10-10 14:00:52 -07:00
Andy McFadden
6d886ecc3a Change some EQU handling
Changed the sort order on EQU lines so that constants come before
address definitions.  This caused trivial changes to three of the
regression tests.

Added the ability to jump directly to an EQU line when an opcode
is double-clicked on.
2019-10-10 13:49:21 -07:00
Andy McFadden
475c31b886 Tweak navigation
If you select a local variable, double-click on a reference entry,
and then hit "back", you aren't taken back to the correct place in
the local variable table.  This is annoying if you're trying to
explore how a local variable is used.

The NavStack Location object now has a "line delta" that can be
applied to position the selection correctly.  This isn't stable
across undo/redo, but it solves the common cases.

This makes LineListGen's "Top" class redundant, so uses of that have
been replaced with Location.
2019-10-10 11:57:36 -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
e1a9100a8f Fully style the code list view
We were changing the control template for lines with long comments
and notes, matching the default Win10 style.  This got ugly when a
non-default theme was being used, particularly "dark" themes,
because the long-comment lines looked significantly different from
everything else.

We now fully specify the style for the ListView and ListViewItems,
which means everybody's main window now looks like the default Win10
style.  Which is unfortunate, but significantly easier than creating
a full set of theme-specific styles.

We now specify black text for highlighted address/label fields,
because they otherwise become illegible when we apply our background
highlight color.  In the Notes window, we set the background of
un-highlighted entries to white, so that we can always read it with
black text.

Addresses issue #50.
2019-10-09 11:50:33 -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
c519a58962 Version 1.4.0-dev1 2019-10-08 13:32:14 -07:00
Andy McFadden
b5d1881cf0 Add inline string script sample
Also, updated LZ4FH sample, which needed to have explicit widths on
a couple of zero-page pointers.

Also, updated Zippy sample, which had a ton of unnecessary format
entries for a couple of pointers.
2019-10-08 10:44:49 -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
dc8e49e4d8 Exercise address-to-offset function in plugin
Also exercise various formatting options.

Also, fix a bug where the code that applies project/platform symbols
to numeric references was ignoring inline data items.
2019-10-07 14:21:26 -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
997242361a Relocate AddressMap to CommonUtil
This allows us to use it in plugins.
2019-10-06 17:32:20 -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
c4fe759efc Merge branch 'hotfix/1.3.2' 2019-10-06 15:31:37 -07:00
Andy McFadden
bfe2abd173 Version 1.3.2 2019-10-06 15:30:33 -07:00
Andy McFadden
710a8dc679 Init all FormattedParts strings fields to an empty string
Fixes issue #51.
2019-10-06 15:24:22 -07:00
Andy McFadden
1980a475ca Init all FormattedParts strings fields to an empty string
Fixes issue #51.
2019-10-06 14:38:49 -07:00
Andy McFadden
1908dab360 Recompile extension scripts when dependencies are updated
All plugins depend on PluginCommon.dll and CommonUtil.dll.  If
either of those is newer than the plugin DLL, we need to recompile.
2019-10-05 21:27:34 -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
0d9814d993 Allow explicit widths in project/platform symbols, part 3
Implement multi-byte project/platform symbols by filling out a table
of addresses.  Each symbol is "painted" into the table, replacing
an existing entry if the new entry has higher priority.  This allows
us to handle overlapping entries, giving boosted priority to platform
symbols that are defined in .sym65 files loaded later.

The bounds on project/platform symbols are now rigidly defined.  If
the "nearby" feature is enabled, references to SYM-1 will be picked
up, but we won't go hunting for SYM+1 unless the symbol is at least
two bytes wide.

The cost of adding a symbol to the symbol table is about the same,
but we don't have a quick way to remove a symbol.

Previously, if two platform symbols had the same value, the symbol
with the alphabetically lowest label would win.  Now, the symbol
defined in the most-recently-loaded file wins.  (If you define two
symbols with the same value in the same file, it's still resolved
alphabetically.)  This allows the user to pick the winner by
arranging the load order of the platform symbol files.

Platform symbols now keep a reference to the file ident of the
symbol file that defined them, so we can show the symbols's source
in the Info panel.

These changes altered the behavior of test 2008-address-changes,
which includes some tests on external addresses that are close to
labeled internal addresses.  The previous behavior essentially
treated user labels as being 3 bytes wide and extending outside the
file bounds, which was mildly convenient on occasion but felt a
little skanky.  (We could do with a way to define external symbols
relative to internal symbols, for things like the source address of
code that gets relocated.)

Also, re-enabled some unit tests.

Also, added a bit of identifying stuff to CrashLog.txt.
2019-10-02 16:50:15 -07:00
Andy McFadden
6c9b8fd0e6 Merge branch 'hotfix/1.3.1' 2019-10-01 21:00:38 -07:00
Andy McFadden
abc2df5c04 Version 1.3.1 2019-10-01 21:00:08 -07:00
Andy McFadden
6c102919f5 Fix Actions menu crash
If you open the Actions menu when nothing is selected, the "can I
create a local variable table here" method crashes with a bad index
reference.

Issue #48.
2019-10-01 20:55:17 -07:00
Andy McFadden
e2b5b12e13 Fix Actions menu crash
If you open the Actions menu when nothing is selected, the "can I
create a local variable table here" method crashes with a bad index
reference.

Issue #48.
2019-10-01 19:13:15 -07:00
Andy McFadden
14150af004 Allow explicit widths in project/platform symbols, part 2
Added a Width column to the list in the project symbol editor.

Changed the local variable table editor and the project symbol editor
to use DataGrid instead of ListView.  This gets us easy sorting on
arbitrary columns.  The previous code was reloading the display list
after every change; now we just add/edit/remove individual items,
which helps keep the list position and selection stable.
2019-10-01 19:11: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
7ddde3aad7 Version 1.3.0 2019-09-27 13:52:25 -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
7fcd5c2800 Version 1.3.0-alpha1 2019-09-21 13:46:08 -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
824add17e8 Remap labels that use opcode mnemonics
In a recent survey, three out of four cross assemblers surveyed
recommended not using opcode mnemonics to their patients who use
labels.  We now remap labels like "AND" and "jmp", using the label
map that's part of the label localizer.

We skip the step for Merlin 32, which is perfectly happy to assemble
"JMP JMP JMP".

Also, fixed a bug in MaskLeadingUnderscores that could hang the
source generator thread.
2019-09-20 15:29:34 -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
6bc491885a Minor UI tweaks
Typing a long comment in the project symbol editor caused the
window to expand, which wasn't intended.  Use the mono font in
the comment editor.  Set the focus to the OK button after creating
or editing a project property.  Show constant vs. address in the
info panel when an EQU directive is selected.
2019-09-18 18:11:48 -07:00
Andy McFadden
6f61e37a81 Fix assert failure in data operand editor
Changing an ASCII character operand back to default was going
through a path that tried to resolve low vs. high ASCII, which
isn't useful when you're removing the item.  The root of the problem
was that the "default" button wasn't properly resetting the UI.

Also, updated keyboard shortcuts to be in sync with the instruction
operand editor.
2019-09-18 11:35:45 -07:00
Andy McFadden
5dacbcd9b5 Make "long labels on new line" configurable in export dialog
It felt a little weird tying it to the asm generation setting,
so now it's just another checkbox in the export options.

Implemented the feature for plain text output.  Did some rearranging
in the code.  Fixed suppression of Notes in text and CSV.
2019-09-18 11:14:20 -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
3353819a62 Change the way the "add padded string" functions work
The functions started by trying to pad a column out to a width,
then changed to pad things to a certain length.  What they really
should be doing is padding the start of an entry to a specified
column.  This is much more natural and avoids a trim operation.

The only change to the output is to ORG statements from the HTML
exporter, which are now formatted correctly.
2019-09-17 22:02:05 -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
1ddf4bed48 Fix code tracing bug
If you set things up just right, it's possible for flag status
changes to fail to get merged.

Added a regression test to 1003-flags-and-branches.

Also, tweaked the instruction operand editor to be a bit smoother
from the keyboard: added alt-key shortcuts, and put the focus on the
OK button after creating/editing a label so you can just hit the
return key twice.
2019-09-17 14:38:16 -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
65fc2cb86e Remove excess whitespace after cycle count comments
If a line has a comment with a cycle count and nothing else, it was
getting an extra space or two on the end.

Also, added a few end-of-line comments to the 2020 test to show how
they interact with the cycle counts.
2019-09-15 17:13:29 -07:00
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
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