apple2-go/dos33_boot_test.go

47 lines
1.0 KiB
Go
Raw Normal View History

package main
import (
"fmt"
"mos6502go/cpu"
"mos6502go/keyboard"
"mos6502go/mmu"
"mos6502go/system"
2018-05-17 12:13:10 +00:00
"mos6502go/utils"
"mos6502go/video"
"testing"
"time"
)
2018-05-19 09:56:05 +00:00
const dosDiskImage = "dos33.dsk"
2018-05-19 10:30:30 +00:00
func runDos33Boot(t *testing.T) {
// Boot up DOS3.3
utils.RunUntilBreakPoint(t, 0x0801, 2, false, "Boot0")
utils.RunUntilBreakPoint(t, 0xb700, 2, false, "Boot1")
utils.RunUntilBreakPoint(t, 0x9d84, 2, false, "Boot2")
utils.RunUntilBreakPoint(t, 0xd7d2, 5, false, "JMP to basic interpreter NEWSTT")
}
func TestDOS33Boot(t *testing.T) {
cpu.InitInstructionDecoder()
mmu.InitRAM()
mmu.InitApple2eROM()
mmu.InitIO()
2018-05-19 09:56:05 +00:00
mmu.ReadDiskImage(dosDiskImage)
cpu.Init()
keyboard.Init()
video.Init()
system.Init()
2018-05-19 10:30:30 +00:00
cpu.SetColdStartReset()
cpu.Reset()
t0 := time.Now()
2018-05-16 09:39:53 +00:00
2018-05-19 10:30:30 +00:00
runDos33Boot(t)
elapsed := float64(time.Since(t0) / time.Millisecond)
fmt.Printf("CPU Cycles: %d\n", system.FrameCycles)
fmt.Printf("Time elapsed: %0.2f ms\n", elapsed)
fmt.Printf("Speed: %0.2f cycles/ms\n", float64(system.FrameCycles)/elapsed)
}