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

278 Commits

Author SHA1 Message Date
Andy McFadden
0fc121c9cb Add ability to "erase" previously-defined platform symbols
While disassembling some code I found that I wanted the ROM entry
points, but the zero page usage was significantly different and the
ROM labels were distracting.  Splitting the symbol file in two was
a possibility, but I'm afraid this will lead to a very large
collection of very small files, and we'll lose any sense of relation
between the ROM entry points and the ZP addresses used to pass
arguments.

Platform symbols have the lowest priority when resolving by address,
but using that to hide the unwanted labels requires creating project
symbols or local variables for things that you might not know what
they do yet.  It's possible to hide a platform symbol by adding
another symbol with the same label and an invalid value.

This change formalizes and extends the "hiding" of platform symbols
to full erasure, so that they don't clutter up the symbol table.
This also tightens up the platform symbol parser to only accept
values in the range 0 <= value <= 0x00ffffff (24-bit positive
integers).

An "F8-ROM-nozp" symbol file is now part of the standard set.  A
project can include that to erase the zero-page definitions.

(I'm not entirely convinced this is the right approach, so I'm not
doing this treatment on other symbol files... consider this an
experiment.  Another approach would be some sort of conditional
inclusion, or perhaps erase-by-tag, but that requires some UI work
in the app to define what you want included or excluded.)
2019-10-27 11:09:16 -07:00
Andy McFadden
c49888331a Minor tweaks
- Allow user to "unnecessarily" set an address override.  This is
  a handy thing to do when dealing with code that does a lot of
  relocations.

- Moved "save needed" text to the end of the title string.

- Updated F8-ROM syms.

- Added ProDOS 8 error code constants
2019-10-26 23:34:51 -07:00
Andy McFadden
d99eec0d4f Open damaged projects in read-only mode
If we detect a problem that requires intervention during loading,
e.g. we find unknown elements because we're loading a file created
by a newer version, default to read-only mode.

Read only mode (1) refuses to apply changes, (2) refuses to add
changes to the undo/redo list, and (3) disables Save/SaveAs.  The
mode is indicated in the title bar.

Also, flipped the order of items in the title bar so that "6502bench
SourceGen" comes last.  This allows you to read the project name in
short window title snippets.  (Visual Studio, Notepad, and others
do it this way as well.)
2019-10-26 13:20:54 -07:00
Andy McFadden
6344ea59bb Add Apple-1 symbols
From a post on comp.sys.apple2:
https://groups.google.com/d/msg/comp.sys.apple2/SBBdH1ChMwQ/mnygA3WVEAAJ
2019-10-26 08:28:49 -07:00
Andy McFadden
00612097f6 Minor updates
Add a link to the web site in the About box.

Add an up-link to the HTML export template.

Escape '<', '>', and '&' in the Applesoft to HTML converter.
2019-10-25 18:16:09 -07:00
Andy McFadden
eb99a716f1 Add scripts and inline data to tutorials
Added an inline data formatting section to Tutorial2.

Added a new section on extension scripts, using Scripts/Sample as
the code.
2019-10-23 14:52:52 -07:00
Andy McFadden
463fbff368 Show load address in Edit Address dialog
Sometimes code relocates a few bits of itself but not others.  We
don't currently have a way to say, "go back to where we would have
been".  As a cheap alternative, we now show the "load address", i.e.
where we'd be if there were no address map entries after the first.
2019-10-22 13:58:32 -07:00
Andy McFadden
1b0ee7de21 Fix display of instruction attributes
The "affected flags" constants were incorrect for BIT, BRK, COP,
RTI, XCE, and the undocmented instructions ANE, DCP, and SAX.  The
constants are used for the changed-flag summary shown in the info
window and the instruction chart.

Of greater import: the status flag updater for BIT was incorrectly
marking N/V/C as indeterminate instead of N/V/Z.  The undocmented
instructions ANE, DCP, and SAX were also incorrect.

The cycle counts shown in line comments are computed correctly, but
the counts shown in the info window and instruction chart were
displaying the full set of modifiers, ignoring the CPU type.  That's
okay for the info window, which spells the modifiers out, though
it'd be better if the bits were explicitly marked as being applicable
to the current CPU or a different one.
2019-10-22 10:48:02 -07:00
Andy McFadden
7bbccaf71f Minor tweaks
Mark the "info" window as read-only.

When the project closes, clear the contents of the Symbols and
Notes windows.

Clarify some Apple II I/O definitions.
2019-10-21 17:43:40 -07:00
Andy McFadden
bcac8bc6a0 Add instruction chart
This adds a window that displays all of the instructions for a
given CPU in a summary grid.  Undocumented instructions are
included, but shown in grey italics.

Also, tweaked AppSettings to not mark itself as dirty if a "set"
operation doesn't actually change anything.
2019-10-21 15:15:09 -07:00
Andy McFadden
a4f1de1238 Add message list, part 2 (of 2)
Implemented show/hide mechanic, using a button on the right side of
the status bar to show status and to trigger un-hide.

Also, show I/O direction in project symbols editor list.
2019-10-20 18:02:23 -07:00
Andy McFadden
3cc6f32c6f Put some stuff in a "Navigate" menu
Created a Navigate menu, and put the menu items for Find and Go To
in it.  Added menu items for nav-forward and nav-backward, which
until now were only available as toolbar buttons.
2019-10-19 17:46:40 -07:00
Andy McFadden
cd23580cc5 Add junk/align directives
Sometimes there's a bunch of junk in the binary that isn't used for
anything.  Often it's there to make things line up at the start of
a page boundary.

This adds a ".junk" directive that tells the disassembler that it
can safely disregard the contents of a region.  If the region ends
on a power-of-two boundary, an alignment value can be specified.

The assembly source generators will output an alignment directive
when possible, a .fill directive when appropriate, and a .dense
directive when all else fails.  Because we're required to regenerate
the original data file, it's not always possible to avoid generating
a hex dump.
2019-10-18 21:00:28 -07:00
Andy McFadden
f31b7f5822 Fix constants declared with MULTI_MASK
The masks should only be applied to address symbols.  We were
rejecting constants that didn't match the pattern.
2019-10-18 16:19:42 -07:00
Andy McFadden
716dce5f28 Pass operand to extension script JSR/JSL handlers
Sort of silly to have every handler immediately pull the operand out
of the file data.  (This is arguably less efficient, since we now
have to serialize the argument across the AppDomain boundary, but
we should be okay spending a few extra nanoseconds here.)
2019-10-17 13:15:25 -07:00
Andy McFadden
bd11aea4a4 External symbol I/O direction and address mask, part 3 (of 3)
Added regression tests.  Improved error messages.  Updated
documentation.
2019-10-16 17:32:30 -07:00
Andy McFadden
4d8ee3fd07 External symbol I/O direction and address mask, part 2
First cut at lookup-by-address implementation.  Seems to work, but
needs full tests.
2019-10-16 14:55:10 -07:00
Andy McFadden
9c3422623d External symbol I/O direction and address mask, part 1
Memory-mapped I/O locations can have different behavior when read
vs. written.  This is part 1 of a change to allow two different
symbols to represent the same address, based on I/O direction.

This also adds a set of address masks for systems like the Atari
2600 that map hardware addresses to multiple locations.

This change updates the data structures, .sym65 file reader,
project serialization, and DefSymbol editor.
2019-10-15 19:12:57 -07:00
Andy McFadden
fac2d6a51f Invoke extension scripts when labels they care about change
We were failing to update properly when a label changed if the label
was one that a plugin cared about.  The problem is that a label
add/remove operation skips the code analysis, and a label edit skips
everything but the display update.  Plugins only run during the code
analysis pass, so changes weren't being reflected in the display
list until something caused it to refresh.

The solution is to ask the plugin if the label being changed is one
that it cares about.  This allows the plugin to use the same
wildcard-match logic that it uses elsewhere.

For efficiency, and to reduce clutter in plugins that don't care
about symbols, a new interface class has been created to handle the
"here are the symbols" call and the "do you care about this label"
call.

The program in Examples/Scripts has been updated to show a very
simple single-call plugin and a slightly more complex multi-call
plugin.
2019-10-13 18:32:53 -07:00
Andy McFadden
76efbcfcbe Rename button text 2019-10-13 15:21:05 -07:00
Andy McFadden
df2f3803f4 SourceGen After Dark
Most of SourceGen uses standard WPF controls, which get their default
style from the system theme.  The main disassembly list uses a
custom style, and always looks like the Windows default theme.

Some people greatly prefer white text on a black background, so we
now provide a way to get that.  This also requires muting the colors
used for Notes, since those were chosen to contrast with black text.

This does not affect anything other than the ListView used for
code, because everything else can be set through the Windows
"personalization" interface.  We might want to change the way the
Notes window looks though, to avoid having glowing bookmarks on
the side.
2019-10-12 17:23:32 -07:00
Andy McFadden
547ecd2173 Update comments 2019-10-12 17:18:04 -07:00
Andy McFadden
d8604294bb Change how the "quick set" settings work
The last two tabs in the Edit App Settings dialog have "quick set"
buttons configure all fields for a particular assembler, or reset
them to default values.  The previous UI was a little annoying,
because you had to pick something from the combo box and then hit
"set" to push the change.  It was also confusing, because if you
came back later the combo box was just set to the first entry, not
the thing you picked last.

Now, picking an entry from the combo box immediately updates all
fields.  The combo box selection is set to reflect the actual
contents (so if you set everything just right, the combo box will
change to a specific assembler).  If nothing matches, a special
entry labeled "Custom" is selected.

Also, rearranged the tutorial sections in the manual so the
address table formatting comes last, and appears in the local TOC.
2019-10-11 17:39:52 -07:00
Andy McFadden
3a67c14247 Add "find previous"
The Find box now has forward/backward radio buttons.  Find Next
searches forward, and Find Previous searches backward, regardless
of the direction of the initial search.

The standard key sequence for "find previous" is Shift+F3.  The WPF
ListView has some weird logic that does something like: if you hit
a key, and the selection changes, and the shift key was held down,
then you must have meant to select a range.  So Shift+F3 often (but
not always) selects a range.  I think this might be fixable if I can
figure out how ListView keeps track of the current keyboard
navigation position (which is not the same as the selection).  For
now I'm working around the problem by using Ctrl+F3 to search.
Yay WPF.
2019-10-09 17:47:07 -07:00
Andy McFadden
dfd5bcab1b Optionally treat BRKs as two-byte instructions
Early data sheets listed BRK as one byte, but RTI after a BRK skips
the following byte, effectively making BRK a 2-byte instruction.
Sometimes, such as when diassembling Apple /// SOS code, it's handy
to treat it that way explicitly.

This change makes two-byte BRKs optional, controlled by a checkbox
in the project settings.  In the system definitions it defaults to
true for Apple ///, false for all others.

ACME doesn't allow BRK to have an arg, and cc65 only allows it for
65816 code (?), so it's emitted as a hex blob for those assemblers.
Anyone wishing to target those assemblers should stick to 1-byte mode.

Extension scripts have to switch between formatting one byte of
inline data and formatting an instruction with a one-byte operand.
A helper function has been added to the plugin Util class.

To get some regression test coverage, 2022-extension-scripts has
been configured to use two-byte BRK.

Also, added/corrected some SOS constants.

See also issue #44.
2019-10-09 14:55:56 -07:00
Andy McFadden
b8e11215fa Add separate button for adding symbols+scripts from project
The "add platform symbol file" and "add extension script" buttons
create a file dialog with the initial directory set to the
RuntimeData directory inside the SourceGen installation directory.
This is great if you're trying to add a file from the platform
definitions, but annoying if you're trying to add it from the
project directory.

It's really convenient to not have to hunt around though, so now
there are two buttons: one for platform, one for project.  The
latter is disabled if the project is new and hasn't been saved yet.
2019-10-09 13:24:09 -07:00
Andy McFadden
98ebf449ef Tweak comments
Useful comments need to be on each line, so that they appear in the
disassembly listing.
2019-10-08 17:46:00 -07:00
Andy McFadden
86c4331cce Add issues & limitations for scripts to manual
Also, note in the code where we're discarding the compiler error
messages.
2019-10-07 17:56:35 -07:00
Andy McFadden
57d8514faa Format ProDOS 8 parameter blocks
If it's a known function, apply basic numeric formatting to the
various fields.  Primarily of value for the pathname and buffer
parameters, which are formatted as addresses.

Also, enable horizontal scrolling in the generic show-text dialog.
2019-10-07 15:42:40 -07:00
Andy McFadden
245e0bd9f3 Make address translation available to extension scripts
The current AddressMap is now passed into the plugin manager, which
wraps it in an AddressTranslate object and passes that to the
plugins at Prepare() time.  This allows plugins to convert addresses
to offsets, making it possible to format complex structures.

This breaks existing plugins.
2019-10-06 18:13:39 -07:00
Andy McFadden
8c87ce3004 Check formatted string structure at load time
If we have a bug, or somebody edits the project file manually, we
can end up with a very wrong string, such as a null-terminated
string that isn't, or a DCI string that has a mix of high and low
ASCII from start to finish.  We now check all incoming strings for
validity, and discard any that fail the test.  The verification
code is shared with the extension script inline data formatter.

Also, added a comment to an F8-ROM symbol I stumbled over.
2019-10-06 17:07:07 -07:00
Andy McFadden
28eafef27c Expand the set of things SetInlineDataFormat accepts
Extension scripts (a/k/a "plugins") can now apply any data format
supported by FormatDescriptor to inline data.  In particular, it can
now handle variable-length inline strings.  The code analyzer
verifies the string structure (e.g. null-terminated strings have
exactly one null byte, at the very end).

Added PluginException to carry an exception back to the plugin code,
for occasions when they're doing something so wrong that we just
want to smack them.

Added test 2022-extension-scripts to exercise the feature.
2019-10-05 19:51:34 -07:00
Andy McFadden
9a11ffea49 Missed a spot 2019-10-04 17:55:48 -07:00
Andy McFadden
3c3209b67f Expand set of symbols available to plugins
We were providing platform symbols to plugins through the PlatSym
list, which allowed them to find constants and well-known addresses.
We now pass all project symbols and user labels in as well.  The
name "PlatSym" is no longer accurate, so the class has been renamed.

Also, added a bunch of things to the problem list viewer, and
added some more info to the Info panel.

Also, added a minor test to 2011-hinting that does not affect the
output (which is the point).
2019-10-04 16:57:57 -07:00
Andy McFadden
3172ea0b70 Update Apple II data files
Added symbols for the ProDOS 8 global page, as well as some notes
about screen holes.

Also, if a platform symbol has a tag, show it in the Info panel.
2019-10-03 15:18:59 -07:00
Andy McFadden
b1d11480f3 Fix errors in manual 2019-10-03 10:53:56 -07:00
Andy McFadden
37855c8f8e Allow explicit widths in project/platform symbols, part 4 (of 4)
Handle situation where a symbol wraps around a bank.  Updated
2021-external-symbols for that, and to test the behavior when file
data and an external symbol overlap.

The bank-wrap test turned up a bug in Merlin 32.  A workaround has
been added.

Updated documentation to explain widths.
2019-10-03 10:32:54 -07:00
Andy McFadden
2a41d70e04 Allow explicit widths in project/platform symbols, part 1
The ability to give explicit widths to local variables worked out
pretty well, so we're going to try adding the same thing to project
and platform symbols.

The first step is to allow widths to be specified in platform files,
and set with the project symbol editor.  The DefSymbol editor is
also used for local variables, so a bit of dancing is required.
For platform/project symbols the width is optional, and is totally
ignored for constants.  (For variables, constants are used for the
StackRel args, so the width is meaningful and required.)

We also now show the symbol's type (address or constant) and width
in the listing.  This gets really distracting when overused, so we
only show it when the width is explicitly set.  The default width
is 1, which most things will be, so users can make an aesthetic
choice there.  (The place where widths make very little sense is when
the symbol represents a code entry point, rather than a data item.)

The maximum width of a local variable is now 256, but it's not
allowed to overlap with other variables or run of the end of the
direct page.  The maximum width of a platform/project symbol is
65536, with bank-wrap behavior TBD.

The local variable table editor now refers to stack-relative
constants as such, rather than simply "constant", to make it clear
that it's not just defining an 8-bit constant.

Widths have been added to a handful of Apple II platform defs.
2019-10-01 16:00:08 -07:00
Andy McFadden
e898ef9568 Minor fixes
Change + save + undo + change was being treated as non-dirty.

Added link to "export" feature to documentation TOC.

Added keyboard shortcut for high part in data operand editor.

Corrected various things in the tutorial.
2019-09-27 13:43:58 -07:00
Andy McFadden
7739f640f5 Minor tweaks
Added a blank line after local variable tables.  Otherwise they
just sort of blend in with the stuff around them.

Put prefixes before the DOS 3.3 platform symbols.

Added a BAS_HBASH entry.  We were getting BAS_HBASL and MON_GBASH
paired up, which looks weird.

Apply a very light tint to the preview section of the Edit Long
Comment dialog, to hint that the window is read-only.
2019-09-26 13:00:14 -07:00
Andy McFadden
0877857e7e Make links less distracting in HTML output
Having underlined blue text everywhere was too noisy.  This changes
the CSS style for internal links to be plain black text that gets
blue and underliney when you hover the mouse over it.

Also, added the current date and time to the set of template
substitutions.
2019-09-22 16:45:08 -07:00
Andy McFadden
488df3e68e Minor fixes
HTML output should have had double quotes around internal anchors.
(Chrome and Edge didn't complain, but the w3c validator wasn't
happy.)

Made the text areas in the load-time problem report dialogs
scrollable.

Updated the manual.
2019-09-21 18:49:03 -07:00
Andy McFadden
41cd30a8c6 Add Problem List Viewer to debug menu
The analyzer sometimes runs into things that don't seem right, like
hidden labels or references to non-existent symbols, but has no way
to report them.  This adds a problem viewer.

I'm not quite ready to turn this into a real feature, so for now it's
a free-floating window accessed from the debug menu.

Also, updated some documentation.
2019-09-21 13:43:01 -07:00
Andy McFadden
c05c42bf21 Add a few things to Apple II platform symbol lists 2019-09-20 19:04:10 -07:00
Andy McFadden
b74630dd5b Work around two assembler issues
Most assemblers end local label scope when a global label is
encountered.  cc65 takes this one step further by ending local label
scope when constants or variables are defined.  So, if we have a
variable table with a nonzero number of entries, we want to create
a fake global label at that point to end the scope.

Merlin 32 won't let you write " LDA #',' ".  For some reason the
comma causes an error.  IGenerator now has a "tweak operand format"
interface that lets us fix that.
2019-09-20 14:05:17 -07:00
Andy McFadden
6df874c559 Minor changes to local variable tables
Split "edit local variable table" into "create" and "edit prior".
The motivation is to allow the user to make changes to the most
recently defined table without having to go search for it.  Having
table creation be an explicit action, rather than something that
just happens if you edit a table that isn't there, feels reasonable.

Show table offset in LV table edit dialog, so if you really want
to go find it there's a (clumsy) way to do so.

Increased the maximum width of a variable from 4 to 8.  (This is
entirely arbitrary.)
2019-09-19 16:37:59 -07:00
Andy McFadden
ab755f1bc1 Tweak HTML output
Changed the HTML template to make the SourceGen version visible,
and added the expression style.
2019-09-17 22:14:10 -07:00
Andy McFadden
d01c61fbc1 Fix HTML output
We weren't escaping '<', '>', and '&', which caused browsers to get
very confused.  Browsers seem to prefer <PRE> to <CODE> for long
blocks of text, so switch to that.

Also, added support for putting long labels on their own lines in
the HTML output.

Also, fixed some unescaped angle brackets in the manual.

Also, tweaked the edit instruction operand a bit more.
2019-09-17 19:13:28 -07:00
Andy McFadden
c1056839b1 Changed naming convention in Applesoft/F8-ROM symbol files
I was using the plain names, but when you've got symbols like
READ and WAIT it's too easy to have a conflict and it's not plainly
obvious where something came from.  Now all monitor symbols begin
with MON_, and Applesoft symbols begin with BAS_.

The Amper-fdraw example ended up with a few broken symbol refs,
because it was created before project/platform symbols followed the
"nearby" rules, and was explicitly naming LINNUM and AMPERV.  I
switched the operands to default, and they now auto-format correctly.

I added a few more entries to Applesoft while I was at it.
2019-09-16 16:58:32 -07:00
Andy McFadden
2828cc8ca7 Apply project/platform symbols to Numeric/Address data operands
A ".dd2 <address>" item would get linked to an internal label, but
references to external addresses weren't doing the appropriate
search through the platform/project symbol list.

This change altered the output of the 2019-local-variables test.
The previous behavior was restored by disabling "nearby" symbol
matching in the project properties.

Updated the "lookup symbol by address" function to ignore local
variables.

Also, minor updates to Applesoft and F8-ROM symbol tables.
2019-09-15 14:38:12 -07:00
Andy McFadden
6f81d748ee Rename FormatSplitAddress to FormatAddressTable
Updated menus and docs to match.
2019-09-15 13:37:38 -07:00
Andy McFadden
44c140a8d0 Add "Copy to Operand" button to instruction operand editor
It's possible to define multiple project symbols with the same
address.  The way to resolve the ambiguity is to explicitly
reference the desired symbol from the operand.  This was the
default behavior of the "create project symbol" shortcut in the
previous version.

It's rarely necessary, and it can get ugly if you rename a project
symbol, because we don't refactor operands in that case.
2019-09-14 17:57:46 -07:00
Andy McFadden
62b7655a1c Fix handling of data formatting that overlaps with code
If you play games with code hints you can create a data operand that
overlaps with code.  This causes problems (see issue #45).  We now
check for that situation and ignore overlapping data descriptors.

Added a regression test to 2011-hinting.
2019-09-14 11:44:17 -07:00
Andy McFadden
be2b1e7bba Add Export feature to documentation
Also, removed "include symbol table" from export dialog.  You can
exclude the table by removing it from the template, which right
now  you'd need to do anyway to get rid of the H2 header and other
framing.  To make this work correctly as an option we'd need to
parse the "div" in the template file and strip the whole section,
or split the template into multiple parts that get included as
needed.  Not worth doing the work until we're sure it matters.
2019-09-13 18:22:34 -07:00
Andy McFadden
d3ff1f6eff Implement HTML export
Pretty straightforward formatted-text dump, with links for internal
labels, and a table of exported symbols at the end.
2019-09-13 17:18:33 -07:00
Andy McFadden
bb23bf82d1 Instruction operand editor rework, part 4 (of 4)
Updated the manual, and changed tutorial #2 to use local variables
for pointers.

If the symbol text box isn't empty, use the string as the initial
value for the Label when creating a new project property.

Fixed a crash when editing a project property.
2019-09-08 21:56:47 -07:00
Andy McFadden
e8ae534879 Instruction operand editor rework, part 2
Implemented local variable editing.  Operands that have a local
variable reference, or are eligible to have one, can now be edited
directly from the instruction operand edit dialog.

Also, updated the code list double-click handler so that, if you
double-click on the opcode of an instruction that uses a local
variable reference, the selection and view will jump to the place
where that variable was defined.

Also, tweaked the way the References window refers to references
to an address that didn't use a symbol at that address.  Updated
the explanation in the manual, which was a bit confusing.

Also, fixed some odds and ends in the manual.

Also, fixed a nasty infinite recursion bug (issue #47).
2019-09-07 20:56:43 -07:00
Andy McFadden
a3b968f025 Fix up the manual a bit 2019-09-06 15:38:49 -07:00
Andy McFadden
ee6e5d7fb6 Fix a couple of obscure bugs
The code that checked to see if a data target was inside a data
operand wasn't going all the way back to the start of the file.
It was also failing to stop when it should, wasting time.

The anattrib validation method has code that avoids a false-positive
on certain complex embedded instruction arrangements.  This was also
preventing it from seeing a transition from a data area to the
middle of an instruction (caused by issue #45).
2019-09-04 17:48:55 -07:00
Andy McFadden
431ad94d95 Make "smart" PLP handling optional
We try to be clever with PHP/PLP, but sometimes we get it wrong.  If
we get it wrong a lot, we want to turn it off.  Now we can.
2019-09-02 15:57:59 -07:00
Andy McFadden
9a8df9c498 Add local variable tables to documentation 2019-09-01 18:14:59 -07:00
Andy McFadden
32d1147eec Improve multi-encoding output in 64tass
Previously, we used the default character encoding from the project
properties to determine how strings and character constants in the
entire source file should be encoded.  Now we switch between
encodings as needed.  The default character encoding is no longer
relevant.

High ASCII is now an actual encoding, rather than acting like ASCII
that sometimes doesn't work.  Because we can do high ASCII character
operands with "| $80", we don't output a .enc to switch from ASCII
to high ASCII unless we need to generate a string.  (If we're
already in high ASCII mode, the "| $80" isn't required but won't
hurt anything.)

We now do a scan up front to see if ASCII or high ASCII is needed,
and only output the .cdefs for the encodings that are actually used.

The only gap in the matrix is high ASCII DCI strings -- the ".shift"
pseudo-op rejects text if the string doesn't start with the high
bit clear.
2019-08-21 13:46:05 -07:00
Andy McFadden
38d3adbb08 PETSCII does DCI
I didn't think it made sense, but I found something that used it,
so apparently it's a thing.  This updates the operand editor to
let you choose PETSCII+DCI, and updates the assemblers to handle
it correctly (really just 64tass, since the others either don't
have a DCI directive or don't deal with PETSCII at all).

Changed the char-encoding sample from "bad dcI" to "pet dcI", and
updated the documentation.
2019-08-20 17:55:12 -07:00
Andy McFadden
149e763821 Change the way ASCII is handled for 64tass
The documentation for 64tass says you're required to pass "--ascii"
when the source file is ASCII (as opposed to PETSCII).  We were
ignoring this, but it turns out that everything works a bit better
if we don't.

So we now pass "--ascii" on the command line, and add a two-line
character encoding definition to every file that is generated with
ASCII as the default encoding.  The sg_petscii and sg_screen
encodings go away, as PETSCII is now the default, and we can use the
built-in "screen" encoding.
2019-08-20 11:21:30 -07:00
Andy McFadden
354d106665 Documentation update
Also, make "spaces between numbers in bytes column" default to
enabled.
2019-08-19 14:16:35 -07:00
Andy McFadden
62c15031fd Update documentation
PETSCII, ACME, and other improvements.
2019-08-18 17:16:44 -07:00
Andy McFadden
176e1ad6af Add default text encoding mode to system definition
This allows C64/C128/Pet projects to start out with PETSCII set as
the default text encoding mode.
2019-08-14 18:03:40 -07:00
Andy McFadden
bc633288ad Prep work for multi-encoding support
Wrote down research into C64 encodings.

Added source for a first cut at 2016-char-encoding test.
2019-08-11 11:27:09 -07:00
Andy McFadden
15d26c9ebd Don't do plugin interface checks during code analysis
The plugin objects are MarshalByRefObject stubs, which means they
don't actually implement the interfaces we're checking for.  There's
some additional overhead to do the interface check.  We can avoid
it by doing the interface queries during initialization, and just
checking some bit flags later on.

Also, in the extension script info window, show a list of
implemented interfaces.
2019-08-10 17:16:39 -07:00
Andy McFadden
835c1c7fe2 Reverse position on '#' in block move operands
During a discussion with the cc65 developers, I became convinced that
generating "MVN $01,$02" is wrong, and "MVN #$01,#$02" is correct.
64tass, cc65, and Merlin 32 all accept this syntax; only ACME does
not.  Operands without a leading '#' should be treated as 24-bit
values, and have the bank byte extracted.

This change updates the on-screen display and assembled output to
include the '#'.  The ACME generator uses a Quirk to suppress the
hash mark.  (It doesn't currently accept values larger than 8 bits,
so there's no ambiguity.)
2019-08-08 13:02:01 -07:00
Andy McFadden
89288c4d8c Updated assembler bugs & quirks
Notably, updated remarks regarding cc65's handling of block move
operands, which are apparently "broken as intended".
2019-08-06 08:52:59 -07:00
Andy McFadden
d80132e941 Finish ACME v0.96.4 support
There's no easy way to make non-zero-bank 65816 code work, so I'm
punting and just generating a whole-file hex dump for those.  This
renders tests 2007 and 2009 useless, so I'm hesitant to claim that
ACME support is fully functional.
2019-08-04 14:48:42 -07:00
Andy McFadden
0616e4e4a4 Define interfaces for inline call handlers and BRK
Instead of providing no-op CheckJsr/CheckJsl, plugins now declare
which calls they support by defining interfaces on the plugin class.

I added a CheckBrk call for code like Apple /// SOS calls, which
use BRK as an OS call mechanism.  The formatting doesn't work quite
right yet because I've been treating BRK as a two-byte instruction.
Hardly anything else does, and I think it's time I stopped (but not
in this commit).

Note: THIS BREAKS ALL PLUGINS that use the inline JSR/JSL feature,
which is pretty much all of them.
2019-08-02 16:06:27 -07:00
Andy McFadden
1219755e85 Remove WinForms code 2019-08-02 12:48:12 -07:00
Andy McFadden
4aee3af089 Various doc fixes 2019-07-29 13:20:03 -07:00
Andy McFadden
4f74430757 Minor fixes
- Updated the tutorial to track changes to WPF, and to clarify
  existing content.
- Fixed Ctrl+H Ctrl+C, which was getting masked by the Copy command
  handler.
- Fixed initial selection of address in Set Address.
2019-07-21 15:24:39 -07:00
Andy McFadden
02f6e884d7 Fix startup issues
- MakeDist now copies CommonWPF.dll.
- Spent a bunch of time tracking down a null-pointer deref that only
  happened when you didn't start with a config file.  Fixed.
- The NPE was causing the program to exit without any sort of useful
  diagnostic, so I added an uncaught exception handler that writes
  the crash to a text file in the current directory.
- Added a trace listener definition to App.config that writes log
  messages to a file, but it can't generally be enabled at runtime
  because you can't write files from inside the sandbox.  So it's
  there but commented out.
- Made the initial size of the main window a little wider.
2019-07-20 17:36:12 -07:00
Andy McFadden
e49ee6f20b Finish split-address table formatter
A lot of things react to other things in this dialog.  I think I
got everything behaving correctly.
2019-07-13 15:55:32 -07:00
Andy McFadden
9aa8b5c9a7 Minor documentation updates
Also, placate consistency hobgoblins.
2019-07-06 10:58:24 -07:00
Andy McFadden
6998eb4021 Minor doc edits
Added Ctrl+W to the tutorial.  Named the 64tass executable.
Performed various acts of word-smithing.
2019-04-19 14:10:48 -07:00
Andy McFadden
8d0ce87ec7 Experiment on uncategorized data analysis
Tried something to speed it up.  Didn't help.  Cleaned up the code
a bit though.
2019-04-18 15:58:43 -07:00
Andy McFadden
61d6cd597a Document the auto-label style setting 2019-04-15 16:04:11 -07:00
Andy McFadden
97a372a884 Add selectable auto-label styles
SourceGen creates "auto" labels when it finds a reference to an
address that doesn't have a label associated with it.  The label for
address $1234 would be "L1234".  This change allows the project to
specify alternative label naming conventions, annotating them with
information from the cross-reference data.  For example, a subroutine
entry point (i.e. the target of a JSR) would be "S_1234".  (The
underscore was added to avoid confusion when an annotation letter
is the same as a hex digit.)

Also, tweaked the way the preferred clipboard line format is stored
in the settings file (was an integer, now an enumeration string).
2019-04-15 15:14:04 -07:00
Andy McFadden
47b1363738 Add more detail to cross references
In the cross-reference table we now indicate whether the reference
source is doing a read, write, read-modify-write, branch, subroutine
call, is just referencing the address, or is part of the data.
2019-04-11 16:23:02 -07:00
Andy McFadden
84eceee085 Note removal of cc65 limitation 2018-11-18 15:20:12 -08:00
Andy McFadden
0e1530fe0f Add Actions > Format As Word (Ctrl+W)
Formats a pair of bytes into a 16-bit word.  As a special case,
attempts to grab the next byte if only one byte is selected.

(issue #29)
2018-11-11 17:25:02 -08:00
Andy McFadden
f5b36afd2e Add a bit to the tutorial
In the data operand edit section, walk through selecting a single
byte vs. multiple bytes when you want to set a multi-byte format.

(inspired by issue #41)
2018-11-08 11:54:33 -08:00
Andy McFadden
09d6512dd2 Note a cross-asm bug 2018-11-02 17:09:02 -07:00
Andy McFadden
c80be07f73 Work around Merlin 32 instruction parsing bug
The 2014-label-dp test now passes.  Prior regression tests are
unaffected.

Also, renamed an IGenerator interface to more accurately reflect
its role.

(issue #37)
2018-11-02 13:49:27 -07:00
Andy McFadden
2096bd2c66 Document another assembler quirk
(see issue #39)
2018-10-31 15:28:01 -07:00
Andy McFadden
3cb1596d90 Add more bugs & quirks 2018-10-30 15:42:13 -07:00
Andy McFadden
c46afe377e Document the "spaces in bytes column" feature 2018-10-27 12:34:59 -07:00
Andy McFadden
372eea385d Clarify 2018-10-26 15:59:00 -07:00
Andy McFadden
2cb6b55802 Generalize expression style setting
Before you could choose between Merlin-style and generic.  Now
there's a combo box that lets you choose Merlin, cc65, or
"common", the latter being used for 64tass.
2018-10-24 17:23:30 -07:00
Andy McFadden
61914c8f79 Progress toward 64tass expression support
Gave cc65 its own expression generator, as the precedence table seems
atypical if not unique.  Configured 64tass to use the "simple"
expression mode.

Added some operations on a 32-bit constant to 2007-labels-and-symbols
to exercise the current worst-case expression (shift + AND + add).
Tweaked the Merlin expression generator to handle it.

(issue #16)
2018-10-24 13:17:03 -07:00
Andy McFadden
f26a03869a Finish the underscore handling in the label localizer
Correctly handle pre-existing underscores and avoidance of
"reserved" labels.

Also, add more underscores to 2012-label-localizer to exercise
the code.

(issue #16)
2018-10-23 20:40:09 -07:00
Andy McFadden
f7e5cf2f45 Progress toward 64tass support
Most tests pass, but 2007-labels-and-symbols fails because the
expressions recognized by 64tass don't match up with either of the
other assemblers.

This is currently using a workaround for the local label syntax.
64tass uses '_' as the prefix, which is unfortunate since SourceGen
explicitly allowed underscores in labels.  (So does 64tass for that
matter, but it treats labels specially when the '_' comes first.)
We will need to rename any non-local user labels that start with '_'.

(issue #16)
2018-10-23 20:08:01 -07:00
Andy McFadden
eec37b684e Split C64 system def into .PRG/.BIN
One starts with a 16-bit load address, one does not.  Not sure
this is the right way to go, but it's worth a try.

(issue #33)
2018-10-23 12:30:19 -07:00
Andy McFadden
80da6cc1df Replace symbol used to indicate embedded instructions
We were using \u23e9, BLACK RIGHT-POINTING DOUBLE TRIANGLE, but
neither Win7 SP1 nor Linux was able to display the glyph.  It also
gets all puffy in web browsers.  We now use \u25bc, BLACK
DOWN-POINTING TRIANGLE, which seems to work everywhere.  It also
feels more appropriate, because it appears next to the "containing"
opcode, with the embedded instruction appearing on the following
line.
2018-10-21 18:46:03 -07:00
Andy McFadden
59f79645d2 Update docs for new assembler configuration scheme 2018-10-21 16:54:44 -07:00
Andy McFadden
b97a25797a Add some more Applesoft zero-page locations 2018-10-11 16:48:30 -07:00
Andy McFadden
ec33c74cd5 Add symbols for Atari Lynx
Another system I know nothing about.
2018-10-11 14:51:54 -07:00
Andy McFadden
26f8a01b5d Add a C128 Kernal entry point list
Looks like the C64 stuff is also available to the C128, so include
this and the C64 defs in the C128 system definition.
2018-10-11 10:46:47 -07:00
Andy McFadden
1ad4bcb150 Add a C64 Kernal entry point list
I know nothing about the C64, but there's a lot of info on the web.
This stuff looked important.

(issue #19)
2018-10-11 10:01:04 -07:00
Andy McFadden
a4e3680655 Remove some test symbols from Cxxx-IO 2018-10-10 16:41:33 -07:00
Andy McFadden
acf19870c2 Add advanced tutorial
Also, fixed a bug where the operand highlight would get out of sync
after an edit.
2018-10-09 14:55:16 -07:00
Andy McFadden
0851746123 Merge branch 'master' of https://github.com/fadden/6502bench 2018-10-09 10:24:37 -07:00
Andy McFadden
705c6e383b Clean up HTML in manual 2018-10-09 10:04:10 -07:00
Andy McFadden
e31de84641 Add remaining Applesoft BASIC tokens 2018-10-08 18:03:04 -07:00
Andy McFadden
c182ecba35
Fix items in angle brackets 2018-10-08 17:11:03 -07:00
Andy McFadden
2c03216da9 Move symbol file and extension script docs into manual
Once upon a time, symbol files and extension scripts could only be
defined in the RuntimeData directory, so having the documentation
there made sense.  Since both of these things can now be defined in
project directories, the documentation belongs in the manual.

(issue #27)
2018-10-08 15:30:43 -07:00
Andy McFadden
b37d3dba02 Expand reach of external symbol nearby-target test
If PTR is defined as an external symbol, we were automatically
symbol-ifying PTR+1.  Now we also symbolify PTR+2.  This helps with
24-bit pointers on the 65816, and 16-bit "jump vectors", where the
address is preceded by a JMP opcode.

Removed the "AMPERV_" symbol I added to make the tutorial look
right.
2018-10-08 13:15:16 -07:00
Andy McFadden
3a001c5f8a Merge menu items for "edit operand" and "edit data"
The instruction operand editor and data operand editor are very
different, but there's no need to impose that distinction on the
user.  They want to edit the operand either way.  We now provide a
single "edit operand" menu item, and open the appropriate dialog
based on what they have selected.

This uses Ctrl+O as the keyboard shortcut, stealing it from
File > Open.

(issue #11)
2018-10-08 12:49:26 -07:00
Andy McFadden
9be99a7cac Make hint application less annoying
Two changes:
(1) Code and data hints are now only applied to the first byte on
    each selected line.  This allows you to slap a code hint on a
    string without lighting up the whole string.  Inline-data hints
    and hint removal work as before.
(2) Added a menu item (with Ctrl+D as shortcut) to toggle the state
    of the uncategorized data analyzer.  This makes it easy to turn
    off the feature that put the code into a string in the first
    place.
2018-10-07 21:55:44 -07:00
Andy McFadden
93c76e219f Add keyboard shortcuts for applying hints
Each is a two-key combo.  Hit Ctrl+H, then Ctrl+C/D/I/R as desired.
Hitting Ctrl+H followed by any other key results in an error beep.
2018-10-07 21:13:37 -07:00
Andy McFadden
b4d47df637 Add split-address table formatting to tutorial
Also, show generated symbol name in preview list.
2018-10-07 10:39:41 -07:00
Andy McFadden
309cc88a54 Improve split-address table formatter
Don't enable OK unless at least one address is valid.
Don't apply code hints unless asked.
Rename a couple of things for clarity.
Add documentation to manual.

(issue #10)
2018-10-06 21:15:59 -07:00
Andy McFadden
92add74fc3 Add first-word-is-load-addr parameter to system definitions
If set, the first word of the file is used to set the load address.
The initial code entry hint is placed at offset +000002 instead of
the start of the file.

Set it to true for the C64 system definition.

(issue #23)
2018-10-05 15:39:44 -07:00
Andy McFadden
2d1ef37a13 Switch some hotkeys around
Ctrl+L -> edit label
Ctrl+; -> edit comment (looks funny in menu)
Ctrl+M -> edit long comment
Ctrl+N -> edit note (was "new project")
Ctrl+W -> nothing (was "close project")

(issue #11)
2018-10-05 13:13:11 -07:00
Andy McFadden
8aba1c4fba Revise documentation 2018-10-04 15:15:44 -07:00
Andy McFadden
99a77c0341 Add Atari Lynx placeholder and 65SC02 definition 2018-10-02 13:18:45 -07:00
Andy McFadden
93b21b16f8 Fix some comments 2018-10-01 15:24:27 -07:00
Andy McFadden
b27accc9d3 Add installation notes to README
Also, add a link to the tutorial near the top of the manual's index
page.
2018-10-01 11:09:04 -07:00
david-schmidt
7f2a0b2cfc More Apple /// details 2018-09-29 00:31:32 -04:00
david-schmidt
405e155881 Flesh out symbols in Apple /// ROM and I/O space 2018-09-29 00:10:37 -04:00
david-schmidt
b477720a2a Whitespaces 2018-09-28 19:43:33 -04:00
david-schmidt
fd8f5e499c Skeletal support for Apple /// 2018-09-28 18:06:35 -04:00
Andy McFadden
2c6212404d Initial file commit 2018-09-28 10:05:11 -07:00