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

691 Commits

Author SHA1 Message Date
Andy McFadden
5ee01ee8a4 Add "StdInline" extension script
Inline strings and 16-bit addresses are sufficiently common that a
general-purpose extension script is useful.
2021-10-16 13:19:21 -07:00
Andy McFadden
adf5726f62 Add daily tips to start screen
The initial screen is largely blank, with just the four large buttons
for new/open/recent1/recent2.  It now also has a "tip of the day" box,
with text and an optional image.

The tips and images are kept in the RuntimeData directory.  They're
small enough that they could have been baked into the binary, but
there's enough other stuff going on there that it didn't seem
necessary.  Also, if the tips annoy you, removing the tips file will
hide the tip UI.

The index of the tip shown is based on the day of the year, modulo
the number of defined tips.  So it will be different every day (with
a bit of hand-waving at the end of the year).
2021-10-16 09:15:28 -07:00
Andy McFadden
2008558870 Add "quick set" menu to delimiter settings tab
Added a pop-up menu with three options: default (curly quotes),
straight, and Merlin.  Removed the "reset to defaults" buttons.

Also, slightly rearranged the Display Format tab so that the quick
set pop-up is on the left, near the items it affects.  Moved the
"use comma-separated format for bulk data" checkbox over as well,
since it's part of the set.
2021-10-15 10:01:14 -07:00
Andy McFadden
cb114be0f6 Add "uninitialized data" format type
This allows regions that hold variable storage to be marked as data
that is initialized by the program before it is used.  Previously
the choices were to treat it as bulk data (initialized) or junk
(totally unused), neither of which are correct.

This is functionally equivalent to "junk" as far as source code
generation is concerned (though it doesn't have to be).

For the code/data/junk counter, uninitialized data is counted as
junk, because it technically does not need to be part of the binary.
2021-10-13 15:05:07 -07:00
Andy McFadden
09eba228dd Add "remove formatting" action
This action removes operand formatting from all code and data in the
selected range.  In most cases this is equivalent to simply editing
the various items and clicking the "default" format radio button,
but the feature can be used to remove data formats that end up inside
multi-byte instructions.  Instructions with such formats cause warnings
and were tricky to fix.

Labels embedded in multi-byte items are also tricky to remove, so this
clears those as well.  It does not remove visible labels.  This is
done in a single pass, which means that labels that would become visible
after the formatting is cleared will still be removed.

Also, fix inclusion of address range end lines when restoring the
selection.  Their peculiar nature -- being associated with the offset
of the last byte of multi-byte items -- was interfering with the
selection save code.  This does not add them to the selection when
an address region deletion is undone, since technically they weren't
part of the selection.

Also, moved Edit Note higher in the Actions menu.
2021-10-12 13:04:34 -07:00
Andy McFadden
6df29e562f Various tweaks
Changed the code that generates cross-references for pre-labels to
ignore labels in regions with non-addressable parents.  Also, changed
the code that complains about references to labels in non-addressable
areas to ignore pre-labels, because it was complaining about references
to pre-labels on region starts that were followed by a non-addressable
region start.

In the address region edit dialog, split up the descriptive text for
the "resize" option to make it easier to see the new end offset and
length.  It doesn't look quite right because it's not using the mono
font like the text near the top, but it'll do.

When multiple lines are selected, the Info window now shows the first
line/offset, last line/offset, and bytes spanned by the selection.
This is helpful if you're trying to figure out how big something is.
2021-10-11 14:44:44 -07:00
Andy McFadden
387b50d827 Implement IsRelative for cc65/merlin32
Added support for "relative" address regions to the Merlin 32 and cc65
code generators.  These generate "flat" address directives, and so
were a little more complicated.

Suppressed generation of relative operands for non-addressable regions.

Also, tweaked the 20250-nested-regions test to include a negative
relative region offset.
2021-10-09 10:08:14 -07:00
Andy McFadden
f56e4f2bec Version 1.8.0-dev1 2021-10-08 12:33:32 -07:00
Andy McFadden
1a00eb0cb7 Add warning to manual when viewed from web
Added a warning to the index page that only appears when viewing it
over http/https.  The issue is that the manual on the web reflects the
tip-of-tree sources, which may be inaccurate for whatever version the
user has.

Also, provide an alternate path to opening the manual in-app when
under development.
2021-10-08 11:01:03 -07:00
Andy McFadden
ed4cc84782 Relocate manual
Move the SourceGen manual to a subdirectory in "docs", so that it can
be accessed directly from the 6502bench web site.  The place where
it's installed in the distribution doesn't change.
2021-10-08 08:43:12 -07:00
Andy McFadden
a395909574 Add a couple of funky projects
Added a project with a few bad address region definitions, and one to
exercise the security sandbox.

Also, fiddled with the documentation a little.
2021-10-08 08:36:44 -07:00
Andy McFadden
0ca9911d0d ORG rework, part 10 (of 10)
Update documentation.  Made lots of address region changes, and split
"intro" into two parts.  Removed all content from "tutorials.html".

This does not update the tutorial, because that goes live as soon as
it's checked in.
2021-10-07 17:59:43 -07:00
Andy McFadden
0ac0686c7a ORG rework, part 9
Modified "jump to" code to understand address range start/end lines.
If there are multiple starts or ends at the same offset, we jump to
the first one in the set, which is suboptimal but simpler to do.
Simplified the API, embedding GoToMode in the Location object (which
is where it really needs to be, to make fwd/back work right).

Updated HTML export to grey out addresses in NON_ADDR sections.

Changed default pseudo-op strings for address regions to ".addrs" and
".adrend", after trying a bunch of things that were worse.  Added
definitions for region-end pseudo-ops to Merlin32 and cc65 for display
on screen.

Added regression test 20260 for address region pre-labels.

Fixed handling of leading underscores in platform/project symbols.
These need to be escaped in 64tass output.  Updated regression test
20170-external-symbols to check it.
2021-10-07 12:39:30 -07:00
Andy McFadden
d2326c389f ORG rework, part 8
Implemented address region pre-labels.  These are useful if the code is
relocating a block from address A to address B, because the code that
does the copying refers to both the "before" address and the "after"
address.  Previously you'd give the block the "after" address and the
"before" would just appears as hex, because it's effectively an
external address.

Pre-labels are shown on screen with their address, but no other fields.
Showing the address makes it easy to see the label's value, which isn't
always obvious right before a .arstart.  The labels are suppressed if the
address value evaluates to non-addressable.

This defines a new type of symbol, which is external and always global
in scope.  Pre-labels affect label localization and must go through
the usual remapping to handle clashes with opcode mnemonics and the
use of leading underscores.  Cross-references are computed, but are
associated with the file offset rather than the label line itself.

Added a new filter to the Symbols window ("PreL").

Implemented label input and checking in the address editor.  Generally
added highlighting of relevant error labels.
2021-10-04 20:41:19 -07:00
Andy McFadden
e8608770b9 ORG rework, part 7
Implemented "is relative" flag.  This only affects source code
generation, replacing ".arstart <addr>" with ".arstart *+<value>".
Only output by 64tass and ACME generators.

Added a bold-text summary to radio buttons in address region edit
dialog.  This makes it much easier to see what you're doing.  Added
a warning to the label edit dialog when a label is being placed in
a non-addressable region.

Modified double-click behavior for .arstart/.arend to jump to the
other end when the opcode is clicked on.  This matches the behavior
of instructions with address operands.

Reordered Actions menu, putting "edit operand" at the top.

Fixed AddressMap entry collision testing.
Fixed PRG issue with multiple address regions at offset +000002.

Added regression tests.  Most of the complicated stuff with regions
is tested by unit tests inside AddressMap, but we still need to
exercise nested region code generation.
2021-10-02 15:43:41 -07:00
Andy McFadden
e6c5c7f8df ORG rework, part 6
Added support for non-addressable regions, which are useful for things
like file headers stripped out by the system loader, or chunks that
get loaded into non-addressable graphics RAM.  Regions are specified
with the "NA" address value.  The code list displays the address field
greyed out, starting from zero (which is kind of handy if you want to
know the relative offset within the region).

Putting labels in non-addressable regions doesn't make sense, but
symbol resolution is complicated enough that we really only have two
options: ignore the labels entirely, or allow them but warn of their
presence.  The problem isn't so much the label, which you could
legitimately want to access from an extension script, but rather the
references to them from code or data.  So we keep the label and add a
warning to the Messages list when we see a reference.

Moved NON_ADDR constants to Address class.  AddressMap now has a copy.
This is awkward because Asm65 and CommonUtil don't share.

Updated the asm code generators to understand NON_ADDR, and reworked
the API so that Merlin and cc65 output is correct for nested regions.

Address region changes are now noted in the anattribs array, which
makes certain operations faster than checking the address map.  It
also fixes a failure to recognize mid-instruction region changes in
the code analyzer.

Tweaked handling of synthetic regions, which are non-addressable areas
generated by the linear address map traversal to fill in any "holes".
The address region editor now treats attempts to edit them as
creation of a new region.
2021-09-30 21:11:26 -07:00
Andy McFadden
2fed19ac47 ORG rework, part 5
Updated project file format to save the new map entries.

Tweaked appearance of .arend directives to show the .arstart address
in the operand field.  This makes it easier to match them up on screen.
Also, add a synthetic comment on auto-generated .arstart entries.

Added .arstart/.arend to the things that respond to Jump to Operand
(Ctrl+J).  Selecting one jumps to the other end.  (Well, it jumps
to the code nearest the other, which will do for now.)

Added a menu item to display a text rendering of the address map.
Helpful when things get complicated.

Modified the linear map iterator to return .arend items with the offset
of the last byte in the region, rather than the first byte of the
following region.  While the "exclusive end" approach is pretty
common, it caused problems when updating the line list, because it
meant that the .arend directives were outside the range of offsets
being updated (and, for directives at the end of the file, outside
the file itself).  This was painful to deal with for partial updates.
Changing this required some relatively subtle changes and annoyed some
of the debug assertions, such as the one where all Line items have
offsets that match the start of a line, but it's the cleaner approach.
2021-09-27 18:13:06 -07:00
Andy McFadden
3a2c4fa6d2 ORG rework, part 4
Reimplemented "set address" dialog as the Address Region Editor.  The
new dialog configures itself differently depending on whether the user
appears to be trying to create, edit, or resize a region.  Each mode
has two options, to allow the user to choose between floating and fixed
end points.

The old dialog would allow you to delete an address override by erasing
the address field.  Now there's an explicit "delete region" button.

Changed the SetAddress undoable change function to use AddressMapEntry
objects.

We now show detailed information on .arstart/.arend in the Info window
when the lines are selected.

PRG files are now created without specifying a region for the first
two bytes, so the load address exists in a NON_ADDR hole.  Fixed a
couple of issues to make that look right.
2021-09-26 17:17:54 -07:00
Andy McFadden
5f472b60cf ORG rework, part 3
Split ".org" into ".arstart" and ".arend" (address range start/end).
Address range ends are now shown in the code list view, and the
pseudo-op can be edited in app settings.  Address range starts are
now shown after notes and long comments, rather than before, which
brings the on-screen display in sync with generated code.

Reworked the address range editor UI to include the new features.
The implementation is fully broken.

More changes to the AddressMap API, putting the resolved region length
into a separate ActualLength field.  Added FindRegion().  Renamed
some things.

Code generation changed slightly: the blank line before a region-end
line now comes after it, and ACME's "} ;!pseudopc" is now just "}".
This required minor updates to some of the regression test results.
2021-09-22 15:28:11 -07:00
Andy McFadden
d4c481839e ORG rework, part 2
AddressMap API reshuffle.  Added "pre-label" to class and API.  Split
AddressMapEntry into two parts to make it clear when FLOATING_LEN
has been resolved.

Updated display line list generator to use in-line linear map
traversal.  Previous approach was to walk through the list of regions
in a second pass, inserting .ORG directives, but that was awkward
and is no longer needed.
2021-09-20 15:17:17 -07:00
Andy McFadden
39b7b20144 ORG rework, part 1
This is the first step toward changing the address region map from a
linear list to a hierarchy.  See issue #107 for the plan.

The AddressMap class has been rewritten to support the new approach.
The rest of the project has been updated to conform to the new API,
but feature-wise is unchanged.  While the map class supports
nested regions with explicit lengths, the rest of the application
still assumes a series of non-overlapping regions with "floating"
lengths.

The Set Address dialog is currently non-functional.

All of the output for cc65 changed because generation of segment
comments has been removed.  Some of the output for ACME changed as
well, because we no longer follow "* = addr" with a redundant
pseudopc statement.  ACME and 65tass have similar approaches to
placing things in memory, and so now have similar implementations.
2021-09-16 17:02:19 -07:00
Andy McFadden
0dfa2326dd Fix L1/L2 ASCII string editing
The data operand editor determines low vs. high ASCII formatting by
examining the first byte of string data.  Unfortunately the test was
broken, and for strings with a 1- or 2-byte length, was testing the
length byte instead of the character data.  This is now fixed.

This also changes the way empty strings are handled.  Before, they
were allowed but not counted, so you couldn't create an empty string
by itself, but could do it if it were part of a larger group.  This
was unnecessarily restrictive.  Empty L1/L2/null-term strings are now
allowed.

This means that a buffer full of $00 can be formatted as a big pile
of empty strings, which seems a bit ridiculous but there's no good
reason to obstruct it.

(issue #110)
2021-09-12 09:46:55 -07:00
Andy McFadden
74fa310718 Fix multi-select with highlighted target
If you select a line that refers to another line, the target line's
address is highlighted.  If you select multiple lines, the highlight
is removed.  The code that removes the highlight was inadvertently
resetting the selection, making it impossible to shift-click a
range that ended with a highlighted line.
2021-09-11 10:48:38 -07:00
Andy McFadden
bdad8501f0 Minor fix for Merlin32
The test for '{' needed more parenthesis.
2021-08-23 17:22:56 -07:00
Andy McFadden
fc5f36885a Fix crash when window panel sizes are off
The code could attempt to set a negative height for the windows in
the side panels.

(issue #108)
2021-08-21 07:45:11 -07:00
Andy McFadden
f4bee76023 Update junk counter
The bottom of the main window shows the total bytes in the project
along with how many are code, data, and junk.  The junk figure wasn't
updating if you changed a data item to junk or vice-versa, because a
simple format change doesn't require reanalyzing the file.

To make the counter "live", we need to tell the updater to refresh the
values whenever a format changes to or from "junk".
2021-08-19 14:40:27 -07:00
Andy McFadden
df2154564f Version 1.7.5 2021-08-16 12:38:58 -07:00
Andy McFadden
b23eefaa1a Improve handling of vanishing selection
If you select a note or long comment and delete it, the selection is
lost, because the selected item no longer exists.  This is inconvenient
if you're working with the keyboard, because it moves the keyboard
position to the top of the file.

If the previous selection was non-empty, and the new selection is
empty, we want to select the line that would have appeared below the
item that was deleted.  Making this work exactly right is a bunch of
work, but we can make it work mostly right by selecting the first line
associated with the offset of the previous selection.
2021-08-15 14:31:11 -07:00
Andy McFadden
992e008e7d Add multi-inline extension script to tutorial
It's useful to have an example of an extension script that handles
multiple types of things.  It's also good to show that scripts can
handle data types other than strings, and can chase an address to
format data items elsewhere in the code.

This required updating the tutorial binary, adding the new script,
and updating the tutorial text and associated screen shots.
2021-08-15 10:00:00 -07:00
Andy McFadden
ec2ad529c8 Remove a couple of faulty assertions
One asserted unnecessarily, one should have been an if/then.  Both
were concerned with instruction operands being formatted with
type "address".
2021-08-11 16:25:24 -07:00
Andy McFadden
635084db9d Fix DCI string edge case
If a DCI string ended with a string delimiter or non-ASCII character
(e.g. a PETSCII char with no ASCII equivalent), the code generator
output the last byte as a hex value.  This caused an error because it
was outputting the raw hex value, with the high bit already set, which
the assembler did not expect.

This change corrects the behavior for code generation and on-screen
display, and adds a few samples to the regression test suite.

(see issue #102)
2021-08-10 14:08:39 -07:00
Andy McFadden
fa1b0af932 Clarify 2021-08-09 16:22:17 -07:00
Andy McFadden
7f82362985 Version 1.7.5-dev4 2021-08-09 15:01:46 -07:00
Andy McFadden
3a02132694 Update 64tass code gen
64tass v1.55.2176 added a missing undocumented op, so we can remove
the workaround unless we're configured for an older version.
2021-08-09 14:26:25 -07:00
Andy McFadden
478afa542e Fix 64tass code gen corner case
On the 65816, if you say "JSR foo" from bank $12, but "foo" is an
address in bank 0, most assemblers will conclude that you're forming
a 16-bit argument with a 16-bit address and assemble happily.  64tass
halts with an error.  Up until v1.55 or so, you could fake it out
by supplying a large offset.

This no longer works.  The preferred way to say "no really I mean to
do this" is to append ",k" to the operand.  We now do that as needed.

I didn't want to define a new ExpressionMode for 64tass just to
support an operand modifier that should probably never actually get
generated (you can't call across banks with JSR!), so this is
implemented with a quirk and an op flag.

64tass v1.56.2625 is now the default.

(issue #104)
2021-08-09 14:11:15 -07:00
Andy McFadden
19ba34760b Rework ItemContainerGenerator StatusChanged hack
This is another attempt to fix the ListView keyboard position
behavior.  Basic problem: if you change something in the ListView,
the keyboard position is lost, and WPF doesn't expose a nice way to
save and restore it.  It appears the way to set the position is by
calling Focus() on the specific item you want to have as the "current"
keyboard position, but you can only do that at certain times.

This attempt removes the grid-splitter resize hack, in favor of just
setting a "needs refocus" flag when we restore the selection set.
This causes Focus() to be called from the StatusChanged callback on
the next event with status="containers generated".

During testing I noticed some other odd behavior: if you used "goto"
to jump to an address, up/down arrows would change focus to a
different control (menu items, grid splitters, etc).  The problem
there was that we were setting focus to the ListView control rather
than to a ListViewItem, so arrow keys were in control-traversal mode
rather than list-walk mode.  That is also fixed.

(Issue #105)
2021-08-08 17:39:21 -07:00
Andy McFadden
3368182e14 Allow single-character DCI strings
The DCI string format uses character values where the high bit of the
last byte differs from the rest of the string.  Usually all the high
bits are clear except on the last byte, but SourceGen generally allows
either polarity.

This gets a little uncertain with single-character strings, because
SourceGen can't auto-detect DCI very effectively.  A series of bytes
with the high bit set could be a single high-ASCII string or a series
of single-byte DCI strings.

The motivation for allowing them is C64 PETSCII.  While ASCII allows
"high ASCII" as an escape hatch, PETSCII doesn't have that option, so
there's no way to mark the data as a character or a string.  We still
want to do a bit of screening, but if the user specifies a non-ASCII
character set and the selected bytes have their high bits set, we
want to just treat the whole set as 1-byte DCI.

Some minor adjustments were needed for a couple of validity checks
that expected longer strings.

This adds some short DCI strings in different character sets to the
char-encoding regression tests.

(for issue #102)
2021-08-08 15:38:39 -07:00
Andy McFadden
3b37f9a449 Version 1.7.5-dev3 2021-08-01 20:06:01 -07:00
Andy McFadden
44b483c8d8 Fix table formatting for embedded destinations
The code for formatting an address table allows you to specify that
code start tags should be placed on all targets.  However, unnecessary
tags are undesirable, and it's not necessary to add a tag if the
target is already treated as executable code.  So the implementation
tested to see if the target address was already an instruction.

The code was incorrectly testing for "is instruction", rather than "is
instruction start", which meant that if the table entry pointed at an
instruction embedded inside another instruction we would conclude that
the tag wasn't necessary, when in fact it was.  Not only weren't we
getting a useful table entry, we were adding a symbolic reference to a
hidden label.

(issue #103)
2021-08-01 18:15:44 -07:00
Andy McFadden
d65ab59461 Don't reject strings with "invalid" characters
When formatting one or more strings with the Edit Data Operand dialog,
the code must determine which options to present.  If the selected
bytes appear to represent one or more null-terminated strings, that
option is enabled in the UI.

The "format recognizers" enforce some strict rules, e.g. null-
terminated strings must end in $00, and also try to confirm that the
data looks like a printable string.  The algorithm rejects strings
with "illegal" characters in them.  This is simpler on some systems
than others.  For example, C64 PETSCII defines quite a few control
characters in ways that make them useful for embedding in printable
strings.

The "recognizers" are only used by the operand edit feature, not as
part of an automated string detector, so there's no real upside in
overriding the user's desire to form a string with arbitrary bytes.

This removes the quick rejection from the four recognizers (null-term,
len8, len16, dci).  It does not alter the high-level code, which
still insists on a certain percentage of the string being printable;
that may be worth revisiting as well.

(issue #100)
2021-08-01 17:50:32 -07:00
Andy McFadden
8db554c1cd Fix 64tass output for non-loadable files
64tass wants to place its output into a 64KB region of memory,
starting at the address "*" is set to, and continuing without
wrapping around the end of the bank.  Some files aren't meant to be
handled that way, so we need to generate the output differently.

If the file's output fits nicely, it's considered "loadable", and
is generated in the usual way.  If it doesn't, it's treated as
"streamable", and the initial "* = addr" directive is omitted
(leaving "*" at zero), and we go straight to ".logical" directives.

65816 code with an initial address outside bank 0 is treated as
"streamable" whether or not the contents fit nicely in the designated
64K area.  This caused a minor change to a few of the 65816 tests.

A new test, 20240-large-overlay, exercises "streamable" by creating
a file with eight overlapping 8KB segments that load at $8000.
While the file as a whole fits in 64KB, it wouldn't if loaded at
the desired start address.

Also, updated the regression test harness to report assembler
failure independently of overall test failure.  This makes it easier
to confirm that (say) ACME v0.96.4 still works with the code we
generate, even though it doesn't match the expected output (which
was generated for v0.97).

(problem was raised in issue #98)
2021-08-01 17:21:20 -07:00
Andy McFadden
752fa06ef5 Tweak backslash escaping
The initial implementation was testing the byte value rather than
the converted value, so backslashes were getting through in high
ASCII strings.  PETSCII and C64 screen codes don't really have a
backslash so it's not really an issue there.

The new implementation handles high ASCII correctly.  The various
201n0-char-encoding-x regression tests have been updated to verify
this.
2021-07-31 20:22:21 -07:00
Andy McFadden
8fc38d5d90 Update ACME version in docs
Added v0.97 to list of successfully-tested versions.

Noted that regression tests are now run against v0.97.
2021-07-31 15:15:21 -07:00
Andy McFadden
a1130ddc2b Fix the "target assembler" comment
The code generator outputs an optional comment specifying which
version of which assembler the code was generated for.  This was
handled inconsistently and, for the most part, incorrectly.  We now
report the correct version.
2021-07-31 14:56:17 -07:00
Andy McFadden
8c053c29f2 Update ACME generator for v0.97
Two things changed: (1) string literals can now hold backslash
escapes like "\n"; (2) MVN/MVP operands can now be prefixed with '#'.
The former was a breaking change because any string with "\" must
be changed to "\\".  This is now handled by the string operand
formatter.

Also, improved test harness output.  Show the assembler versions at
the end, and include assembler failure messages in the collected
output.
2021-07-31 14:42:36 -07:00
Andy McFadden
c16e646701 Add a line to 20052-branches-and-banks
Throw a non-bank-zero JSR <hexaddr> into the mix.
2021-07-31 13:51:35 -07:00
Andy McFadden
38bc7721a4 Fix "goto address" for overlapping segments
If you have multiple overlapping segments (say, four 8KB chunks
that all load at $8000), and you use the "goto" command to jump
to address $8100, it should try to jump to that address within
whichever segment you happen to be working (based on the current
line selection).  If that address doesn't exist in the current
segment, it's okay to punt and jump to the first occurrence of that
address in the file.

The existing code was always jumping to the first instance.

(related to issue #98)
2021-07-30 14:40:17 -07:00
absindx
f8673d81b0 Change entry flags to native mode 2021-07-30 01:02:08 +09:00
absindx
64c7ce28f9 Fixes that reflect feedback.
* Remove excess MULTI_MASK
* Delete placeholder message
2021-07-29 23:46:05 +09:00
absindx
363c2eef76 Added SNES symbol 2021-07-29 22:51:41 +09:00
Andy McFadden
8487508740 Version 1.7.5-dev2 2021-07-20 13:20:32 -07:00
Andy McFadden
03a0fc13fd Expand max local variable width to 257
Code generated by one of the C compilers sets up the stack frame and
then maps the direct page on top of it.  If the value at the top of
the stack is 16 bits, it will be referenced via address $ff.  The
local variable editor was regarding this as illegal, because lvars are
currently only defined for direct page data, and the value doesn't
entirely fit there (unless you're doing an indirect JMP on an NMOS
6502, in which case it wraps around to $00... but let's ignore that).

The actual max width of a local variable is 257 because of the
possibility of a 16-bit access at $ff.

Older versions of SourceGen don't seem to have an issue when they
encounter this situation, as worrying about (start+width) is really
just an editor affectation.  The access itself is still a direct-page
operation.  You won't be able to edit the entry without reducing the
length, but otherwise everything works.  I don't think there's a need
to bump the file version.
2021-07-20 13:08:19 -07:00
Andy McFadden
bc7a225080 Expand 20152-local-variables test
Added a compiled C implementation of strlen().  The most interesting
part about this is that it references a 16-bit value via direct-page
address $ff, which means you'd want a local variable with
address=$ff and width=2.  The current UI prevents this.
2021-07-20 11:28:26 -07:00
Andy McFadden
e42bb2d262 Version 1.7.5-dev1 2021-07-04 09:40:47 -07:00
Didier
fc1b328fb4
Merge branch 'fadden:master' into master 2021-07-03 23:00:26 +02:00
dma-coco-pc
ee25373a43 Modifying errors after feedback
Compiling errors corrected
2021-07-03 22:57:33 +02:00
Andy McFadden
1472609d15 Improve label validation for platform symbol files
We were using a very simple regex pattern for the label part, and
not performing additional validation checks later.  This allowed
a symbol that started with a number (e.g. "4ALL") to get much farther
than it should have.

This change modifies the regex pattern to match only valid label
syntax.
2021-07-03 12:32:02 -07:00
dma-coco-pc
4ae22e1752 Adding Oric system
SystemDefs modified, and Oric system files added
2021-07-03 08:02:55 +02:00
Andy McFadden
78eafa6100 Improve OMF feature docs 2021-06-15 08:57:00 -07:00
Andy McFadden
ab8853219b Version 1.7.4 2021-06-08 13:15:19 -07:00
Andy McFadden
c351fa969d Update docs to point to new tutorial
Replaced the link at the top of the manual.  Remove reference to
old tutorial doc.  Added an obsolescence notice to the top of the
old tutorial.  Updated tutorial message and link in README.

Also, fixed sidenav style.
2021-06-07 17:55:51 -07:00
Andy McFadden
6ef43a3b1a Fix format/typo errors in tutorial 2021-06-04 18:43:36 -07:00
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