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

560 Commits

Author SHA1 Message Date
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