mirror of
https://github.com/fadden/6502bench.git
synced 2025-02-07 14:31:00 +00:00
Add a couple of funky projects
Added a project with a few bad address region definitions, and one to exercise the security sandbox. Also, fiddled with the documentation a little.
This commit is contained in:
parent
0ca9911d0d
commit
a395909574
@ -14,6 +14,91 @@
|
||||
<p><a href="index.html">Back to index</a></p>
|
||||
|
||||
|
||||
<h2><a name="address">Define Address Region</a></h2>
|
||||
|
||||
<p><a href="intro-details.html#address-regions">Address regions</a>
|
||||
may be created, edited, resized, or removed. Which
|
||||
operation is performed depends on the current selection. You can
|
||||
specify the start and end points of a region by selecting the entire
|
||||
region, or by selecting just the first and last lines.</p>
|
||||
<p>In all cases, you can specify the range's initial address
|
||||
as a hexadecimal value. You can prefix it with '$', but that's not
|
||||
required.
|
||||
24-bit addresses may be written with a bank separator, e.g. "12/3456"
|
||||
would resolve to address $123456.
|
||||
If you want to set the region to be non-addressable, enter
|
||||
"<code>NA</code>".</p>
|
||||
|
||||
<p>You can also enter a <a href="intro-details.html#pre-labels">pre-label</a>
|
||||
or specify that the operand should be formatted as a
|
||||
<a href="intro-details.html#relative-addr">relative address</a>.
|
||||
|
||||
<p>To delete a region, click the "Delete Region" button.</p>
|
||||
|
||||
<h4>Create</h4>
|
||||
|
||||
<p>If your selection starts with a code or data line, the editor
|
||||
will allow to create a new address region. If a single line was
|
||||
selected, the default behavior will be to create a region with a
|
||||
floating end point. If multiple lines were selected, the default
|
||||
behavior will be to create a region with a fixed end point.</p>
|
||||
|
||||
<p>The address field will be initialized to the address of the
|
||||
first selected line.</p>
|
||||
|
||||
<p>You can create a child region that shares the same start offset
|
||||
as an existing region by selecting the first code or data line
|
||||
within that region. Note that regions with floating end points cannot
|
||||
have the same start offset as another region.</p>
|
||||
|
||||
<h4>Edit</h4>
|
||||
|
||||
<p>If you select only the address region start line, perhaps by
|
||||
double-clicking the operand there, you will be able to edit the
|
||||
current region's properties.</p>
|
||||
|
||||
<p>If the region has a floating end point, you can choose to convert
|
||||
it to a fixed end. The end doesn't move; it just gets fixed in place.
|
||||
This is a quick way to "lock down" regions once you've established
|
||||
their end points.</p>
|
||||
|
||||
<h4>Resize</h4>
|
||||
|
||||
<p>If you select multiple lines, and the first line is an address
|
||||
region start directive, you will be able to resize that region to
|
||||
the selection. By definition, the updated region will have a fixed
|
||||
end point.</p>
|
||||
|
||||
<h4>Other notes</h4>
|
||||
|
||||
<p>There is no affordance for moving the start offset of a region. You
|
||||
must create a new region and then delete the old one.</p>
|
||||
|
||||
<p>Regions may not "straddle" the start or end points of other regions.</p>
|
||||
|
||||
<p>Double-clicking on the pseudo-opcode of a region start or end
|
||||
declaration will move the selection to the other end, rather than
|
||||
opening the editor.</p>
|
||||
|
||||
<p>To see detailed information about an address region in the "Info"
|
||||
window, select the region start or end directive. You can see the
|
||||
current arrangement of address regions across your entire
|
||||
project with Navigate > View Address Map.</p>
|
||||
|
||||
|
||||
|
||||
<h2><a name="flags">Override Status Flags</a></h2>
|
||||
|
||||
<p>The state of the processor status flags are tracked for every
|
||||
instruction. Each individual flag is recorded as zero, one, or
|
||||
"indeterminate", meaning it could hold either value at the start of
|
||||
that instruction. You can override the value of individual flags.</p>
|
||||
<p>The 65816 emulation bit, which is not part of the processor status
|
||||
register, may also be set in the editor.</p>
|
||||
<p>The M, X, and E flags will not be editable unless your CPU configuration
|
||||
is set to 65816.</p>
|
||||
|
||||
|
||||
<h2><a name="label">Edit Label</a></h2>
|
||||
<p>Sets or clears a label at the selected offset. The label must have the
|
||||
<a href="intro-details.html#about-symbols">proper form</a>, and not have the same
|
||||
@ -34,7 +119,7 @@ be imported by other projects (see
|
||||
<a href="advanced.html#multi-bin">Working With Multiple Binaries</a>).</p>
|
||||
|
||||
|
||||
<h2><a name="instruction-operand">Edit Instruction Operand</a></h2>
|
||||
<h2><a name="instruction-operand">Edit Operand (Instruction)</a></h2>
|
||||
<p>Operands can be formatted explicitly, or you can let the disassembler
|
||||
select the format for you. By default, immediate constants and
|
||||
addresses with no matching symbol are formatted as hex. Symbols
|
||||
@ -131,7 +216,8 @@ and comment fields. If not, a new entry with a generic name and
|
||||
pre-filled value field will be created in the nearest table.</p>
|
||||
|
||||
|
||||
<h2><a name="data-operand">Edit Data Operand</a></h2>
|
||||
<h2><a name="data-operand">Edit Operand (Data)</a></h2>
|
||||
|
||||
<p>This dialog offers a variety of choices, and can be used to apply a
|
||||
format to multiple lines. You must select all of the bytes you want
|
||||
to format. For example, to format two bytes as a 16-bit word, you must
|
||||
@ -275,91 +361,6 @@ comment will have one fewer character per line in cc65 output.</p>
|
||||
not associated with a file offset. If you delete it, you can get it
|
||||
back by using Edit > Edit Header Comment.</p>
|
||||
|
||||
|
||||
<h2><a name="address">Define Address Region</a></h2>
|
||||
|
||||
<p>Address regions may be created, edited, resized, or removed. Which
|
||||
operation is performed depends on the current selection. You can
|
||||
specify the start and end points of a region by selecting the entire
|
||||
region, or by selecting just the first and last lines.</p>
|
||||
<p>In all cases, you can specify the range's initial address
|
||||
as a hexadecimal value. You can prefix it with '$', but that's not
|
||||
required.
|
||||
24-bit addresses may be written with a bank separator, e.g. "12/3456"
|
||||
would resolve to address $123456.
|
||||
If you want to set the region to be non-addressable, enter
|
||||
"<code>NA</code>".</p>
|
||||
|
||||
<p>You can also enter a <a href="intro-details.html#pre-labels">pre-label</a>
|
||||
or specify that the operand should be formatted as a
|
||||
<a href="intro-details.html#relative-addr">relative address</a>.
|
||||
|
||||
<p>To delete a region, click the "Delete Region" button.</p>
|
||||
|
||||
<h4>Create</h4>
|
||||
|
||||
<p>If your selection starts with a code or data line, the editor
|
||||
will allow to create a new address region. If a single line was
|
||||
selected, the default behavior will be to create a region with a
|
||||
floating end point. If multiple lines were selected, the default
|
||||
behavior will be to create a region with a fixed end point.</p>
|
||||
|
||||
<p>The address field will be initialized to the address of the
|
||||
first selected line.</p>
|
||||
|
||||
<p>You can create a child region that shares the same start offset
|
||||
as an existing region by selecting the first code or data line
|
||||
within that region. Note that regions with floating end points cannot
|
||||
have the same start offset as another region.</p>
|
||||
|
||||
<h4>Edit</h4>
|
||||
|
||||
<p>If you select only the address region start line, perhaps by
|
||||
double-clicking the operand there, you will be able to edit the
|
||||
current region's properties.</p>
|
||||
|
||||
<p>If the region has a floating end point, you can choose to convert
|
||||
it to a fixed end. The end doesn't move; it just gets fixed in place.
|
||||
This is a quick way to "lock down" regions once you've established
|
||||
their end points.</p>
|
||||
|
||||
<h4>Resize</h4>
|
||||
|
||||
<p>If you select multiple lines, and the first line is an address
|
||||
region start directive, you will be able to resize that region to
|
||||
the selection. By definition, the updated region will have a fixed
|
||||
end point.</p>
|
||||
|
||||
<h4>Other notes</h4>
|
||||
|
||||
<p>There is no affordance for moving the start offset of a region. You
|
||||
must create a new region and then delete the old one.</p>
|
||||
|
||||
<p>Regions may not "straddle" the start or end points of other regions.</p>
|
||||
|
||||
<p>Double-clicking on the pseudo-opcode of a region start or end
|
||||
declaration will move the selection to the other end, rather than
|
||||
opening the editor.</p>
|
||||
|
||||
<p>To see detailed information about an address region in the "Info"
|
||||
window, select the region start or end directive. You can see the
|
||||
current arrangement of address regions across your entire
|
||||
project with Navigate > View Address Map.</p>
|
||||
|
||||
|
||||
|
||||
<h2><a name="flags">Override Status Flags</a></h2>
|
||||
|
||||
<p>The state of the processor status flags are tracked for every
|
||||
instruction. Each individual flag is recorded as zero, one, or
|
||||
"indeterminate", meaning it could hold either value at the start of
|
||||
that instruction. You can override the value of individual flags.</p>
|
||||
<p>The 65816 emulation bit, which is not part of the processor status
|
||||
register, may also be set in the editor.</p>
|
||||
<p>The M, X, and E flags will not be editable unless your CPU configuration
|
||||
is set to 65816.</p>
|
||||
|
||||
|
||||
<h2><a name="data-bank">Edit Data Bank (65816 only)</a></h2>
|
||||
|
||||
<p>Sets the Data Bank Register (DBR) value for 65816 code. This is used
|
||||
|
@ -83,22 +83,22 @@ and 65816 code. The official web site is
|
||||
|
||||
<li><a href="editors.html">Editors</a>
|
||||
<ul>
|
||||
<li><a href="editors.html#address">Define Address Region<a></li>
|
||||
<li><a href="editors.html#flags">Override Status Flags</a></li>
|
||||
<li><a href="editors.html#label">Edit Label</a></li>
|
||||
<li><a href="editors.html#instruction-operand">Edit Instruction Operand</a>
|
||||
<li><a href="editors.html#instruction-operand">Edit Operand (Instruction)</a>
|
||||
<ul>
|
||||
<li><a href="editors.html#explicit-format">Explicit Formats</a></li>
|
||||
<li><a href="editors.html#shortcut-nar">Numeric Address References</a></li>
|
||||
<li><a href="editors.html#shortcut-local-var">Local Variable References</a></li>
|
||||
</ul></li>
|
||||
<li><a href="editors.html#data-operand">Edit Data Operand</a></li>
|
||||
<li><a href="editors.html#data-operand">Edit Operand (Data)</a></li>
|
||||
<li><a href="editors.html#comment">Edit Comment</a></li>
|
||||
<li><a href="editors.html#long-comment">Edit Long Comment</a></li>
|
||||
<li><a href="editors.html#address">Define Address Region<a></li>
|
||||
<li><a href="editors.html#flags">Override Status Flags</a></li>
|
||||
<li><a href="editors.html#data-bank">Edit Data Bank (65816 only)</a></li>
|
||||
<li><a href="editors.html#note">Edit Note</a></li>
|
||||
<li><a href="editors.html#project-symbol">Edit Project Symbol</a></li>
|
||||
<li><a href="editors.html#lvtable">Edit Local Variable Table</a></li>
|
||||
<li><a href="editors.html#lvtable">Create / Edit Local Variable Table</a></li>
|
||||
</ul></li>
|
||||
|
||||
<li><a href="visualization.html">Visualizations</a>
|
||||
|
@ -527,7 +527,7 @@ The source code starts with a directive that tells the assembler what the
|
||||
initial address is, and the code and data statements that follow are
|
||||
placed appropriately. More complicated programs might relocate parts
|
||||
of themselves to other parts of memory, or be comprised of multiple
|
||||
"overlay" segments that, through disk loading or bank-switching, all execute
|
||||
"overlay" segments that, through disk I/O or bank-switching, all execute
|
||||
at the same address.</p>
|
||||
|
||||
<p>Consider the code in the first tutorial. It loads at $1000, copies
|
||||
|
47
SourceGen/SGTestData/FunkyProjects/BadExt.cs
Normal file
47
SourceGen/SGTestData/FunkyProjects/BadExt.cs
Normal file
@ -0,0 +1,47 @@
|
||||
// Copyright 2021 faddenSoft. All Rights Reserved.
|
||||
// See the LICENSE.txt file for distribution terms (Apache 2.0).
|
||||
|
||||
using System;
|
||||
//using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using PluginCommon;
|
||||
|
||||
namespace FunkyTest {
|
||||
/// <summary>
|
||||
/// Extension script that tries to violate the security sandbox.
|
||||
/// </summary>
|
||||
public class BadExt: MarshalByRefObject, IPlugin {
|
||||
private IApplication mAppRef;
|
||||
private byte[] mFileData;
|
||||
|
||||
public string Identifier {
|
||||
get {
|
||||
return "Bad test";
|
||||
}
|
||||
}
|
||||
|
||||
public void Prepare(IApplication appRef, byte[] fileData, AddressTranslate addrTrans) {
|
||||
mAppRef = appRef;
|
||||
mFileData = fileData;
|
||||
|
||||
mAppRef.DebugLog("BadTest(id=" + AppDomain.CurrentDomain.Id + "): prepare()");
|
||||
|
||||
// The behavior should be either "found" or "not found" depending on whether or
|
||||
// not the security sandbox is enabled. The output is visible in the analyzer
|
||||
// output window.
|
||||
mAppRef.DebugLog("Testing file access...");
|
||||
string testDir = @"C:\";
|
||||
if (Directory.Exists(testDir)) {
|
||||
mAppRef.DebugLog("Found " + testDir);
|
||||
} else {
|
||||
mAppRef.DebugLog("No such file " + testDir);
|
||||
}
|
||||
}
|
||||
|
||||
public void Unprepare() {
|
||||
mAppRef = null;
|
||||
mFileData = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -19,8 +19,11 @@ The files are:
|
||||
not match the data file contents. The program should tell you this and
|
||||
offer to let you locate the correct file.
|
||||
* Simple-BadDescLen.dis65 : An operand format descriptor covers a range
|
||||
off the end of the file. THe program should tell you that it's discarding
|
||||
off the end of the file. The program should tell you that it's discarding
|
||||
the bad format and continuing.
|
||||
* Simple-BadExt.dis65 : The project has an extension script that attempts
|
||||
to perform some basic file I/O that should be blocked by the security
|
||||
sandbox. (Must look at analyzer output to see the failure.)
|
||||
* Simple-BadJSON.dis65 : Garbage has been inserted into the JSON data
|
||||
stream. The project load should fail with an appropriate message.
|
||||
* Simple-BadLen.dis65 : The data file length stored in the project file
|
||||
@ -29,6 +32,10 @@ The files are:
|
||||
* Simple-BadMagic.dis65 : The "magic number" at the start of the project
|
||||
file has been damaged. The project load should fail with an
|
||||
appropriate message.
|
||||
* Simple-BadRegions.dis65 : The project has three correct regions, and
|
||||
three bad regions: one is zero-length, one is an exact duplicate of
|
||||
another region, and one straddles two regions. The bad regions should
|
||||
be discarded with warning messages.
|
||||
* Simple-DupLabel.dis65 : More than one line has the same label. You
|
||||
should be warned that the duplicates are being stripped away.
|
||||
* Simple-FutureVersion.dis65 : The project has a content-version higher
|
||||
@ -36,10 +43,9 @@ The files are:
|
||||
* Simple-MissingPlatSym.dis65 : One of the platform symbol files listed in
|
||||
the project file does not exist. You should be notified of the problem
|
||||
and loading should continue. (Furthermore, if you look in the project
|
||||
settings, the missing project file should still be present.)
|
||||
settings, the missing project file should still be listed.)
|
||||
* Simple-TooShort.dis65 : Same as Simple-BadMagic, but tests to see if we
|
||||
choke when the file is shorter than the magic string.
|
||||
|
||||
* ZeroLengthFile : This is intended for use with "new project". The
|
||||
application should refuse to create a new project for a zero-length file.
|
||||
|
||||
|
66
SourceGen/SGTestData/FunkyProjects/Simple-BadExt.dis65
Normal file
66
SourceGen/SGTestData/FunkyProjects/Simple-BadExt.dis65
Normal file
@ -0,0 +1,66 @@
|
||||
### 6502bench SourceGen dis65 v1.0 ###
|
||||
{
|
||||
"_ContentVersion":5,
|
||||
"FileDataLength":6,
|
||||
"FileDataCrc32":35051720,
|
||||
"ProjectProps":{
|
||||
"CpuName":"6502",
|
||||
"IncludeUndocumentedInstr":false,
|
||||
"TwoByteBrk":false,
|
||||
"EntryFlags":33489103,
|
||||
"AutoLabelStyle":"Simple",
|
||||
"AnalysisParams":{
|
||||
"AnalyzeUncategorizedData":true,
|
||||
"DefaultTextScanMode":"LowHighAscii",
|
||||
"MinCharsForString":4,
|
||||
"SeekNearbyTargets":true,
|
||||
"UseRelocData":false,
|
||||
"SmartPlpHandling":true,
|
||||
"SmartPlbHandling":true},
|
||||
|
||||
"PlatformSymbolFileIdentifiers":[],
|
||||
"ExtensionScriptFileIdentifiers":["PROJ:BadExt.cs"],
|
||||
"ProjectSyms":{
|
||||
}},
|
||||
|
||||
"AddressMap":[{
|
||||
"Offset":0,
|
||||
"Addr":4096,
|
||||
"Length":-1024,
|
||||
"PreLabel":"",
|
||||
"IsRelative":false}],
|
||||
"TypeHints":[{
|
||||
"Low":0,
|
||||
"High":0,
|
||||
"Hint":"Code"}],
|
||||
"StatusFlagOverrides":{
|
||||
},
|
||||
|
||||
"Comments":{
|
||||
},
|
||||
|
||||
"LongComments":{
|
||||
},
|
||||
|
||||
"Notes":{
|
||||
},
|
||||
|
||||
"UserLabels":{
|
||||
},
|
||||
|
||||
"OperandFormats":{
|
||||
},
|
||||
|
||||
"LvTables":{
|
||||
},
|
||||
|
||||
"Visualizations":[],
|
||||
"VisualizationAnimations":[],
|
||||
"VisualizationSets":{
|
||||
},
|
||||
|
||||
"RelocList":{
|
||||
},
|
||||
|
||||
"DbrValues":{
|
||||
}}
|
103
SourceGen/SGTestData/FunkyProjects/Simple-BadRegions.dis65
Normal file
103
SourceGen/SGTestData/FunkyProjects/Simple-BadRegions.dis65
Normal file
@ -0,0 +1,103 @@
|
||||
### 6502bench SourceGen dis65 v1.0 ###
|
||||
{
|
||||
"_ContentVersion":5,
|
||||
"FileDataLength":6,
|
||||
"FileDataCrc32":35051720,
|
||||
"ProjectProps":{
|
||||
"CpuName":"6502",
|
||||
"IncludeUndocumentedInstr":false,
|
||||
"TwoByteBrk":false,
|
||||
"EntryFlags":33489103,
|
||||
"AutoLabelStyle":"Simple",
|
||||
"AnalysisParams":{
|
||||
"AnalyzeUncategorizedData":true,
|
||||
"DefaultTextScanMode":"LowHighAscii",
|
||||
"MinCharsForString":4,
|
||||
"SeekNearbyTargets":true,
|
||||
"UseRelocData":false,
|
||||
"SmartPlpHandling":true,
|
||||
"SmartPlbHandling":true},
|
||||
|
||||
"PlatformSymbolFileIdentifiers":[],
|
||||
"ExtensionScriptFileIdentifiers":[],
|
||||
"ProjectSyms":{
|
||||
}},
|
||||
|
||||
"AddressMap":[{
|
||||
"Offset":0,
|
||||
"Addr":4096,
|
||||
"Length":2,
|
||||
"PreLabel":"",
|
||||
"IsRelative":false},
|
||||
|
||||
{
|
||||
"Offset":2,
|
||||
"Addr":4098,
|
||||
"Length":0,
|
||||
"PreLabel":"invalid-zero",
|
||||
"IsRelative":false},
|
||||
|
||||
{
|
||||
"Offset":2,
|
||||
"Addr":4098,
|
||||
"Length":3,
|
||||
"PreLabel":"",
|
||||
"IsRelative":false},
|
||||
|
||||
{
|
||||
"Offset":2,
|
||||
"Addr":4098,
|
||||
"Length":3,
|
||||
"PreLabel":"invalid-dup",
|
||||
"IsRelative":false},
|
||||
|
||||
{
|
||||
"Offset":5,
|
||||
"Addr":4101,
|
||||
"Length":-1024,
|
||||
"PreLabel":"",
|
||||
"IsRelative":false},
|
||||
|
||||
{
|
||||
"Offset":3,
|
||||
"Addr":4098,
|
||||
"Length":3,
|
||||
"PreLabel":"invalid-cross",
|
||||
"IsRelative":false}
|
||||
],
|
||||
|
||||
"TypeHints":[{
|
||||
"Low":0,
|
||||
"High":0,
|
||||
"Hint":"Code"}],
|
||||
"StatusFlagOverrides":{
|
||||
},
|
||||
|
||||
"Comments":{
|
||||
},
|
||||
|
||||
"LongComments":{
|
||||
},
|
||||
|
||||
"Notes":{
|
||||
},
|
||||
|
||||
"UserLabels":{
|
||||
},
|
||||
|
||||
"OperandFormats":{
|
||||
},
|
||||
|
||||
"LvTables":{
|
||||
},
|
||||
|
||||
"Visualizations":[],
|
||||
"VisualizationAnimations":[],
|
||||
"VisualizationSets":{
|
||||
},
|
||||
|
||||
"RelocList":{
|
||||
},
|
||||
|
||||
"DbrValues":{
|
||||
}}
|
@ -275,6 +275,8 @@ namespace SourceGen.Sandbox {
|
||||
int spanLength;
|
||||
List<AddressMap.AddressMapEntry> addrEnts =
|
||||
mProject.AddrMap.GetEntryList(out spanLength);
|
||||
// TODO: if Prepare() throws an exception, we should catch it and report
|
||||
// it to the user.
|
||||
DomainMgr.PluginMgr.PreparePlugins(appRef, spanLength, addrEnts, plSyms);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user