mirror of
https://github.com/ivanizag/izapple2.git
synced 2025-01-18 03:29:52 +00:00
Video7, mix with RGB color text 40
This commit is contained in:
parent
d1bf13ce7f
commit
ede3b65257
80
screen.go
80
screen.go
@ -16,31 +16,36 @@ References:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const (
|
const (
|
||||||
videoText40 uint8 = 0x01
|
// Base Video Mode
|
||||||
videoGR uint8 = 0x02
|
videoBaseMask uint16 = 0x1f
|
||||||
videoHGR uint8 = 0x03
|
videoText40 uint16 = 0x01
|
||||||
|
videoGR uint16 = 0x02
|
||||||
|
videoHGR uint16 = 0x03
|
||||||
|
videoText80 uint16 = 0x08
|
||||||
|
videoDGR uint16 = 0x09
|
||||||
|
videoDHGR uint16 = 0x0a
|
||||||
|
videoText40RGB uint16 = 0x10
|
||||||
|
videoMono560 uint16 = 0x11
|
||||||
|
videoRGBMix uint16 = 0x12
|
||||||
|
videoRGB160 uint16 = 0x13
|
||||||
|
videoSHR uint16 = 0x14
|
||||||
|
|
||||||
videoText80 uint8 = 0x08
|
// Mix text modifiers
|
||||||
videoDGR uint8 = 0x09
|
videoMixTextMask uint16 = 0x0f00
|
||||||
videoDHGR uint8 = 0x0a
|
videoMixText40 uint16 = 0x0100
|
||||||
|
videoMixText80 uint16 = 0x0200
|
||||||
|
videoMixText40RGB uint16 = 0x0300
|
||||||
|
|
||||||
videoRGBText40 uint8 = 0x10
|
// Other modifiers
|
||||||
videoMono560 uint8 = 0x11
|
videoModifiersMask uint16 = 0xf000
|
||||||
videoRGBMix uint8 = 0x12
|
videoSecondPage uint16 = 0x1000
|
||||||
videoRGB160 uint8 = 0x13
|
|
||||||
videoSHR uint8 = 0x14
|
|
||||||
|
|
||||||
// Modifiers
|
|
||||||
videoBaseMask uint8 = 0x1f
|
|
||||||
videoSecondPage uint8 = 0x20
|
|
||||||
videoMixText40 uint8 = 0x40
|
|
||||||
videoMixText80 uint8 = 0x80
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func getCurrentVideoMode(a *Apple2) uint8 {
|
func getCurrentVideoMode(a *Apple2) uint16 {
|
||||||
isTextMode := a.io.isSoftSwitchActive(ioFlagText)
|
isTextMode := a.io.isSoftSwitchActive(ioFlagText)
|
||||||
isHiResMode := a.io.isSoftSwitchActive(ioFlagHiRes)
|
isHiResMode := a.io.isSoftSwitchActive(ioFlagHiRes)
|
||||||
is80Columns := a.io.isSoftSwitchActive(ioFlag80Col)
|
is80Columns := a.io.isSoftSwitchActive(ioFlag80Col)
|
||||||
|
isStore80Active := a.mmu.store80Active
|
||||||
isDoubleResMode := !isTextMode && is80Columns && !a.io.isSoftSwitchActive(ioFlagAnnunciator3)
|
isDoubleResMode := !isTextMode && is80Columns && !a.io.isSoftSwitchActive(ioFlagAnnunciator3)
|
||||||
isSuperHighResMode := a.io.isSoftSwitchActive(ioDataNewVideo)
|
isSuperHighResMode := a.io.isSoftSwitchActive(ioDataNewVideo)
|
||||||
|
|
||||||
@ -52,19 +57,17 @@ func getCurrentVideoMode(a *Apple2) uint8 {
|
|||||||
|
|
||||||
isMixMode := a.io.isSoftSwitchActive(ioFlagMixed)
|
isMixMode := a.io.isSoftSwitchActive(ioFlagMixed)
|
||||||
|
|
||||||
mode := uint8(0)
|
mode := uint16(0)
|
||||||
if isSuperHighResMode {
|
if isSuperHighResMode {
|
||||||
mode = videoSHR
|
mode = videoSHR
|
||||||
isMixMode = false
|
isMixMode = false
|
||||||
} else if isTextMode {
|
} else if isTextMode {
|
||||||
if is80Columns {
|
if is80Columns {
|
||||||
mode = videoText80
|
mode = videoText80
|
||||||
|
} else if isStore80Active {
|
||||||
|
mode = videoText40RGB
|
||||||
} else {
|
} else {
|
||||||
if a.mmu.store80Active {
|
mode = videoText40
|
||||||
mode = videoRGBText40
|
|
||||||
} else {
|
|
||||||
mode = videoText40
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
isMixMode = false
|
isMixMode = false
|
||||||
} else if isHiResMode {
|
} else if isHiResMode {
|
||||||
@ -89,6 +92,8 @@ func getCurrentVideoMode(a *Apple2) uint8 {
|
|||||||
if isMixMode {
|
if isMixMode {
|
||||||
if is80Columns {
|
if is80Columns {
|
||||||
mode |= videoMixText80
|
mode |= videoMixText80
|
||||||
|
} else if isStore80Active {
|
||||||
|
mode |= videoMixText40RGB
|
||||||
} else {
|
} else {
|
||||||
mode |= videoMixText40
|
mode |= videoMixText40
|
||||||
}
|
}
|
||||||
@ -101,10 +106,10 @@ func getCurrentVideoMode(a *Apple2) uint8 {
|
|||||||
return mode
|
return mode
|
||||||
}
|
}
|
||||||
|
|
||||||
func snapshotByMode(a *Apple2, videoMode uint8) *image.RGBA {
|
func snapshotByMode(a *Apple2, videoMode uint16) *image.RGBA {
|
||||||
videoBase := videoMode & videoBaseMask
|
videoBase := videoMode & videoBaseMask
|
||||||
|
mixMode := videoMode & videoMixTextMask
|
||||||
isSecondPage := (videoMode & videoSecondPage) != 0
|
isSecondPage := (videoMode & videoSecondPage) != 0
|
||||||
isMixMode := (videoMode & (videoMixText40 | videoMixText80)) != 0
|
|
||||||
|
|
||||||
var lightColor color.Color
|
var lightColor color.Color
|
||||||
if a.isColor {
|
if a.isColor {
|
||||||
@ -126,7 +131,7 @@ func snapshotByMode(a *Apple2, videoMode uint8) *image.RGBA {
|
|||||||
case videoText80:
|
case videoText80:
|
||||||
snap = snapshotText80Mode(a, isSecondPage, lightColor)
|
snap = snapshotText80Mode(a, isSecondPage, lightColor)
|
||||||
applyNTSCFilter = false
|
applyNTSCFilter = false
|
||||||
case videoRGBText40:
|
case videoText40RGB:
|
||||||
snap = snapshotText40RGBMode(a, isSecondPage)
|
snap = snapshotText40RGBMode(a, isSecondPage)
|
||||||
applyNTSCFilter = false
|
applyNTSCFilter = false
|
||||||
case videoGR:
|
case videoGR:
|
||||||
@ -149,19 +154,28 @@ func snapshotByMode(a *Apple2, videoMode uint8) *image.RGBA {
|
|||||||
applyNTSCFilter = false
|
applyNTSCFilter = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if isMixMode {
|
if applyNTSCFilter {
|
||||||
|
snap = filterNTSCColor(snap, ntscMask)
|
||||||
|
}
|
||||||
|
|
||||||
|
if mixMode != 0 {
|
||||||
var bottom *image.RGBA
|
var bottom *image.RGBA
|
||||||
if (videoMode & videoMixText40) != 0 {
|
applyNTSCFilter := a.isColor
|
||||||
|
switch mixMode {
|
||||||
|
case videoMixText40:
|
||||||
bottom = snapshotText40Mode(a, isSecondPage, lightColor)
|
bottom = snapshotText40Mode(a, isSecondPage, lightColor)
|
||||||
} else {
|
case videoMixText80:
|
||||||
bottom = snapshotText80Mode(a, isSecondPage, lightColor)
|
bottom = snapshotText80Mode(a, isSecondPage, lightColor)
|
||||||
|
case videoMixText40RGB:
|
||||||
|
bottom = snapshotText40RGBMode(a, isSecondPage)
|
||||||
|
applyNTSCFilter = false
|
||||||
|
}
|
||||||
|
if applyNTSCFilter {
|
||||||
|
snap = filterNTSCColor(snap, ntscMask)
|
||||||
}
|
}
|
||||||
snap = mixSnapshots(snap, bottom)
|
snap = mixSnapshots(snap, bottom)
|
||||||
}
|
}
|
||||||
|
|
||||||
if applyNTSCFilter {
|
|
||||||
snap = filterNTSCColor(snap, ntscMask)
|
|
||||||
}
|
|
||||||
return snap
|
return snap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,8 @@ func (a *Apple2) SnapshotParts() *image.RGBA {
|
|||||||
videoMode := getCurrentVideoMode(a)
|
videoMode := getCurrentVideoMode(a)
|
||||||
isSecondPage := (videoMode & videoSecondPage) != 0
|
isSecondPage := (videoMode & videoSecondPage) != 0
|
||||||
videoBase := videoMode & videoBaseMask
|
videoBase := videoMode & videoBaseMask
|
||||||
|
mixMode := videoMode & videoMixTextMask
|
||||||
|
modifiers := videoMode & videoModifiersMask
|
||||||
|
|
||||||
snapScreen := snapshotByMode(a, videoMode)
|
snapScreen := snapshotByMode(a, videoMode)
|
||||||
snapPage1 := snapshotByMode(a, videoMode&^videoSecondPage)
|
snapPage1 := snapshotByMode(a, videoMode&^videoSecondPage)
|
||||||
@ -21,12 +23,17 @@ func (a *Apple2) SnapshotParts() *image.RGBA {
|
|||||||
snapAux = filterMask(mask)
|
snapAux = filterMask(mask)
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if videoBase == videoRGBText40 {
|
if videoBase == videoText40RGB {
|
||||||
snapAux = snapshotText40RGBModeColors(a, isSecondPage)
|
snapAux = snapshotText40RGBModeColors(a, isSecondPage)
|
||||||
} else if (videoMode & videoMixText80) != 0 {
|
|
||||||
snapAux = snapshotByMode(a, videoText80)
|
|
||||||
} else {
|
} else {
|
||||||
snapAux = snapshotByMode(a, videoText40)
|
switch mixMode {
|
||||||
|
case videoMixText80:
|
||||||
|
snapAux = snapshotByMode(a, videoText80|modifiers)
|
||||||
|
case videoMixText40RGB:
|
||||||
|
snapAux = snapshotByMode(a, videoText40RGB|modifiers)
|
||||||
|
default:
|
||||||
|
snapAux = snapshotByMode(a, videoText40|modifiers)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mixFourSnapshots([]*image.RGBA{snapScreen, snapAux, snapPage1, snapPage2})
|
return mixFourSnapshots([]*image.RGBA{snapScreen, snapAux, snapPage1, snapPage2})
|
||||||
@ -36,6 +43,7 @@ func (a *Apple2) SnapshotParts() *image.RGBA {
|
|||||||
func (a *Apple2) VideoModeName() string {
|
func (a *Apple2) VideoModeName() string {
|
||||||
videoMode := getCurrentVideoMode(a)
|
videoMode := getCurrentVideoMode(a)
|
||||||
videoBase := videoMode & videoBaseMask
|
videoBase := videoMode & videoBaseMask
|
||||||
|
mixMode := videoMode & videoMixTextMask
|
||||||
|
|
||||||
var name string
|
var name string
|
||||||
applyNTSCFilter := a.isColor
|
applyNTSCFilter := a.isColor
|
||||||
@ -47,7 +55,7 @@ func (a *Apple2) VideoModeName() string {
|
|||||||
case videoText80:
|
case videoText80:
|
||||||
name = "TEXT80COL"
|
name = "TEXT80COL"
|
||||||
applyNTSCFilter = false
|
applyNTSCFilter = false
|
||||||
case videoRGBText40:
|
case videoText40RGB:
|
||||||
name = "TEXT40COLRGB"
|
name = "TEXT40COLRGB"
|
||||||
applyNTSCFilter = false
|
applyNTSCFilter = false
|
||||||
case videoGR:
|
case videoGR:
|
||||||
@ -76,12 +84,13 @@ func (a *Apple2) VideoModeName() string {
|
|||||||
name += "-PAGE2"
|
name += "-PAGE2"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (videoMode & videoMixText40) != 0 {
|
switch mixMode {
|
||||||
|
case videoMixText40:
|
||||||
name += "-MIX40"
|
name += "-MIX40"
|
||||||
}
|
case videoMixText80:
|
||||||
|
|
||||||
if (videoMode & videoMixText80) != 0 {
|
|
||||||
name += "-MIX80"
|
name += "-MIX80"
|
||||||
|
case videoMixText40RGB:
|
||||||
|
name += "-MIX40RGB"
|
||||||
}
|
}
|
||||||
|
|
||||||
if applyNTSCFilter {
|
if applyNTSCFilter {
|
||||||
|
@ -85,7 +85,7 @@ func getRGBTextColor(pixel bool, colorKey uint8) color.Color {
|
|||||||
colorKey >>= 4
|
colorKey >>= 4
|
||||||
}
|
}
|
||||||
colorKey &= 0x0f
|
colorKey &= 0x0f
|
||||||
return rgbColorMap[colorKey]
|
return ntscColorMap[colorKey]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user