From a2e7c88fc9976ec96cb204bb6439905d0a9f9e23 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Tue, 18 Aug 2020 15:10:10 -0700 Subject: [PATCH] Update Apple II definitions Added explicit widths to the 6502 vectors. Two changes to Apple II hi-res visualization: (1) Allow the row stride to be any value >= 1. This is useful when data is stored in column-major order, i.e. it's a two-byte-wide shape, with all of the data for the first column stored before the data for the second column. (Set the row stride to 1, and the column stride to the bitmap height.) (2) Modify the layout of grids (sprite sheets and fonts), so that we're closer to square when the item counts is low. Otherwise the thumbnail just looks like a dashed line. (This one is strictly cosmetic.) --- SourceGen/RuntimeData/Apple/F8-ROM.sym65 | 6 +++--- SourceGen/RuntimeData/Apple/VisHiRes.cs | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/SourceGen/RuntimeData/Apple/F8-ROM.sym65 b/SourceGen/RuntimeData/Apple/F8-ROM.sym65 index 057a0e4..0e8ed0f 100644 --- a/SourceGen/RuntimeData/Apple/F8-ROM.sym65 +++ b/SourceGen/RuntimeData/Apple/F8-ROM.sym65 @@ -168,6 +168,6 @@ MON_TOSUB @ $FFBE MON_ZMODE @ $FFC7 ; locations defined by the 6502 -MON_6502_NMI @ $FFFA ;6502 NMI vector -MON_6502_RESET @ $FFFC ;6502 reset vector -MON_6502_IRQ @ $FFFE ;6502 IRQ vector +MON_6502_NMI @ $FFFA 2 ;6502 NMI vector +MON_6502_RESET @ $FFFC 2 ;6502 reset vector +MON_6502_IRQ @ $FFFE 2 ;6502 IRQ vector diff --git a/SourceGen/RuntimeData/Apple/VisHiRes.cs b/SourceGen/RuntimeData/Apple/VisHiRes.cs index 92dee11..532f35d 100644 --- a/SourceGen/RuntimeData/Apple/VisHiRes.cs +++ b/SourceGen/RuntimeData/Apple/VisHiRes.cs @@ -196,7 +196,11 @@ namespace RuntimeData.Apple { mAppRef.ReportError("Invalid column stride"); return null; } - if (rowStride < byteWidth * colStride - (colStride - 1) || rowStride > MAX_DIM) { + // This used to be limited to rowStride >= byteWidth * colStride - (colStride - 1), + // but that doesn't allow for a 2x8 bitmap in column-major order. In that case + // you want a row stride of 1 (because each row starts 1 byte farther on) and a + // column stride of 8 (because each column is separated by 8 bytes). + if (rowStride < 1 || rowStride > MAX_DIM) { mAppRef.ReportError("Invalid row stride"); return null; } @@ -286,12 +290,17 @@ namespace RuntimeData.Apple { return null; } - // Set the number of horizontal cells to 16 or 32 based on the number of elements. + // Set the number of horizontal cells. For small counts we try to make it square, + // for larger counts we use a reasonable power of 2. int hcells; if (count > 128) { hcells = 32; - } else { + } else if (count >= 64) { hcells = 16; + } else if (count >= 32) { + hcells = 8; + } else { + hcells = (int)Math.Sqrt(count + 1); } int vcells = (count + hcells - 1) / hcells;