mirror of
https://github.com/fadden/6502bench.git
synced 2024-11-29 10:50:28 +00:00
Split operand selection set at visualizations
Also, added a colStride/rowStride test to Apple II bitmap test. Removed ClunkyColor. Made color conversion mode selectable for debugging.
This commit is contained in:
parent
4bf1ab2799
commit
b56bdb7743
@ -3332,6 +3332,9 @@ namespace SourceGen {
|
||||
} else if (mProject.HasCommentOrNote(offset)) {
|
||||
// Don't carry across a long comment or note.
|
||||
groupNum++;
|
||||
} else if (mProject.VisualizationSets.ContainsKey(offset)) {
|
||||
// Don't carry across a visualization.
|
||||
groupNum++;
|
||||
}
|
||||
|
||||
// Mark every byte of an instruction or multi-byte data item --
|
||||
|
@ -42,7 +42,7 @@ namespace RuntimeData.Apple {
|
||||
private const string P_ROW_STRIDE = "rowStride";
|
||||
private const string P_IS_COLOR = "isColor";
|
||||
private const string P_IS_FIRST_ODD = "isFirstOdd";
|
||||
|
||||
private const string P_COLOR_CONV_MODE = "colorConvMode";
|
||||
private const string P_ITEM_BYTE_WIDTH = "itemByteWidth";
|
||||
private const string P_ITEM_HEIGHT = "itemHeight";
|
||||
private const string P_COUNT = "count";
|
||||
@ -67,6 +67,9 @@ namespace RuntimeData.Apple {
|
||||
P_IS_COLOR, typeof(bool), 0, 0, 0, true),
|
||||
new VisParamDescr("First col odd",
|
||||
P_IS_FIRST_ODD, typeof(bool), 0, 0, 0, false),
|
||||
//new VisParamDescr("Color conv mode",
|
||||
// P_COLOR_CONV_MODE, typeof(int), (int)ColorMode.SimpleColor,
|
||||
// (int)ColorMode.IIgsRGB, 0, (int)ColorMode.SimpleColor),
|
||||
//new VisParamDescr("Test Float",
|
||||
// "floaty", typeof(float), -5.0f, 5.0f, 0, 0.1f),
|
||||
}),
|
||||
@ -139,6 +142,8 @@ namespace RuntimeData.Apple {
|
||||
int rowStride = Util.GetFromObjDict(parms, P_ROW_STRIDE, 0);
|
||||
bool isColor = Util.GetFromObjDict(parms, P_IS_COLOR, true);
|
||||
bool isFirstOdd = Util.GetFromObjDict(parms, P_IS_FIRST_ODD, false);
|
||||
int colorConvMode = !isColor ? (int)ColorMode.Mono :
|
||||
Util.GetFromObjDict(parms, P_COLOR_CONV_MODE, (int)ColorMode.SimpleColor);
|
||||
|
||||
// We allow the stride entries to be zero to indicate a "dense" bitmap.
|
||||
if (colStride == 0) {
|
||||
@ -175,8 +180,7 @@ namespace RuntimeData.Apple {
|
||||
SetHiResPalette(vb);
|
||||
|
||||
RenderBitmap(mFileData, offset, byteWidth, height, colStride, rowStride,
|
||||
isColor ? ColorMode.SimpleColor : ColorMode.Mono, isFirstOdd,
|
||||
vb, 0, 0);
|
||||
(ColorMode)colorConvMode, isFirstOdd, vb, 0, 0);
|
||||
return vb;
|
||||
}
|
||||
|
||||
@ -287,7 +291,7 @@ namespace RuntimeData.Apple {
|
||||
}
|
||||
|
||||
|
||||
private enum ColorMode { Mono, ClunkyColor, SimpleColor, IIgsRGB };
|
||||
private enum ColorMode { Mono, SimpleColor, IIgsRGB };
|
||||
|
||||
private void RenderBitmap(byte[] data, int offset, int byteWidth, int height,
|
||||
int colStride, int rowStride, ColorMode colorMode, bool isFirstOdd,
|
||||
@ -319,62 +323,6 @@ namespace RuntimeData.Apple {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ColorMode.ClunkyColor: {
|
||||
// We treat the data as a strictly 140-mode bitmap, which doesn't match
|
||||
// up well with how the pixels will be displayed, but does allow a
|
||||
// straightforward conversion between file formats. Color fringing is
|
||||
// severe.
|
||||
for (int row = 0; row < height; row++) {
|
||||
int lastBit;
|
||||
if (isFirstOdd) {
|
||||
lastBit = 0; // pretend we already have one bit
|
||||
} else {
|
||||
lastBit = -1;
|
||||
}
|
||||
|
||||
for (int colByte = 0; colByte < byteWidth; colByte += colStride) {
|
||||
byte val = data[offset + colByte];
|
||||
bool hiBitSet = (val & 0x80) != 0;
|
||||
|
||||
// Grab 3 or 4 pairs of bits.
|
||||
int pairCount = (lastBit < 0) ? 3 : 4;
|
||||
while (pairCount-- > 0) {
|
||||
int twoBits;
|
||||
if (lastBit >= 0) {
|
||||
// merge with bit from previous byte
|
||||
twoBits = (lastBit << 1) | (val & 0x01);
|
||||
val >>= 1;
|
||||
lastBit = -1;
|
||||
} else {
|
||||
// grab two bits
|
||||
twoBits = (val & 0x03);
|
||||
val >>= 2;
|
||||
}
|
||||
|
||||
if (hiBitSet) {
|
||||
twoBits += 4;
|
||||
}
|
||||
|
||||
// We're in 140 mode, so set two adjacent pixels.
|
||||
vb.SetPixelIndex(bx++, by, sHiResColorMap[twoBits]);
|
||||
vb.SetPixelIndex(bx++, by, sHiResColorMap[twoBits]);
|
||||
}
|
||||
|
||||
bool thisEven = ((colByte & 0x01) == 0) ^ isFirstOdd;
|
||||
if (thisEven) {
|
||||
// started in even column we have one bit left over
|
||||
lastBit = val & 0x01;
|
||||
} else {
|
||||
// started in odd column, all bits consumed
|
||||
lastBit = -1;
|
||||
}
|
||||
}
|
||||
bx = xstart;
|
||||
by++;
|
||||
offset += rowStride;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ColorMode.SimpleColor: {
|
||||
// Straightforward conversion, with no funky border effects. This
|
||||
// represents an idealized version of the hardware.
|
||||
|
Binary file not shown.
@ -17,6 +17,7 @@ count equ $05
|
||||
bit bitmap3
|
||||
bit bitmap4
|
||||
bit bitmap5
|
||||
bit bitmap6
|
||||
|
||||
jsr HGR ;clear screen, set hi-res mode
|
||||
lda #<bitmap1
|
||||
@ -69,6 +70,16 @@ count equ $05
|
||||
sta width
|
||||
jsr draw
|
||||
|
||||
lda #<bitmap6
|
||||
sta src_ptr
|
||||
lda #>bitmap6
|
||||
sta src_ptr+1
|
||||
lda #$12
|
||||
sta xoff
|
||||
lda #$03 ;3x8
|
||||
sta width
|
||||
jsr odd_draw
|
||||
|
||||
rts
|
||||
|
||||
; Copies an Nx8 bitmap to the hi-res screen.
|
||||
@ -81,20 +92,43 @@ draw
|
||||
:loop ldx line
|
||||
lda addrs,x
|
||||
beq :done
|
||||
sta _copy+2
|
||||
sta :_copy+2
|
||||
lda xoff
|
||||
sta _copy+1
|
||||
sta :_copy+1
|
||||
|
||||
ldx #$00
|
||||
:loop1 lda (src_ptr),y
|
||||
_copy sta $2000,x
|
||||
:_copy sta $2000,x
|
||||
iny
|
||||
inx
|
||||
cpx width
|
||||
bne :loop1
|
||||
inc line
|
||||
bne :loop ;always (more or less)
|
||||
bne :loop ;(always... more or less)
|
||||
:done rts
|
||||
|
||||
odd_draw
|
||||
ldy #$00
|
||||
sty line
|
||||
:loop ldx line
|
||||
lda addrs,x
|
||||
beq :done
|
||||
sta :_ocopy+2
|
||||
lda xoff
|
||||
sta :_ocopy+1
|
||||
|
||||
ldx #$00
|
||||
:loop1 lda (src_ptr),y
|
||||
:_ocopy sta $2000,x
|
||||
iny ;incr source index twice (colStride)
|
||||
iny
|
||||
inx
|
||||
cpx width
|
||||
bne :loop1
|
||||
iny ;advance twice more (rowStride)
|
||||
iny
|
||||
inc line
|
||||
bne :loop ;(always)
|
||||
:done rts
|
||||
|
||||
; hi byte of base addresses on hi-res screen; must be 8 of them
|
||||
@ -153,14 +187,24 @@ bitmap4
|
||||
dfb $aa,$aa
|
||||
dfb $d5,$55
|
||||
|
||||
; 3x8 (do in B&W)
|
||||
; 3x8
|
||||
bitmap5
|
||||
dfb $7f,$7f,$7f
|
||||
dfb $03,$08,$60
|
||||
dfb $03,$1c,$60
|
||||
dfb $03,$3e,$60
|
||||
dfb $03,$7f,$60
|
||||
dfb $06,$3e,$30
|
||||
dfb $06,$7f,$30
|
||||
dfb $43,$77,$61
|
||||
dfb $63,$63,$63
|
||||
dfb $7f,$7f,$7f
|
||||
|
||||
; 3x8, colStride=2 rowStride=8
|
||||
bitmap6
|
||||
dfb $55,7,$08,7,$55,7,1,1
|
||||
dfb $15,7,$1c,7,$54,7,1,1
|
||||
dfb $05,7,$2a,7,$50,7,1,1
|
||||
dfb $01,7,$14,7,$40,7,1,1
|
||||
dfb $81,7,$94,7,$c0,7,1,1
|
||||
dfb $85,7,$aa,7,$d0,7,1,1
|
||||
dfb $95,7,$9c,7,$d4,7,1,1
|
||||
dfb $d5,7,$88,7,$d5,7,1,1
|
||||
|
@ -1,10 +1,17 @@
|
||||
### 6502bench SourceGen dis65 v1.0 ###
|
||||
{
|
||||
"_ContentVersion":3,"FileDataLength":232,"FileDataCrc32":-2081570119,"ProjectProps":{
|
||||
"_ContentVersion":3,"FileDataLength":358,"FileDataCrc32":1000438370,"ProjectProps":{
|
||||
"CpuName":"65C02","IncludeUndocumentedInstr":false,"TwoByteBrk":false,"EntryFlags":32702671,"AutoLabelStyle":"Simple","AnalysisParams":{
|
||||
"AnalyzeUncategorizedData":true,"DefaultTextScanMode":"LowHighAscii","MinCharsForString":4,"SeekNearbyTargets":true,"SmartPlpHandling":true},
|
||||
"PlatformSymbolFileIdentifiers":["RT:Apple/F8-ROM.sym65","RT:Apple/Cxxx-IO.sym65"],"ExtensionScriptFileIdentifiers":["RT:Apple/VisHiRes.cs"],"ProjectSyms":{
|
||||
}},
|
||||
"PlatformSymbolFileIdentifiers":[],"ExtensionScriptFileIdentifiers":["RT:Apple/VisHiRes.cs"],"ProjectSyms":{
|
||||
"HGR":{
|
||||
"DataDescriptor":{
|
||||
"Length":1,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","HasWidth":false,"Direction":"ReadWrite","MultiMask":null,"Label":"HGR","Value":62434,"Source":"Project","Type":"ExternalAddr","LabelAnno":"None"},
|
||||
"hi_res_page_1":{
|
||||
"DataDescriptor":{
|
||||
"Length":8192,"Format":"NumericLE","SubFormat":"Hex","SymbolRef":null},
|
||||
"Comment":"","HasWidth":true,"Direction":"ReadWrite","MultiMask":null,"Label":"hi_res_page_1","Value":8192,"Source":"Project","Type":"ExternalAddr","LabelAnno":"None"}}},
|
||||
"AddressMap":[{
|
||||
"Offset":0,"Addr":4096}],"TypeHints":[{
|
||||
"Low":0,"High":0,"Hint":"Code"}],"StatusFlagOverrides":{
|
||||
@ -12,36 +19,51 @@
|
||||
"Comments":{
|
||||
},
|
||||
"LongComments":{
|
||||
"-2147483647":{
|
||||
"Text":"6502bench SourceGen v1.5.0-dev1","BoxMode":false,"MaxWidth":80,"BackgroundColor":0}},
|
||||
"Notes":{
|
||||
},
|
||||
"Notes":{
|
||||
"213":{
|
||||
"Text":"Bitmaps here","BoxMode":false,"MaxWidth":80,"BackgroundColor":-256}},
|
||||
"UserLabels":{
|
||||
"114":{
|
||||
"Label":"Draw","Value":4210,"Source":"User","Type":"GlobalAddr","LabelAnno":"None"}},
|
||||
},
|
||||
"OperandFormats":{
|
||||
"151":{
|
||||
"Length":9,"Format":"Dense","SubFormat":"None","SymbolRef":null}},
|
||||
"213":{
|
||||
"Length":9,"Format":"Dense","SubFormat":"None","SymbolRef":null},
|
||||
"222":{
|
||||
"Length":8,"Format":"Dense","SubFormat":"None","SymbolRef":null},
|
||||
"230":{
|
||||
"Length":8,"Format":"Dense","SubFormat":"None","SymbolRef":null},
|
||||
"238":{
|
||||
"Length":16,"Format":"Dense","SubFormat":"None","SymbolRef":null},
|
||||
"254":{
|
||||
"Length":16,"Format":"Dense","SubFormat":"None","SymbolRef":null},
|
||||
"270":{
|
||||
"Length":24,"Format":"Dense","SubFormat":"None","SymbolRef":null},
|
||||
"294":{
|
||||
"Length":64,"Format":"Dense","SubFormat":"None","SymbolRef":null}},
|
||||
"LvTables":{
|
||||
},
|
||||
"VisualizationSets":{
|
||||
"160":{
|
||||
"222":{
|
||||
"Items":[{
|
||||
"Tag":"vis0000a0","VisGenIdent":"apple2-hi-res-bitmap","VisGenParams":{
|
||||
"offset":160,"byteWidth":1,"height":8,"colStride":0,"rowStride":0,"isColor":true,"isFirstOdd":false}}]},
|
||||
"168":{
|
||||
"Tag":"vis0000de","VisGenIdent":"apple2-hi-res-bitmap","VisGenParams":{
|
||||
"offset":222,"byteWidth":1,"height":8,"colStride":0,"rowStride":0,"isColor":true,"isFirstOdd":false}}]},
|
||||
"230":{
|
||||
"Items":[{
|
||||
"Tag":"vis0000a8","VisGenIdent":"apple2-hi-res-bitmap","VisGenParams":{
|
||||
"offset":168,"byteWidth":1,"height":8,"colStride":0,"rowStride":0,"isColor":true,"isFirstOdd":true}}]},
|
||||
"176":{
|
||||
"Tag":"vis0000e6","VisGenIdent":"apple2-hi-res-bitmap","VisGenParams":{
|
||||
"offset":230,"byteWidth":1,"height":8,"colStride":0,"rowStride":0,"isColor":true,"isFirstOdd":true}}]},
|
||||
"238":{
|
||||
"Items":[{
|
||||
"Tag":"vis0000b0","VisGenIdent":"apple2-hi-res-bitmap","VisGenParams":{
|
||||
"offset":176,"byteWidth":2,"height":8,"colStride":0,"rowStride":0,"isColor":true,"isFirstOdd":false}}]},
|
||||
"192":{
|
||||
"Tag":"vis0000ee","VisGenIdent":"apple2-hi-res-bitmap","VisGenParams":{
|
||||
"offset":238,"byteWidth":2,"height":8,"colStride":0,"rowStride":0,"isColor":true,"isFirstOdd":false}}]},
|
||||
"254":{
|
||||
"Items":[{
|
||||
"Tag":"vis0000c0","VisGenIdent":"apple2-hi-res-bitmap","VisGenParams":{
|
||||
"offset":192,"byteWidth":2,"height":8,"colStride":0,"rowStride":0,"isColor":true,"isFirstOdd":false}}]},
|
||||
"208":{
|
||||
"Tag":"vis0000fe","VisGenIdent":"apple2-hi-res-bitmap","VisGenParams":{
|
||||
"offset":254,"byteWidth":2,"height":8,"colStride":0,"rowStride":0,"isColor":true,"isFirstOdd":false}}]},
|
||||
"270":{
|
||||
"Items":[{
|
||||
"Tag":"vis0000d0","VisGenIdent":"apple2-hi-res-bitmap","VisGenParams":{
|
||||
"offset":208,"byteWidth":3,"height":8,"colStride":0,"rowStride":0,"isColor":true,"isFirstOdd":false}}]}}}
|
||||
"Tag":"vis00010e","VisGenIdent":"apple2-hi-res-bitmap","VisGenParams":{
|
||||
"offset":270,"byteWidth":3,"height":8,"colStride":0,"rowStride":0,"isColor":true,"isFirstOdd":false}}]},
|
||||
"294":{
|
||||
"Items":[{
|
||||
"Tag":"vis000126","VisGenIdent":"apple2-hi-res-bitmap","VisGenParams":{
|
||||
"offset":294,"byteWidth":3,"height":8,"colStride":2,"rowStride":8,"isColor":true,"isFirstOdd":false}}]}}}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 713 B After Width: | Height: | Size: 870 B |
Loading…
Reference in New Issue
Block a user