From 10f6c05e6d4321f7b8b19786b95d69dc211113e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Izaguirre?= Date: Sun, 21 Jul 2024 23:28:31 +0200 Subject: [PATCH] Help is uppercase when lowercase is not supported --- apple2.go | 1 + screen/snapshotsDebug.go | 3 +++ screen/testScenarios.go | 5 +++++ screen/videoSource.go | 2 ++ setup.go | 2 ++ videoSourceImpl.go | 5 +++++ 6 files changed, 18 insertions(+) diff --git a/apple2.go b/apple2.go index 6be2045..31334b9 100644 --- a/apple2.go +++ b/apple2.go @@ -19,6 +19,7 @@ type Apple2 struct { softVideoSwitch *SoftVideoSwitch board string isApple2e bool + hasLowerCase bool isFourColors bool // An Apple II without the 6 color mod commandChannel chan command diff --git a/screen/snapshotsDebug.go b/screen/snapshotsDebug.go index 0162520..515c58a 100644 --- a/screen/snapshotsDebug.go +++ b/screen/snapshotsDebug.go @@ -162,6 +162,9 @@ func SnapshotCharacterGenerator(vs VideoSource, isAltText bool) *image.RGBA { // SnapshotMessageGenerator shows a message on the screen func SnapshotMessageGenerator(vs VideoSource, message string) *image.RGBA { + if !vs.SupportsLowercase() { + message = strings.ToUpper(message) + } lines := strings.Split(message, "\n") text := make([]uint8, textLines*text40Columns) for i := range text { diff --git a/screen/testScenarios.go b/screen/testScenarios.go index 5925d86..9cf40f4 100644 --- a/screen/testScenarios.go +++ b/screen/testScenarios.go @@ -134,6 +134,11 @@ func (ts *TestScenario) GetCardImage(light color.Color) *image.RGBA { return nil } +// SupportsLowercase returns true if the video source supports lowercase +func (ts *TestScenario) SupportsLowercase() bool { + return true +} + func buildImageName(name string, screenMode int, altSet bool) string { var screenName string switch screenMode { diff --git a/screen/videoSource.go b/screen/videoSource.go index f6e2d05..f7b5254 100644 --- a/screen/videoSource.go +++ b/screen/videoSource.go @@ -53,4 +53,6 @@ type VideoSource interface { GetSuperVideoMemory() []uint8 // GetCardImage returns an image provided by a card, like the videx card GetCardImage(light color.Color) *image.RGBA + // SupportsLowercase returns true if the video source supports lowercase + SupportsLowercase() bool } diff --git a/setup.go b/setup.go index 4a4bada..724d50b 100644 --- a/setup.go +++ b/setup.go @@ -19,10 +19,12 @@ func configure(configuration *configuration) (*Apple2, error) { addApple2SoftSwitches(a.io) if a.isApple2e { + a.hasLowerCase = true a.mmu.initExtendedRAM(1) addApple2ESoftSwitches(a.io) } if board == "base64a" { + a.hasLowerCase = true addBase64aSoftSwitches(a.io) } diff --git a/videoSourceImpl.go b/videoSourceImpl.go index 13ec110..ff7d131 100644 --- a/videoSourceImpl.go +++ b/videoSourceImpl.go @@ -155,6 +155,11 @@ func (a *Apple2) GetCardImage(light color.Color) *image.RGBA { return a.softVideoSwitch.BuildAlternateImage(light) } +// SupportsLowercase returns true if the video source supports lowercase +func (a *Apple2) SupportsLowercase() bool { + return a.hasLowerCase +} + // DumpTextModeAnsi returns the text mode contents using ANSI escape codes for reverse and flash func DumpTextModeAnsi(a *Apple2) string { is80Columns := a.io.isSoftSwitchActive(ioFlag80Col)