From b56bdb774358f0e3acf66e12b0e3b8c000c2bb09 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Thu, 5 Dec 2019 13:48:18 -0800 Subject: [PATCH] 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. --- SourceGen/MainController.cs | 5 +- SourceGen/RuntimeData/Apple/VisHiRes.cs | 68 ++--------------- .../Visualization/apple2-bitmap-test#061000 | Bin 232 -> 358 bytes .../Visualization/apple2-bitmap-test#061000.S | 58 ++++++++++++-- .../apple2-bitmap-test#061000.dis65 | 72 ++++++++++++------ .../apple2-bitmap-test-AW-RGB.png | Bin 713 -> 870 bytes 6 files changed, 110 insertions(+), 93 deletions(-) diff --git a/SourceGen/MainController.cs b/SourceGen/MainController.cs index f1bcab3..f67eed3 100644 --- a/SourceGen/MainController.cs +++ b/SourceGen/MainController.cs @@ -3319,7 +3319,7 @@ namespace SourceGen { expectedAddr = attr.Address; groupNum++; - } else if (mProject.UserLabels.ContainsKey(offset)) { + } else if (mProject.UserLabels.ContainsKey(offset)) { //if (mProject.GetAnattrib(offset).Symbol != null) { // We consider auto labels when splitting regions for the data analysis, // but I don't think we want to take them into account here. The specific @@ -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 -- diff --git a/SourceGen/RuntimeData/Apple/VisHiRes.cs b/SourceGen/RuntimeData/Apple/VisHiRes.cs index 41ed1df..0f7cef3 100644 --- a/SourceGen/RuntimeData/Apple/VisHiRes.cs +++ b/SourceGen/RuntimeData/Apple/VisHiRes.cs @@ -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. diff --git a/SourceGen/SGTestData/Visualization/apple2-bitmap-test#061000 b/SourceGen/SGTestData/Visualization/apple2-bitmap-test#061000 index 5eb048cdb348f389bbf3b787833567192acec661..dab5698bd1d3bcf9f20ee427984d15cd83eae71a 100644 GIT binary patch literal 358 zcmYk!u}i~16vy$qT+9m&;UYQ+88S$bzHK`X;bfmX(q46RHn8C#hZiUd}!fC@1q zgf>8h*nmPz5LE}DLR<);3s50Gpb#@yRl)*>7M5i!d#4M0knHUi7g);F+a<7wVI#v_ k289zZo-kkd`i$kmgNaw1`I+q!nClaq%M+86lk4m20Wdy4i2wiq diff --git a/SourceGen/SGTestData/Visualization/apple2-bitmap-test#061000.S b/SourceGen/SGTestData/Visualization/apple2-bitmap-test#061000.S index 72b75a6..e5b320b 100644 --- a/SourceGen/SGTestData/Visualization/apple2-bitmap-test#061000.S +++ b/SourceGen/SGTestData/Visualization/apple2-bitmap-test#061000.S @@ -17,6 +17,7 @@ count equ $05 bit bitmap3 bit bitmap4 bit bitmap5 + bit bitmap6 jsr HGR ;clear screen, set hi-res mode 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 diff --git a/SourceGen/SGTestData/Visualization/apple2-bitmap-test#061000.dis65 b/SourceGen/SGTestData/Visualization/apple2-bitmap-test#061000.dis65 index 4e6fa01..00fd089 100644 --- a/SourceGen/SGTestData/Visualization/apple2-bitmap-test#061000.dis65 +++ b/SourceGen/SGTestData/Visualization/apple2-bitmap-test#061000.dis65 @@ -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}}]}}} diff --git a/SourceGen/SGTestData/Visualization/apple2-bitmap-test-AW-RGB.png b/SourceGen/SGTestData/Visualization/apple2-bitmap-test-AW-RGB.png index 4e731f5dd690a2d483a9a8da76d76b7647a90bbf..3d86cd72936368c583f8382a4ad590043e234a78 100644 GIT binary patch delta 832 zcmV-G1Hb&q1?C1JiBL{Q4GJ0x0000DNk~Le0003g0000J2nGNE0L%~j{gELxfBQ*9 zK~#8N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