mirror of
https://github.com/ivanizag/izapple2.git
synced 2025-04-01 12:30:01 +00:00
Support double width low resolution
This commit is contained in:
parent
8ea3abe2ff
commit
a8f22224a8
@ -25,6 +25,7 @@ Portable emulator of an Apple II+. Written in Go.
|
||||
- Text 40 columns
|
||||
- text 80 columns (Apple //e only)
|
||||
- Low-Resolution graphics
|
||||
- Double-Width Low-Resolution graphics (Apple //e only)
|
||||
- High-Resolution graphics
|
||||
- Mixed mode
|
||||
- Displays:
|
||||
|
@ -47,12 +47,7 @@ func Snapshot(a *Apple2) *image.RGBA {
|
||||
if isHiResMode {
|
||||
snap = snapshotHiResModeMonoShift(a, pageIndex, isMixMode, lightColor)
|
||||
} else {
|
||||
if isDoubleResMode {
|
||||
//snap = snapshotLoResDoubleModeMono(a, false /*isSecondPage*/, isMixMode, lightColor)
|
||||
snap = snapshotLoResModeMono(a, isSecondPage, isMixMode, lightColor)
|
||||
} else {
|
||||
snap = snapshotLoResModeMono(a, isSecondPage, isMixMode, lightColor)
|
||||
}
|
||||
snap = snapshotLoResModeMono(a, isDoubleResMode, isSecondPage, isMixMode, lightColor)
|
||||
}
|
||||
|
||||
if isMixMode {
|
||||
|
@ -6,8 +6,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
loResPixelWidth = charWidth * 2
|
||||
loResPixelHeight = charHeight / 2
|
||||
loResPixelWidth = charWidth * 2
|
||||
doubleLoResPixelWidth = charWidth
|
||||
loResPixelHeight = charHeight / 2
|
||||
)
|
||||
|
||||
func getColorPatterns(light color.Color) [16][16]color.Color {
|
||||
@ -37,14 +38,18 @@ func getColorPatterns(light color.Color) [16][16]color.Color {
|
||||
|
||||
}
|
||||
|
||||
func snapshotLoResModeMono(a *Apple2, isSecondPage bool, isMixMode bool, light color.Color) *image.RGBA {
|
||||
text, columns, lines := getActiveText(a, false, isSecondPage, false)
|
||||
func snapshotLoResModeMono(a *Apple2, isDoubleResMode bool, isSecondPage bool, isMixMode bool, light color.Color) *image.RGBA {
|
||||
text, columns, lines := getActiveText(a, isDoubleResMode, isSecondPage, false)
|
||||
if isMixMode {
|
||||
lines -= textLinesMix
|
||||
}
|
||||
grLines := lines * 2
|
||||
pixelWidth := loResPixelWidth
|
||||
if isDoubleResMode {
|
||||
pixelWidth = doubleLoResPixelWidth
|
||||
}
|
||||
|
||||
size := image.Rect(0, 0, columns*loResPixelWidth, grLines*loResPixelHeight)
|
||||
size := image.Rect(0, 0, columns*pixelWidth, grLines*loResPixelHeight)
|
||||
img := image.NewRGBA(size)
|
||||
|
||||
patterns := getColorPatterns(light)
|
||||
@ -55,10 +60,12 @@ func snapshotLoResModeMono(a *Apple2, isSecondPage bool, isMixMode bool, light c
|
||||
if l%2 == 0 {
|
||||
grPixel = char & 0xf
|
||||
}
|
||||
offset := (c % 2) * 2 // 2 pixel offset for odd lores pixels, 0 for even pixels
|
||||
// We place pixelWidth mono pixels per graphic pixel.
|
||||
// The groups of 4 mono pixels need to be alligned with an offset to get plain surfaces
|
||||
offset := (c * pixelWidth) % 4
|
||||
|
||||
// Insert the 14 half pixels required
|
||||
for i := 0; i < loResPixelWidth; i++ {
|
||||
// Insert the pixelWidth pixels required
|
||||
for i := 0; i < pixelWidth; i++ {
|
||||
v := patterns[grPixel][i+offset]
|
||||
// Repeat the same color for 4 lines
|
||||
for r := 0; r < loResPixelHeight; r++ {
|
||||
|
Loading…
x
Reference in New Issue
Block a user