izapple2/screen/textToString.go

31 lines
727 B
Go
Raw Normal View History

2022-02-21 22:05:53 +00:00
package screen
import (
"fmt"
2024-01-27 16:20:53 +00:00
"strings"
2022-02-21 22:05:53 +00:00
)
// RenderTextModeString returns the text mode contents ignoring reverse and flash
func RenderTextModeString(vs VideoSource, is80Columns bool, isSecondPage bool, isAltText bool, isApple2e bool) string {
var text []uint8
if is80Columns {
text = getText80FromMemory(vs, isSecondPage)
} else {
text = getTextFromMemory(vs, isSecondPage, false)
}
columns := len(text) / textLines
content := ""
for l := 0; l < textLines; l++ {
line := ""
for c := 0; c < columns; c++ {
char := text[l*columns+c]
line += textMemoryByteToString(char, isAltText, isApple2e, false)
}
2024-01-27 16:20:53 +00:00
line = strings.TrimRight(line, " ")
2022-02-21 22:05:53 +00:00
content += fmt.Sprintf("%v\n", line)
}
return content
}