1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-26 06:49:19 +00:00
This commit is contained in:
Andy McFadden 2018-10-09 10:24:37 -07:00
commit 0851746123
11 changed files with 100 additions and 100 deletions

View File

@ -9,7 +9,7 @@
</head>
<body>
<div id=content>
<div id="content">
<h1>6502bench SourceGen: Advanced Topics</h1>
<p><a href="index.html">Back to index</a></p>
@ -263,7 +263,7 @@ not help you debug 6502 projects.</p>
</div>
<div id=footer>
<div id="footer">
<p><a href="index.html">Back to index</a></p>
</div>
</body>

View File

@ -9,7 +9,7 @@
</head>
<body>
<div id=content>
<div id="content">
<h1>6502bench SourceGen: Instruction and Data Analysis</h1>
<p><a href="index.html">Back to index</a></p>
@ -137,22 +137,22 @@ the changes are made, the Anattrib array and other data structures are
regenerated.</p>
<p>Data format editing can create some tricky situations. For example,
suppose you have 8 bytes that have been formatted as two 32-bit words:
suppose you have 8 bytes that have been formatted as two 32-bit words:</p>
<pre>
1000: 68690074 .dd4 $74006968
1004: 65737400 .dd4 $00747365
</pre>
You realize these are null-terminated strings, select both words, and
reformat them:
<p>You realize these are null-terminated strings, select both words, and
reformat them:</p>
<pre>
1000: 686900 .zstr "hi"
1003: 74657374+ .zstr "test"
</pre>
Seems simple enough. Under the hood, SourceGen created three changes:
<p>Seems simple enough. Under the hood, SourceGen created three changes:</p>
<ol>
<li>At offset +000000, replace the current format descriptor (4-byte
numeric) with a 3-byte null-terminated string descriptor.</li>
@ -176,21 +176,21 @@ for every instruction:</p>
<ol>
<li>Continue. Execution always continues at the next instruction.
Examples: <code>LDA</code>, <code>STA</code>, <code>AND</code>,
<code>NOP</code>.
<code>NOP</code>.</li>
<li>Don't continue. The next instruction to be executed can't be
determined from the file data (unless you're disassembling the
system ROM around the BRK vector).
Examples: <code>RTS</code>, <code>BRK</code>.
Examples: <code>RTS</code>, <code>BRK</code>.</li>
<li>Branch always. The operand specifies the next instruction address.
Examples: <code>JMP</code>, <code>BRA</code>, <code>BRL</code>.
Examples: <code>JMP</code>, <code>BRA</code>, <code>BRL</code>.</li>
<li>Branch sometimes. Execution may continue at the operand address,
or may execute the following instruction. If we know the value of
the flags in the processor status register, we can eliminate one
possibility. Examples: <code>BCC</code>, <code>BEQ</code>,
<code>BVS</code>.
<code>BVS</code>.</li>
<li>Call subroutine. Execution will continue at the operand address,
and is expected to also continue at the following instruction.
Examples: <code>JSR</code>, <code>JSL</code>.
Examples: <code>JSR</code>, <code>JSL</code>.</li>
</ol>
<p>Branch targets are added to a list. When the current run of instructions
@ -247,10 +247,10 @@ override on the instruction following the PLP fixes things.)</p>
<p>Some other things that the code analyzer can't recognize automatically:</p>
<ul>
<li>Jumping indirectly through an address outside the file, e.g.
storing an address in zero-page memory and jumping through it.
storing an address in zero-page memory and jumping through it.</li>
<li>Jumping to an address by pushing the location onto the stack,
then executing an <code>RTS</code>.
<li>Self-modifying code, e.g. overwriting a <code>JMP</code> instruction.
then executing an <code>RTS</code>.</li>
<li>Self-modifying code, e.g. overwriting a <code>JMP</code> instruction.</li>
</ul>
<p>Sometimes the indirect jump targets are coming from a table of
addresses in the file. If so, these can be formatted as addresses,
@ -311,7 +311,7 @@ byte values.</p>
</div>
<div id=footer>
<div id="footer">
<p><a href="index.html">Back to index</a></p>
</div>
</body>

View File

@ -9,7 +9,7 @@
</head>
<body>
<div id=content>
<div id="content">
<h1>6502bench SourceGen: Code Generation &amp; Assembly</h1>
<p><a href="index.html">Back to index</a></p>
@ -65,7 +65,7 @@ will be shown with the detected version number. If the assembler
executable isn't configured, "[latest version]" will be shown instead
of a version number.</p>
<p>The Settings button will take you directly to the assembler configuration
tab in the application settings dialog.
tab in the application settings dialog.</p>
<p>Hit the Generate button to generate the source code into a file on disk.
The file will use the project name, with the ".dis65" replaced by
"_&lt;assembler&gt;.S".</p>
@ -107,7 +107,7 @@ so any failure is an opportunity for improvement.</p>
</div>
<div id=footer>
<div id="footer">
<p><a href="index.html">Back to index</a></p>
</div>
</body>

View File

@ -9,7 +9,7 @@
</head>
<body>
<div id=content>
<div id="content">
<h1>6502bench SourceGen: Editors</h1>
<p><a href="index.html">Back to index</a></p>
@ -92,7 +92,7 @@ to format. For example, to format two bytes as a 16-bit word, you must
select both bytes in the editor. (If you click on the first item, then
Shift+double-click on the operand field of the last item, you can do
this very quickly.) The selection does not need to be contiguous: you
can use Control+click to select scattered items.)
can use Control+click to select scattered items.)</p>
<p>If the range is discontiguous, or crosses a visual boundary
such as a change in address, a user-specified label, or a long comment
or note, the selection will be split into smaller regions. A message at the
@ -247,7 +247,7 @@ marked as "constant" will not, though you can still specify them manually.</p>
</div>
<div id=footer>
<div id="footer">
<p><a href="index.html">Back to index</a></p>
</div>
</body>

View File

@ -9,7 +9,7 @@
</head>
<body>
<div id=content>
<div id="content">
<h1>6502bench SourceGen: End Notes</h1>
<p><a href="index.html">Back to index</a></p>
@ -76,7 +76,7 @@ are solid enough to excuse the excesses.</p>
</div>
<div id=footer>
<div id="footer">
<p><a href="index.html">Back to index</a></p>
</div>
</body>

View File

@ -9,7 +9,7 @@
</head>
<body>
<div id=content>
<div id="content">
<h1>6502bench SourceGen</h1>
<p>SourceGen is an interactive disassembler for 6502, 65C02, 65802,
and 65816 code. The official web site is
@ -20,31 +20,31 @@ and 65816 code. The official web site is
<h2>Contents</h2>
<ul>
<li><a href="intro.html">Overview</a></li>
<li><a href="intro.html">Overview</a>
<ul>
<li><a href="intro.html#fundamental-concepts">Fundamental Concepts</a></li>
<li><a href="intro.html#begin">About 6502 Code</a></li>
<li><a href="intro.html#sgintro">How SourceGen Works</a></li>
<li><a href="intro.html#sgintro">How SourceGen Works</a>
<ul>
<li><a href="intro.html#scripts">Extension Scripts</a></li>
<li><a href="intro.html#hints">Analyzer Hints</a></li>
</ul>
</ul></li>
<li><a href="intro.html#sgconcepts">SourceGen Concepts</a></li>
<li><a href="intro.html#about-symbols">All About Symbols</a></li>
<li><a href="intro.html#about-symbols">All About Symbols</a>
<ul>
<li><a href="intro.html#weak-refs">Weak References</a></li>
<li><a href="intro.html#symbol-parts">Parts and Adjustments</a></li>
<li><a href="intro.html#nearby-targets">Automatic Use of Nearby Targets</a></li>
</ul>
</ul></li>
<li><a href="intro.html#width-disambiguation">Width Disambiguation</a></li>
<li><a href="intro.html#pseudo-ops">Data and Directive Pseudo-Opcodes</a></li>
</ul>
</ul></li>
<li><a href="mainwin.html">Using SourceGen</a></li>
<li><a href="mainwin.html">Using SourceGen</a>
<ul>
<li><a href="mainwin.html#starting-new">Starting a New Project</a></li>
<li><a href="mainwin.html#opening">Opening an Existing Project</a></li>
<li><a href="mainwin.html#working">Working With a Project</a></li>
<li><a href="mainwin.html#working">Working With a Project</a>
<ul>
<li><a href="mainwin.html#code-list">Code List</a></li>
<li><a href="mainwin.html#undo">Undo &amp; Redo</a></li>
@ -58,10 +58,10 @@ and 65816 code. The official web site is
<li><a href="mainwin.html#toggle-format">Quick Format Toggle</a></li>
<li><a href="mainwin.html#toggle-data">Toggle Data Scan</a></li>
<li><a href="mainwin.html#clipboard">Copying to Clipboard</a></li>
</ul>
</ul>
</ul></li>
</ul></li>
<li><a href="editors.html">Editors</a></li>
<li><a href="editors.html">Editors</a>
<ul>
<li><a href="editors.html#address">Edit Address</a></li>
<li><a href="editors.html#flags">Edit Status Flags</a></li>
@ -72,77 +72,77 @@ and 65816 code. The official web site is
<li><a href="editors.html#long-comment">Edit Long Comment</a></li>
<li><a href="editors.html#note">Edit Note</a></li>
<li><a href="editors.html#project-symbol">Edit Project Symbol</a></li>
</ul>
</ul></li>
<li><a href="codegen.html">Code Generation &amp; Assembly</a></li>
<li><a href="codegen.html">Code Generation &amp; Assembly</a>
<ul>
<li><a href="codegen.html#supported">Supported Assemblers</a></li>
<li><a href="codegen.html#supported">Supported Assemblers</a>
<ul>
<li><a href="codegen.html#version">Version-Specific Code Generation</a></li>
</ul>
<li><a href="codegen.html#generate">Generating Source Code</a></li>
</ul></li>
<li><a href="codegen.html#generate">Generating Source Code</a>
<ul>
<li><a href="codegen.html#localizer">Label Localizer</a></li>
</ul>
</ul></li>
<li><a href="codegen.html#assemble">Cross-Assembling Generated Code</a></li>
</ul>
</ul></li>
<li><a href="settings.html">Properties &amp; Settings</a></li>
<li><a href="settings.html">Properties &amp; Settings</a>
<ul>
<li><a href="settings.html#app-settings">Application Settings</a></li>
<li><a href="settings.html#app-settings">Application Settings</a>
<ul>
<li><a href="settings.html#appset-codeview">Code View</a></li>
<li><a href="settings.html#appset-asmconfig">Asm Config</a></li>
<li><a href="settings.html#appset-displayformat">Display Format</a></li>
<li><a href="settings.html#appset-pseudoop">Pseudo-Op</a></li>
</ul>
<li><a href="settings.html#project-properties">Project Properties</a></li>
</ul></li>
<li><a href="settings.html#project-properties">Project Properties</a>
<ul>
<li><a href="settings.html#projprop-general">General</a></li>
<li><a href="settings.html#projprop-projsym">Project Symbols</a></li>
<li><a href="settings.html#projprop-symfiles">Symbol Files</a></li>
<li><a href="settings.html#projprop-extscripts">Extension Scripts</a></li>
</ul>
</ul>
</ul></li>
</ul></li>
<li><a href="tools.html">Tools</a></li>
<li><a href="tools.html">Tools</a>
<ul>
<li><a href="tools.html#hexdump">Hex Dump Viewer</a></li>
<li><a href="tools.html#ascii-chart">ASCII Chart</a></li>
</ul>
</ul></li>
<li><a href="advanced.html">Advanced Topics</a></li>
<li><a href="advanced.html">Advanced Topics</a>
<ul>
<li><a href="advanced.html#platform-symbols">Platform Symbol Files (.sym65)</a></li>
<li><a href="advanced.html#extension-scripts">Extension Scripts</a></li>
<li><a href="advanced.html#multi-bin">Working With Multiple Binaries</a></li>
<li><a href="advanced.html#overlap">Overlapping Address Spaces</a></li>
<li><a href="advanced.html#debug">Debug Menu Options</a></li>
</ul>
</ul></li>
<li><a href="analysis.html">Appendix: Instruction and Data Analysis</a></li>
<li><a href="analysis.html">Appendix: Instruction and Data Analysis</a>
<ul>
<li><a href="analysis.html#analysis-process">Analysis Process</a></li>
<li><a href="analysis.html#analysis-process">Analysis Process</a>
<ul>
<li><a href="analysis.html#auto-format">Automatic Formatting</a></li>
<li><a href="analysis.html#undo-redo">Interaction With Undo/Redo</a></li>
</ul>
<li><a href="analysis.html#code-analysis">Code Analysis</a></li>
</ul></li>
<li><a href="analysis.html#code-analysis">Code Analysis</a>
<ul>
<li><a href="analysis.html#extension-scripts">Extension Scripts</a></li>
</ul>
</ul></li>
<li><a href="analysis.html#data-analysis">Data Analysis</a></li>
</ul>
</ul></li>
<li><a href="end-notes.html">End Notes</a></li>
<li><a href="end-notes.html">End Notes</a> </li>
<br/>
<li><a href="tutorials.html">Tutorials</a></li>
<li><a href="tutorials.html">Tutorials</a>
<ul>
<li><a href="tutorials.html#basic-features">Basic Features</a></li>
<li><a href="tutorials.html#advanced-features">Advanced Features</a></li>
</ul>
</ul></li>
</ul>
@ -150,8 +150,8 @@ and 65816 code. The official web site is
</div>
<div id=footer>
<hr>
<div id="footer">
<hr/>
<p>Copyright 2018 faddenSoft</p>
</div>
</body>

View File

@ -9,7 +9,7 @@
</head>
<body>
<div id=content>
<div id="content">
<h1>6502bench SourceGen: Intro</h1>
<p><a href="index.html">Back to index</a></p>
@ -148,7 +148,7 @@ disassembly of the instruction stream will come out wrong.</p>
<p>SourceGen employs a partial emulation technique that traces the flow
of execution. Most of what a given instruction does isn't important;
only its effect on the flow of execution matters.
only its effect on the flow of execution matters.</p>
<p>The code tracing has to start somewhere, so SourceGen uses "code entry
point hints" to identify places where execution may begin. By default,
@ -231,7 +231,7 @@ L1009 CLC
assumes those are data. Further, the functions at those addresses may
also be considered data unless some bit of code reachable from L1009
calls into them. If you add a code hint to $1003 and $1006,
you'll get better results:
you'll get better results:</p>
<pre>
.ORG $1000
JMP L1009
@ -343,13 +343,13 @@ to add comments explaining it. SourceGen projects have three kinds of
comments:</p>
<ol>
<li>End-of-line comments. As the name implies, these appear at the
end of a line, to the right of the opcode or operand.
end of a line, to the right of the opcode or operand.</li>
<li>Long comments, also known as multi-line comments. These get a
line all to themselves, and may span multiple lines.
line all to themselves, and may span multiple lines.</li>
<li>Notes. Like long comments, these get a line to themselves. Unlike
long comments, these do not appear in generated assembly code. They
are a way for you to leave notes to yourself, perhaps "don't forget
to figure this out" or "this is the cool part".
to figure this out" or "this is the cool part".</li>
</ol>
<p>Every file offset can have one of each.</p>
@ -372,9 +372,9 @@ different ways.</p>
<p>The label syntax is restricted to a format that should be compatible
with most assemblers:</p>
<ul>
<li>2-32 characters long.
<li>Starts with a letter or underscore.
<li>Comprised of ASCII letters, numbers, and the underscore.
<li>2-32 characters long.</li>
<li>Starts with a letter or underscore.</li>
<li>Comprised of ASCII letters, numbers, and the underscore.</li>
</ul>
<p>Label comparisons are case-sensitive, as is customary for programming
languages.</p>
@ -442,7 +442,7 @@ symbol exists, the reference is used. If the symbol can't be found, the
operand is formatted in hex instead.</p>
<p>It's important to know this when editing a project. Consider the
following trivial chunk of code:
following trivial chunk of code:</p>
<pre>
1000: 4c0310 JMP $1003
@ -596,7 +596,7 @@ L1012 .DD1 $00
the code is actually setting up a single 24-bit address. For clarity,
you'd like the output to reflect the fact that it's a single, multi-byte
variable. So, if you set a label at $1010, SourceGen removes the
nearby auto labels, and sets the numeric references to use your label:
nearby auto labels, and sets the numeric references to use your label:</p>
<pre>
.ORG $1000
@ -684,7 +684,7 @@ represent hundreds of bytes and span multiple lines.</p>
<li>.BULK - data packed in as compact a form as the assembler allows.
Useful for chunks of graphics data.</li>
<li>.FILL - a series of identical bytes. The operand
is the byte count, followed by the byte value.
is the byte count, followed by the byte value.</li>
</ul>
<p>In addition, several pseudo-ops are defined for string constants:</p>
@ -708,7 +708,7 @@ uses in the
</div>
<div id=footer>
<div id="footer">
<p><a href="index.html">Back to index</a></p>
</div>
</body>

View File

@ -9,7 +9,7 @@
</head>
<body>
<div id=content>
<div id="content">
<h1>6502bench SourceGen: Main Window</h1>
<p><a href="index.html">Back to index</a></p>
@ -68,11 +68,11 @@ most-recently-opened projects will be available.</p>
<p>The main project window is divided into five areas:</p>
<ol>
<li>Center: the code list. If no project is open, this will instead
have clickable links to open a new or existing project.
<li>Top left: cross-reference list.
<li>Bottom left: notes list.
<li>Top right: symbols list.
<li>Bottom right: info on selected line.
have clickable links to open a new or existing project.</li>
<li>Top left: cross-reference list.</li>
<li>Bottom left: notes list.</li>
<li>Top right: symbols list.</li>
<li>Bottom right: info on selected line.</li>
</ol>
<p>Most of the action takes place in the center code list.</p>
@ -431,7 +431,7 @@ to put the data into individual cells.</p>
</div>
<div id=footer>
<div id="footer">
<p><a href="index.html">Back to index</a></p>
</div>
</body>

View File

@ -9,7 +9,7 @@
</head>
<body>
<div id=content>
<div id="content">
<h1>6502bench SourceGen: Properties &amp; Settings</h1>
<p><a href="index.html">Back to index</a></p>
@ -63,7 +63,7 @@ or the other.</p>
<a href="mainwin.html#clipboard">copied to the clipboard</a>. The
"Assembler Source" format includes the rightmost columns (label,
opcode, operand, and comment), like assembly source code does. The
"Disassembly" format adds the address and bytes on the left.
"Disassembly" format adds the address and bytes on the left.</p>
<h3><a name="appset-asmconfig">Asm Config</a></h3>
@ -148,7 +148,7 @@ you later hit Cancel, but the changes are not applied immediately.</p>
<p>The choice of CPU determines the set of available instructions, as
well as cycle costs and register widths. There are many variations
on the 6502, but from the perspective of a disassembler most can be
treated as one of these three:
treated as one of these three:</p>
<ol>
<li>MOS 6502. The original 8-bit instruction set.</li>
<li>WDC W65C02S. Expanded the instruction set and smoothed
@ -244,7 +244,7 @@ you will receive a warning.</p>
</div>
<div id=footer>
<div id="footer">
<p><a href="index.html">Back to index</a></p>
</div>
</body>

View File

@ -9,7 +9,7 @@
</head>
<body>
<div id=content>
<div id="content">
<h1>6502bench SourceGen: Tools</h1>
<h2><a name="hexdump">Hex Dump Viewer</a></h2>
@ -59,7 +59,7 @@ ASCII.</p>
</div>
<div id=footer>
<div id="footer">
<p><a href="index.html">Back to index</a></p>
</div>
</body>

View File

@ -9,7 +9,7 @@
</head>
<body>
<div id=content>
<div id="content">
<h1>6502bench SourceGen: Tutorials</h1>
<p><a href="index.html">Back to index</a></p>
@ -43,7 +43,7 @@ window will have some information about the data file, once we choose one.</p>
open the Examples folder, then open the "Tutorial" folder. Select the
file named "Tutorial1", and click "Open".</p>
<p>The filename now appears in the bottom window, along with an indication
of the file's size.
of the file's size.</p>
<p>Click OK to create the project.</p>
@ -176,7 +176,7 @@ In the Edit Address dialog, type "2000", and hit Enter.)</p>
<p>Note the way the code list has changed. When you changed the address,
the "JMP $2000" at L1014 found a home inside the bounds of the file, so
the code tracer was able to find the instructions there.<p>
the code tracer was able to find the instructions there.</p>
<p>From the menu, select Edit &gt; Undo. Notice how everything reverts to
the way it was. Now, select Edit &gt; Redo. You can undo any change you
make to the project. (The undo history is <strong>not</strong> saved in
@ -281,7 +281,7 @@ the "Address" radio button. Click "OK".</p>
<p>We just told SourceGen that those 10 bytes are actually five numeric
references. SourceGen determined that the addresses are contained in the
file, and created labels for each of them. Labels only work if they're
on their own line, so each string is now in a separate ".STR" statement.
on their own line, so each string is now in a separate ".STR" statement.</p>
<p>Use File &gt; Save (or hit Ctrl+S) to save your hard work.</p>
@ -329,7 +329,7 @@ and navigate to the Examples directory. In A2-Amper-fdraw, select
<p>Not a lot to see here -- just half a dozen lines of loads and stores.
This particular program interfaces with Applesoft BASIC, so we can make it
a bit more meaningful by loading an additional platform
symbol file. Select Edit > Project Properties, then the Symbol Files
symbol file. Select Edit &gt; Project Properties, then the Symbol Files
tab. Click Add Symbol Files. The file browser starts in the RuntimeData
directory. In the Apple folder, select <code>Applesoft.sym65</code>, and
click Open. Click OK to close the project properties window.</p>
@ -340,7 +340,7 @@ the filename -- so let's make that change. Double-click the initial .ORG
statement, and change it from $2000 to $1d60. We can now see that $1d70
starts right after this initial chunk of code.</p>
<p>Select the line with address $1d70, then Actions > Hint As Code Entry Point.
<p>Select the line with address $1d70, then Actions &gt; Hint As Code Entry Point.
More code appears, but not much -- if you scroll down you'll see that most
of the file is still data. The code at $1d70 searches through a table at
$1d88 for a match with the contents of the accumulator. If it finds a match,
@ -352,7 +352,7 @@ address minus one.</p>
<p>The first byte in the first table at $1d97 (which has the auto-label
L1D97) is $b4. The first byte in the second table is $1d. So the first
address we want is $1db4 + 1 = $1db5.</p>
<p>Select the line at $1db5, and use Actions > Hint As Code Entry Point.
<p>Select the line at $1db5, and use Actions &gt; Hint As Code Entry Point.
More code appears, but again it's only a few lines. Let's dress this one
up a bit. Set a label on the code at $1db5 called "FUNC". At $1d97, edit
the data item (double-click on "$b4"), click "Single bytes", then type "FUNC"
@ -380,13 +380,13 @@ we know that they're all code entry points.</p>
<p>Click OK. The table of address bytes should now all be references to
symbols -- 15 low parts followed by 15 high parts. If you scroll down,
you should see nothing but instructions until you get to the last dozen
bytes at the end of the file. (If this isn't the case, use Edit > Undo,
bytes at the end of the file. (If this isn't the case, use Edit &gt; Undo,
then work through the steps again.)</p>
<p>The formatter did the same steps you went through earlier -- set a
label, apply the label to the low and high bytes in the table, add a
code entry point hint -- but did several of them at once.</p>
<p>We don't want to save this project, so select File > Close. When
<p>We don't want to save this project, so select File &gt; Close. When
SourceGen asks if you want to continue, click OK.</p>
@ -395,7 +395,7 @@ SourceGen asks if you want to continue, click OK.</p>
</div>
<div id=footer>
<div id="footer">
<p><a href="index.html">Back to index</a></p>
</div>
</body>