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.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
namespace PluginCommon {
|
||||
/// <summary>
|
||||
@ -34,7 +32,7 @@ namespace PluginCommon {
|
||||
|
||||
private byte[] mData;
|
||||
private int[] mPalette;
|
||||
private int mNextColor;
|
||||
private int mNextColorIdx;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -52,7 +50,7 @@ namespace PluginCommon {
|
||||
|
||||
mData = new byte[width * height];
|
||||
mPalette = new int[256];
|
||||
mNextColor = 0;
|
||||
mNextColorIdx = 0;
|
||||
}
|
||||
|
||||
public int GetPixel(int x, int y) {
|
||||
@ -60,22 +58,32 @@ namespace PluginCommon {
|
||||
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) {
|
||||
if (x < 0 || x >= Width || y < 0 || y >= Height) {
|
||||
throw new ArgumentException("Bad x/y: " + x + "," + y + " (width=" + Width +
|
||||
" height=" + Height + ")");
|
||||
}
|
||||
if (colorIndex < 0 || colorIndex >= mNextColor) {
|
||||
if (colorIndex < 0 || colorIndex >= mNextColorIdx) {
|
||||
throw new ArgumentException("Bad color: " + colorIndex + " (nextCol=" +
|
||||
mNextColor + ")");
|
||||
mNextColorIdx + ")");
|
||||
}
|
||||
mData[x + y * Width] = colorIndex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the color for all pixels.
|
||||
/// </summary>
|
||||
/// <param name="colorIndex">Color index.</param>
|
||||
public void SetAllPixelIndices(byte colorIndex) {
|
||||
if (colorIndex < 0 || colorIndex >= mNextColor) {
|
||||
if (colorIndex < 0 || colorIndex >= mNextColorIdx) {
|
||||
throw new ArgumentException("Bad color: " + colorIndex + " (nextCol=" +
|
||||
mNextColor + ")");
|
||||
mNextColorIdx + ")");
|
||||
}
|
||||
for (int i = 0; i < mData.Length; i++) {
|
||||
mData[i] = colorIndex;
|
||||
@ -89,8 +97,8 @@ namespace PluginCommon {
|
||||
|
||||
// IVisualization2d
|
||||
public int[] GetPalette() {
|
||||
int[] pal = new int[mNextColor];
|
||||
for (int i = 0; i < mNextColor; i++) {
|
||||
int[] pal = new int[mNextColorIdx];
|
||||
for (int i = 0; i < mNextColorIdx; i++) {
|
||||
pal[i] = mPalette[i];
|
||||
}
|
||||
return pal;
|
||||
@ -103,18 +111,19 @@ namespace PluginCommon {
|
||||
/// </summary>
|
||||
/// <param name="color">32-bit ARGB color value.</param>
|
||||
public void AddColor(int color) {
|
||||
if (mNextColor == 256) {
|
||||
if (mNextColorIdx == 256) {
|
||||
Debug.WriteLine("Palette is full");
|
||||
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) {
|
||||
Debug.WriteLine("Color " + color.ToString("x6") +
|
||||
" already exists in palette (" + i + ")");
|
||||
return;
|
||||
}
|
||||
}
|
||||
mPalette[mNextColor++] = color;
|
||||
mPalette[mNextColorIdx++] = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -3623,7 +3623,6 @@ namespace SourceGen {
|
||||
}
|
||||
break;
|
||||
case LineListGen.Line.Type.VisualizationSet:
|
||||
// TODO(xyzzy)
|
||||
lineTypeStr = "visualization set";
|
||||
break;
|
||||
default:
|
||||
|
@ -14,9 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
|
||||
using PluginCommon;
|
||||
|
||||
@ -303,6 +301,24 @@ namespace RuntimeData.Apple {
|
||||
|
||||
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,
|
||||
int colStride, int rowStride, ColorMode colorMode, bool isFirstOdd,
|
||||
VisBitmap8 vb, int xstart, int ystart) {
|
||||
@ -505,11 +521,6 @@ namespace RuntimeData.Apple {
|
||||
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) {
|
||||
// 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
|
||||
|
@ -14,14 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
|
||||
using PluginCommon;
|
||||
|
||||
namespace RuntimeData.Atari {
|
||||
public class VisAtari2600 : MarshalByRefObject, IPlugin, IPlugin_Visualizer {
|
||||
public class Vis2600 : MarshalByRefObject, IPlugin, IPlugin_Visualizer {
|
||||
// IPlugin
|
||||
public string Identifier {
|
||||
get { return "Atari 2600 Graphic Visualizer"; }
|
@ -14,9 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Text;
|
||||
|
||||
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>
|
||||
<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
|
||||
to be the same size. Bear in mind that this is a disassembler, not a
|
||||
graphics conversion tool.</p>
|
||||
to be the same size when displayed as thumbnails in the code list.</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>
|
||||
@ -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
|
||||
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.
|
||||
You can display a visualization near the instructions that perform the
|
||||
drawing.</p>
|
||||
You can display a visualization near the data or near the instructions
|
||||
that perform the drawing. Or both.</p>
|
||||
|
||||
<p>To create a visualization set, select a code or data line, and use
|
||||
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>
|
||||
</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>
|
||||
|
||||
<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
|
||||
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
|
||||
appearance of a sprite or playfield on a single row. The visualization
|
||||
generator works for data stored in a straightforward fashion.</p>
|
||||
appearance of a sprite or playfield on a single row. The register
|
||||
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>
|
||||
<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>
|
||||
|
||||
<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
|
||||
"multi-color" format. Sprites can be doubled in width or height.</p>
|
||||
It comes in two basic varieties:</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>
|
||||
<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:#000000;background-color:#ffffff"> white </span></li>
|
||||
<li><span style="color:#ffffff;background-color:#67372b"> red </span></li>
|
||||
|
@ -3,7 +3,7 @@
|
||||
"_ContentVersion":3,"FileDataLength":131,"FileDataCrc32":-1864286961,"ProjectProps":{
|
||||
"CpuName":"6502","IncludeUndocumentedInstr":false,"TwoByteBrk":false,"EntryFlags":32702671,"AutoLabelStyle":"Simple","AnalysisParams":{
|
||||
"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":[{
|
||||
"Offset":0,"Addr":61440}],"TypeHints":[{
|
||||
@ -13,7 +13,7 @@
|
||||
},
|
||||
"LongComments":{
|
||||
"-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":{
|
||||
},
|
||||
"UserLabels":{
|
||||
|
@ -33,7 +33,9 @@
|
||||
"128":{
|
||||
"Length":64,"Format":"Dense","SubFormat":"None","SymbolRef":null},
|
||||
"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":{
|
||||
},
|
||||
"VisualizationSets":{
|
@ -97,7 +97,8 @@ See also https://github.com/fadden/DisasmUiTest
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<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.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
@ -106,7 +107,7 @@ See also https://github.com/fadden/DisasmUiTest
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderThickness="1" Margin="8,0,0,0" Padding="1"
|
||||
<Border BorderThickness="1" Padding="1"
|
||||
Background="{StaticResource BitmapBackground}">
|
||||
<Image Width="64" Height="64" Source="{Binding CachedImage}"
|
||||
RenderOptions.BitmapScalingMode="NearestNeighbor"/>
|
||||
|
Loading…
Reference in New Issue
Block a user