mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-12-28 02:30:36 +00:00
Adding a --forceCaps flag to ensure all keypresses are in caps. Particularly useful if you are multitasking!
This commit is contained in:
parent
d8293e2dda
commit
541d8be170
10
apple2.go
10
apple2.go
@ -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
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user