Fix regression on the command line parsing
This commit is contained in:
parent
c7cc5c15b4
commit
08edc95834
10
apple2.go
10
apple2.go
|
@ -25,6 +25,7 @@ type Apple2 struct {
|
||||||
isColor bool
|
isColor bool
|
||||||
fastMode bool
|
fastMode bool
|
||||||
fastRequestsCounter int
|
fastRequestsCounter int
|
||||||
|
profile bool
|
||||||
showSpeed bool
|
showSpeed bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +92,15 @@ func (a *Apple2) Run() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *Apple2) setProfiling(value bool) {
|
||||||
|
a.profile = value
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsProfiling returns true when profiling
|
||||||
|
func (a *Apple2) IsProfiling() bool {
|
||||||
|
return a.profile
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// CommandToggleSpeed toggles cpu speed between full speed and actual Apple II speed
|
// CommandToggleSpeed toggles cpu speed between full speed and actual Apple II speed
|
||||||
CommandToggleSpeed = iota + 1
|
CommandToggleSpeed = iota + 1
|
||||||
|
|
|
@ -97,6 +97,10 @@ func MainApple() *Apple2 {
|
||||||
"model",
|
"model",
|
||||||
"2enh",
|
"2enh",
|
||||||
"set base model. Models available 2plus, 2e, 2enh, base64a")
|
"set base model. Models available 2plus, 2e, 2enh, base64a")
|
||||||
|
profile := flag.Bool(
|
||||||
|
"profile",
|
||||||
|
false,
|
||||||
|
"generate profile trace to analyse with pprof")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *wozImage != "" {
|
if *wozImage != "" {
|
||||||
|
@ -170,6 +174,7 @@ func MainApple() *Apple2 {
|
||||||
a.cpu.SetTrace(*traceCPU)
|
a.cpu.SetTrace(*traceCPU)
|
||||||
a.io.setTrace(*traceSS)
|
a.io.setTrace(*traceSS)
|
||||||
a.io.setPanicNotImplemented(*panicSS)
|
a.io.setPanicNotImplemented(*panicSS)
|
||||||
|
a.setProfiling(*profile)
|
||||||
|
|
||||||
// Load ROM if not loaded already
|
// Load ROM if not loaded already
|
||||||
if *romFile != "" {
|
if *romFile != "" {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/ivanizag/apple2"
|
"github.com/ivanizag/apple2"
|
||||||
|
@ -10,18 +9,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
prof := flag.Bool(
|
a := apple2.MainApple()
|
||||||
"profile",
|
if a.IsProfiling() {
|
||||||
false,
|
|
||||||
"generate profile trace to analyse with pprof")
|
|
||||||
flag.Parse()
|
|
||||||
if *prof {
|
|
||||||
// See the log with:
|
// See the log with:
|
||||||
// go tool pprof --pdf ~/go/bin/apple2sdl /tmp/profile329536248/cpu.pprof > profile.pdf
|
// go tool pprof --pdf ~/go/bin/apple2sdl /tmp/profile329536248/cpu.pprof > profile.pdf
|
||||||
defer profile.Start().Stop()
|
defer profile.Start().Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
a := apple2.MainApple()
|
|
||||||
if a != nil {
|
if a != nil {
|
||||||
SDLRun(a)
|
SDLRun(a)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue