mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-12-21 18:29:45 +00:00
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
|
||||
core6502.Reset(&s)
|
||||
t.prepare()
|
||||
for true {
|
||||
for {
|
||||
core6502.ExecuteInstruction(&s, log)
|
||||
t.dumpIfDirty()
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
package apple2
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type textPages struct {
|
||||
pages [4]textPage
|
||||
lastDump int64
|
||||
pages [4]textPage
|
||||
}
|
||||
|
||||
type textPage struct {
|
||||
@ -35,7 +39,7 @@ func textMemoryByteToStringHex(value uint8) string {
|
||||
}
|
||||
|
||||
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() {
|
||||
@ -63,10 +67,18 @@ func (tp *textPages) dump() {
|
||||
}
|
||||
|
||||
fmt.Println("------------------------------------------")
|
||||
tp.lastDump = time.Now().UnixNano()
|
||||
|
||||
}
|
||||
|
||||
const refreshDelayMs = 100
|
||||
|
||||
func (tp *textPages) dumpIfDirty() {
|
||||
if time.Now().UnixNano()-tp.lastDump < refreshDelayMs*1000*1000 {
|
||||
// Wait more the next refresh
|
||||
return
|
||||
}
|
||||
|
||||
dirty := false
|
||||
for i := 0; i < 4; i++ {
|
||||
if tp.pages[i].dirty {
|
||||
|
Loading…
Reference in New Issue
Block a user