Set minimum screen refresh time as 100ms
This commit is contained in:
parent
09da9056f9
commit
3fca4ed170
|
@ -19,7 +19,7 @@ func Run(romFile string, log bool) {
|
||||||
// Start the processor
|
// Start the processor
|
||||||
core6502.Reset(&s)
|
core6502.Reset(&s)
|
||||||
t.prepare()
|
t.prepare()
|
||||||
for true {
|
for {
|
||||||
core6502.ExecuteInstruction(&s, log)
|
core6502.ExecuteInstruction(&s, log)
|
||||||
t.dumpIfDirty()
|
t.dumpIfDirty()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
package apple2
|
package apple2
|
||||||
|
|
||||||
import "fmt"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
type textPages struct {
|
type textPages struct {
|
||||||
pages [4]textPage
|
lastDump int64
|
||||||
|
pages [4]textPage
|
||||||
}
|
}
|
||||||
|
|
||||||
type textPage struct {
|
type textPage struct {
|
||||||
|
@ -35,7 +39,7 @@ func textMemoryByteToStringHex(value uint8) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tp *textPages) prepare() {
|
func (tp *textPages) prepare() {
|
||||||
fmt.Printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
|
fmt.Printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tp *textPages) dump() {
|
func (tp *textPages) dump() {
|
||||||
|
@ -63,10 +67,18 @@ func (tp *textPages) dump() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("------------------------------------------")
|
fmt.Println("------------------------------------------")
|
||||||
|
tp.lastDump = time.Now().UnixNano()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const refreshDelayMs = 100
|
||||||
|
|
||||||
func (tp *textPages) dumpIfDirty() {
|
func (tp *textPages) dumpIfDirty() {
|
||||||
|
if time.Now().UnixNano()-tp.lastDump < refreshDelayMs*1000*1000 {
|
||||||
|
// Wait more the next refresh
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
dirty := false
|
dirty := false
|
||||||
for i := 0; i < 4; i++ {
|
for i := 0; i < 4; i++ {
|
||||||
if tp.pages[i].dirty {
|
if tp.pages[i].dirty {
|
||||||
|
|
Loading…
Reference in New Issue