diff --git a/CommonUtil/Font8x8.cs b/CommonUtil/Font8x8.cs index 8fbb78c..6da283f 100644 --- a/CommonUtil/Font8x8.cs +++ b/CommonUtil/Font8x8.cs @@ -23,6 +23,8 @@ namespace CommonUtil { /// so glyphs can be packed tightly. /// public static class Font8x8 { + private static List sBitData; + /// /// Returns an 8-byte array for the specified character. Each byte represents one /// row. The first byte holds the top row, and the most significant bit in each @@ -41,6 +43,11 @@ namespace CommonUtil { return sBitData[index]; } + /// + /// Maps a character value to an index into sFontData. + /// + /// Character to find. + /// Index of character's glyph, or index of REPLACEMENT CHARACTER. private static int MapChar(char ch) { if (ch == ' ') { return 1; @@ -53,8 +60,6 @@ namespace CommonUtil { } } - private static List sBitData; - /// /// Converts the easy-to-edit string data into easy-to-process bitmaps. /// @@ -170,7 +175,7 @@ namespace CommonUtil { "#.....#." + ".#####.." + "........", - // ' ' + // '7' "#######." + "......#." + ".....#.." + @@ -179,7 +184,7 @@ namespace CommonUtil { "..#....." + ".#......" + "........", - // ' ' + // '8' ".#####.." + "#.....#." + "#.....#." + diff --git a/SourceGen/RuntimeData/Apple/VisHiRes.cs b/SourceGen/RuntimeData/Apple/VisHiRes.cs index b7a4f56..341ce5c 100644 --- a/SourceGen/RuntimeData/Apple/VisHiRes.cs +++ b/SourceGen/RuntimeData/Apple/VisHiRes.cs @@ -64,9 +64,9 @@ namespace RuntimeData.Apple { new VisParamDescr("Height", P_HEIGHT, typeof(int), 1, 1024, 0, 1), new VisParamDescr("Column stride (bytes)", - P_COL_STRIDE, typeof(int), 0, 1024, 0, 0), + P_COL_STRIDE, typeof(int), 0, 4096, 0, 0), new VisParamDescr("Row stride (bytes)", - P_ROW_STRIDE, typeof(int), 0, 1024, 0, 0), + P_ROW_STRIDE, typeof(int), 0, 4096, 0, 0), new VisParamDescr("Color", P_IS_COLOR, typeof(bool), 0, 0, 0, true), new VisParamDescr("First col odd", @@ -88,13 +88,13 @@ namespace RuntimeData.Apple { new VisParamDescr("Cell height", P_ITEM_HEIGHT, typeof(int), 1, 192, 0, 1), new VisParamDescr("Column stride (bytes)", - P_COL_STRIDE, typeof(int), 0, 1024, 0, 0), + P_COL_STRIDE, typeof(int), 0, 4096, 0, 0), new VisParamDescr("Row stride (bytes)", - P_ROW_STRIDE, typeof(int), 0, 1024, 0, 0), + P_ROW_STRIDE, typeof(int), 0, 4096, 0, 0), new VisParamDescr("Cell stride (bytes)", P_CELL_STRIDE, typeof(int), 0, 4096, 0, 0), new VisParamDescr("Number of items", - P_COUNT, typeof(int), 1, 1024, 0, 64), + P_COUNT, typeof(int), 1, 4096, 0, 64), new VisParamDescr("Color", P_IS_COLOR, typeof(bool), 0, 0, 0, true), new VisParamDescr("First col odd", @@ -205,11 +205,14 @@ namespace RuntimeData.Apple { return null; } - int lastOffset = offset + rowStride * height - (colStride - 1) - 1; + int lastOffset = offset + rowStride * (height - 1) + + colStride * (byteWidth - 1); if (lastOffset >= mFileData.Length) { mAppRef.ReportError("Bitmap runs off end of file (last offset +" + lastOffset.ToString("x6") + ")"); return null; + //} else { + // mAppRef.DebugLog("last offset=+" + lastOffset.ToString("x6")); } VisBitmap8 vb = new VisBitmap8(byteWidth * 7, height); @@ -283,11 +286,15 @@ namespace RuntimeData.Apple { } int lastOffset = offset + (cellStride * (count - 1)) + - rowStride * itemHeight - (colStride - 1) - 1; + rowStride * (itemHeight - 1) + + colStride * (itemByteWidth - 1); if (lastOffset >= mFileData.Length) { mAppRef.ReportError("Bitmap runs off end of file (last offset +" + lastOffset.ToString("x6") + ")"); return null; + //} else { + // mAppRef.DebugLog("lastOffset=+" + lastOffset.ToString("x6") + + // ", len=" + mFileData.Length.ToString("x6")); } // Set the number of horizontal cells. For small counts we try to make it square, diff --git a/SourceGen/SGTestData/Visualization/apple2-grid-test1 b/SourceGen/SGTestData/Visualization/apple2-grid-test1 new file mode 100644 index 0000000..89cb39a Binary files /dev/null and b/SourceGen/SGTestData/Visualization/apple2-grid-test1 differ diff --git a/SourceGen/SGTestData/Visualization/apple2-grid-test1.dis65 b/SourceGen/SGTestData/Visualization/apple2-grid-test1.dis65 new file mode 100644 index 0000000..2c2cc3c --- /dev/null +++ b/SourceGen/SGTestData/Visualization/apple2-grid-test1.dis65 @@ -0,0 +1,89 @@ +### 6502bench SourceGen dis65 v1.0 ### +{ +"_ContentVersion":4, +"FileDataLength":40, +"FileDataCrc32":-1890840498, +"ProjectProps":{ +"CpuName":"65C02", +"IncludeUndocumentedInstr":false, +"TwoByteBrk":false, +"EntryFlags":32702671, +"AutoLabelStyle":"Simple", +"AnalysisParams":{ +"AnalyzeUncategorizedData":true, +"DefaultTextScanMode":"LowHighAscii", +"MinCharsForString":4, +"SeekNearbyTargets":true, +"UseRelocData":false, +"SmartPlpHandling":false, +"SmartPlbHandling":true}, + +"PlatformSymbolFileIdentifiers":["RT:Apple/F8-ROM.sym65", +"RT:Apple/Cxxx-IO.sym65", +"RT:Apple/C08x-DiskII.sym65", +"RT:Apple/ProDOS8.sym65"], +"ExtensionScriptFileIdentifiers":["RT:Apple/ProDOS8.cs", +"RT:Apple/VisHiRes.cs"], +"ProjectSyms":{ +}}, + +"AddressMap":[{ +"Offset":0, +"Addr":8192}], +"TypeHints":[{ +"Low":0, +"High":0, +"Hint":"Code"}], +"StatusFlagOverrides":{ +}, + +"Comments":{ +}, + +"LongComments":{ +"-2147483647":{ +"Text":"Grid with 5 1x8 bitmaps, with a large row stride.", +"BoxMode":false, +"MaxWidth":80, +"BackgroundColor":0}}, + +"Notes":{ +}, + +"UserLabels":{ +}, + +"OperandFormats":{ +"0":{ +"Length":40, +"Format":"Dense", +"SubFormat":"None", +"SymbolRef":null}}, + +"LvTables":{ +}, + +"Visualizations":[{ +"Tag":"vis000000", +"VisGenIdent":"apple2-hi-res-bitmap-grid", +"VisGenParams":{ +"offset":0, +"itemByteWidth":1, +"itemHeight":8, +"colStride":0, +"rowStride":5, +"cellStride":1, +"count":5, +"isColor":true, +"isFirstOdd":false, +"isHighBitFlipped":false}}], +"VisualizationAnimations":[], +"VisualizationSets":{ +"0":{ +"Tags":["vis000000"]}}, + +"RelocList":{ +}, + +"DbrValues":{ +}} diff --git a/SourceGen/SGTestData/Visualization/apple2-grid-test2 b/SourceGen/SGTestData/Visualization/apple2-grid-test2 new file mode 100644 index 0000000..98acc2c Binary files /dev/null and b/SourceGen/SGTestData/Visualization/apple2-grid-test2 differ diff --git a/SourceGen/SGTestData/Visualization/apple2-grid-test2.dis65 b/SourceGen/SGTestData/Visualization/apple2-grid-test2.dis65 new file mode 100644 index 0000000..18347eb --- /dev/null +++ b/SourceGen/SGTestData/Visualization/apple2-grid-test2.dis65 @@ -0,0 +1,86 @@ +### 6502bench SourceGen dis65 v1.0 ### +{ +"_ContentVersion":4, +"FileDataLength":80, +"FileDataCrc32":1433343667, +"ProjectProps":{ +"CpuName":"65C02", +"IncludeUndocumentedInstr":false, +"TwoByteBrk":false, +"EntryFlags":32702671, +"AutoLabelStyle":"Simple", +"AnalysisParams":{ +"AnalyzeUncategorizedData":true, +"DefaultTextScanMode":"LowHighAscii", +"MinCharsForString":4, +"SeekNearbyTargets":true, +"UseRelocData":false, +"SmartPlpHandling":false, +"SmartPlbHandling":true}, + +"PlatformSymbolFileIdentifiers":["RT:Apple/F8-ROM.sym65", +"RT:Apple/Cxxx-IO.sym65", +"RT:Apple/C08x-DiskII.sym65", +"RT:Apple/ProDOS8.sym65"], +"ExtensionScriptFileIdentifiers":["RT:Apple/ProDOS8.cs", +"RT:Apple/VisHiRes.cs"], +"ProjectSyms":{ +}}, + +"AddressMap":[{ +"Offset":0, +"Addr":8192}], +"TypeHints":[], +"StatusFlagOverrides":{ +}, + +"Comments":{ +}, + +"LongComments":{ +"-2147483647":{ +"Text":"Lode Runner-style sprite sheet.", +"BoxMode":false, +"MaxWidth":80, +"BackgroundColor":0}}, + +"Notes":{ +}, + +"UserLabels":{ +}, + +"OperandFormats":{ +"0":{ +"Length":80, +"Format":"Dense", +"SubFormat":"None", +"SymbolRef":null}}, + +"LvTables":{ +}, + +"Visualizations":[{ +"Tag":"vis000000", +"VisGenIdent":"apple2-hi-res-bitmap-grid", +"VisGenParams":{ +"offset":0, +"itemByteWidth":2, +"itemHeight":8, +"colStride":5, +"rowStride":0, +"cellStride":1, +"count":5, +"isColor":true, +"isFirstOdd":false, +"isHighBitFlipped":false}}], +"VisualizationAnimations":[], +"VisualizationSets":{ +"0":{ +"Tags":["vis000000"]}}, + +"RelocList":{ +}, + +"DbrValues":{ +}}