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 // ConfigureStdConsole uses stdin and stdout to interface with the Apple2
func (a *Apple2) Run(log bool, stdinKeyboard bool) { func (a *Apple2) ConfigureStdConsole(stdinKeyboard bool, stdoutScreen bool) {
if !stdinKeyboard && !stdoutScreen {
return
}
// Init frontend // Init frontend
fe := newAnsiConsoleFrontend(a, stdinKeyboard) fe := newAnsiConsoleFrontend(a, stdinKeyboard)
if stdinKeyboard { if stdinKeyboard {
a.io.setKeyboardProvider(fe) a.io.setKeyboardProvider(fe)
} }
if !log { if stdoutScreen {
go fe.textModeGoRoutine() go fe.textModeGoRoutine()
} }
}
// Run starts the Apple2 emulation
func (a *Apple2) Run(log bool) {
// Start the processor // Start the processor
a.cpu.Reset() a.cpu.Reset()
for { for {

View File

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

10
main.go
View File

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