izapple2/screen/textToString.go

29 lines
678 B
Go
Raw Normal View History

2022-02-21 22:05:53 +00:00
package screen
import (
"fmt"
)
// 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)
}
content += fmt.Sprintf("%v\n", line)
}
return content
}