mirror of
https://github.com/fadden/6502bench.git
synced 2024-11-17 09:04:43 +00:00
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.
This commit is contained in:
parent
7739f640f5
commit
e898ef9568
@ -1657,6 +1657,14 @@ namespace SourceGen {
|
||||
|
||||
mUndoList.Add(changeSet);
|
||||
mUndoTop = mUndoList.Count;
|
||||
|
||||
// If the user makes a change, saves the file, hits undo, then makes another change,
|
||||
// the "undo top" and "save index" will be equal, which will make us think the
|
||||
// file doesn't need to be saved. In reality there is no longer any undo index that
|
||||
// matches the saved file state.
|
||||
if (mUndoSaveIndex >= mUndoTop) {
|
||||
mUndoSaveIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
public string DebugGetUndoRedoHistory() {
|
||||
|
@ -103,6 +103,7 @@ and 65816 code. The official web site is
|
||||
<li><a href="codegen.html#cc65">cc65</a></li>
|
||||
<li><a href="codegen.html#merlin32">Merlin 32</a></li>
|
||||
</ul></li>
|
||||
<li><a href="codegen.html#export-source">Exporting Source Code</a>
|
||||
</ul></li>
|
||||
|
||||
<li><a href="settings.html">Properties & Settings</a>
|
||||
@ -171,7 +172,7 @@ and 65816 code. The official web site is
|
||||
|
||||
<div id="footer">
|
||||
<hr/>
|
||||
<p>Copyright 2018 faddenSoft</p>
|
||||
<p>Copyright 2019 faddenSoft</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -28,7 +28,7 @@ manual is recommended.</p>
|
||||
|
||||
<p>Start by launching SourceGen. The initial screen has a large
|
||||
center area with some buttons, and some mostly-empty windows on the sides.
|
||||
The buttons are shortcuts for menu items in the File menu.</p>
|
||||
The buttons are shortcuts for items in the File menu.</p>
|
||||
|
||||
|
||||
<h3>Create the project</h3>
|
||||
@ -63,7 +63,7 @@ or data. This is a standard Windows "list view", so you can select a row
|
||||
by left-clicking anywhere in it. Use Ctrl+Click to toggle the selection
|
||||
on individual lines, and Shift+Click to select a range of lines. You can
|
||||
move the selection around with the up/down arrow keys and PgUp/PgDn. Scroll
|
||||
the window with the mouse wheel or by grabbing the scroll bar.</p>
|
||||
the window with the mouse wheel or by dragging the scroll bar.</p>
|
||||
|
||||
<p>Each row is divided into nine columns. You can adjust the column
|
||||
widths by clicking and dragging the column dividers in the header. The
|
||||
@ -97,7 +97,7 @@ highlights and contents of other windows change.</p>
|
||||
selection jumps to L1017. When an operand references an in-file address,
|
||||
double-clicking on the opcode will take you to it. (Double-clicking on
|
||||
the operand itself opens a format editor; more on that later.)</p>
|
||||
<p>With L1017 highlighted, double-click on the line that appears in the
|
||||
<p>With line L1017 selected, double-click on the line that appears in the
|
||||
References window. Note the selection jumps to L1002. You can immediately
|
||||
jump to any reference.</p>
|
||||
<p>At the top of the Symbols window on the right side of the screen is a
|
||||
@ -229,7 +229,9 @@ as a hexadecimal value.</p>
|
||||
Actions > Edit Label. Enter "IS_OK", and hit Enter. (NOTE: labels are
|
||||
case-sensitive, so it needs to match the operand at $2005 exactly.) You'll
|
||||
see the new label appear, and the operand at line $2005 will use it.</p>
|
||||
<p>There's an easier way. Double-click on the "BCC" opcode at address
|
||||
<p>There's an easier way. Select Edit > Undo twice, to get back to the
|
||||
state where line $2005 says "BCC L2009", and line $2009 has the label
|
||||
L2009. Now double-click on the "BCC" opcode (not operand) at address
|
||||
$2005. This moves the selection to $2009. Double-click on the label field,
|
||||
and enter "IS_OK". Hit "OK".</p>
|
||||
<p>You should now see that both the operand at $2005 and the label at
|
||||
@ -237,9 +239,19 @@ $2009 have changed to IS_OK, accomplishing what we wanted to do in a
|
||||
single step. The key difference is that we haven't explicitly set a
|
||||
format for the BCC operand -- we just defined a label, and SourceGen
|
||||
used it automatically.</p>
|
||||
<p>We could do the exact same thing by using Edit Operand on
|
||||
the BCC line, clicking the "Create Label" button, and typing "IS_OK".
|
||||
Sometimes one approach is more convenient than the other.</p>
|
||||
<p>There's another way to do the same thing that is sometimes
|
||||
more convenient. Double-click the "IS_OK" label on line $2009, hit
|
||||
the Delete key to erase it, and click "OK". This removes the label,
|
||||
so SourceGen generates L2009 again. Double-click on the operand on
|
||||
line $2005 ("L2009") to open the operand editor, then in the bottom left
|
||||
panel click "Create Label". Type "IS_OK", then click "OK". Make sure the
|
||||
radio buttons are still set to Default format, and click "OK".</p>
|
||||
<p>You should again have the IS_OK label at line $2009, just like it did
|
||||
when you created the label on line $2009, because you did exactly the
|
||||
same thing. You just opened the label editor from the Edit Operand dialog
|
||||
instead of the code list. In many cases, particularly when operand's
|
||||
target address is far off screen, it's more convenient to work through the
|
||||
operand editor.</p>
|
||||
|
||||
|
||||
<h3>Editing Data Operands</h3>
|
||||
@ -344,13 +356,14 @@ a bit more meaningful by loading an additional platform
|
||||
symbol file. Select Edit > 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>
|
||||
<p>The STA instructions now reference <code>AMPERV</code>, which is noted
|
||||
as a call vector. We can see the code setting up a jump (opcode $4c) to
|
||||
$1d70. As it happens, the start address of the code is $1d60 -- the last
|
||||
four digits of 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>
|
||||
click "Open". Click "OK" to close the project properties window.</p>
|
||||
<p>The <code>STA</code> instructions now reference <code>BAS_AMPERV</code>,
|
||||
which is noted as a code vector. We can see the code setting up a jump
|
||||
(opcode $4c) to $1d70. As it happens, the start address of the code
|
||||
is $1d60 -- the last four digits of 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.
|
||||
@ -359,9 +372,9 @@ 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,
|
||||
it loads bytes from tables at $1da6 and $1d97, pushes them on the stack,
|
||||
and the JMPs away. This code is pushing a return address onto the stack.
|
||||
When the code at CHRGET returns, it'll return to that address. Because of
|
||||
a quirk of the 6502 architecture, the address pushed must be the target
|
||||
address minus one.</p>
|
||||
When the code at <code>BAS_CHRGET</code> returns, it'll return to that
|
||||
address. Because of a quirk of the 6502 architecture, the address pushed
|
||||
must be the desired address minus one.</p>
|
||||
<p>The first byte in the first address 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>
|
||||
@ -408,7 +421,7 @@ SourceGen asks for confirmation, click Discard & Continue.</p>
|
||||
<h3>Going Deeper</h3>
|
||||
|
||||
<p>Start a new project. Select "Generic 6502". For the data file, navigate
|
||||
to the Examples directory, then from the Tutorials directory
|
||||
to the Examples directory, then from the Tutorial directory
|
||||
select "Tutorial2".</p>
|
||||
<p>The first thing you'll notice is that we immediately ran into a BRK,
|
||||
which is a pretty reliable sign that we're not in a code section. The
|
||||
@ -470,7 +483,7 @@ as the dialog opens; you don't need to click around first.) If all
|
||||
went well, the operands should now read <code>LDA #<XDATA</code>
|
||||
and <code>LDA #>XDATA</code>.</p>
|
||||
<p>Let's give the pointer a name. Select line $203d, and use
|
||||
Actions > Edit Local Variable Table to create an empty table.
|
||||
Actions > Create Local Variable Table to create an empty table.
|
||||
Click "New Symbol" on the right side. Set the Label field to "PTR1",
|
||||
the Value field to $02, and the width to 2 (it's a 2-byte pointer). Leave
|
||||
the Address button selected. Click "OK" to create the entry, and then
|
||||
@ -556,23 +569,26 @@ than the "nearby" logic.</p>
|
||||
avoid explicitly labeling every part of a multi-byte data item. For now,
|
||||
use Edit > Undo to switch it back on.</p>
|
||||
|
||||
<p>The code at $2085 looks a bit strange. LDX, then a BIT with a weird
|
||||
symbol, then another LDX. If you look at the "bytes" column, you'll notice
|
||||
that the three-byte BIT instruction has only one byte on its line. The
|
||||
trick here is that the <code>LDX #$01</code> is embedded inside the BIT
|
||||
instruction. When the code runs through here, X is set to $00, then
|
||||
the BIT instruction sets some flags, then the STA runs. Several lines
|
||||
down there's a BNE to $2088, which is in the middle of the BIT instruction.
|
||||
It loads X with $01, then also continues to the STA.</p>
|
||||
<p>Embedded instructions are unusual but not unheard-of. When you see the
|
||||
<p>The code at $2085 looks a bit strange. <code>LDX</code>, then a
|
||||
<code>BIT</code> with a weird symbol, then another <code>LDX</code>. If
|
||||
you look at the "bytes" column, you'll notice that the three-byte
|
||||
<code>BIT</code> instruction has only one byte on its line. The
|
||||
trick here is that the <code>LDX #$01</code> is embedded inside the
|
||||
<code>BIT</code> instruction. When the code runs through here, X is set
|
||||
to $00, then the <code>BIT</code> instruction sets some flags, then the
|
||||
<code>STA</code> runs. Several lines down there's a <code>BNE</code>
|
||||
to $2088, which is in the middle of the <code>BIT</code> instruction.
|
||||
It loads X with $01, then also continues to the <code>STA</code>.</p>
|
||||
<p>Embedded instructions are unusual but not unheard-of. (This trick is
|
||||
used extensively in Microsoft BASICs, such as Applesoft.) When you see the
|
||||
extra symbol in the opcode field, you need to look closely at what's going
|
||||
on.</p>
|
||||
|
||||
|
||||
<h3>Go Forth</h3>
|
||||
|
||||
<p>That's it for the tutorials. There's significantly more detail on
|
||||
all aspects of SourceGen in the manual.</p>
|
||||
<p>That's it for the tutorials. Significantly more detail on
|
||||
all aspects of SourceGen can be found in the manual.</p>
|
||||
<p>While you can do some fancy things, nothing you do will alter the
|
||||
data file. The assembled output will always match the original. So
|
||||
don't be afraid to play around.</p>
|
||||
|
@ -113,7 +113,7 @@ limitations under the License.
|
||||
<StackPanel Orientation="Horizontal" Margin="20,4,0,0"
|
||||
IsEnabled="{Binding ElementName=radioSimpleDataSymbolic, Path=IsChecked}">
|
||||
<RadioButton Name="radioSymbolPartLow" GroupName="Part" Content="Low"/>
|
||||
<RadioButton Name="radioSymbolPartHigh" GroupName="Part" Content="High" Margin="8,0,0,0"/>
|
||||
<RadioButton Name="radioSymbolPartHigh" GroupName="Part" Content="H_igh" Margin="8,0,0,0"/>
|
||||
<RadioButton Name="radioSymbolPartBank" GroupName="Part" Content="Bank" Margin="8,0,8,0"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
Loading…
Reference in New Issue
Block a user