apple2-go/dos33_boot_test.go

47 lines
1.3 KiB
Go
Raw Normal View History

package main
import (
"fmt"
2018-05-26 22:23:35 +00:00
"testing"
"time"
2019-11-02 13:33:05 +00:00
"github.com/freewilll/apple2-go/cpu"
"github.com/freewilll/apple2-go/disk"
"github.com/freewilll/apple2-go/keyboard"
"github.com/freewilll/apple2-go/mmu"
"github.com/freewilll/apple2-go/system"
"github.com/freewilll/apple2-go/utils"
"github.com/freewilll/apple2-go/video"
)
2018-05-19 09:56:05 +00:00
const dosDiskImage = "dos33.dsk"
2018-05-27 20:57:46 +00:00
// TestDOS33Boot goes through the boot process and asserts that the code ends
// up in the BASIC interpreter after DOS has loaded.
func TestDOS33Boot(t *testing.T) {
cpu.InitInstructionDecoder()
mmu.InitRAM()
mmu.InitApple2eROM()
mmu.InitIO()
2018-05-26 22:23:35 +00:00
disk.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-27 20:57:46 +00:00
// Boot up DOS3.3
utils.RunUntilBreakPoint(t, 0x0801, 2, false, "Boot0")
utils.RunUntilBreakPoint(t, 0xb700, 1, false, "Boot1") // $3700 is for master disk, $b700 for a slave disk
utils.RunUntilBreakPoint(t, 0x9d84, 3, false, "Boot2")
utils.RunUntilBreakPoint(t, 0xd7d2, 2, false, "JMP to basic interpreter NEWSTT")
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)
}