Adding a --forceCaps flag to ensure all keypresses are in caps. Particularly useful if you are multitasking!

This commit is contained in:
Rob Greene 2020-11-02 13:17:00 -06:00 committed by Iván Izaguirre
parent d8293e2dda
commit 541d8be170
3 changed files with 20 additions and 0 deletions

View File

@ -24,6 +24,7 @@ type Apple2 struct {
showSpeed bool
paused bool
traceMLI *traceProDOS
forceCaps bool
}
const (
@ -137,6 +138,15 @@ func (a *Apple2) IsProfiling() bool {
return a.profile
}
func (a *Apple2) setForceCaps(value bool) {
a.forceCaps = value
}
// IsForceCaps returns true when all letters are forced to upper case
func (a *Apple2) IsForceCaps() bool {
return a.forceCaps
}
const (
// CommandToggleSpeed toggles cpu speed between full speed and actual Apple II speed
CommandToggleSpeed = iota + 1

View File

@ -123,6 +123,10 @@ func MainApple() *Apple2 {
"traceMLI",
false,
"dump to the console the calls to ProDOS machine language interface calls to $BF00")
forceCaps := flag.Bool(
"forceCaps",
false,
"force all letters to be uppercased (no need for caps lock!)")
flag.Parse()
@ -144,6 +148,7 @@ func MainApple() *Apple2 {
a.io.setTraceRegistrations(*traceSSReg)
a.io.setPanicNotImplemented(*panicSS)
a.setProfiling(*profile)
a.setForceCaps(*forceCaps)
var charGenMap charColumnMap
initialCharGenPage := 0

View File

@ -1,5 +1,7 @@
package izapple2
import "unicode"
// KeyboardProvider provides a keyboard implementation
type KeyboardProvider interface {
GetKey(strobe bool) (key uint8, ok bool)
@ -31,6 +33,9 @@ func (k *KeyboardChannel) PutText(text string) {
func (k *KeyboardChannel) PutRune(ch rune) {
// We will use computed text only for printable ASCII chars
if ch >= ' ' && ch <= '~' {
if k.a.IsForceCaps() && ch >= 'a' && ch <= 'z' {
ch = unicode.ToUpper(ch)
}
k.PutChar(uint8(ch))
}
}