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

729 Commits

Author SHA1 Message Date
Andy McFadden
5fb1fb3240 Set owner of status flags edit window
The XAML code specified it to be placed centered on the owner's window,
but we weren't actually setting the owner.
2021-06-03 17:16:07 -07:00
Andy McFadden
011181d848 Work around minor column width update issue
If you changed the width of a column, and then clicked the "toggle
display of cycle counts" button in the toolbar, the column width
would revert.  The problem appears unique to that toolbar button,
so for now the fix is localized there.  The more general fix is to
ensure that column width changes don't get stomped, but that's a
larger change.
2021-06-03 15:03:22 -07:00
Andy McFadden
6db18cc1df Change bookmark link element
Use <span> instead of <a> when defining target.
2021-05-23 15:28:30 -07:00
Andy McFadden
3bda6df786 Update HTML export to use HTML 5
There's no need to use XHTML Transitional.  The only change outside
the template was to use "id" for anchors instead of "name", as the
latter is deprecated.
2021-05-23 11:27:42 -07:00
Andy McFadden
33ccdd91eb Fix lastOffset calculations in Apple II hi-res visualizer
The calculations were wrong for certain situations, generating
answers that were useless or that caused a false-positive overflow
error.

This adds a couple of simple regression tests, modeled after layout
of the Lode Runner sprite sheet (which worked fine before) and the
Empire II EWS3 font (which failed).

This also bumps up some of the arbitrary limits in the visualizer.

(issue #94)
2021-05-17 17:28:13 -07:00
Andy McFadden
d3e00b2342 Add Apple IIgs I/O locations in bank $E1
The $Cxxx I/O locations are mapped into banks $E0/E1, and are usually
configured to appear in banks $00/01 as well.  Direct access to
locations in banks $E0/E1 is common in 16-bit code, but we only had
definitions for $E0.

This adds a clone of definitions for $E1, and renames the symbols
to be _E0/_E1 instead of _GS.

This can also be solved with MULTI_MASK, but that will always use
$E0 as the base address, so references to $E1/Cxxx will have a large
adjustment added ("+$10000"), which is kind of ugly.

Note we still don't have definitions for $01/Cxxx.  I'll add those
if I run into them in 16-bit code.  (That might be a reasonable use
of MULTI_MASK; feels less ugly somehow.)
2020-11-03 11:54:25 -08:00
Andy McFadden
9321f15052 Minor fix for 24-bit MULTI_MASK
The test for max allowed value was assuming 16-bit addresses.

We had no tests for 24-bit values, so this adds a 65816-specific
version of 20170-external-symbols.
2020-11-03 11:47:53 -08:00
Andy McFadden
3ddf9d11c4 Version 1.7.3 2020-10-23 10:57:13 -07:00
Andy McFadden
67c713ea7d Change some words
Replace "hint" in a few more places.  Mention W65C02 in main README.
State that new PRG feature is only enabled for 64tass.
2020-10-23 10:50:36 -07:00
Andy McFadden
345dff7765 Clone 20152-local-variables
Generate a 6502 test from the 65816 version by substituting the
16-bit instructions with 8-bit no-ops.  There's a lot of project
edits and weird stuff in the test, so this was much easier than
starting over.

The 65816 variant is largely unchanged, though it could now be
stripped down to the stack-offset instructions.
2020-10-19 17:14:56 -07:00
Andy McFadden
84e3dd3df2 Add 20100-label-dp test
The 20102-label-dp test is "allops-common-65816" with direct-page
labels.  20100-label-dp is the same thing, but with the 6502 version
instead.
2020-10-19 16:02:28 -07:00
Andy McFadden
b7d3e3cfdf Refactor 2006x-target-adjustment
Split into 6502/65816 portions.  The 6502 version is the original
with a few in-place substitutions (e.g. JMP for BRL).  The 65816
version is only needed to exercise special handling of PEA/PER.
2020-10-19 15:46:05 -07:00
Andy McFadden
8109396c48 Rework 201XX-char-encoding-X tests
We have a single character-encoding test that is cloned 3x so we can
exercise the different values for the project's default character
set.  It was a 65816 test because it tested 16-bit immediate char
operands, but that's a very small part of it.

The 65816-specific portion is now 20122-char-encoding.  The rest is
now 201{2,3,4}0-char-encoding-X.
2020-10-19 15:01:02 -07:00
Andy McFadden
7ae4b63fa3 Tweak wording 2020-10-19 14:59:27 -07:00
Andy McFadden
17dc908420 Refactor tests 1002x and 1003x
Tests 10022-embedded-instructions and 10032-flags-and-branches were
a mix of 6502 and 65816 code.  The 6502 code has been separated into
its own file, so that the tests can be run on 8-bit-only assemblers.
2020-10-18 20:30:42 -07:00
Andy McFadden
e9fbc6c96c Change Merlin 32 output suffix
We append an assembler identifier to generated code.  For Merlin 32,
this was "_Merlin32".  All of the other assemblers use a lower-case
string, which makes Merlin look a little weird, so it has been
changed to "_merlin32".

Windows filesystems are generally case-insensitive, so this won't
likely affect anything.
2020-10-18 15:47:11 -07:00
Andy McFadden
cac03e6a25 Version 1.7.3-dev2 2020-10-18 13:43:44 -07:00
Andy McFadden
49603ba417 Refine handling of C64 PRG header
A few tweaks:
- Test now requires an ORG on offset +000002, not just a correct
  address.
- Suppress on-screen display of the initial ORG directive when
  a PRG file is detected.  Subtle, but helpful.
- In new project setup, fix initial address for PRG projects that
  load at $0000.
- In new project setup, add a "load address" comment to the first line.

Also, fix some out-of-date documentation.

(issue #90)
2020-10-18 13:22:24 -07:00
Andy McFadden
2afb280472 Rename test 10042
The 10042-data-recognition test has no 65816-specific content, so it
should be named 10040-data-recognition.

Also, remove header comment from 20102-label-dp.
2020-10-18 09:16:50 -07:00
Andy McFadden
99cd0d3ac1 Improve handling of C64 PRG header
C64 PRG files are pretty common.  Their salient feature is that they
start with a 16-bit value that is used as the load address.  The
value is commonly generated by the assembler itself, rather than
explicitly added to the source file.

Not all assemblers know what a PRG file is, and some of them handle
it in ways that are difficult to guarantee in SourceGen.  ACME adds
the 16-bit header when the output file name ends in ".prg", cc65
uses a modified config file, 64tass uses a different command-line
option, and Merlin 32 has no idea what they are.

This change adds PRG file detection and handling to the 64tass code
generator.  Doing so required making a few changes to the gen/asm
interfaces, because we now need to have the generator pass additional
flags to the assembler, and sometimes we need code generation to
start somewhere other than offset zero.  Overall the changes were
pretty minor.

The 20042-address-changes test needed a 6502-only variant.  A new test
(20040-address-changes) has been added and given a PRG header.  As
part of this change the 65816 variant was changed to use addresses
in bank 2, which uncovered a code generation bug that this change
also fixes.

The 64tass --long-address flag doesn't appear to be necessary for
files <= 65536 bytes long, so we no longer emit it for those.

(issue #90)
2020-10-17 16:45:13 -07:00
Andy McFadden
ae4c90d838 Warn about multi-line start/stop tags
One of the most confusing things you can do is select a bunch of
lines and apply a code start tag (nee "code hint").  We now ask for
confirmation when applying start/stop hints to multiple lines.

(issue #89)
2020-10-15 17:18:49 -07:00
Andy McFadden
49f4017410 Rename "hints" to "analyzer tags"
Variables, types, and comments have been updated to reflect the new
naming scheme.

The project file serialization code is untouched, because the data
is output as serialized enumerated values.  Adding a string conversion
layer didn't seem worthwhile.

No changes in behavior.

(issue #89)
2020-10-15 16:55:29 -07:00
Andy McFadden
908a1c9900 Rename "hint" in UI and documentation
Before:
 Hint As Code Entry Point
 Hint As Data Start
 Hint As Inline Data
 Remove Hints

After:
 Tag Address As Code Start Point
 Tag Address As Code Stop Point
 Tag Bytes As Inline Data
 Remove Analyzer Tags

The goal is to reduce confusion.  The old nomenclature was causing
problems because it's inaccurate -- they're directives, not hints --
and made it look like you need to mark data items explicitly.  The
new action names emphasize the idea that you should be tagging a
single address for start/stop, not blanketing a region.

This change updates the user interface, manual, and tutorials, but
does not change how the items are referred to in code, and does not
change how the program works.

(issue #89)
2020-10-14 15:02:53 -07:00
Andy McFadden
0d164e1719 Fix PCRel sample in instruction chart
Relative branches should display as $xxxx, not $xx.
2020-10-14 15:02:13 -07:00
Andy McFadden
5015a4b4c6 Version 1.7.3-dev1 2020-10-11 18:46:37 -07:00
Andy McFadden
728966f8d2 Add W65C02S support, part 4 (of 4)
Added 20233-rockwell unit test to exercise the new opcodes.  Nothing
too fancy.

Fixed branch offset computation.

(issue #87)
2020-10-11 18:43:00 -07:00
Andy McFadden
34ba47e71d Add W65C02S support, part 3
Modified the asm source generators and on-screen display to show the
DP arg for BBR/BBS as hex.  The instructions are otherwise treated
as relative branches, e.g. the DP arg doesn't get factored into the
cross-reference table.

ACME/cc65 put the bit number in the mnemonic, 64tass wants it to be
in the first argument, and Merlin32 wants nothing to do with any of
this because it's incompatible with the 65816.

Added an "all ops" test for W65C02.
2020-10-11 14:35:17 -07:00
Andy McFadden
70ee8793ae Add W65C02S support, part 2
Created the "all ops" tests for W65C02.  Filled in enough of the
necessary infrastructure to be able to create the project and
disassemble the file, though we're not yet handling the instructions
correctly.
2020-10-10 18:34:19 -07:00
Andy McFadden
b60dc4fee4 Add W65C02S support, part 1
We were claiming W65C02S, but it turns out that CPU has the Rockwell
extensions and the STP/WAI instructions.  We need to change existing
references to be "WDC 65C02", and add a new CPU definition for the
actual W65C02S chip.

This adds the new CPU definition, the instruction definitions for
the Rockwell extensions, and updates the selectors in project properties
and the instruction chart tool.

This change shouldn't affect any existing projects.  Still more to do
before W65C02 works though, mostly because the Rockwell instructions
introduced a new two-argument address mode that has to be handled in
various places.
2020-10-10 15:46:34 -07:00
Andy McFadden
9ffc4a9383 Version 1.7.2 2020-09-24 12:51:43 -07:00
Andy McFadden
9548b5c27c Add link to ToC 2020-09-20 17:42:40 -07:00
Andy McFadden
3f154406d4 Fix multi-byte local var xrefs
The cross-references for multi-byte local variable table entries were
not showing adjustment values.
2020-09-05 18:18:55 -07:00
Andy McFadden
d984e8013a Mention VS2017 icon library usage
Should be mentioned in LegalStuff.txt.
2020-09-04 18:20:26 -07:00
Andy McFadden
e411cca485 Minor style change to "back" link
Smaller font, (parenthesis).
2020-09-04 18:17:01 -07:00
Andy McFadden
b962d8715d Add toolbar button for "show cycle counts"
Sometimes you just want to turn cycle counts on for a bit, and going
through app settings is tiresome.  Now there's a toolbar checkbox
for it.  The icon isn't ideal, but it'll do.
2020-09-04 17:49:28 -07:00
Andy McFadden
f30780a9de Fix Message update when broken symbolic ref is fixed
Renaming a user label doesn't cause a re-analysis, just a display
update, because nothing structural is changing.  However, that's not
quite true when you have a reference to a non-existent label (e.g.
"LDA hoser"), and you rename a label to match (e.g. change "blah"
to "hoser").  The most obvious consequence was that the Message list,
which enumerates the broken symbolic references, was not being
updated.

We now identify broken references during the refactoring rename, and
change the reanalysis mode accordingly.

There is a deeper problem, where undoing the label rename does the
wrong thing with the previously-broken symbolic references (in the
earlier example, it "undoes" them to "blah" rather than back to
"hoser").  I added some notes about that, but it's harder to fix.

Also, clean up some code that was still treating ReanalysisScope as
if it were bit flags.
2020-09-04 15:21:47 -07:00
Andy McFadden
bd5b556a7f Show "ptr" for pointer use in cross-reference list
Consider:
 LDA $00 loads a value from address $00
 LDA $00,X might load from $00, or might not
 LDA ($00),Y dereferences $00 as a 16-bit pointer
 LDA ($00,X) dereferences a pointer, not necessarily from $00

When perusing the cross-reference list, it's useful to be able to
tell whether an instruction is accessing the location, using it as a
base address, or deferencing it as a pointer.  We now show "ptr" in
the list for pointer dereferences.  (We already showed "idx" for
indexed accesses.)
2020-09-04 13:26:41 -07:00
Andy McFadden
7c506dceb6 Add Ctrl+Enter as a way to close the LVTable edit dialog
When editing local variables, the data grid generally has the input
focus, so hitting Enter doesn't close the dialog.  Rather than play
games with the focus, just take Ctrl+Enter as a shortcut to close
the dialog (same as notes and long comments).

(I found myself hitting Ctrl+Enter automatically, and being annoyed
when it didn't work, so I figured I'd make it official.)
2020-08-27 17:09:18 -07:00
Andy McFadden
69a9e98a43 Split "show cycle counts" in two
The "show cycle counts in comments" setting is the only one that
affects both the on-screen display and generated source code.  This
felt a little weird, so it's now two independent settings.  This
also provided an opportunity to move it to the initial tab, so it's
easier to toggle on and off.  Overall it feels less confusing to have
two settings for essentially the same thing, because code generation
is distinct from everything else.

The "spaces between bytes" setting was moved to the Display Format
tab, which seems a better fit.

Documentation and tutorial have been updated.

Also did a little bit of cleanup in EditAppSettings.
2020-08-27 13:59:53 -07:00
Andy McFadden
575b4f25a7 Add screen holes to Apple II text memory chart
The page 1 screen holes are used by peripherals, so it's useful to
call out their locations.
2020-08-24 14:00:08 -07:00
Andy McFadden
24bc7326e6 Version 1.7.2-dev1 2020-08-23 10:55:43 -07:00
Andy McFadden
53857089e9 Update Apple /// SOS definitions
- Added SOS parameter block formatting.
- Normalized SOS call names to values in SOS Reference Manual.
- Added SOS call error code constants.
- (from robjustice) Added more to A3-IO.sym65.

Also, rearranged the ProDOS code slightly.

(issue #85)
2020-08-22 18:41:24 -07:00
Andy McFadden
2ec2917da5 Fix inline BRK no-no-continue flag
Inline BRK instructions have a problem similar to the one fixed
for JSR/JSL back in 63d7a487, but the same fix won't work because
JSR/JSL are assumed "continue", while BRK is assumed "no-continue",
and must therefore set a no-no-continue flag.  For now, we just
re-evaluate the BRK on every visit to the code.

A review of the previous fix revealed an opportunity to use the
NoContinueScript flag on subsequent visits to improve consistency.
2020-08-22 13:47:52 -07:00
Andy McFadden
ba35f88d02 Mark flags as indeterminate for inline BRK
We weren't altering the status flags after a BRK because of the
assumption that a BRK was a crash.  For an inline BRK, such as a SOS
call, execution continues.  We need to mark NVZC indeterminate or
we may incorrectly handle conditional branches that follow.

The BRK instruction now uses the same flag updater as JSR, since it's
effectively a subroutine call to unknown code.  If execution doesn't
continue across the BRK then the flags don't matter.

Updated 20182-extension-scripts to exercise this.
2020-08-22 08:56:38 -07:00
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