mirror of
https://github.com/fadden/6502bench.git
synced 2024-11-26 06:49:19 +00:00
Various minor tweaks
Added comments, renamed files, removed cruft. Stop showing the visualization tag name in the code list. It's often redundant with the code label, and it's distracting. (We may want to make this an option so you can Ctrl+F to find a tag.)
This commit is contained in:
parent
ed66e129cd
commit
e82678126f
@ -14,9 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace PluginCommon {
|
namespace PluginCommon {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -34,7 +32,7 @@ namespace PluginCommon {
|
|||||||
|
|
||||||
private byte[] mData;
|
private byte[] mData;
|
||||||
private int[] mPalette;
|
private int[] mPalette;
|
||||||
private int mNextColor;
|
private int mNextColorIdx;
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -52,7 +50,7 @@ namespace PluginCommon {
|
|||||||
|
|
||||||
mData = new byte[width * height];
|
mData = new byte[width * height];
|
||||||
mPalette = new int[256];
|
mPalette = new int[256];
|
||||||
mNextColor = 0;
|
mNextColorIdx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetPixel(int x, int y) {
|
public int GetPixel(int x, int y) {
|
||||||
@ -60,22 +58,32 @@ namespace PluginCommon {
|
|||||||
return mPalette[pix];
|
return mPalette[pix];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the color for a single pixel.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x">X coordinate.</param>
|
||||||
|
/// <param name="y">Y coordinate.</param>
|
||||||
|
/// <param name="colorIndex">Color index.</param>
|
||||||
public void SetPixelIndex(int x, int y, byte colorIndex) {
|
public void SetPixelIndex(int x, int y, byte colorIndex) {
|
||||||
if (x < 0 || x >= Width || y < 0 || y >= Height) {
|
if (x < 0 || x >= Width || y < 0 || y >= Height) {
|
||||||
throw new ArgumentException("Bad x/y: " + x + "," + y + " (width=" + Width +
|
throw new ArgumentException("Bad x/y: " + x + "," + y + " (width=" + Width +
|
||||||
" height=" + Height + ")");
|
" height=" + Height + ")");
|
||||||
}
|
}
|
||||||
if (colorIndex < 0 || colorIndex >= mNextColor) {
|
if (colorIndex < 0 || colorIndex >= mNextColorIdx) {
|
||||||
throw new ArgumentException("Bad color: " + colorIndex + " (nextCol=" +
|
throw new ArgumentException("Bad color: " + colorIndex + " (nextCol=" +
|
||||||
mNextColor + ")");
|
mNextColorIdx + ")");
|
||||||
}
|
}
|
||||||
mData[x + y * Width] = colorIndex;
|
mData[x + y * Width] = colorIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the color for all pixels.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="colorIndex">Color index.</param>
|
||||||
public void SetAllPixelIndices(byte colorIndex) {
|
public void SetAllPixelIndices(byte colorIndex) {
|
||||||
if (colorIndex < 0 || colorIndex >= mNextColor) {
|
if (colorIndex < 0 || colorIndex >= mNextColorIdx) {
|
||||||
throw new ArgumentException("Bad color: " + colorIndex + " (nextCol=" +
|
throw new ArgumentException("Bad color: " + colorIndex + " (nextCol=" +
|
||||||
mNextColor + ")");
|
mNextColorIdx + ")");
|
||||||
}
|
}
|
||||||
for (int i = 0; i < mData.Length; i++) {
|
for (int i = 0; i < mData.Length; i++) {
|
||||||
mData[i] = colorIndex;
|
mData[i] = colorIndex;
|
||||||
@ -89,8 +97,8 @@ namespace PluginCommon {
|
|||||||
|
|
||||||
// IVisualization2d
|
// IVisualization2d
|
||||||
public int[] GetPalette() {
|
public int[] GetPalette() {
|
||||||
int[] pal = new int[mNextColor];
|
int[] pal = new int[mNextColorIdx];
|
||||||
for (int i = 0; i < mNextColor; i++) {
|
for (int i = 0; i < mNextColorIdx; i++) {
|
||||||
pal[i] = mPalette[i];
|
pal[i] = mPalette[i];
|
||||||
}
|
}
|
||||||
return pal;
|
return pal;
|
||||||
@ -103,18 +111,19 @@ namespace PluginCommon {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="color">32-bit ARGB color value.</param>
|
/// <param name="color">32-bit ARGB color value.</param>
|
||||||
public void AddColor(int color) {
|
public void AddColor(int color) {
|
||||||
if (mNextColor == 256) {
|
if (mNextColorIdx == 256) {
|
||||||
Debug.WriteLine("Palette is full");
|
Debug.WriteLine("Palette is full");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < mNextColor; i++) {
|
// I'm expecting palettes to only have a few colors, so O(n^2) is fine for now.
|
||||||
|
for (int i = 0; i < mNextColorIdx; i++) {
|
||||||
if (mPalette[i] == color) {
|
if (mPalette[i] == color) {
|
||||||
Debug.WriteLine("Color " + color.ToString("x6") +
|
Debug.WriteLine("Color " + color.ToString("x6") +
|
||||||
" already exists in palette (" + i + ")");
|
" already exists in palette (" + i + ")");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mPalette[mNextColor++] = color;
|
mPalette[mNextColorIdx++] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -3623,7 +3623,6 @@ namespace SourceGen {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LineListGen.Line.Type.VisualizationSet:
|
case LineListGen.Line.Type.VisualizationSet:
|
||||||
// TODO(xyzzy)
|
|
||||||
lineTypeStr = "visualization set";
|
lineTypeStr = "visualization set";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -14,9 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using PluginCommon;
|
using PluginCommon;
|
||||||
|
|
||||||
@ -303,6 +301,24 @@ namespace RuntimeData.Apple {
|
|||||||
|
|
||||||
private enum ColorMode { Mono, SimpleColor, IIgsRGB };
|
private enum ColorMode { Mono, SimpleColor, IIgsRGB };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Renders bitmap data.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data">Data source, typically the file data.</param>
|
||||||
|
/// <param name="offset">Offset into data of the first byte.</param>
|
||||||
|
/// <param name="byteWidth">Width, in bytes, of the data to render. Each byte
|
||||||
|
/// represents 7 pixels in the output (more or less).</param>
|
||||||
|
/// <param name="height">Height, in lines, of the data to render.</param>
|
||||||
|
/// <param name="colStride">Column stride. The number of bytes used to hold each
|
||||||
|
/// byte of data. Must be >= 1.</param>
|
||||||
|
/// <param name="rowStride">Row stride. The number of bytes used to hold each row
|
||||||
|
/// of data. Must be >= (colStride * byteWidth - (colStride - 1)).</param>
|
||||||
|
/// <param name="colorMode">Color conversion mode.</param>
|
||||||
|
/// <param name="isFirstOdd">If true, render as if we're starting on an odd column.
|
||||||
|
/// This affects the colors.</param>
|
||||||
|
/// <param name="vb">Output bitmap object.</param>
|
||||||
|
/// <param name="xstart">Initial X position in the output.</param>
|
||||||
|
/// <param name="ystart">Initial Y position in the output.</param>
|
||||||
private void RenderBitmap(byte[] data, int offset, int byteWidth, int height,
|
private void RenderBitmap(byte[] data, int offset, int byteWidth, int height,
|
||||||
int colStride, int rowStride, ColorMode colorMode, bool isFirstOdd,
|
int colStride, int rowStride, ColorMode colorMode, bool isFirstOdd,
|
||||||
VisBitmap8 vb, int xstart, int ystart) {
|
VisBitmap8 vb, int xstart, int ystart) {
|
||||||
@ -505,11 +521,6 @@ namespace RuntimeData.Apple {
|
|||||||
White1 = 2
|
White1 = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maps HiResColors to the palette entries. Used for mapping 2-bit values to colors.
|
|
||||||
private static readonly byte[] sHiResColorMap = new byte[8] {
|
|
||||||
1, 3, 4, 2, 1, 5, 6, 2
|
|
||||||
};
|
|
||||||
|
|
||||||
private void SetHiResPalette(VisBitmap8 vb) {
|
private void SetHiResPalette(VisBitmap8 vb) {
|
||||||
// These don't match directly to hi-res color numbers because we want to
|
// These don't match directly to hi-res color numbers because we want to
|
||||||
// avoid adding black/white twice. The colors correspond to Apple IIgs RGB
|
// avoid adding black/white twice. The colors correspond to Apple IIgs RGB
|
||||||
|
@ -14,14 +14,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using PluginCommon;
|
using PluginCommon;
|
||||||
|
|
||||||
namespace RuntimeData.Atari {
|
namespace RuntimeData.Atari {
|
||||||
public class VisAtari2600 : MarshalByRefObject, IPlugin, IPlugin_Visualizer {
|
public class Vis2600 : MarshalByRefObject, IPlugin, IPlugin_Visualizer {
|
||||||
// IPlugin
|
// IPlugin
|
||||||
public string Identifier {
|
public string Identifier {
|
||||||
get { return "Atari 2600 Graphic Visualizer"; }
|
get { return "Atari 2600 Graphic Visualizer"; }
|
@ -14,9 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using PluginCommon;
|
using PluginCommon;
|
||||||
|
|
||||||
|
@ -40,8 +40,12 @@ e.g. it's in the middle of a multi-byte instruction or data item. The
|
|||||||
editors will try to prevent you from doing this.</p>
|
editors will try to prevent you from doing this.</p>
|
||||||
<p>Bitmaps will always be scaled up as much as possible to make them
|
<p>Bitmaps will always be scaled up as much as possible to make them
|
||||||
easy to see. This means that small shapes and large shapes may appears
|
easy to see. This means that small shapes and large shapes may appears
|
||||||
to be the same size. Bear in mind that this is a disassembler, not a
|
to be the same size when displayed as thumbnails in the code list.</p>
|
||||||
graphics conversion tool.</p>
|
<p>The role of a visualization generator is to take a collection of input
|
||||||
|
parameters and generate graphical data. It's most useful for graphical
|
||||||
|
sources like bitmaps, but it's not limited to that. You could, for example,
|
||||||
|
write a script that generates random flowers, and use it to make your
|
||||||
|
source listings more cheerful.</p>
|
||||||
|
|
||||||
|
|
||||||
<h2><a name="vis-and-sets">Visualizations and Visualization Sets</a></h2>
|
<h2><a name="vis-and-sets">Visualizations and Visualization Sets</a></h2>
|
||||||
@ -52,8 +56,8 @@ contained in sets that are placed at arbitrary offsets. Each set can
|
|||||||
contain multiple items. For example, if a file has data for
|
contain multiple items. For example, if a file has data for
|
||||||
10 bitmaps, you can place a visualization near each, or create a single
|
10 bitmaps, you can place a visualization near each, or create a single
|
||||||
visualization set with all 10 items and put it at the start of the file.
|
visualization set with all 10 items and put it at the start of the file.
|
||||||
You can display a visualization near the instructions that perform the
|
You can display a visualization near the data or near the instructions
|
||||||
drawing.</p>
|
that perform the drawing. Or both.</p>
|
||||||
|
|
||||||
<p>To create a visualization set, select a code or data line, and use
|
<p>To create a visualization set, select a code or data line, and use
|
||||||
Actions > Create/Edit Visualization Set. To edit a visualization set,
|
Actions > Create/Edit Visualization Set. To edit a visualization set,
|
||||||
@ -112,6 +116,11 @@ Some less-common parameters include:</p>
|
|||||||
visualizer will default to no interleave (stride == 1).</li>
|
visualizer will default to no interleave (stride == 1).</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<p>Remember that this is a disassembler, not an image converter. The
|
||||||
|
results do not need to be perfectly accurate to be useful when disassembling
|
||||||
|
code.</p>
|
||||||
|
|
||||||
|
|
||||||
<h3>Apple II - Apple/VisHiRes</h3>
|
<h3>Apple II - Apple/VisHiRes</h3>
|
||||||
|
|
||||||
<p>There is no standard format for small hi-res bitmaps, but certain
|
<p>There is no standard format for small hi-res bitmaps, but certain
|
||||||
@ -143,11 +152,13 @@ but has no effect on black or white.</p>
|
|||||||
<p>The converter generates one output pixel for every source pixel, so
|
<p>The converter generates one output pixel for every source pixel, so
|
||||||
half-pixel shifts are not rendered.</p>
|
half-pixel shifts are not rendered.</p>
|
||||||
|
|
||||||
<h3>Atari 2600 - Atari/VisAtari2600</h3>
|
<h3>Atari 2600 - Atari/Vis2600</h3>
|
||||||
|
|
||||||
<p>The Atari 2600 graphics system has registers that determine the
|
<p>The Atari 2600 graphics system has registers that determine the
|
||||||
appearance of a sprite or playfield on a single row. The visualization
|
appearance of a sprite or playfield on a single row. The register
|
||||||
generator works for data stored in a straightforward fashion.</p>
|
values are typically changed as the screen is drawn to get different
|
||||||
|
data on successive rows. The visualization generator works for data
|
||||||
|
stored in a straightforward fashion.</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><b>Sprite</b> - basic 1xN sprite, converted to an image 8 pixels
|
<li><b>Sprite</b> - basic 1xN sprite, converted to an image 8 pixels
|
||||||
@ -163,10 +174,16 @@ generator works for data stored in a straightforward fashion.</p>
|
|||||||
<h3>Commodore 64 - Commodore/VisC64</h3>
|
<h3>Commodore 64 - Commodore/VisC64</h3>
|
||||||
|
|
||||||
<p>The Commodore 64 has a 64-bit sprite format defined by the hardware.
|
<p>The Commodore 64 has a 64-bit sprite format defined by the hardware.
|
||||||
It supports a single-color "high resolution" 24x21 format, and a 12x21
|
It comes in two basic varieties:</p>
|
||||||
"multi-color" format. Sprites can be doubled in width or height.</p>
|
<ul>
|
||||||
|
<li><b>High-resolution sprite</b> - 24x21 monochrome. Pixels are either
|
||||||
|
colored or transparent.</li>
|
||||||
|
<li><b>Multi-color sprite</b> - 12x21 3-color. The width of each pixel
|
||||||
|
is doubled to make it 24x21.
|
||||||
|
</ul>
|
||||||
|
<p>Sprites can be doubled in width and/or height.</p>
|
||||||
<p>Colors come from a hardware-defined palette of 16:</p>
|
<p>Colors come from a hardware-defined palette of 16:</p>
|
||||||
<ol start="0">
|
<ol start="0" style="columns:2; -webkit-columns:2; -moz-columns:2;">
|
||||||
<li><span style="color:#ffffff;background-color:#000000"> black </span></li>
|
<li><span style="color:#ffffff;background-color:#000000"> black </span></li>
|
||||||
<li><span style="color:#000000;background-color:#ffffff"> white </span></li>
|
<li><span style="color:#000000;background-color:#ffffff"> white </span></li>
|
||||||
<li><span style="color:#ffffff;background-color:#67372b"> red </span></li>
|
<li><span style="color:#ffffff;background-color:#67372b"> red </span></li>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"_ContentVersion":3,"FileDataLength":131,"FileDataCrc32":-1864286961,"ProjectProps":{
|
"_ContentVersion":3,"FileDataLength":131,"FileDataCrc32":-1864286961,"ProjectProps":{
|
||||||
"CpuName":"6502","IncludeUndocumentedInstr":false,"TwoByteBrk":false,"EntryFlags":32702671,"AutoLabelStyle":"Simple","AnalysisParams":{
|
"CpuName":"6502","IncludeUndocumentedInstr":false,"TwoByteBrk":false,"EntryFlags":32702671,"AutoLabelStyle":"Simple","AnalysisParams":{
|
||||||
"AnalyzeUncategorizedData":true,"DefaultTextScanMode":"LowHighAscii","MinCharsForString":4,"SeekNearbyTargets":true,"SmartPlpHandling":true},
|
"AnalyzeUncategorizedData":true,"DefaultTextScanMode":"LowHighAscii","MinCharsForString":4,"SeekNearbyTargets":true,"SmartPlpHandling":true},
|
||||||
"PlatformSymbolFileIdentifiers":["RT:Atari/2600.sym65"],"ExtensionScriptFileIdentifiers":["RT:Atari/VisAtari2600.cs"],"ProjectSyms":{
|
"PlatformSymbolFileIdentifiers":["RT:Atari/2600.sym65"],"ExtensionScriptFileIdentifiers":["RT:Atari/Vis2600.cs"],"ProjectSyms":{
|
||||||
}},
|
}},
|
||||||
"AddressMap":[{
|
"AddressMap":[{
|
||||||
"Offset":0,"Addr":61440}],"TypeHints":[{
|
"Offset":0,"Addr":61440}],"TypeHints":[{
|
||||||
@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"LongComments":{
|
"LongComments":{
|
||||||
"-2147483647":{
|
"-2147483647":{
|
||||||
"Text":"A few sprites and playfield graphics from Atari Adventure.\r\n","BoxMode":false,"MaxWidth":80,"BackgroundColor":0}},
|
"Text":"A few sprites and playfield graphics from Warren Robinett\u0027s Adventure.\r\n\r\nCopyright 1980 Atari, Inc.\r\n","BoxMode":false,"MaxWidth":80,"BackgroundColor":0}},
|
||||||
"Notes":{
|
"Notes":{
|
||||||
},
|
},
|
||||||
"UserLabels":{
|
"UserLabels":{
|
||||||
|
@ -33,7 +33,9 @@
|
|||||||
"128":{
|
"128":{
|
||||||
"Length":64,"Format":"Dense","SubFormat":"None","SymbolRef":null},
|
"Length":64,"Format":"Dense","SubFormat":"None","SymbolRef":null},
|
||||||
"192":{
|
"192":{
|
||||||
"Length":64,"Format":"Dense","SubFormat":"None","SymbolRef":null}},
|
"Length":64,"Format":"Dense","SubFormat":"None","SymbolRef":null},
|
||||||
|
"256":{
|
||||||
|
"Length":1792,"Format":"Junk","SubFormat":"None","SymbolRef":null}},
|
||||||
"LvTables":{
|
"LvTables":{
|
||||||
},
|
},
|
||||||
"VisualizationSets":{
|
"VisualizationSets":{
|
@ -97,7 +97,8 @@ See also https://github.com/fadden/DisasmUiTest
|
|||||||
<GridViewColumn.CellTemplate>
|
<GridViewColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Text="{Binding Path=Comment}" VerticalAlignment="Center"/>
|
<TextBlock Text="{Binding Path=Comment}" VerticalAlignment="Center" Margin="0,0,8,0"
|
||||||
|
Visibility="Collapsed"/>
|
||||||
<ItemsControl ItemsSource="{Binding VisualizationSet}">
|
<ItemsControl ItemsSource="{Binding VisualizationSet}">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
@ -106,7 +107,7 @@ See also https://github.com/fadden/DisasmUiTest
|
|||||||
</ItemsControl.ItemsPanel>
|
</ItemsControl.ItemsPanel>
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Border BorderThickness="1" Margin="8,0,0,0" Padding="1"
|
<Border BorderThickness="1" Padding="1"
|
||||||
Background="{StaticResource BitmapBackground}">
|
Background="{StaticResource BitmapBackground}">
|
||||||
<Image Width="64" Height="64" Source="{Binding CachedImage}"
|
<Image Width="64" Height="64" Source="{Binding CachedImage}"
|
||||||
RenderOptions.BitmapScalingMode="NearestNeighbor"/>
|
RenderOptions.BitmapScalingMode="NearestNeighbor"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user