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.
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.
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.
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.
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.
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.
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.
(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.)
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.)
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.
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.
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.
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.
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.
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.
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.
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.)
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.)
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.