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

246 Commits

Author SHA1 Message Date
Andy McFadden
6ef43a3b1a Fix format/typo errors in tutorial 2021-06-04 18:43:36 -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
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
7ae4b63fa3 Tweak wording 2020-10-19 14:59:27 -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
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
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
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
9548b5c27c Add link to ToC 2020-09-20 17:42:40 -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
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
69a9e98a43 Split "show cycle counts" in two
The "show cycle counts in comments" setting is the only one that
affects both the on-screen display and generated source code.  This
felt a little weird, so it's now two independent settings.  This
also provided an opportunity to move it to the initial tab, so it's
easier to toggle on and off.  Overall it feels less confusing to have
two settings for essentially the same thing, because code generation
is distinct from everything else.

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

Documentation and tutorial have been updated.

Also did a little bit of cleanup in EditAppSettings.
2020-08-27 13:59:53 -07:00
Andy McFadden
53857089e9 Update Apple /// SOS definitions
- Added SOS parameter block formatting.
- Normalized SOS call names to values in SOS Reference Manual.
- Added SOS call error code constants.
- (from robjustice) Added more to A3-IO.sym65.

Also, rearranged the ProDOS code slightly.

(issue #85)
2020-08-22 18:41:24 -07:00
Andy McFadden
30cb96f737 Update Apple II definitions
Picked some names to fill the gaps in the language card I/O
location list.

Tweaked the hi-res sprite sheet slightly.
2020-08-21 20:01:41 -07:00
Andy McFadden
2dfdb3234b Add Apple II screen memory chart
Show mapping between lines on the text and hi-res screens and
locations in memory.
2020-08-20 17:24:28 -07:00
Andy McFadden
a2e7c88fc9 Update Apple II definitions
Added explicit widths to the 6502 vectors.

Two changes to Apple II hi-res visualization:

(1) Allow the row stride to be any value >= 1.  This is useful
when data is stored in column-major order, i.e. it's a two-byte-wide
shape, with all of the data for the first column stored before the
data for the second column.  (Set the row stride to 1, and the
column stride to the bitmap height.)

(2) Modify the layout of grids (sprite sheets and fonts), so that
we're closer to square when the item counts is low.  Otherwise the
thumbnail just looks like a dashed line.  (This one is strictly
cosmetic.)
2020-08-18 15:10:10 -07:00
Andy McFadden
31d466f0bd Update some Apple II definitions
Added a bunch of Applesoft entry points, and updated the F8ROM
definitions.

Added a visualizer for Applesoft shape table shapes that are not part
of an actual shape table.
2020-08-12 20:40:56 -07:00
Andy McFadden
52853edcd1 Update GS/OS parameter block definitions
The FlushGS call has an additional argument.
2020-07-31 08:34:06 -07:00
Andy McFadden
92c648807c Minor fixes to tutorial text 2020-07-30 19:59:50 -07:00
Andy McFadden
97ca814854 Update DOS 3.3 and GS/OS symbols 2020-07-30 15:22:54 -07:00
Andy McFadden
94d7a30a09 Expand "apply platform symbols" feature
This experimental feature applied platform symbols to the project,
setting labels where the platform symbol's address matched an internal
address.  The feature now applies project symbols as well, and has
been renamed to "apply external symbols".

We now report the number of labels set.
2020-07-28 10:56:07 -07:00
Andy McFadden
2a65457e19 Default "smart PLP handling" to off
The feature is mildly broken and, frankly, unreliable on its best
day.  Default it to off for new projects.
2020-07-24 21:38:45 -07:00
Andy McFadden
6892040ea8 Add two options to OMF converter
First, make the per-segment comments and notes optional.

Second, add an "offset segment by $0100" feature that tries to shift
each segment forward 256 bytes.  Doing so avoids potential ambiguity
with direct page locations.

The 20212-reloc-data test no longer has the per-segment comments.
2020-07-20 13:50:49 -07:00
Andy McFadden
288a857e47 Change PLP handling
The "smart" PLP handler tries to recover the flags from an earlier
PHP.  The non-smart version just marks all the flags as indeterminate.
This doesn't work well on the 65816 in native mode, because having
the M/X flags in an indeterminate state is rarely what you want.

Code rarely uses PLP to reset the flags to a specific state, preferring
explicit SEP/REP.  The analyzer is more likely to get the correct
answer by simply leaving the flags in their prior state.

A test case has been added to 20052-branches-and-banks, which now has
"smart PLP" disabled.
2020-07-20 11:54:00 -07:00
Andy McFadden
cb6ceafd73 Make operand wrap length configurable
Long operands, such as strings and bulk data, can span multiple lines.
SourceGen wraps them at 64 characters, which is fine for assembly
output but occasionally annoying on screen: if the operand column is
wide enough to show the entire value, the comment column is pushed
pretty far to the right.

This change makes the width configurable, as 32/48/64 characters,
with a pop-up in app settings.

The assemblers are all wired to 64 characters, though we could make
this configurable as well with an assembler-specific setting.

Some things have moved around a bit in app settings.  The Asm Config
tab now comes last.  Having it sandwiched in the middle of tabs that
altered the on-screen display didn't make much sense.  The Display
Format is now explicitly for opcodes and operands, and is split into
two columns.  The left column is managed by the "quick set" feature,
the right column is independent.
2020-07-19 18:39:27 -07:00
Andy McFadden
a3c7cd0cf9 Add File > Reload External Files
The new menu item reloads platform symbol files and extension scripts,
which is very handy when making edits to project files.
2020-07-19 16:59:41 -07:00
Andy McFadden
195c93a94a Reboot sandbox when required
Another chapter in the never-ending AppDomain security saga.

If a computer goes to sleep while SourceGen is running with a project
open, life gets confusing when the system wakes up.  The keep-alive
timer fires and a ping is sent to the remote AppDomain, successfully.
At the same time, the lease expires on the remote side, and the objects
are discarded (apparently without bothering to query the ILease object).
This failure mode is 100% repeatable.

Since we can't prevent sandbox objects from disappearing, we have to
detect and recover from the problem.  Fortunately we don't keep any
necessary state on the plugin side, so we can just tear the whole
thing down and recreate it.

The various methods in ScriptManager now do a "health check" before
making calls into the plugin AppDomain.  If the ping attempt fails,
the AppDomain is "rebooted" by destroying it and creating a new one,
reloading all plugins that were in there before.  The plugin binaries
*should* still be in the PluginDllCache directory since the ping failure
was due to objects being discarded, not AppDomain shutdown, and Windows
doesn't let you mess with files that hold executable code.

A new "reboot security sandbox" option has been added to the DEBUG
menu to facilitate testing.

The PluginManager's Ping() method gets called more often, but not to
the extent that performance will be affected.

This change also adds a finalizer to DisasmProject, since we're relying
on it to shut down the ScriptManager, and it's relying on callers to
invoke its cleanup function.  The finalizer throws an assertion if the
cleanup function doesn't get called.

(Issue #82)
2020-07-19 13:20:18 -07:00
Andy McFadden
1b2679d712 Add GS/OS file system IDs 2020-07-18 13:53:16 -07:00
Andy McFadden
4928dfd872 Tweak security menu items
Changed "Use Keep-Alive Hack" to "Disable Keep-Alive Hack" to emphasize
that it defaults to enabled.  Added a menu item for "Disable Security
Sandbox".  Added a warning to both that tells the user that they must
reopen the current project for the change to take effect.

Note neither of these is persisted in app settings.
2020-07-18 13:47:01 -07:00
Andy McFadden
c97d85974f Add GS/OS error code constants 2020-07-16 20:12:24 -07:00
Andy McFadden
b280fb58ba Rename PluginDll dir to PluginDllCache
The new name is more indicative of the purpose of the directory.

Updated the docs to point out that you can delete the contents any
time you want, so long as SourceGen isn't running at the time.

Also, change the default column widths for the exporter.
2020-07-16 10:36:58 -07:00
Andy McFadden
9aaa37a23c Add Cxxx I/O locations in bank $e0 for Apple IIgs
On an Apple IIgs, the memory-mapped I/O locations are actually in
bank $e0, shadow-copied to bank $00.  This adds a copy of the
relevant definitions from Cxxx-IO.sym65, with the addresses in bank
$e0 and "_GS" appended to the labels.

This is now included by default for the Apple IIgs system defintions.

(I thought about just adding them to Cxxx-IO.sym65, but then they
pollute the namespace for 8-bit systems.  Stripping them out at run
time got a little complicated because the platform symbols are only
loaded once, and we'd have to reload them every time the CPU definition
changed.  Further, there are a few aliases provided as constants, and
constants are allowed to be 32 bits on all systems, so those can't be
stripped.  Rather than defining a new definition I figured it was
just easier to have a second file.  Maintenance shouldn't be too taxing,
as definitions for 40-year-old machines don't change all that often.)

(I also thought about trying to make the address mirroring stuff work
for me here, but that would result in accesses being made to the
canonical address with an offset of +$e00000, which looks awful.)
2020-07-11 14:01:02 -07:00
Andy McFadden
e82dc31da6 Move Disk ][ defs into separate platform symbol file
The Disk ][ I/O locations are generally accessed as an offset, using
something like "LDA $C08n,X".  However the range from $C080-C08F is
already used for language card in slot 0.  SourceGen doesn't have a
way to distinguish between indexed and direct accesses, and even if
it did there's no way to separate one peripheral card from another
without knowing the contents of the CPU register.

As a workaround, the Disk ][ definitions are now in a separate symbol
file.  When loaded, the definitions replace the base slot 0 equates.

I figure Disk ][ accesses are more common than language card
manipulation, so I'm making it a default for new projects.  Existing
projects that reference the Disk ][ symbols (which existed, but as
constants) will need to be updated to include the new .sym65.
2020-07-11 13:23:46 -07:00
Andy McFadden
cc6ebaffc5 Update relocation data handling
When we have relocation data available, the code currently skips the
process of matching an address with a label for a PEA instruction when
the instruction in question doesn't have reloc data.  This does a
great job of separating code that pushes parts of addresses from code
that pushes constants.

This change expands the behavior to exclude instructions with 16-bit
address operands that use the Data Bank Register, e.g. "LDA abs"
and "LDA abs,X".  This is particularly useful for code that accesses
structured data using the operand as the structure offset, e.g.
"LDX addr" / "LDA $0000,X"

The 20212-reloc-data test has been updated to check the behavior.
2020-07-10 17:41:38 -07:00
Andy McFadden
2a2aadffec Data Bank Register management, part 5
Update documentation.  Add some information about OMF relocation
data as well.

Fix bug in B=K handling.
2020-07-10 13:29:36 -07:00
Andy McFadden
0929077fda Data Bank Register management, part 4
Implemented "smart" PLB handling.  If we see PHK/PLB, or 8-bit
LDA imm/PHA/PLB, we create a data bank change item.  The feature
can be disabled with a project property.
2020-07-09 19:42:31 -07:00
Andy McFadden
18e6951f17 Add Data Bank Register management, part 1
On the 65816, 16-bit data access instructions (e.g. LDA abs) are
expanded to 24 bits by merging in the Data Bank Register (B).  The
value of the register is difficult to determine via static analysis,
so we need a way to annotate the disassembly with the correct value.
Without this, the mapping of address to file offset will sometimes
be incorrect.

This change adds the basic data structures and "fixup" function, a
functional but incomplete editor, and source for a new test case.
2020-07-08 17:56:27 -07:00
Andy McFadden
4782cae116 Update ProDOS, ProDOS-16, and GS/OS call handling
Added P16 parameter blocks.  Updated GS/OS calls with System 6.0
changes.  Added comments, renamed symbols.
2020-07-05 10:54:55 -07:00
Andy McFadden
8d291ba21e Fix bank for AbsInd and AbsIndLong addressing
The Absolute Indirect and Absolute Indirect Long addressing modes
(e.g. "JMP (addr)" and "JMP [addr]") are 16-bit values in bank 0.
The code analyzer was placing them in the program bank, which
meant the wrong symbol was being used.

Also, tweak some docs.
2020-07-04 15:03:23 -07:00
Andy McFadden
a6700e9062 Format GS/OS parameter blocks
Similar to the ProDOS 8 formatter, but slightly more complex due
to the variable-length parameter block layout.

Also, added Orca shell call numbers to the list of constants.
2020-07-03 21:01:05 -07:00
Andy McFadden
d58b747571 Use relocation data to format instruction operands
This was a relatively lightweight change to confirm the usefulness
of relocation data.  The results were very positive.

The relatively superficial integration of the data into the data
analysis process causes some problems, e.g. the cross-reference table
entries show an offset because the code analyzer's computed operand
offset doesn't match the value of the label.  The feature should be
considered experimental

The feature can be enabled or disabled with a project property.  The
results were sufficiently useful and non-annoying to make the setting
enabled by default.
2020-07-03 17:58:41 -07:00
Andy McFadden
6d7fdff6b5 Fix 65816 code generation issues
Code generated for 64tass was incorrect for JSR/JMP to a location
outside the file bounds.  A test added to 20052-branches-and-banks
revealed an issue with cc65 generation as well.
2020-07-03 14:02:38 -07:00
Andy McFadden
d035e29de5 Update GS/OS symbols
Added "GS" suffix to GS/OS calls.  Added ProDOS-16 calls.
2020-07-03 11:27:45 -07:00
Andy McFadden
d979571880 Remove "Atari Arcade Cabinet" system definition
The handful of 6502-based Atari coin-op systems were very different
from each other, so having a dedicated entry doesn't make sense.

Also, enable word-wrap in the New Project text box that holds the
system description.
2020-07-01 11:06:23 -07:00