1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-02 04:29:28 +00:00

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.)
This commit is contained in:
Andy McFadden 2020-08-18 15:10:10 -07:00
parent 3c73ea7ff6
commit a2e7c88fc9
2 changed files with 15 additions and 6 deletions

View File

@ -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

View File

@ -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;