CPU execution with bursts

This commit is contained in:
Ivan Izaguirre 2020-08-13 20:34:37 +02:00
parent a3f69bc01d
commit 81c77c7700

View File

@ -33,7 +33,10 @@ const (
cpuClockEuroMhz = 14.238 / 14 cpuClockEuroMhz = 14.238 / 14
) )
const maxWaitDuration = 100 * time.Millisecond const (
maxWaitDuration = 100 * time.Millisecond
cpuSpinLoops = 100
)
// Run starts the Apple2 emulation // Run starts the Apple2 emulation
func (a *Apple2) Run() { func (a *Apple2) Run() {
@ -47,8 +50,10 @@ func (a *Apple2) Run() {
for { for {
// Run a 6502 step // Run a 6502 step
if !a.paused { if !a.paused {
a.cpu.ExecuteInstruction() for i := 0; i < cpuSpinLoops; i++ {
a.executionTrace() a.cpu.ExecuteInstruction()
a.executionTrace()
}
} else { } else {
time.Sleep(200 * time.Millisecond) time.Sleep(200 * time.Millisecond)
} }