Screen dumped on the stdout no longer by default

This commit is contained in:
Ivan Izaguirre 2019-05-03 22:00:48 +02:00
parent f80b635ff1
commit 240cfbae9b
3 changed files with 19 additions and 6 deletions

View File

@ -49,17 +49,24 @@ func (a *Apple2) AddDisk2(diskRomFile string, diskImage string) {
}
}
// Run starts the Apple2 emulation
func (a *Apple2) Run(log bool, stdinKeyboard bool) {
// ConfigureStdConsole uses stdin and stdout to interface with the Apple2
func (a *Apple2) ConfigureStdConsole(stdinKeyboard bool, stdoutScreen bool) {
if !stdinKeyboard && !stdoutScreen {
return
}
// Init frontend
fe := newAnsiConsoleFrontend(a, stdinKeyboard)
if stdinKeyboard {
a.io.setKeyboardProvider(fe)
}
if !log {
if stdoutScreen {
go fe.textModeGoRoutine()
}
}
// Run starts the Apple2 emulation
func (a *Apple2) Run(log bool) {
// Start the processor
a.cpu.Reset()
for {

View File

@ -23,7 +23,7 @@ func SDLRun(a *apple2.Apple2) {
kp := newSDLKeyBoard()
a.SetKeyboardProvider(&kp)
go a.Run(false, false)
go a.Run(false)
running := true
for running {

10
main.go
View File

@ -27,10 +27,14 @@ func main() {
"sdl",
true,
"use SDL")
stdoutScreen := flag.Bool(
"stdout",
false,
"show the text screen on the standard output")
panicSS := flag.Bool(
"panicss",
false,
"panic if a not implemented softwtich is used")
"panic if a not implemented softswitch is used")
dumpChars := flag.Bool(
"dumpChars",
false,
@ -56,8 +60,10 @@ func main() {
a := apple2.NewApple2(*romFile, *charRomFile, *panicSS)
a.AddDisk2(*disk2RomFile, *diskImage)
if *useSdl {
a.ConfigureStdConsole(false, *stdoutScreen)
apple2sdl.SDLRun(a)
} else {
a.Run(log, true)
a.ConfigureStdConsole(true, true)
a.Run(log)
}
}