1
0
mirror of https://github.com/fadden/6502bench.git synced 2026-01-22 07:19:49 +00:00

71 Commits

Author SHA1 Message Date
Andy McFadden
ac93d22eb2 Attempt to clarify generate vs. export
Also, updated NMS links.
2025-12-27 08:32:32 -08:00
Andy McFadden
45fed396ab Make hex adjustment threshold configurable
We generate operand adjustments automatically, and output small
values as decimal (e.g. LDA FOO-1) and large values as hex (e.g.
LDA FOO+$1000).  This change adds a setting for the threshold
between small and large.

The default setting is 8.  The previous threshold was 255, which
felt a bit high.

(issue #176)
2025-09-22 09:06:00 -07:00
Andy McFadden
a4b71e0c9b Update tutorial and manual
Fix some typos, clarify some things, and replace a slightly incorrect
pair of PNGs.

Some of the dialogs have gained additional options, but the changes
aren't meaningful enough to warrant taking lots of screen shots.
2025-08-01 13:36:32 -07:00
Andy McFadden
cae1fa5173 Disregard operand address, part 2 (of 2)
Added assembler regression tests, for 6502 and 65816.

The "remove formatting" action now clears the flag.  It's a bit of a
stretch to call it "formatting" but this feels right.

Updated the documentation, adding a new section about embedded
instructions to the intro material.
2025-07-30 16:06:21 -07:00
Andy McFadden
ec50f48f95 Disregard operand address, part 1
SourceGen puts a lot of effort into connecting address operands to
internal offsets and external symbols.  Sometimes this is undesirable.
For example, a BIT or conditional branch instruction is sometimes used
as a dummy when there are multiple entry points that vary only in a
status flag or register value.  The address in the BIT or branch is
either irrelevant or never actually referenced, so auto-generating a
label for it is annoying.

Having a way to tell the disassembler to disregard an address operand,
so that it won't generate an auto-label or be included in the list of
cross-references, provides a simple solution to this.

The operand's file offset is determined during the code analysis
pass.  Setting it to -1 makes the operand look like an external address.
If we disable the project/platform symbol lookup for that instruction
as well, we can avoid label generation and cross-references.

We also need to prevent the 65816 data bank fixup code from restoring
it, and the relocation data code from doing its thing.

The flag is implemented as a new "misc flags" table, which holds a
set of bit flags for every file offset.  The "disregard operand address"
flag is set on the opcode byte of instructions.  The flags are expected
to be used infrequently, so they're currently output as a list of
(offset, integer) pairs.

The flag is set in the Edit Instruction Operand dialog, which has a
new checkbox.  The checkbox is disabled for immediate operands.

(issue #174)
2025-07-30 09:16:32 -07:00
Andy McFadden
4846a26c9a Treat PEA operand as imm const16
We were treating PEA's operand as an absolute address and attempting to
extend it to 24 bits.  This wasn't very successful, and was
counter-productive when the argument was actually a constant, which is
common.  Worse, if the operand appeared to reference an internal address
outside bank 0, we would output a 24-bit value, breaking 64tass and cc65.

We now treat PEA as having an immediate operand.  (It was already
classified as an "extended immediate", but the operand-address
computation was still happening.)

This will have little to no effect on projects that use OMF relocation
data, because PEA arguments are explicitly identified as symbols or
constants.

New tests were added to 20032-labels-and-symbols to exercise the code
generation failures.  A few other tests that used PEA were affected.
20152-local-variables was fixed by adding a symbolic reference, the
others remained as-is and the expected output was revised.

(issue #172)
2025-07-18 13:25:29 -07:00
Andy McFadden
8dba2c1de6 Allow formatting of 32-bit address tables
These are actually 24-bit address tables, with an extra byte to pad
each entry to an even number of bytes, so the GUI refers to them as
"24-bit + pad byte".  The extra byte is not included in the address
calculation, and is simply skipped over.

(issue #171)
2025-07-16 08:22:59 -07:00
Andy McFadden
4ea4204ab7 Add signed-decimal operand formatting
This allows signed decimal operands to be formatted as such, e.g.
"LDA #$FE" becomes "LDA #-2".  This can be applied to immediate
operands and to numeric data pseudo-ops.

Not all assemblers support this in all situations.  The asm generators
will output unsigned decimal operands if so.

The 20020- and 20022-operand-formats tests have been updated.
2025-07-15 13:34:19 -07:00
Andy McFadden
eb6999b1b0 Add jump table formatting
When asked to tag an absolute JMP instruction ($4C) as code, we now
scan forward to see if it's the start of a series of JMPs.  If we
find more than one, we offer the opportunity to tag the entire set
all at once.

A series of unformatted JMPs has been added to 20200-ui-edge-cases
for manual testing.

(issue #22)
2025-07-10 16:16:22 -07:00
Andy McFadden
459cde40c4 Fix Merlin 32 DP op generation
Most assemblers treat '<' and '>' as byte-select operators.  Merlin 32
treats them as shift operators, making '<' effectively a no-op.  A
mask is applied based on the length implied by the opcode or pseudo-op,
e.g. "DFB <FOO" will mask off the high bits.  This is problematic for
instructions like "LDA <FOO", where the choice between absolute and DP
addressing depends on the value of "<FOO".  If FOO is >= $100, the
lack of masking will cause it be treated as absolute.  There is
currently no other mechanism to force the use of a direct-page opcode.

The only recourse is to append "&$ff" to the operand, so the
assembler knows that it can be handled as a DP op.  The code generator
has been updated to add "&$ff" where needed, based on the label's
value.  Unfortunately the assembler doesn't accept this for certain
specific addressing modes; this appears to be a bug.

The relevant test cases (2003x-labels-and-symbols) have been updated
to exercise these situations.  The current test projects side-step the
failing assembler behavior by using a DP label instead.  These should
be changed to correctly exercise the full behavior, with the code
generator outputting the instructions as raw hex values to work
around bugs.

There are some deliberately broken things (like a duplicate label) in
the 20030 case that were copied into the 20032 case when it was
created.  For ease of editing these have been removed from 20032.

(issue #170)
2025-07-10 12:04:16 -07:00
Andy McFadden
7fdf459899 Version 1.9.2-dev3 2025-06-27 15:11:28 -07:00
Andy McFadden
b6e6363234 Add "find all" feature
This uses the same (very weak) string search as the current Find
feature, but does it over the entire file.  Matches are added to a
table of results and displayed in the same dialog used by the
References panel "copy out" feature.

The reference table now jumps to a Location rather than just the
closest offset, so that we can jump to the middle of a multi-line
comment.
2025-06-27 15:00:38 -07:00
Andy McFadden
0d64e0a94f Handle LVT entries for operand target label edits
The "edit operand target label" feature now handles local variables.
The individual symbol is edited in the table, the same way it would
if the appropriate option were selected from the Edit Instruction
Operand dialog.

Also, show the address in the Edit Label dialog.  It feels
unobtrusive and is occasionally useful.
2025-06-26 09:59:54 -07:00
Andy McFadden
ab5818a204 Add "copy out" button to References window
The References window is handy for seeing everything that refers to
a particular address or symbol, but walking through the list is
annoying because the window gets reset every time you double-click
on an entry and the selection moves.

This adds a "copy out" button that copies the references to a
floating window.  References can be double-clicked as usual, but the
list doesn't update unless you click "copy out" again.

This might be better if it were somehow integrated into the main
window, e.g. as a tab in the Info panel, so that the focus isn't
bouncing between two independently Z-ordered windows.
2025-06-22 13:44:53 -07:00
Andy McFadden
0eb417ac46 Add "edit operand target label" action
This adds a shortcut for editing the label at the address referenced
by an instruction operand or data address pseudo-op.  This can be
activated from the Actions menu, or with Ctrl+Shift+L.

For references inside the file, the Edit Label dialog is opened.  For
external addresses, the project symbol editor is opened.

Local variable table entries are currently not supported.

(issue #166)
2025-06-21 17:31:49 -07:00
Andy McFadden
83ed8ed5d9 Minor updates 2024-09-17 15:11:03 -07:00
Andy McFadden
5aaaf43bf9 trivial change to nudge github 2024-09-17 13:20:26 -07:00
Andy McFadden
ec9017cbc3 Add "omit implicit acc operand" feature
By default, implicit acc operands are shown, e.g. "LSR A" rather
than just "LSR".  I like showing operands for instructions that
have multiple address modes.

Not everyone agrees, so now it's a setting.  They're shown by default,
but enabling the option will strip them on-screen, in generated
assembly, and in the instruction chart.

They are always omitted for ACME output, which doesn't allow them.

(issue #162)
2024-09-15 13:29:04 -07:00
Andy McFadden
6c2eee806b Update tool reference 2024-08-19 13:12:53 -07:00
Andy McFadden
eef1710d5d Update tutorial
Two main changes:
 - "Seek nearby targets" is no longer enabled by default.
 - The application asks the user to save new projects immediately.

Various minor edits were also made.

A couple of the images are slightly stale, showing ".org" rather than
".addrs", but they're in the advanced section and the difference
isn't notable.
2024-08-19 13:03:16 -07:00
Andy McFadden
fca742e890 Auto-save, part 3 (of 3)
Added the recovery file check when a project is opened, and the GUI
elements for choosing which file to use.

If a recovery file exists but can't be opened, presumably because it's
open by another process, offer to open the project read-only.  (This
is a generally good idea, but we don't hold the project file open
in normal usage, so it only works when auto-save is enabled.)

After making a choice, auto-save is disabled until the first manual
save.

One thing we don't do: if we find a recovery file, but auto-save is
disabled, the recovery file won't be deleted after the user makes a
choice.  This might be a feature.

Updated documentation.

(issue #161)
2024-08-09 13:42:12 -07:00
Andy McFadden
ef13101923 Clarify some app settings
The pop-up that lets you choose which assembler to set configuration
options for looked like it let you choose an assembler generally.
Changed some wording and visuals for better clarity.
2024-08-01 15:08:43 -07:00
Andy McFadden
5a560aa9eb Fancy comments, part 5 (of 5)
Added a "format help" button to the long comment edit window.  This
brings up a quick summary of the format tags in a modal dialog.

Updated documentation and tutorial.
2024-07-07 18:12:29 -07:00
Andy McFadden
b1ca87e3c8 Fix Applesoft shape table visualizer
An edge case wasn't being handled correctly.
2024-06-28 13:45:57 -07:00
Andy McFadden
9784ad043e Use '*' for full-line Merlin comments
While it's okay to use ';', the classic Merlin editor will treat it
as an end-of-line comment and shove the entire thing off to the right
side of the screen.

This adds a configuration item to the app settings, with a default
value of ';'.
2024-06-26 10:54:46 -07:00
Andy McFadden
c05b5b3a28 Fix sgmanual index 2024-06-01 13:40:34 -07:00
Andy McFadden
4e5c34f457 Binary includes
This adds a new data format option, "binary include", that takes a
filename operand.  When assembly sources are generated, the section
of file is replaced with an appropriate pseudo-op, and binary files
are generated that hold the file contents.  This is a convenient way
to remove large binary blobs, such as music or sound samples, that
aren't useful to have in text form in the sources.

Partial pathnames are allowed, so you can output a sound blob to
"sounds/blather.bin".  For safety reasons, we don't allow the files
to be created above the project directory, and existing files will
only be overwritten if they have a matching length (so you don't
accidentally stomp on your project file).

The files are not currently shown in the GenAsm dialog, which lets
you see a preview of the generated sources.  The hex dump tool
can do this for the (presumably rare) situations where it's useful.

A new regression test, 20300-binary-include, has been added.  The
pseudo-op name can be overridden on-screen in the settings.

We don't currently do anything new for text/HTML exports.  It might
be useful to generate an optional appendix with a hex dump of the
excised sections.

(issue #144)
2024-05-31 14:22:39 -07:00
Andy McFadden
3b20566b10 Minor tweaks
Note that address region isolation doesn't prevent explicit label
references from working (add update the test to prove it).

Added a note about pre-label xrefs.
2024-05-22 14:02:53 -07:00
Andy McFadden
7a7ff44d3a Address region isolation, part 3 (of 3)
If an address resolves to a user label in an isolated region, we
don't want to use it.  However, we still want to try to match it
to a project/platform symbol.

For example, suppose the isolated code wants to reference address
$1C00, which is a memory-mapped I/O location in one area, but a
regular bunch of code in the other.  We don't want it to map to
the regular code, but we do want it to resolve to our table of
platform I/O addresses.

We now handle this correctly.  The regression test has been updated
to check this.  The current implementation does a linear scan through
the symbol table, but I'm hoping this is not a common situation.

The reference manual has been updated to describe the new feature.
2024-05-21 14:14:32 -07:00
Andy McFadden
47b11b6797 Document new label placement setting 2024-04-22 17:35:21 -07:00
Andy McFadden
9e82ff8b88 Make label files look more like cc65 output
The cc65 docs say VICE labels start with '.'.  Also, output local
labels prefixed with '@', per ca65 convention.  The default output
file is now "labels.lbl".

Added some minimal documentation.

(issue #151)
2024-04-22 15:09:23 -07:00
Andy McFadden
8532cfb433 Rename menu item
Changed "File > Assemble" to "File > Generate Assembly".

Also, correctly mark a read-only text field as such.
2024-04-19 14:16:30 -07:00
Andy McFadden
c637d6549c Minor updates 2024-03-02 11:17:52 -08:00
Andy McFadden
dcab984f3b Fix formatting 2022-05-23 15:45:25 -07:00
Andy McFadden
8b1e70fa58 Expand C64 sprite visualizer
Added fonts and sprite sheets.  Updated documentation.
2022-05-01 11:09:41 -07:00
Andy McFadden
b942c24ef2 Tweak web site 2021-11-21 11:23:24 -08:00
Andy McFadden
8c5509d69d Update "digging deeper" tutorial
The tutorial was creating a new address region at +000002 without
removing the previous one, which leaves the 16-bit file load address
sitting at $1000 when it should be non-addressable.  The text now
shows the correct procedure.  Some screen shots had to be recaptured
to show the greyed-out address field.

This doesn't change anything meaningful about the disassembly -- the
PRG optimization hides the region start/end markers either way -- but
it's more correct this way, and it's an opportunity to introduce
the use of non-addressable regions for file headers.
2021-11-14 11:20:48 -08:00
Andy McFadden
4537f24958 Rework tutorial for changes in v1.8
Biggest changes were to the address region handling in Tutorial1
and the use of StdInline.cs for the inline strings in Tutorial4.

Also, fixed the off-by-one error in Tutorial1.
2021-11-14 09:02:53 -08:00
Andy McFadden
cd937709fa Tweak address region edit dialog
Altered the address region edit UI a little to improve clarity.

Also, close the hex dump viewer window when Escape is hit.  (The
tool windows don't have "cancel" buttons, so the key has to be
handled explicitly.)
2021-10-20 09:06:53 -07:00
Andy McFadden
22c47e1d0b Update reference manual formatting
Switched from XHTML to HTML5.  Added formatting for menu items and
keyboard shortcuts.

Made various minor edits to the text.
2021-10-18 17:56:08 -07:00
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
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
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
62509d0bd7 Documentation / comment tweaks 2021-09-11 14:12:09 -07:00
Andy McFadden
55359d423a Minor documentation update 2021-09-06 11:41:08 -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
fa1b0af932 Clarify 2021-08-09 16:22:17 -07:00