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

685 Commits

Author SHA1 Message Date
Andy McFadden
30cb96f737 Update Apple II definitions
Picked some names to fill the gaps in the language card I/O
location list.

Tweaked the hi-res sprite sheet slightly.
2020-08-21 20:01:41 -07:00
Andy McFadden
2dfdb3234b Add Apple II screen memory chart
Show mapping between lines on the text and hi-res screens and
locations in memory.
2020-08-20 17:24:28 -07:00
Andy McFadden
a2e7c88fc9 Update Apple II definitions
Added explicit widths to the 6502 vectors.

Two changes to Apple II hi-res visualization:

(1) Allow the row stride to be any value >= 1.  This is useful
when data is stored in column-major order, i.e. it's a two-byte-wide
shape, with all of the data for the first column stored before the
data for the second column.  (Set the row stride to 1, and the
column stride to the bitmap height.)

(2) Modify the layout of grids (sprite sheets and fonts), so that
we're closer to square when the item counts is low.  Otherwise the
thumbnail just looks like a dashed line.  (This one is strictly
cosmetic.)
2020-08-18 15:10:10 -07:00
Andy McFadden
3c73ea7ff6 Version 1.7.1 2020-08-13 10:45:11 -07:00
Andy McFadden
31d466f0bd Update some Apple II definitions
Added a bunch of Applesoft entry points, and updated the F8ROM
definitions.

Added a visualizer for Applesoft shape table shapes that are not part
of an actual shape table.
2020-08-12 20:40:56 -07:00
Andy McFadden
c2470c4ec4 Tweak debug feature
Make project symbols optional for "apply external symbols".
2020-08-10 14:09:26 -07:00
Andy McFadden
52853edcd1 Update GS/OS parameter block definitions
The FlushGS call has an additional argument.
2020-07-31 08:34:06 -07:00
Andy McFadden
4086551fb1 Version 1.7.0 2020-07-30 20:34:53 -07:00
Andy McFadden
92c648807c Minor fixes to tutorial text 2020-07-30 19:59:50 -07:00
Andy McFadden
c63035fb55 Update expected results for 10032-flags-and-branches
The "smart PLP" behavior change in 2a65457e altered the analysis.
2020-07-30 16:57:33 -07:00
Andy McFadden
97ca814854 Update DOS 3.3 and GS/OS symbols 2020-07-30 15:22:54 -07:00
Andy McFadden
0b765e075f Add current position to nav stack on initial Find
It's fairly common to want to Find something and then jump back to
where you were.  The Find command now adds the current position to
the nav stack for the initial search.  If you Find Next, the nav
stack is not altered.
2020-07-30 14:32:15 -07:00
Andy McFadden
94d7a30a09 Expand "apply platform symbols" feature
This experimental feature applied platform symbols to the project,
setting labels where the platform symbol's address matched an internal
address.  The feature now applies project symbols as well, and has
been renamed to "apply external symbols".

We now report the number of labels set.
2020-07-28 10:56:07 -07:00
Andy McFadden
c380b001b7 Put focus on code list after opening project
Setting the focus allows certain key commands (like up/down arrows)
to work without having to click in the code list first.
2020-07-25 11:35:27 -07:00
Andy McFadden
2a65457e19 Default "smart PLP handling" to off
The feature is mildly broken and, frankly, unreliable on its best
day.  Default it to off for new projects.
2020-07-24 21:38:45 -07:00
Andy McFadden
1e7a6620e0 Make project properties window resizable
Useful for the project symbols tab.  The size is retained for the
current session, but resets when the program exits.
2020-07-24 17:14:15 -07:00
Andy McFadden
b7d771a3b2 Fix expected values for 20212-reloc-data
Somehow these weren't part of commit 689204.
2020-07-22 17:25:55 -07:00
Andy McFadden
d1bece510c Version 1.7.0-alpha1 2020-07-22 10:54:56 -07:00
Andy McFadden
b1340ec2ac Tweaks 2020-07-22 10:53:54 -07:00
Andy McFadden
6892040ea8 Add two options to OMF converter
First, make the per-segment comments and notes optional.

Second, add an "offset segment by $0100" feature that tries to shift
each segment forward 256 bytes.  Doing so avoids potential ambiguity
with direct page locations.

The 20212-reloc-data test no longer has the per-segment comments.
2020-07-20 13:50:49 -07:00
Andy McFadden
288a857e47 Change PLP handling
The "smart" PLP handler tries to recover the flags from an earlier
PHP.  The non-smart version just marks all the flags as indeterminate.
This doesn't work well on the 65816 in native mode, because having
the M/X flags in an indeterminate state is rarely what you want.

Code rarely uses PLP to reset the flags to a specific state, preferring
explicit SEP/REP.  The analyzer is more likely to get the correct
answer by simply leaving the flags in their prior state.

A test case has been added to 20052-branches-and-banks, which now has
"smart PLP" disabled.
2020-07-20 11:54:00 -07:00
Andy McFadden
cb6ceafd73 Make operand wrap length configurable
Long operands, such as strings and bulk data, can span multiple lines.
SourceGen wraps them at 64 characters, which is fine for assembly
output but occasionally annoying on screen: if the operand column is
wide enough to show the entire value, the comment column is pushed
pretty far to the right.

This change makes the width configurable, as 32/48/64 characters,
with a pop-up in app settings.

The assemblers are all wired to 64 characters, though we could make
this configurable as well with an assembler-specific setting.

Some things have moved around a bit in app settings.  The Asm Config
tab now comes last.  Having it sandwiched in the middle of tabs that
altered the on-screen display didn't make much sense.  The Display
Format is now explicitly for opcodes and operands, and is split into
two columns.  The left column is managed by the "quick set" feature,
the right column is independent.
2020-07-19 18:39:27 -07:00
Andy McFadden
a3c7cd0cf9 Add File > Reload External Files
The new menu item reloads platform symbol files and extension scripts,
which is very handy when making edits to project files.
2020-07-19 16:59:41 -07:00
Andy McFadden
195c93a94a Reboot sandbox when required
Another chapter in the never-ending AppDomain security saga.

If a computer goes to sleep while SourceGen is running with a project
open, life gets confusing when the system wakes up.  The keep-alive
timer fires and a ping is sent to the remote AppDomain, successfully.
At the same time, the lease expires on the remote side, and the objects
are discarded (apparently without bothering to query the ILease object).
This failure mode is 100% repeatable.

Since we can't prevent sandbox objects from disappearing, we have to
detect and recover from the problem.  Fortunately we don't keep any
necessary state on the plugin side, so we can just tear the whole
thing down and recreate it.

The various methods in ScriptManager now do a "health check" before
making calls into the plugin AppDomain.  If the ping attempt fails,
the AppDomain is "rebooted" by destroying it and creating a new one,
reloading all plugins that were in there before.  The plugin binaries
*should* still be in the PluginDllCache directory since the ping failure
was due to objects being discarded, not AppDomain shutdown, and Windows
doesn't let you mess with files that hold executable code.

A new "reboot security sandbox" option has been added to the DEBUG
menu to facilitate testing.

The PluginManager's Ping() method gets called more often, but not to
the extent that performance will be affected.

This change also adds a finalizer to DisasmProject, since we're relying
on it to shut down the ScriptManager, and it's relying on callers to
invoke its cleanup function.  The finalizer throws an assertion if the
cleanup function doesn't get called.

(Issue #82)
2020-07-19 13:20:18 -07:00
Andy McFadden
de6e61a37e Increase verbosity of sandbox ping 2020-07-18 17:21:49 -07:00
Andy McFadden
1b2679d712 Add GS/OS file system IDs 2020-07-18 13:53:16 -07:00
Andy McFadden
4928dfd872 Tweak security menu items
Changed "Use Keep-Alive Hack" to "Disable Keep-Alive Hack" to emphasize
that it defaults to enabled.  Added a menu item for "Disable Security
Sandbox".  Added a warning to both that tells the user that they must
reopen the current project for the change to take effect.

Note neither of these is persisted in app settings.
2020-07-18 13:47:01 -07:00
Andy McFadden
c97d85974f Add GS/OS error code constants 2020-07-16 20:12:24 -07:00
Andy McFadden
ad02494f0f Default to source bank in Format Address Table
When formatting a table of 16-bit addresses in 65816 code, the bank
byte was always being set to zero.  However, for "JMP (addr,X)", the
program bank is used.  We now default to that behavior.

The choice can be overridden as before (select 24-bit addresses with a
constant value for the bank byte).
2020-07-16 13:26:13 -07:00
Andy McFadden
eecace8988 Tweak column widths for clipboard and Export default
The old values were pretty optimistic in terms of the length of labels.
Short labels in all caps are very retro but sort of annoying to read,
so most disassemblies use longer ones.  The new defaults are more
accommodating for the way labels are actually used.
2020-07-16 10:48:03 -07:00
Andy McFadden
b280fb58ba Rename PluginDll dir to PluginDllCache
The new name is more indicative of the purpose of the directory.

Updated the docs to point out that you can delete the contents any
time you want, so long as SourceGen isn't running at the time.

Also, change the default column widths for the exporter.
2020-07-16 10:36:58 -07:00
Andy McFadden
9a56ae8544 SGEC tweaks
Don't allow comments to be set in the middle of an instruction or
multi-byte data item.  The subsequent partial update confuses the
line list generator.

Change order of note/long-comment/comment to match display.
2020-07-16 10:14:28 -07:00
Andy McFadden
0860a00a54 SGEC update, part 2 (of 2)
Expand SGEC to include long comments and notes.  These are serialized
in JavaScript form.

SGEC now accepts addresses and relative position deltas.  Exported
content uses addresses, and can be configured for deltas.
2020-07-15 17:43:08 -07:00
Andy McFadden
c5d764d11f SGEC update, part 1
This is still an "experimental" feature, but it's getting expanded
a bit.  The implementation now lives in its own class.  An "export"
feature that generates SGEC data has been added.  The file extension
has been changed from ".sgec" to ".txt" to make it simpler to edit
under Windows.
2020-07-15 16:18:02 -07:00
Andy McFadden
0f415ffaf3 Version 1.7.0-dev2 2020-07-11 17:09:37 -07:00
Andy McFadden
9aaa37a23c Add Cxxx I/O locations in bank $e0 for Apple IIgs
On an Apple IIgs, the memory-mapped I/O locations are actually in
bank $e0, shadow-copied to bank $00.  This adds a copy of the
relevant definitions from Cxxx-IO.sym65, with the addresses in bank
$e0 and "_GS" appended to the labels.

This is now included by default for the Apple IIgs system defintions.

(I thought about just adding them to Cxxx-IO.sym65, but then they
pollute the namespace for 8-bit systems.  Stripping them out at run
time got a little complicated because the platform symbols are only
loaded once, and we'd have to reload them every time the CPU definition
changed.  Further, there are a few aliases provided as constants, and
constants are allowed to be 32 bits on all systems, so those can't be
stripped.  Rather than defining a new definition I figured it was
just easier to have a second file.  Maintenance shouldn't be too taxing,
as definitions for 40-year-old machines don't change all that often.)

(I also thought about trying to make the address mirroring stuff work
for me here, but that would result in accesses being made to the
canonical address with an offset of +$e00000, which looks awful.)
2020-07-11 14:01:02 -07:00
Andy McFadden
e82dc31da6 Move Disk ][ defs into separate platform symbol file
The Disk ][ I/O locations are generally accessed as an offset, using
something like "LDA $C08n,X".  However the range from $C080-C08F is
already used for language card in slot 0.  SourceGen doesn't have a
way to distinguish between indexed and direct accesses, and even if
it did there's no way to separate one peripheral card from another
without knowing the contents of the CPU register.

As a workaround, the Disk ][ definitions are now in a separate symbol
file.  When loaded, the definitions replace the base slot 0 equates.

I figure Disk ][ accesses are more common than language card
manipulation, so I'm making it a default for new projects.  Existing
projects that reference the Disk ][ symbols (which existed, but as
constants) will need to be updated to include the new .sym65.
2020-07-11 13:23:46 -07:00
Andy McFadden
abba1c8462 Update A2-HP-CDA example
This used to be an example of why disassembling Apple IIgs OMF
binaries didn't work.  Now it's an example of how well it works.
2020-07-10 21:22:18 -07:00
Andy McFadden
cc6ebaffc5 Update relocation data handling
When we have relocation data available, the code currently skips the
process of matching an address with a label for a PEA instruction when
the instruction in question doesn't have reloc data.  This does a
great job of separating code that pushes parts of addresses from code
that pushes constants.

This change expands the behavior to exclude instructions with 16-bit
address operands that use the Data Bank Register, e.g. "LDA abs"
and "LDA abs,X".  This is particularly useful for code that accesses
structured data using the operand as the structure offset, e.g.
"LDX addr" / "LDA $0000,X"

The 20212-reloc-data test has been updated to check the behavior.
2020-07-10 17:41:38 -07:00
Andy McFadden
da38bc0db8 Data Bank Register management, part 6 (of 6)
Add 20222-data-bank to regression test suite.  This exercises handling
of 16-bit operands with inter- and intra-bank references, and tests the
smartness in "smart PLB".

Also, update a couple of older tests that broke because the DBR is no
longer always the same as the PBR.  This just required adding "B=K"
in a few places to restore the original output.
2020-07-10 15:53:43 -07:00
Andy McFadden
6ce2cc0b58 Fix label-trampling bug in reloc data handler
If code accesses the high/low parts of a 32-bit address value with
no label, it auto-generates labels for addr+2 and addr.  The reloc
handler was replacing the unformatted bytes with a single multi-byte
format, hiding the label at addr+2.

The easy fix is to have the reloc data handler skip the entry.  This
is less useful than other approaches, but much simpler.

Added a test to 20212-reloc-data.
2020-07-10 13:56:07 -07:00
Andy McFadden
2a2aadffec Data Bank Register management, part 5
Update documentation.  Add some information about OMF relocation
data as well.

Fix bug in B=K handling.
2020-07-10 13:29:36 -07:00
Andy McFadden
0929077fda Data Bank Register management, part 4
Implemented "smart" PLB handling.  If we see PHK/PLB, or 8-bit
LDA imm/PHA/PLB, we create a data bank change item.  The feature
can be disabled with a project property.
2020-07-09 19:42:31 -07:00
Andy McFadden
ee58d9e803 Data Bank Register management, part 3
Added a "fake" assembler pseudo-op for DBR changes.  Display entries
in line list.

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

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

This change adds the basic data structures and "fixup" function, a
functional but incomplete editor, and source for a new test case.
2020-07-08 17:56:27 -07:00
Andy McFadden
44522dc2f2 Performance tweak
The Visual Studio performance profiler showed the FormatDescriptor
equality test being called quite a lot.  The test was vs. null, so
a simple change from "==" to "is" improved performance dramatically.

Fixing the underlying issue with a better data structure is still
important, but this provided a big boost with little effort.
2020-07-07 12:09:00 -07:00
Andy McFadden
f4fe3af050 Fix application of reloc info in data areas
The test wasn't correctly excluding instructions, so it was possible
to create a situation where a two-byte data item had an instruction
starting in the second byte.

We also weren't checking the length of the instruction to ensure that
it was wider than the reloc data.  This could get weird for an
immediate constant when the M/X flags are wrong.  When in doubt, don't
overwrite.
2020-07-07 11:48:51 -07:00
Andy McFadden
bc15178a8e Tweak M/X/E flag handling
The decision of how to handle indeterminate M/X flag values is made in
StatusFlags.  This provides consistent behavior throughout the app.
This was being done for M/X but not for E.

This change also renames the M/X tests, prefixing them with "Is" to
emphasize that they are boolean rather than tri-state.

There should be no change in behavior from this.
2020-07-06 08:31:18 -07:00
Andy McFadden
4e70edc90c Add 20212-reloc-data test
This test exercises the relocation data feature.  The test file is
generated from a multi-segment OMF file that was hex-edited to have
specific attributes (see 20212-reloc-data-lnk.S for instructions).
The test also serves as a way to exercise the OMF converter.

Also, implement the Bank Relative flag.
2020-07-05 17:17:44 -07:00
Andy McFadden
4782cae116 Update ProDOS, ProDOS-16, and GS/OS call handling
Added P16 parameter blocks.  Updated GS/OS calls with System 6.0
changes.  Added comments, renamed symbols.
2020-07-05 10:54:55 -07:00
Andy McFadden
8d291ba21e Fix bank for AbsInd and AbsIndLong addressing
The Absolute Indirect and Absolute Indirect Long addressing modes
(e.g. "JMP (addr)" and "JMP [addr]") are 16-bit values in bank 0.
The code analyzer was placing them in the program bank, which
meant the wrong symbol was being used.

Also, tweak some docs.
2020-07-04 15:03:23 -07:00
Andy McFadden
0fa77cba75 Apply relocation data to unformatted data
Works well for things like jump tables.  Seeing a bunch of these
scattered in a chunk of data is a decent signal that it's actually
code.

In a bold move, we now exclude PEA operands from auto-label gen when
they don't have relocation data.  This is very useful for things
like Int2Hex for which constants are typically pushed with PEA.

Reworked the "use reloc data" setting so it defaults to false and is
explicitly set to true when converting OMF.  This provides a minor
optimization since we now check the boolean and skip doing a lookup
in an empty table.
2020-07-03 22:03:50 -07:00
Andy McFadden
a6700e9062 Format GS/OS parameter blocks
Similar to the ProDOS 8 formatter, but slightly more complex due
to the variable-length parameter block layout.

Also, added Orca shell call numbers to the list of constants.
2020-07-03 21:01:05 -07:00
Andy McFadden
d58b747571 Use relocation data to format instruction operands
This was a relatively lightweight change to confirm the usefulness
of relocation data.  The results were very positive.

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

The feature can be enabled or disabled with a project property.  The
results were sufficiently useful and non-annoying to make the setting
enabled by default.
2020-07-03 17:58:41 -07:00
Andy McFadden
6d7fdff6b5 Fix 65816 code generation issues
Code generated for 64tass was incorrect for JSR/JMP to a location
outside the file bounds.  A test added to 20052-branches-and-banks
revealed an issue with cc65 generation as well.
2020-07-03 14:02:38 -07:00
Andy McFadden
d035e29de5 Update GS/OS symbols
Added "GS" suffix to GS/OS calls.  Added ProDOS-16 calls.
2020-07-03 11:27:45 -07:00
Andy McFadden
327ad4fbbc Store reduced OMF relocation data in project file
A "cooked" form of the relocation data is added to the project, for
use during data analysis.

Also, changed the data grids in the segment viewer to allow multi-
select, so users can copy & paste the contents.
2020-07-02 17:10:05 -07:00
Andy McFadden
190f68d1f8 Add code hints to OMF jump tables
We now put a code hint on the JML instruction in each jump table
entry.  This is necessary to ensure that the target address is
recognized as code, since a dynamic segment won't otherwise be
referenced.

Also, fiddle with the note/comment formatting some more.
2020-07-02 13:41:44 -07:00
Andy McFadden
4d06bb24eb Improve Common expression generation
Removed unnecessary parenthesis from Common-style expressions, which
are used by 64tass and ACME.
2020-07-02 13:00:02 -07:00
Andy McFadden
7d1d7f9c56 Operand for ".enc" should be in double quotes
The 64tass assembler was generating a warning.
2020-07-02 08:14:42 -07:00
Andy McFadden
fdd2bcf847 Fix some 65816 code generation issues
Two basic problems:

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

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

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

The 20052-branches-and-banks test was expanded to cover the problematic
cases.
2020-07-01 17:59:12 -07:00
Andy McFadden
d979571880 Remove "Atari Arcade Cabinet" system definition
The handful of 6502-based Atari coin-op systems were very different
from each other, so having a dedicated entry doesn't make sense.

Also, enable word-wrap in the New Project text box that holds the
system description.
2020-07-01 11:06:23 -07:00
Andy McFadden
86be31a02f Rewrite OMF jump table segments
The GS/OS loader initializes the calls with JSLs to a loader entry
point, and replaces them with JMLs to code in dynamic segments when
the segments are loaded.  Since we have all the segments loaded at
once, we can just rewrite them to be JMLs immediately.
2020-06-30 15:17:39 -07:00
Andy McFadden
86ead987d5 Tweak OMF converter
Changed bank-start comments to notes, added a summary to the top-of-file
comment.

Also, fixed a bug where the app settings dialog wasn't identifying
display settings as a preset for 64tass and cc65.
2020-06-30 11:48:11 -07:00
Andy McFadden
58a415bd93 Finish initial work on OMF file handling
Generate multiple .ORG directives for segments that span multiple
banks.  Some assemblers don't like it when things cross.  This is
pretty rare (Cryllan Mission is an example).

Conversion of OMF Load files to a data/project pair is generally
working.  The 65816 source code generators need some work though.
2020-06-30 09:27:29 -07:00
Andy McFadden
bb7998d1f0 Progress toward OMF file handling
Added generation of data and project files.  We're applying the
relocation dictionary, but not using the information to inform the
formatting.
2020-06-30 08:20:12 -07:00
Andy McFadden
463a0cc561 Progress toward OMF file handling
Added generation of the relocation dictionary and constant body for
segments in Load files.

Also, don't reject files with v1 segments (whose length is specified
as a block count) just because the EOF isn't a multiple of 512 bytes.
Some executables don't pad out the last block.

Various tweaks to output formatting.
2020-06-28 21:10:53 -07:00
Andy McFadden
0702882c8c Progress toward OMF file handling
Added file type determination (Load, Object, Library).  Requires
screening the segment and record types.

Also, fix parsing of v0 headers, which placed ORG and ALIGN in
different places.
2020-06-28 11:59:01 -07:00
Andy McFadden
fa500a2a49 Progress toward OMF file handling
Added parsing of records from OMF segment bodies.  These are displayed
in the segment viewer window.
2020-06-27 18:12:48 -07:00
Andy McFadden
d1526e5f25 Progress toward OMF file handling
Added generation of info/error messages to segment parser, which
are displayed in the main OMF viewer window.

Added segment viewer window, which opens when a segment entry in the
viewer list is double-clicked.  Currently shows the "raw" header
fields, with place-holder UI for additional stuff.
2020-06-26 17:04:35 -07:00
Andy McFadden
b77d9ba4c8 Progress on Apple IIgs OMF file handling
Wrote segment parser.
2020-06-25 17:30:44 -07:00
Andy McFadden
5026fd6569 First step toward Apple IIgs OMF file handling
This lays a bit of groundwork for an OMF file analyzer / viewer.
2020-06-23 17:21:18 -07:00
Andy McFadden
c47beffcee Add Export feature to visualization editor
It's nice to be able to save images from the visualization editor
for display elsewhere.  This can be done during HTML export, but
that's inconvenient when you just want one image, and doesn't allow
the output size to be specified.

This change adds an Export button to the Edit Visualization dialog.
The current bitmap, wireframe, or wireframe animation can be saved
to a GIF image.  A handful of sizes can be selected from a pop-up
menu.
2020-06-20 17:32:57 -07:00
Andy McFadden
b43fd07688 Split 2002x-operand-formats test
My original goal was to add a sign-extended decimal format, but that
turned out to be awkward.  It works for data items and instructions
with immediate operands (e.g. "LDA #-1"), but is either wrong or
useless for address operands, since most assemblers treat integers
as 32-bit values.  (LDA -1 is not LDA $FFFF, it's LDA $FFFFFFFF,
which is not useful unless your asm is doing an implicit mod.)

There's also a bit of variability in how assemblers treat negative
values, so I'm shelving the idea for now.  I'm keeping the updated
tests, which are now split into 6502 / 65816 parts.

Also, updated the formatter to output all decimal values as unsigned.
Most assemblers were fine with negative values, but 64tass .dword
insists on positive.  Rather than make the opcode conditional on the
value's range, we now just always output unsigned decimal, which
all current assemblers accept.
2020-06-08 17:47:26 -07:00
Andy McFadden
bb830a29db Add Navigate > Jump to Operand
If you double-click on the opcode of an instruction whose operand is
an address or equate, the selection jumps to that address.  This
feature is now available in the Navigate menu, with the keyboard
shortcut Ctrl+J.

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

See also issue #63 and issue #72.
2020-06-07 16:37:41 -07:00
Andy McFadden
3637bb964d Regression test rework, part 4
Split 2005x-branches-and-banks into two parts, one that stays within
the 64K bounds of the 6502, one that puts code in a separate bank.
2020-06-06 17:30:50 -07:00
Andy McFadden
d0d387b973 Regression test rework, part 3
Add a 6502-only version of the 20032-labels-and-symbols test.  The
65816 version could get away with just the 65816-specific stuff, but
there's no real need to modify it.  (The next time I update it I may
remove the duplicate label since that requires hand-editing.)
2020-06-06 17:06:31 -07:00
Andy McFadden
225ab9e132 Regression test rework, part 2
Renamed the remaining tests.  Only edits were to the project files
that referenced .sym65/.cs.
2020-06-06 15:36:08 -07:00
Andy McFadden
3ff0fbae34 Regression test rework, part 1
The regression tests were written with the assumption that all cross
assemblers would support 6502, 65C02, and 65816 code.  There are a
few that support 65816 partially (e.g. ACME) or not at all.  To best
support these, we need to split some of the tests into pieces, so
that important 6502 tests aren't skipped simply because parts of the
test also exercise 65816 code.

The first step is to change the regression test naming scheme.  The
old system used 1xxx for tests without project files, and 2xxx for
tests with project files.  The new system uses 1xxxN / 2xxxN, where
N indicates the CPU type: 0 for 6502, 1 for 65C02, and 2 for 65816.
For the 1xxxN tests the new value determines which CPU is used,
which allows us to move the "allops" 6502/65C02 tests into the
no-project category.  For 2xxxN it just allows the 6502 and 65816
versions to have the same base name and number.

This change updates the first batch of tests.  It involves minor
changes to the test harness and a whole bunch of renaming.
2020-06-06 14:47:19 -07:00
Andy McFadden
bac9949d8a Version 1.7.0-dev1 2020-05-15 11:26:14 -07:00
Andy McFadden
4981c3cdbb Fix ACME code gen "overflow"
ACME has a "real" PC and a "pseudo" PC.  The "real" PC determines the
initial position in a 64KB buffer used to hold assembler output.  If
the amount of code generated runs off the end, the assembler fails
with "produced too much code".

The source code generator in SourceGen was outputting a "real" PC
for the first address range and "psuedo" PCs for any address ranges
that followed.  This produced nice results for code with a single
range, but caused problems for multi-range sources if the initial
range was high in memory and a later range was lower in memory.
While the assembler isn't actually generating more than 64KB of code,
ACME's buffer management was detecting an overflow.

Now, if a source file has multiple address ranges, we set the "real"
PC to $0000 and use a "pseudo" PC for all ranges.  Output for projects
with a single address range is unmodified.
2020-05-14 16:37:33 -07:00
Andy McFadden
100d2ffc13 Add NES visualization generator
Added a visualizer for the CHR ROM pattern tables, and a semi-useful
visualizer for tile grids.

Also added a few chars in an 8x8 font that visualizers can use to
label things.
2020-05-14 15:34:05 -07:00
Andy McFadden
63d7a48705 Fix bug in inline JSR/JSL no-continue handling
JSR/JSL calls with inline data have the option of reporting that
they don't continue, which causes the code analyzer to treat them
as JMPs instead.  There was a bug that was causing the no-continue
flag to be lost in certain circumstances.

The code now explicitly records the plugin's response in an Anattrib
flag.  Test 2022-extension-scripts has been updated with a test case
that exercises this situation.
2020-05-08 17:41:26 -07:00
Andy McFadden
71af8bf117 Change PETSCII keyboard shortcut
Alt+P was clashing in Edit Instruction Operand, so use Alt+T instead.
2020-05-05 21:40:42 -07:00
Andy McFadden
47c773dcdf Show "idx" for indexed accesses in References window
Sometimes it's useful to know whether an address referenced by a
function is a direct access, or is being used as a base address.
(I'm somewhat undecided on this one, since it clutters up the list
a bit.  Giving it a try.)
2020-05-02 14:09:53 -07:00
Andy McFadden
facaa721de Fix AND/ORA imm flag updater
The code was making an unwarranted assumption about how the flags
were being set.  For example, ORA #$00 can't know if the previous
contents of the accumulator were nonzero, only that the instruction
hasn't made them nonzero, but instead of marking the Z-flag
"indeterminate" it was leaving the flag in its previous state.  This
produces incorrect results if the previous instruction didn't set
its flags from the accumulator contents, e.g. it was an LDX.

Test 1003-flags-and-branches has been updated to test these states.
2020-05-01 17:29:22 -07:00
Andy McFadden
59b7ec0dea Recognize that LSR always clears the 'N' flag
The instruction shifts 0 into the high bit, so the result is never
negative.  Added a test case to 1003-flags-and-branches.
2020-04-23 17:23:12 -07:00
Andy McFadden
ea379fce18 Consolidate wireframe data validation
Some tests were duplicated between VisWireframe and the code that
consumed the data.  We now expose the Validate function as a public
interface, and invoke it from WireframeObject.  Failed validation
results in a null object being returned, which was previously allowed
but not actually checked for.
2020-04-23 11:25:45 -07:00
Andy McFadden
3820bfee8b Set initial focus to appropriate field for project properties
If you double-click a project symbol declaration, the symbol editor
opens.  I found that I was double-clicking on the comment field and
typing with the expectation that the comment would be updated, but
it was actually setting the initial focus to the label field.

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

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

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

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

Also, renamed the atari-avg visualizer to atari-avg-bz, with the
expectation that one day somebody might want to create a variant
for newer games.
2020-04-13 17:33:34 -07:00
Andy McFadden
7cdc2d5b92 Updated some comments 2020-04-12 15:54:36 -07:00
Andy McFadden
356492d6da Add Atari AVG visualizer
This converts AVG commands to wireframes.  We don't try to track
color or intensity.  (This is a disassembler, not a graphics
converter; perfection is not required.)  The various rotation and
animation options are still enabled, though they're not terribly
useful for this.

Commands that are meant to be used in series, such as font glyphs,
tend to use (0,0) as their left edge and baseline.  This puts the
shape in the upper-right corner of the thumbnail, which makes
everything smaller.  The change adds a "re-center" option to the
wireframe renderer that computes the visible bounds and adjusts
the coordinates so that the center of the object is at (0,0) for
display.
2020-04-11 17:24:21 -07:00
Andy McFadden
df823f4c09 Add support for points in wireframe meshes
This allows rendering of a vertex directly, rather than just as an
edge endpoint.  They're currently drawn as small '+' signs.  A
round dot would be better, but the code is passing a list of line
segments around, so this is simpler.
2020-04-11 11:23:16 -07:00
Andy McFadden
a42584834b Fix address cross-reference code
The code was wrong, but due to aggressive auto-label generation, it
rarely had an opportunity to express itself.  The problem appeared
when you formatted a 16-bit value as an address, but the address
was outside the file and not associated with a project/platform
symbol.  This fixes the glitch and adds some logging.
2020-04-10 11:00:27 -07:00
Andy McFadden
61db267111 Version 1.6.0 2020-03-30 16:52:53 -07:00
Andy McFadden
5010fbae37 Various minor changes
- Freeze Note brushes, so HTML export doesn't blow up when it tries
  to access them.
- Add Ctrl+Shift+E as keyboard shortcut for File > Export.
- For code/data percentage, count inline data as data.
- Tweak code/data percentage text.
- Document Merlin32 '{' bug.
- Tweak tutorial text.
2020-03-30 16:50:52 -07:00
Andy McFadden
65b960d78b Version 1.6.0-alpha1 2020-03-24 14:02:30 -07:00
Andy McFadden
0121037302 Fix some visualization wording in the tutorial 2020-03-24 14:02:02 -07:00
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